Files
MSYS2-packages/python/PKGBUILD
Christoph Reiter 75bb29d4ff openssl rebuilds
2022-12-21 18:57:19 +01:00

186 lines
6.4 KiB
Bash

# Maintainer: Alexey Pavlov <Alexpux@gmail.com>
# Contributor: Ray Donnelly <mingw.android@gmail.com>
pkgbase=python
pkgname=('python' 'python-devel')
pkgver=3.10.9
pkgrel=2
_pybasever=${pkgver%.*}
pkgdesc="Next generation of the python high-level scripting language"
arch=('i686' 'x86_64')
license=('custom')
url="https://www.python.org/"
makedepends=(
'libbz2-devel'
'libcrypt-devel'
'libexpat-devel'
'mpdecimal-devel'
'libsqlite-devel'
'libffi-devel'
'ncurses-devel'
'libreadline-devel'
'liblzma-devel'
'openssl-devel'
'zlib-devel'
'autotools'
'autoconf-archive'
'gcc'
)
source=(https://www.python.org/ftp/python/${pkgver%rc*}/Python-${pkgver}.tar.xz
001-3.1-enable-new-dtags.patch
003-3.4-select-cygwin.patch
005-3.7-ctypes-cygwin.patch
006-3.7-ftm.patch
007-3.8-dbm-cygwin.patch
008-3.8-distutils-cygwin.patch
009-3.8-export-PySignal_SetWakeupFd.patch
010-3.8-nis-cygwin.patch
012-3.8-pep3149-cygwin.patch
013-3.8-tkinter-cygwin.patch
014-3.8-xxsubinterpreters-cygwin.patch
015-rpath.patch
025-MINGW-compiler-customize-mingw-cygwin-compilers.patch
027-install-import-library.patch
900-msysize.patch
920-allow-win-drives-in-os-path-isabs.patch
930-fix-missing-tcp-include.patch
940-rebase-python-dll.patch
950-rebase-dlls.patch
960-fix-parallel-make.patch
28881-backport.patch)
sha256sums=('5ae03e308260164baba39921fdb4dbf8e6d03d8235a939d4582b33f0b5e46a83'
'be96ddaca58a39ddaf1e3e5bb7900b34c0e6d00e9b64c4e0f8a3565a74a44e84'
'82cfafc5b31ad4c9bb4c9786044c39c75762dbc2656abdfdc433c23fee69c02f'
'f0bb75ca69c63894fc43e0f8218c9dbcc746935bf5ea095a724e6fb2f5dcc566'
'098a756dfdb69b43bece4efe9d53a4f6ffc05a9a19a3d48854de787e69fc453c'
'dc044b0651a67f7c76e4119d65085e42277c0513b8e9653f0972d955c3dde2c5'
'8c460bf9522e50e06aa2c21a921eb42543d7a4cac6c598b13be43940a96966bf'
'70f854f00de71372e49f2ebbff7491e09e9e036e8e3f3646fe2984e30fb4a9da'
'62588723eb4051dccd0c8ab4183455e7ab99a3dca6c3c07e7403e1919b934ef0'
'9b84b5e027ff39ed3f827e805079f260db319a78571012815da30765ee2ceabc'
'4c6d9d786da1673208b0ef2bc3340e1acf08ce861b49193eb1592c53c3a4bd26'
'e48c719be36cb266ac3ceae834739fb1faae6740524cd672fd367f9304894a39'
'437332e1a7195dd0adcd505ecdeab5c3a7a793efdd7fea7bec55f97957bb8934'
'3e6c115c9b8e044193c0524b94275dfb13c1adfba3d250131b065f632b6d5512'
'9d0efb7e7e913e96b9f7953802311bbc2d046a7bfdcc3ffaf11fc509731b4d18'
'ce55a5e343158d7b1cd114cc7d7d53bcedfcd8616c533f816b3a0f1b2fe13682'
'85d9d042e0fa3493ec54b364e6b4fb6d2b12ba09641e01047bc84a09605ef76b'
'17e4ac1b5f0fa8a6c410fb80d1ad99ec9185efef51b8450a31932b553c354ed1'
'b439ff4f0a1f13858f8fb596414b74ed2c14fc3103d90287bb8e461ee89288b9'
'612bc5bcbe24c2f623713172d318c65a69ae601d72bcc5a170fe7c4eee458d18'
'c59025ca9d1219bbb42d620ca8d19398610737c5754f1873db07d55c47b2dad1'
'81e9e1a55fee1031b19dac55dbd068ed878abc5a6092cf4ab120486893ebb03a')
apply_patch_with_msg() {
for _patch in "$@"
do
msg2 "Applying $_patch"
patch -Nbp1 -i "${srcdir}/$_patch"
done
}
prepare() {
cd "${srcdir}/Python-${pkgver}"
# FS#23997
sed -i -e "s|^#.* /usr/local/bin/python|#!/usr/bin/python|" Lib/cgi.py
apply_patch_with_msg \
001-3.1-enable-new-dtags.patch \
003-3.4-select-cygwin.patch \
005-3.7-ctypes-cygwin.patch \
006-3.7-ftm.patch \
007-3.8-dbm-cygwin.patch \
008-3.8-distutils-cygwin.patch \
009-3.8-export-PySignal_SetWakeupFd.patch \
010-3.8-nis-cygwin.patch \
012-3.8-pep3149-cygwin.patch \
013-3.8-tkinter-cygwin.patch \
014-3.8-xxsubinterpreters-cygwin.patch \
015-rpath.patch \
025-MINGW-compiler-customize-mingw-cygwin-compilers.patch \
027-install-import-library.patch \
900-msysize.patch \
920-allow-win-drives-in-os-path-isabs.patch \
940-rebase-python-dll.patch \
950-rebase-dlls.patch \
960-fix-parallel-make.patch
# https://bugs.python.org/issue41374
apply_patch_with_msg \
930-fix-missing-tcp-include.patch
# https://github.com/python/cpython/pull/28881
apply_patch_with_msg \
28881-backport.patch
# 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/_ctypes/{darwin,libffi}*
rm -r Modules/_decimal/libmpdec
autoreconf -fiv
}
build() {
cd "${srcdir}/Python-${pkgver}"
CPPFLAGS+=" -I/usr/include/ncursesw"
LDFLAGS+=" -L."
local CYGWIN_CHOST="${CHOST/-msys/-cygwin}"
CXX=/usr/bin/g++ \
./configure \
--prefix=/usr \
--build=${CYGWIN_CHOST} \
--host=${CYGWIN_CHOST} \
--enable-shared \
--enable-ipv6 \
--with-dbmliborder=gdbm \
--with-libc= \
--with-libm= \
--with-system-expat \
--with-system-ffi \
--with-system-libmpdec \
--enable-loadable-sqlite-extensions \
--without-ensurepip \
ac_cv_func_bind_textdomain_codeset=yes
LC_CTYPE=en_US.UTF-8 make EXTRA_CFLAGS="$CFLAGS" > >(tee make-python.log)
sed -ne '/^\s*Failed to build these modules/,$ {p; /^\s*$/q42}' make-python.log
}
check() {
cd "${srcdir}/Python-${pkgver}"
"${srcdir}/Python-${pkgver}/python.exe" -m test.regrtest -x test_posixpath test_logging
}
package_python() {
#optdepends=('tk: for tkinter' 'sqlite')
depends=('libbz2' 'libexpat' 'libffi' 'liblzma' 'ncurses' 'libopenssl' 'libreadline' 'mpdecimal' 'libsqlite' 'zlib')
provides=('python3')
replaces=('python3')
cd "${srcdir}/Python-${pkgver}"
make DESTDIR="${pkgdir}" EXTRA_CFLAGS="$CFLAGS" install
# Why are these not done by default...
ln -sf python3 "${pkgdir}"/usr/bin/python.exe
ln -sf python3-config "${pkgdir}"/usr/bin/python-config
ln -sf idle3 "${pkgdir}"/usr/bin/idle
ln -sf pydoc3 "${pkgdir}"/usr/bin/pydoc
ln -sf python${_pybasever}.1 "${pkgdir}"/usr/share/man/man1/python3.1
ln -sf python${_pybasever}.1 "${pkgdir}"/usr/share/man/man1/python.1
# 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
}
package_python-devel() {
pkgdesc="Python headers and dev dependencies"
depends=("python=${pkgver}")
}