170 lines
6.1 KiB
Bash
170 lines
6.1 KiB
Bash
# Maintainer: Alexey Pavlov <Alexpux@gmail.com>
|
|
# Contributor: Ray Donnelly <mingw.android@gmail.com>
|
|
|
|
pkgname=python2
|
|
pkgver=2.7.9
|
|
pkgrel=1
|
|
_pybasever=2.7
|
|
pkgdesc="A high-level scripting language"
|
|
arch=('i686' 'x86_64')
|
|
license=('PSF')
|
|
url="http://www.python.org/"
|
|
depends=('gdbm' 'libbz2' 'libopenssl' 'zlib' 'libexpat' 'libsqlite' 'libffi' 'ncurses' 'libreadline')
|
|
makedepends=('libbz2-devel' 'openssl-devel' 'zlib-devel' 'libexpat-devel' 'libgdbm-devel' 'libsqlite-devel' 'libffi-devel' 'ncurses-devel' 'libreadline-devel')
|
|
#optdepends=('tk: for IDLE')
|
|
conflicts=('python<3')
|
|
options=('!makeflags') # '!strip' 'debug')
|
|
source=(http://www.python.org/ftp/python/${pkgver%rc?}/Python-${pkgver}.tar.xz
|
|
0010-ctypes-util-find_library.patch
|
|
0020-tkinter-x11.patch
|
|
0030-ssl-threads.patch
|
|
0040-FD_SETSIZE.patch
|
|
0050-export-PySignal_SetWakeupFd.patch
|
|
0060-ncurses-abi6.patch
|
|
0070-dbm.patch
|
|
0080-dylib.patch
|
|
0090-getpath-exe-extension.patch
|
|
0100-no-libm.patch
|
|
0120-fix-sqlite-module.patch
|
|
0200-msys2.patch
|
|
0210-reorder-bininstall-ln-symlink-creation.patch
|
|
0250-allow-win-drives-in-os-path-isabs.patch
|
|
2.7.5-allow-windows-paths-for-executable.patch)
|
|
sha1sums=('3172f6e957713c2d9fca462cc16068222fd1b9d3'
|
|
'ff18e75ffa0351c481ca45065cdcc5cd83857712'
|
|
'eb3a15abc19c26754121b9a8f9e3e49055424e09'
|
|
'53ddc2e463046aed4dfcff42a832a2edceb66867'
|
|
'd16f8f3ea8b5a7760d2e44f45ffe396618891ede'
|
|
'ec92fce6407bf7583a499aa513a7c04087176c56'
|
|
'b93fa24ecdf19a72b21c86521887c9a9321922a0'
|
|
'6ff10519b5386a2b29d57f5385d723bd65742bcc'
|
|
'ebc73f45bb01a28519b1a5c9d124a28943724b80'
|
|
'4fd71aac6a4316c9350150dd35d15196ed01efeb'
|
|
'215d3f1e68aaf1c31b8a9f94ed8b2d03d42c4c03'
|
|
'f0a9ff9081bbc3df4eab8a6ec1492b5d537f9ca1'
|
|
'a1806da6956df1860cc23ff3701cd80cbb126b87'
|
|
'e6e13cb541efaaf228355cb1d7d5cd8574757c72'
|
|
'80975639f5ad78fd15b8f81bd98fb460c4ee05c4'
|
|
'fb78069fadcf5394ba380e26e371ad687d344415')
|
|
|
|
prepare() {
|
|
cd "${srcdir}/Python-${pkgver}"
|
|
|
|
patch -p1 -i ${srcdir}/0010-ctypes-util-find_library.patch
|
|
patch -p1 -i ${srcdir}/0020-tkinter-x11.patch
|
|
patch -p1 -i ${srcdir}/0030-ssl-threads.patch
|
|
patch -p1 -i ${srcdir}/0040-FD_SETSIZE.patch
|
|
patch -p1 -i ${srcdir}/0050-export-PySignal_SetWakeupFd.patch
|
|
patch -p1 -i ${srcdir}/0060-ncurses-abi6.patch
|
|
patch -p1 -i ${srcdir}/0070-dbm.patch
|
|
patch -p1 -i ${srcdir}/0080-dylib.patch
|
|
patch -p1 -i ${srcdir}/0090-getpath-exe-extension.patch
|
|
patch -p1 -i ${srcdir}/0100-no-libm.patch
|
|
patch -p1 -i ${srcdir}/0120-fix-sqlite-module.patch
|
|
patch -p1 -i ${srcdir}/0200-msys2.patch
|
|
patch -p1 -i ${srcdir}/0210-reorder-bininstall-ln-symlink-creation.patch
|
|
patch -p1 -i ${srcdir}/0250-allow-win-drives-in-os-path-isabs.patch
|
|
|
|
# Incomplete patch from Ray Donnelly
|
|
# patch -p1 -i ${srcdir}/2.7.5-allow-windows-paths-for-executable.patch
|
|
|
|
# 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 SQLite module to load extensions (fix FS#22122)
|
|
sed -i "/SQLITE_OMIT_LOAD_EXTENSION/d" setup.py
|
|
|
|
# FS#23997
|
|
sed -i -e "s|^#.* /usr/local/bin/python|#!/usr/bin/python2|" Lib/cgi.py
|
|
|
|
sed -i "s/python2.3/python2/g" Lib/distutils/tests/test_build_scripts.py \
|
|
Lib/distutils/tests/test_install_scripts.py Tools/scripts/gprof2html.py
|
|
|
|
# Ensure that we are using the system copy of various libraries (expat, zlib and libffi),
|
|
# rather than copies shipped in the tarball
|
|
rm -r Modules/expat
|
|
rm -r Modules/zlib
|
|
rm -r Modules/_ctypes/{darwin,libffi}*
|
|
}
|
|
|
|
check() {
|
|
cd "${srcdir}/Python-${pkgver}"
|
|
make test
|
|
}
|
|
|
|
build() {
|
|
cd "${srcdir}/Python-${pkgver}"
|
|
|
|
if check_option "strip" "y"; then
|
|
LDFLAGS+=" -s "
|
|
fi
|
|
if check_option "debug" "n"; then
|
|
CFLAGS+=" -DNDEBUG "
|
|
CXXFLAGS+=" -DNDEBUG "
|
|
else
|
|
plain " -DDEBUG -DPy_DEBUG -D_DEBUG does not work unfortunately .."
|
|
# CFLAGS+=" -DDEBUG -DPy_DEBUG -D_DEBUG "
|
|
# CXXFLAGS+=" -DDEBUG -DPy_DEBUG -D_DEBUG "
|
|
CFLAGS+=" -O0 -ggdb"
|
|
CXXFLAGS+=" -O0 -ggdb"
|
|
fi
|
|
|
|
export OPT="${CFLAGS}"
|
|
./configure --build=${CHOST} \
|
|
--prefix=/usr \
|
|
--enable-shared \
|
|
--enable-ipv6 \
|
|
--with-libc= \
|
|
--with-libm= \
|
|
--with-system-expat \
|
|
--with-system-ffi \
|
|
--with-threads \
|
|
ac_cv_func_bind_textdomain_codeset=yes \
|
|
CPPFLAGS="${CPPFLAGS} -I/usr/include/ncursesw" \
|
|
LDFLAGS="${LDFLAGS} -L."
|
|
|
|
make
|
|
}
|
|
|
|
package() {
|
|
cd "${srcdir}/Python-${pkgver}"
|
|
make DESTDIR="${pkgdir}" altinstall maninstall
|
|
|
|
rm "${pkgdir}"/usr/share/man/man1/python.1
|
|
|
|
ln -sf python${_pybasever} "${pkgdir}"/usr/bin/python2.exe
|
|
ln -sf python${_pybasever}-config "${pkgdir}"/usr/bin/python2-config
|
|
ln -sf python${_pybasever}.1 "${pkgdir}"/usr/share/man/man1/python2.1
|
|
|
|
# FS#33954
|
|
ln -sf python-${_pybasever}.pc "${pkgdir}"/usr/lib/pkgconfig/python2.pc
|
|
|
|
cp -f "${pkgdir}"/usr/lib/python${_pybasever}/config/libpython${_pybasever}.dll.a "${pkgdir}"/usr/lib/libpython${_pybasever}.dll.a
|
|
|
|
mv "${pkgdir}"/usr/bin/smtpd.py "${pkgdir}"/usr/lib/python${_pybasever}/
|
|
|
|
# some useful "stuff"
|
|
install -dm755 "${pkgdir}"/usr/lib/python${_pybasever}/Tools/{i18n,scripts}
|
|
install -m755 Tools/i18n/{msgfmt,pygettext}.py "${pkgdir}"/usr/lib/python${_pybasever}/Tools/i18n/
|
|
install -m755 Tools/scripts/{README,*py} "${pkgdir}"/usr/lib/python${_pybasever}/Tools/scripts/
|
|
|
|
# fix conflicts with python
|
|
mv "${pkgdir}"/usr/bin/idle{,2}
|
|
mv "${pkgdir}"/usr/bin/pydoc{,2}
|
|
mv "${pkgdir}"/usr/bin/2to3{,-2.7}
|
|
|
|
# clean up #!s
|
|
find "${pkgdir}"/usr/lib/python${_pybasever}/ -name '*.py' | \
|
|
xargs sed -i "s|#[ ]*![ ]*/usr/bin/env python$|#!/usr/bin/env python2|"
|
|
|
|
# clean-up reference to build directory
|
|
sed -i "s#${srcdir}/Python-${pkgver}:##" "${pkgdir}"/usr/lib/python${_pybasever}/config/Makefile
|
|
|
|
# license
|
|
install -Dm644 LICENSE "${pkgdir}"/usr/share/licenses/${pkgname}/LICENSE
|
|
|
|
# fix permissons
|
|
find ${pkgdir}/usr -type f \( -name "*.dll" -o -name "*.exe" \) | xargs chmod 0755
|
|
}
|