# $Id$ PNAME="python" PVER="2.7.1" PBUILD="r2" PCATEGORIE="dev-lang" STATE="unstable" DESCRIPTION="Python is an interpreted, interactive, object-oriented programming language." HOMEPAGE="http://www.python.org/" DEPEND_x86_64=">= sys-apps/multiarch-wrapper-1" SPECIAL_VARS="DEPEND_x86_64" DEPEND="\$(eval echo \\\$DEPEND_\${ARCH/i*86/x86} | tr ';' '\n') >= virtual/glibc >= sys-libs/ncurses-5.8 >= sys-libs/zlib-1.2 >= dev-libs/expat-2" SDEPEND=">= virtual/sed" SRCFILE="${PNAME/py/Py}-${PVER/.0}.tar.bz2" SRCDIR="${BUILDDIR}/${PNAME/py/Py}-${PVER/.0}" # disabled modules (needs the gentoo_py_dontcompile patch) export PYTHON_DISABLE_MODULES="gdbm dbm bsddb _tkinter" || die # force usage of our CFLAGS export OPT="${CFLAGS}" sminclude mtools multilib # uses PYVER and sometimes PVER; so keep both SRC_URI=( http://www.python.org/ftp/python/${PVER%.*}/${SRCFILE} http://www.python.org/ftp/python/${PVER}/${SRCFILE} mirror://${PNAME}/${SRCFILE} mirror://${PNAME}/${PNAME}-2.7.0-gentoo_py_dontcompile.patch mirror://${PNAME}/${PNAME}-2.4-disable_modules_and_ssl.patch mirror://${PNAME}/${PNAME}-2.5.0-mimetypes-apache.patch mirror://${PNAME}/${PNAME}-2.7.0-lib64-3.patch ) # sed line: on 2 digits add an zero: 2.6 -> 2.6.0 UP2DATE="updatecmd ${HOMEPAGE}/download/releases/ | grep 'Python .*(.*)' | sed 's/.*Python\ \([0-9].*\) (.*/\1/g;s/\([0-9]\.[0-9]\$\)/\1.0/;q'" src_prepare() { munpack ${SRCFILE} || die # adds support for PYTHON_DONTCOMPILE shell environment to # supress automatic generation of .pyc and .pyo files mpatch ${PNAME}-2.7.0-gentoo_py_dontcompile.patch || die mpatch ${PNAME}-2.4-disable_modules_and_ssl.patch || die mpatch ${PNAME}-2.5.0-mimetypes-apache.patch || die only-m64 mpatch ${PNAME}-2.7.0-lib64-3.patch || die } src_compile() { # disable all unneccessary modules export PYTHON_DISABLE_MODULES="dbm _bsddb gdbm _curses _curses_panel readline _sqlite3 _tkinter _elementtree pyexpat" # no ssl export PYTHON_DISABLE_SSL="1" mconfigure \ --with-fpectl \ --enable-shared \ --infodir='${prefix}'/share/info \ --mandir='${prefix}'/share/man \ --with-threads \ ${myconf} \ || die mmake || die } src_install() { # install some missing directories minstalldir /usr || die mmake DESTDIR=${BINDIR} altinstall || die all-abis minstalldir /usr/'$(mlibdir)'/python${PVER%.*}/config || die all-abis minstallfile Makefile.pre.in /usr/'$(mlibdir)'/python${PVER%.*}/config || die # remove hardcoded CFLAGS from default Makefile all-abis sed -i 's:^OPT=.*:OPT=-DNDEBUG:' ${BINDIR}/usr/'$(mlibdir)'/python${PVER%.*}/config/Makefile || die if [[ ${ARCH} = x86_64 ]] then # move config header all-abis minstallfile pyconfig.h /usr/include/python${PVER%.*}/pyconfig-$(mabi).h || die # install a stub header cat > ${BINDIR}/usr/include/python${PVER%.*}/pyconfig.h << "EOF" /* pyconfig.h - Stub Header */ #ifndef __STUB__PYCONFIG_H__ #define __STUB__PYCONFIG_H__ #if defined(__x86_64__) || \ defined(__sparc64__) || \ defined(__arch64__) || \ defined(__powerpc64__) || \ defined (__s390x__) # include "pyconfig-m64.h" #else # include "pyconfig-m32.h" #endif #endif /* __STUB__PYCONFIG_H__ */ EOF # install the multiarch-wrapper if [[ -f ${BINDIR}/usr/bin/python${PVER%.*} ]] then rm -f ${BINDIR}/usr/bin/python${PVER%.*} || die fi all-abis minstallexec python /usr/bin/python${PVER%.*}-$(mabi) || die mlink multiarch-wrapper /usr/bin/python${PVER%.*} || die all-abis mlink python${PVER%.*}-$(mabi) /usr/bin/python-$(mabi) || die all-abis mlink python${PVER%.*}-$(mabi) /usr/bin/python2-$(mabi) || die fi # link python${PVER%.*}-config to python-config mlink python${PVER%.*}-config /usr/bin/python-config || die # link python2.7 binary with python mlink python${PVER%.*} /usr/bin/python || die # link python2.7 binary with python2 mlink python${PVER%.*} /usr/bin/python2 || die minstalldocs LICENSE README || die }