Package-Name: python
Gentoo-Package: dev-lang/python
Homepage: http://www.python.org/
Rebuild-For: ncurses tcl tk zlib
#Source: ftp://ftp.python.org/pub/python/(\d+(.\d+)+) $1 $1/Python-$1.tgz
Source: http://www.python.org/ftp/python//>(\d+(\.\d+)+)/[\0-\377]*?(\d+(.\d+)+) $1 http://www.python.org/ftp/python/$1/Python-$1.tar.bz2
Repack:
	tar xjvfp "$(SOURCE)"
	mv Python-"$(VERSION)" python-"$(VERSION)"
Compile:
	cp -pf Modules/Setup.dist Modules/Setup
	grep '^# *linuxaudiodev' Modules/Setup.dist | sed 's/^# *//' >>Modules/Setup
	if packager c ncurses ; then \
		grep '^# *_curses ' Modules/Setup.dist | sed -e 's/^# *//' -e 's/-l.*/-lncurses/' >>Modules/Setup ; \
		grep '^# *_curses_panel' Modules/Setup.dist | sed 's/^# *//' >>Modules/Setup ; \
	fi
	if packager c tcl && packager c tk ; then \
		ONEUP=`cd "$(PREFIX)"/..;pwd` ; \
		TCLVER=`cut -d. -f1-2 "$$ONEUP"/tcl/.version` ; \
		TKVER=`cut -d. -f1-2 "$$ONEUP"/tk/.version` ; \
		grep '^# *_tkinter' Modules/Setup.dist | sed 's/^# *//' >>Modules/Setup ; \
		echo >>Modules/Setup "-L'$$ONEUP/tcl/lib' -L'$$ONEUP/tk/lib' -I'$$ONEUP/tcl/include' -I'$$ONEUP/tk/include' -I/usr/X11/include -ltk$$TKVER -ltcl$$TCLVER -L/usr/X11/lib -lX11" ; \
	fi
	if packager c zlib ; then \
		grep '^# *zlib' Modules/Setup.dist | sed 's/^# *//' >>Modules/Setup ; \
	fi
	ac_cv_pthread_system_supported=no \
	OPT="-O2 $(GCC_OPT_FLAGS)" $(MAKE) -f ../Makefile configure CONFIGURE_OPTS="--with-mandir=/usr/man --with-threads --enable-ipv6 --enable-static --enable-shared"
	$(MAKE)
	$(MAKE) install
	ver2=`echo "$(VERSION)" | cut -d. -f1-2` ; \
	if [ -d "$(PREFIX)/include/python$(VERSION)" -a ! -d "$(PREFIX)/include/python$$ver2" ] ; then \
		ln -fs python"$(VERSION)" "$(PREFIX)/include/python$$ver2" ; \
	fi
	if [ -d "$(PREFIX)/lib/python$(VERSION)" -a ! -d "$(PREFIX)/lib/python$$ver2" ] ; then \
		ln -fs python"$(VERSION)" "$(PREFIX)/lib/python$$ver2" ; \
	fi
	# alsa-lib expects -lpython2.5 to be accessible
	rm -f "$(PREFIX)"/lib/libpython*.a
	if [ -f "$(PREFIX)/lib/python$(VERSION)/config/libpython$(VERSION).a" ] ; then \
		cp -pf "$(PREFIX)/lib/python$(VERSION)/config/libpython$(VERSION).a" "$(PREFIX)"/lib/ ; \
	fi
Install:
	rm -f /usr/include/python* /usr/lib/libpython*
	$(MAKE) instbin BIN="python python-config pydoc"
	$(MAKE) instinc INC="python*"
	$(MAKE) instlib LIB="python*"
	$(MAKE) addldso
	$(MAKE) instman SECTION=1 MAN=python
	rm -rf /usr/lib/python*
	ln -s "$(PREFIX)"/lib/python* /usr/lib/
Clean:
	@set -e; \
	for d in "$(PREFIX)"/bin "$(PREFIX)"/include "$(PREFIX)"/lib /usr/include /usr/lib; do \
		cd "$$d"; \
		for i in python[0-9]*; do \
			j=`echo "$$i" | sed 's/-config$$//'`; \
			if ! echo "python$(VERSION)" | grep -q \^"$$j"; then \
				echo "removing \`$$d/$$i'"; \
				rm -r "$$i"; \
			fi; \
		done; \
	done

/pkg/python/
/usr/bin/pydoc
/usr/bin/python
/usr/bin/python-config
/usr/include/python*
/usr/lib/libpython*.*
/usr/lib/python*
/usr/man/man1/python.1.gz
