# $Id: Portfile,v 1.20 2005/08/25 06:37:36 blb Exp $

PortSystem			1.0
name				python23
version				2.3.5
revision			4
categories			lang
maintainers			mwdiers@gmail.com
description			An interpreted, object-oriented programming language
long_description	${description}

platforms			darwin freebsd sunos

homepage			http://www.python.org/
master_sites		ftp://ftp.python.org/pub/python/${version}/ \
					http://www.python.org/ftp/python/${version}/
distname			Python-${version}
use_bzip2			yes
checksums			md5 c12b57c6e0cf8bc676fd9444d71c9e18 \
					sha1 98bfa6257f73a3826b244047c183d933d26f4322

# Should be depends_extract, but that isn't implemented
depends_build		bin:gnutar:gnutar

extract.post_args	| gnutar -xf -

patchfiles			patch-Makefile.pre.in patch-configure.in patch-setup.py

use_autoconf		yes

configure.env		CPPFLAGS="-I${prefix}/include" LDFLAGS="-L${prefix}/lib"
configure.args		--enable-shared --mandir=${prefix}/share/man --disable-tk

post-patch {
	reinplace "s|@@VERSION@@|${version}|g" ${worksrcpath}/Makefile.pre.in
}

post-destroot {
	cd ${destroot}${prefix}
	file delete bin/python
	file rename share/man/man1/python.1 share/man/man1/python2.3.1
	file rename bin/pydoc bin/pydoc2.3
	file rename bin/idle bin/idle2.3
	reinplace "s|${prefix}/bin/python|${prefix}/bin/python2.3|g" \
		bin/pydoc2.3 bin/idle2.3
}

variant nothreads {
	configure.args-append	--without-threads
}

variant puredarwin {
	configure.args-append	--disable-toolbox-glue
}

variant x86 {
	configure.args-append	--disable-toolbox-glue
}

platform darwin 8 {
	patchfiles-append	patch-darwin8-pyconfig.h.in
}

variant pydebug {
	configure.args-append	--with-pydebug
}

variant readline {
	depends_lib-append		lib:libreadline:readline
	configure.args-append	--with-readline
}

variant darwin {
	if {![variant_isset puredarwin] && ![variant_isset x86]} {
		configure.env-append	LIBS="-framework CoreServices \
								-framework Foundation"
	}
}

variant tk {
	configure.args-delete	--disable-tk
	depends_lib-append		lib:libtk:tk
}

