# SliTaz package receipt.

PACKAGE="python"
VERSION="2.7.2"
CATEGORY="development"
SHORT_DESC="The Python programming language."
MAINTAINER="pankso@slitaz.org"
SOURCE="Python"
TARBALL="$SOURCE-$VERSION.tar.bz2"
WEB_SITE="http://www.python.org/"
WGET_URL="http://www.python.org/ftp/python/$VERSION/$TARBALL"

DEPENDS="openssl bzlib readline sqlite zlib ncursesw"
BUILD_DEPENDS="openssl-dev bzip2-dev readline-dev sqlite-dev zlib-dev \
ncursesw-dev tcl-dev tk-dev db-dev"
SUGGESTED="tcl tk"

# Rules to configure and make the package.
compile_rules()
{
	cd $src
	# Temporary workaround for FS#22322
	# See http://bugs.python.org/issue10835 for upstream report
	sed -i "/progname =/s/python/python${_pybasever}/" Python/pythonrun.c
	# Enable built-in SQLite3 module to load extensions (fix FS#22122)
	sed -i "/SQLITE_OMIT_LOAD_EXTENSION/d" setup.py
	./configure \
		--enable-shared \
		--build=$HOST_SYSTEM \
		--host=$HOST_SYSTEM &&
	make &&	make DESTDIR=$DESTDIR install
}

# Rules to gen a SliTaz package suitable for Tazpkg.
genpkg_rules()
{
	python_version=${VERSION:0:3}
	mkdir -p $fs/usr/include/${PACKAGE}$python_version
	cp -a $_pkg/usr/bin $fs/usr
	cp -a $_pkg/usr/lib $fs/usr
	# needed for mericurial to work now
	cp -a $_pkg/usr/include/${PACKAGE}$python_version/pyconfig.h \
		$fs/usr/include/${PACKAGE}$python_version
	rm -f $fs/usr/bin/*-config
	
	# Python can be symlink to python$python_version ???
	#cd $fs/usr/bin
	#rm python && ln -s python$python_version python
}