# $Id: Portfile,v 1.34 2006/04/30 09:59:13 mww Exp $

PortSystem 1.0

name			python24
version			2.4.3
revision		1
set major_version	2
set minor_version	4
categories		lang
platforms		darwin
maintainers		mww@opendarwin.org
description		An interpreted, object-oriented programming language
long_description	Python is an interpreted, interactive, object-oriented \
					programming language.

homepage		http://www.python.org/
master_sites	${homepage}/ftp/python/2.4.3/ \
				ftp://ftp.python.org/pub/python/2.4.3/
distname		Python-${version}
checksums		md5 141c683447d5e76be1d2bd4829574f02
patchfiles		patch-Makefile.pre.in \
				patch-configure \
				patch-Lib-site.py \
				patch-Mac-OSX-Makefile \
				patch-setup.py \
				patch-Include-pyport.h \
				patch-Lib-plat-mac-applesingle.py

use_bzip2		yes

post-patch {
	cd ${worksrcpath}
	reinplace "s|__PREFIX__|${prefix}|g" Lib/site.py Mac/OSX/Makefile
}

configure.args	--enable-shared \
				--mandir=${prefix}/share/man \
				--bindir=${prefix}/bin \
				--libdir=${prefix}/lib \
				--without-readline \
				--enable-framework=${prefix}/Library/Frameworks \
				--enable-ipv6 \
				--disable-tk
post-configure {
	cd ${worksrcpath}
	reinplace "s|^LIBDIR=.*|LIBDIR=${prefix}/lib|g" Makefile
	reinplace "s|^INCLUDEDIR=.*|INCLUDEDIR=${prefix}/include|g" Makefile
	reinplace "s|^CONFINCLUDEDIR=.*|CONFINCLUDEDIR=${prefix}/include|g" Makefile
}

test.run		yes
test.target		test

destroot.target	frameworkinstall maninstall
post-destroot {
	if { ![variant_isset puredarwin]} {
		set framewdir ${prefix}/Library/Frameworks/Python.framework/
		xinstall -m 755 -d ${destroot}${framewdir}/Versions/2.4/include
		system "cd ${destroot}${framewdir} \
			&& ln -s Versions/Current/lib Libraries"
		system "ln -sf ${prefix}/include/python2.4 ${destroot}${framewdir}/Versions/2.4/include/python2.4"
		system "cd ${destroot}${prefix}/bin \
			&& ln -sf ${framewdir}/Versions/2.4/bin/pydoc pydoc \
			&& ln -sf ${framewdir}/Versions/2.4/bin/pydoc pydoc24"
		system "cd ${destroot}${framewdir}/Versions/2.4/lib/python2.4 \
			&& ln -s ${prefix}/lib/python2.4/config config"
	}
	system "cd ${destroot}${prefix}/lib && \
		ln -s libpython${major_version}.${minor_version}.dylib \
			libpython${version}.dylib && \
		ln -s libpython${major_version}.${minor_version}.dylib \
			libpython${major_version}.dylib && \
		ln -s libpython${major_version}.${minor_version}.dylib \
			libpython.dylib"
}

platform puredarwin {
	configure.args-delete	--enable-framework=${prefix}/Library/Frameworks
	configure.args-append	--disable-toolbox-glue --disable-framework
	destroot.target		install maninstall
}

platform darwin 8 {
	configure.env CC=/usr/bin/gcc-4.0 CPP=/usr/bin/cpp-4.0 CXX=/usr/bin/g++-4.0
	configure.args-append --with-cxx=/usr/bin/g++-4.0
}

