# Maintainer: Natanael Copa pkgname=python pkgver=2.7.10 _verbase=${pkgver%.*} pkgrel=0 pkgdesc="A high-level scripting language" url="http://www.python.org" arch="all" license="custom" replaces="python-dev" subpackages="$pkgname-dev $pkgname-doc $pkgname-tests py-gdbm:gdbm " depends="" makedepends="expat-dev openssl-dev zlib-dev ncurses-dev bzip2-dev gdbm-dev sqlite-dev libffi-dev readline-dev paxctl" source="http://www.python.org/ftp/python/$pkgver/Python-$pkgver.tar.xz find_library.patch recvfrom_into_buffer_overflow_2.7.patch " prepare() { cd "$srcdir/Python-$pkgver" for i in $source; do case $i in *.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1 esac done # Make sure we use system libs rm -r Modules/expat Modules/_ctypes/libffi* Modules/zlib || return 1 # make sure our /dev/shm is world writeable if ! touch /dev/shm/$pkgname-$pkgver; then error "/dev/shm is not world writeable. this will cause a broken python build" return 1 fi rm /dev/shm/$pkgname-$pkgver } build() { cd "$srcdir/Python-$pkgver" export OPT="$CFLAGS" ./configure \ --build=$CBUILD \ --host=$CHOST \ --prefix=/usr \ --enable-shared \ --with-threads \ --enable-ipv6 \ --with-system-ffi \ --with-system-expat \ --with-system-zlib \ --enable-unicode=ucs4 \ || return 1 make || return 1 } package() { cd "$srcdir/Python-$pkgver" make -j1 DESTDIR="$pkgdir" install || return 1 install -Dm644 LICENSE "$pkgdir"/usr/share/licenses/$pkgname/LICENSE rm "$pkgdir/usr/bin/2to3" || return 1 # we need to enable emutramp - needed for virt-manager # disable mprotect - needed for cffi paxctl -czxm "$pkgdir"/usr/bin/python } _mv_files() { local i for i in "$@"; do mkdir -p "$subpkgdir"/${i%/*} mv "$pkgdir"/$i "$subpkgdir"/$i || return 1 done } dev() { # pyconfig.h is needed runtime so we move it back default_dev mkdir -p "$pkgdir"/usr/include/python$_verbase mv "$subpkgdir"/usr/include/python$_verbase/pyconfig.h \ "$pkgdir"/usr/include/python$_verbase/ } tests() { pkgdesc="The test modules from the main python package" cd "$pkgdir" _mv_files usr/lib/python*/*/test \ usr/lib/python*/test } gdbm() { pkgdesc="GNU dbm database support for Python" cd "$pkgdir" _mv_files $(find usr/lib -name '*gdbm*') } md5sums="c685ef0b8e9f27b5e3db5db12b268ac6 Python-2.7.10.tar.xz 22e32fddd3a973172f2fd570f8c5c416 find_library.patch 9bfbe06cf0752d5906992bb1e09198ca recvfrom_into_buffer_overflow_2.7.patch" sha256sums="1cd3730781b91caf0fa1c4d472dc29274186480161a150294c42ce9b5c5effc0 Python-2.7.10.tar.xz 452f9dc842316bcacfd7d6547ac5c1faaa286568cc782db1c0099464bc913946 find_library.patch bdf280058fe31b6e9d08a32e4ce16e958e3dddeed515417a03b25e5ec62d41b4 recvfrom_into_buffer_overflow_2.7.patch" sha512sums="67615a6defbcda062f15a09f9dd3b9441afd01a8cc3255e5bc45b925378a0ddc38d468b7701176f6cc153ec52a4f21671b433780d9bde343aa9b9c1b2ae29feb Python-2.7.10.tar.xz a1ea61266bb56358158de4036f5be0ad579b44ae616fe0f8d5cef59610886daed73979308c26e56f944435167a6bb8cc6278e6f97f9a72b5f5786d3c31668fc2 find_library.patch 21b534e41ce1cd1bf954849f4246ef0ae907ba7335b42ccfc914cc33068db91140dc1fea0f1b8a83818609e7f5a5f5df6623f029c2c86004f2126eb3f2699c06 recvfrom_into_buffer_overflow_2.7.patch"