Files
MSYS2-packages/python3/PKGBUILD
2016-03-04 11:38:22 +03:00

153 lines
6.3 KiB
Bash

# Maintainer: Alexey Pavlov <Alexpux@gmail.com>
# Contributor: Ray Donnelly <mingw.android@gmail.com>
pkgname=python
pkgver=3.4.3
pkgrel=3
_pybasever=3.4
pkgdesc="Next generation of the python high-level scripting language"
arch=('i686' 'x86_64')
license=('custom')
url="https://www.python.org/"
depends=('libbz2' 'libexpat' 'libffi' 'liblzma' 'ncurses' 'libopenssl' 'libreadline' 'libsqlite' 'zlib')
makedepends=('libbz2-devel' 'libexpat-devel' 'libsqlite-devel' 'libffi-devel' 'ncurses-devel' 'libreadline-devel' 'liblzma-devel' 'openssl-devel' 'zlib-devel')
#optdepends=('tk: for tkinter' 'sqlite')
provides=('python3')
replaces=('python3')
options=('!makeflags')
source=(https://www.python.org/ftp/python/${pkgver%rc*}/Python-${pkgver}.tar.xz
001-3.4-dbm-cygwin.patch
002-3.1-enable-new-dtags.patch
003-3.4-tkinter-cygwin.patch
004-3.4-ctypes-cygwin.patch
005-3.1-PATH_MAX.patch
006-3.1-ncurses-abi6.patch
007-3.2-export-PySignal_SetWakeupFd.patch
008-3.4-distutils-soname.patch
009-3.2-distutils-shlibext.patch
010-3.4-pep3149-cygwin.patch
011-3.4-thread-cygwin64.patch
012-3.2-getpath-exe-extension.patch
013-3.4-select-cygwin.patch
014-3.4-signal-cygwin.patch
015-3.4-struct-cygwin.patch
016-3.4-ctypes-error-formatting.patch
025-MINGW-compiler-customize-mingw-cygwin-compilers.patch
900-msysize.patch
910-libffi-msys2.patch
920-allow-win-drives-in-os-path-isabs.patch)
sha256sums=('b5b3963533768d5fc325a4d7a6bd6f666726002d696f1d399ec06b043ea996b8'
'4fadf48332d86266c0fa30548dba56ca295d936d556b879972aea81290ad7520'
'4db598b2bf7ae3767a7ab84501ba9cc0d2b26d2b94e6c2652884143b40bf9820'
'fc27003dda4a96cc5154faec447183c325cb7508339de58e7152207ecd19bfa5'
'7b688e9103af3eed42999c418c29a26c973020eec89cfc35c5a63c03c42ec9d9'
'bb5a438ecb655e1e2e54372e3980abafc667c2e229dda0f269eccd79ed72ed4e'
'8a138293fa5ad3a7522e00194994fecc8967c6a71822127391e4d756b2280e74'
'8e8c554e5f2e3a5765a3487e1b80f03c4e377f878548730fe43f0860a9dc0108'
'3e557cbd67246c33da738e80de59e56352e0822ce604cee8d12df50c311f7c12'
'8e1ea7683ccd3f4b45f97075c125be86f28d4db9a342a257ea2f138936fd80a4'
'df1e72d5dc55c480d15a039dfe7ba2b73700e6ec6fac860ed2e6152e55ca9f29'
'a5250b1d4b38d90b8bb03ba93642c1b6d44b51d76c3659c9360363610b7cc698'
'e7e3aa7adbee914a30aad34dcc6fe0beb036580edcefdfae596c55b408c450c9'
'63189f7e171eaa082af1f6315f14cc1aebb4b3b431ec0e120d1b7b178263c39f'
'98ec5d02475388ff899bd59566b37996895cd2a049c40d2845c052816e4875ff'
'4d2331bf3af0beb8528c0aad4669b4d58093481f4f8120e80a71645d98565495'
'f810a2c0ddaf641904e726191596620ba18ca5fc582b74b427b8a68c6821d9c3'
'0f96dc585398d3d04e2f02e5e398f2d81f65cbd6544999e5acf38d985975caba'
'e21c674a9454f3ff441ca2d298889616ec126defaa29fc7469e74427b1df44bb'
'7e587d145db24fbee1c7c7b96a4d7f247d132315384d551005ffb39b51f41906'
'a1edaeda01466268cd75eb50c440b1ee76eafea334b14515b3cfb66c1e38d0e9')
prepare() {
cd "${srcdir}/Python-${pkgver}"
# FS#23997
sed -i -e "s|^#.* /usr/local/bin/python|#!/usr/bin/python|" Lib/cgi.py
patch -p1 -i ${srcdir}/001-3.4-dbm-cygwin.patch
patch -p1 -i ${srcdir}/002-3.1-enable-new-dtags.patch
patch -p1 -i ${srcdir}/003-3.4-tkinter-cygwin.patch
patch -p1 -i ${srcdir}/004-3.4-ctypes-cygwin.patch
patch -p1 -i ${srcdir}/005-3.1-PATH_MAX.patch
patch -p1 -i ${srcdir}/006-3.1-ncurses-abi6.patch
patch -p1 -i ${srcdir}/007-3.2-export-PySignal_SetWakeupFd.patch
patch -p1 -i ${srcdir}/008-3.4-distutils-soname.patch
patch -p1 -i ${srcdir}/009-3.2-distutils-shlibext.patch
patch -p1 -i ${srcdir}/010-3.4-pep3149-cygwin.patch
patch -p1 -i ${srcdir}/011-3.4-thread-cygwin64.patch
patch -p1 -i ${srcdir}/012-3.2-getpath-exe-extension.patch
patch -p1 -i ${srcdir}/013-3.4-select-cygwin.patch
patch -p1 -i ${srcdir}/014-3.4-signal-cygwin.patch
patch -p1 -i ${srcdir}/015-3.4-struct-cygwin.patch
patch -p1 -i ${srcdir}/016-3.4-ctypes-error-formatting.patch
patch -p1 -i ${srcdir}/025-MINGW-compiler-customize-mingw-cygwin-compilers.patch
patch -p1 -i ${srcdir}/900-msysize.patch
patch -p1 -i ${srcdir}/910-libffi-msys2.patch
patch -p1 -i ${srcdir}/920-allow-win-drives-in-os-path-isabs.patch
# Incomplete patch from Ray Donnelly
# patch -p1 -i ${srcdir}/3.3.2-allow-windows-paths-for-executable.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/zlib
rm -r Modules/_ctypes/{darwin,libffi}*
autoreconf -fiv
}
build() {
cd "${srcdir}/Python-${pkgver}"
CPPFLAGS+=" -I/usr/include/ncursesw"
LDFLAGS+=" -L."
CXX=/usr/bin/g++ \
./configure \
--prefix=/usr \
--build=${CHOST} \
--host=${CHOST} \
--enable-shared \
--enable-ipv6 \
--with-dbmliborder=gdbm \
--with-libc= \
--with-libm= \
--with-system-expat \
--with-system-ffi \
--with-threads \
--without-ensurepip \
ac_cv_func_bind_textdomain_codeset=yes
make
}
check() {
cd "${srcdir}/Python-${pkgver}"
"${srcdir}/Python-${pkgver}/python" -m test.regrtest -x test_posixpath test_logging
}
package() {
cd "${srcdir}/Python-${pkgver}"
make DESTDIR="${pkgdir}" install maninstall
# 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
# Fix FS#22552
cp -f "${pkgdir}"/usr/lib/python${_pybasever}/config-${_pybasever}m/libpython${_pybasever}m.dll.a "${pkgdir}"/usr/lib/libpython${_pybasever}m.dll.a
# Clean-up reference to build directory
sed -i "s|$srcdir/Python-${pkgver}:||" "$pkgdir/usr/lib/python${_pybasever}/config-${_pybasever}m/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
}