opt/python/Pkgfile

53 lines
1.5 KiB
Plaintext

# Description: Python interpreter, version 2.7
# URL: https://www.python.org
# Maintainer: Juergen Daubert, jue at crux dot nu
# Depends on: db gdbm openssl bzip2 zlib sqlite3
name=python
version=2.7.18
release=3
source=(https://www.python.org/ftp/$name/${version::6}/Python-$version.tar.xz \
pyconfig.h \
CVE-2019-20907.patch \
CVE-2020-26116.patch \
CVE-2021-3177.patch)
build () {
cd Python-$version
patch -p1 -i $SRC/CVE-2019-20907.patch
patch -p1 -i $SRC/CVE-2020-26116.patch
patch -p1 -i $SRC/CVE-2021-3177.patch
# remove 2to3, we use the one from python3
rm -r Lib/lib2to3
# remove tests
rm -r Lib/{bsddb,ctypes,email,lib-tk,sqlite3,unittest}/test
rm -r Lib/{{distutils,json}/tests,idlelib/idle_test,test}
./configure --prefix=/usr \
--enable-shared \
--with-threads \
--enable-ipv6
make
make -j1 DESTDIR=$PKG install
# fix issue with man-page symlink
ln -sf python2.7.1 $PKG/usr/share//man/man1/python.1
ln -sf python2.7 $PKG/usr/bin/python
ln -s python2.7 $PKG/usr/lib/python
ln -s python2.7 $PKG/usr/include/python
ln -s /usr/lib/libpython2.7.so $PKG/usr/lib/python2.7/config/libpython2.7.so
rm $PKG/usr/bin/2to3
rm $PKG/usr/lib/python/{distutils,site-packages}/README
rm $PKG/usr/lib/python/idlelib/{ChangeLog,{NEWS,README,TODO}.txt}
rm $PKG/usr/lib/python/ctypes/macholib/README.ctypes
mv $PKG/usr/include/python2.7/pyconfig{,-64}.h
install -m 0644 $SRC/pyconfig.h $PKG/usr/include/python2.7/
}