Files
MINGW-packages/mingw-w64-python-numpy/PKGBUILD
2019-01-17 07:47:36 +03:00

156 lines
6.4 KiB
Bash

# Maintainer: Alexey Pavlov <alexpux@gmail.com>
# Contributor: Ray Donnelly <mingw.android@gmail.com>
# Contributor: Duong Pham <dthpham@gmail.com>
_realname=numpy
pkgbase=mingw-w64-python-${_realname}
pkgname=("${MINGW_PACKAGE_PREFIX}-python2-${_realname}" "${MINGW_PACKAGE_PREFIX}-python3-${_realname}")
pkgver=1.16.0
pkgrel=1
pkgdesc="Scientific tools for Python (mingw-w64)"
arch=('any')
license=('BSD')
url="http://www.numpy.org/"
makedepends=("${MINGW_PACKAGE_PREFIX}-openblas"
"${MINGW_PACKAGE_PREFIX}-python3-setuptools"
"${MINGW_PACKAGE_PREFIX}-python3-pytest"
"${MINGW_PACKAGE_PREFIX}-python2-setuptools"
"${MINGW_PACKAGE_PREFIX}-python2-pytest"
"${MINGW_PACKAGE_PREFIX}-gcc-fortran")
#options=('!strip' 'debug')
source=(https://github.com/numpy/numpy/releases/download/v${pkgver}/${_realname}-${pkgver}.tar.gz
0001-detect-mingw-environment.patch
0002-fix-finding-python2.patch
0003-gfortran-better-version-check.patch
0004-fix-testsuite.patch
0005-mincoming-stack-boundary-32bit-optimized-64bit.patch
0006-disable-visualcompaq-for-mingw.patch
0007-disable-64bit-experimental-warning.patch
0008-detect-mingw-environment2.patch)
sha256sums=('9b98898687b5dd05c4ac7bcf7e8669a50dd2bb19591b772e045e5806c23e0ca4'
'94e48602f59a69a9d56886e5b1dab62ffc4fb30b00c5d62d2a818d67d4fd079a'
'cbe3c59fe4a4182112c88070ff8dbea8198a5d4f7c43336621eb352d475b171b'
'3b640625b56b158465d6628f75fadce90af8825259d04af1b1af09fef53a720c'
'1f9783c356196327a424113e9a5d39c04fc70fef5529fd0d43288ff5274494f4'
'429d3379e6840dd39763c629488a687a04dc3c4540e58565e75f9809e57f778d'
'e8f2c52131e79a4e36c98f499efa85bc56254e577fae11ebce0093422114a306'
'00eac381f73172cb03f54fc71a845a3e72a998d78e88cbce752cf52672fc6bd1'
'5f59d7f0435af8933cd66659599d277cedfb499e036b7a3e4391db6ddd08dd72')
prepare() {
cd ${_realname}-${pkgver}
patch -Np1 -i ${srcdir}/0001-detect-mingw-environment.patch
patch -Np1 -i ${srcdir}/0002-fix-finding-python2.patch
patch -Np1 -i ${srcdir}/0003-gfortran-better-version-check.patch
patch -Np1 -i ${srcdir}/0004-fix-testsuite.patch
# Note, -mincoming-stack-boundary (and the other flags set) doesn't get used except
# in a test compilation, AFAICT.
patch -Np1 -i ${srcdir}/0005-mincoming-stack-boundary-32bit-optimized-64bit.patch
patch -Np1 -i ${srcdir}/0006-disable-visualcompaq-for-mingw.patch
patch -Np1 -i ${srcdir}/0007-disable-64bit-experimental-warning.patch
patch -Np1 -i ${srcdir}/0008-detect-mingw-environment2.patch
cd ..
cp -a ${_realname}-${pkgver} ${_realname}-py2-${CARCH}
cp -a ${_realname}-${pkgver} ${_realname}-py3-${CARCH}
cd ${_realname}-py2-${CARCH}
sed -e "s|#![ ]*/usr/bin/python$|#!/usr/bin/python2|" \
-e "s|#![ ]*/usr/bin/env python$|#!/usr/bin/env python2|" \
-e "s|#![ ]*/bin/env python$|#!/usr/bin/env python2|" \
-i $(find . -name '*.py')
}
build() {
export ATLAS=None
export LDFLAGS="$LDFLAGS -shared"
echo "Building Python2"
cd ${_realname}-py2-${CARCH}
MSYS2_ARG_CONV_EXCL="--prefix=;--install-scripts=;--install-platlib=" \
${MINGW_PREFIX}/bin/python2 setup.py config_fc --fcompiler=gnu95 build
echo "Building Python3"
cd ../${_realname}-py3-${CARCH}
MSYS2_ARG_CONV_EXCL="--prefix=;--install-scripts=;--install-platlib=" \
${MINGW_PREFIX}/bin/python3 setup.py config_fc --fcompiler=gnu95 build
}
package_python2-numpy() {
depends=("${MINGW_PACKAGE_PREFIX}-openblas" "${MINGW_PACKAGE_PREFIX}-python2")
optdepends=("${MINGW_PACKAGE_PREFIX}-python2-pytest: testsuite")
_pyver=$(${MINGW_PREFIX}/bin/python2 -c "import sys;sys.stdout.write('.'.join(map(str, sys.version_info[:2])))")
export ATLAS=None
export LDFLAGS="$LDFLAGS -shared"
cd ${_realname}-py2-${CARCH}
MSYS2_ARG_CONV_EXCL="--prefix=;--install-scripts=;--install-platlib=" \
${MINGW_PREFIX}/bin/python2 setup.py config_fc --fcompiler=gnu95 install --prefix=${MINGW_PREFIX} --root="${pkgdir}" --optimize=1
install -m755 -d "${pkgdir}${MINGW_PREFIX}/share/licenses/python2-${_realname}"
install -m644 LICENSE.txt "${pkgdir}${MINGW_PREFIX}/share/licenses/python2-${_realname}/"
install -m755 -d "${pkgdir}${MINGW_PREFIX}/include/python${_pyver}"
cp -rf ${pkgdir}${MINGW_PREFIX}/lib/python${_pyver}/site-packages/${_realname}/core/include/${_realname} "${pkgdir}${MINGW_PREFIX}/include/python${_pyver}/"
for f in f2py; do
mv "${pkgdir}${MINGW_PREFIX}"/bin/${f}{,2}.exe
if [ -f "${pkgdir}${MINGW_PREFIX}"/bin/${f}.exe.manifest ]; then
mv "${pkgdir}${MINGW_PREFIX}"/bin/${f}{,2}.exe.manifest
sed -e "s|${f}|${f}2|g" -i "${pkgdir}${MINGW_PREFIX}"/bin/${f}2.exe.manifest
fi
mv "${pkgdir}${MINGW_PREFIX}"/bin/${f}{,2}-script.py
done
# fix python command in files
local _mingw_prefix=$(cygpath -am ${MINGW_PREFIX})
for _f in "${pkgdir}${MINGW_PREFIX}"/bin/*.py; do
sed -e "s|${_mingw_prefix}/bin/|/usr/bin/env |g" -i ${_f}
done
}
package_python3-numpy() {
depends=("${MINGW_PACKAGE_PREFIX}-openblas" "${MINGW_PACKAGE_PREFIX}-python3")
optdepends=("${MINGW_PACKAGE_PREFIX}-python3-pytest: testsuite")
_pyver=$(${MINGW_PREFIX}/bin/python3 -c "import sys;sys.stdout.write('.'.join(map(str, sys.version_info[:2])))")
_pyinc=${_pyver}m
export ATLAS=None
export LDFLAGS="$LDFLAGS -shared"
cd ${_realname}-py3-${CARCH}
MSYS2_ARG_CONV_EXCL="--prefix=;--install-scripts=;--install-platlib=" \
${MINGW_PREFIX}/bin/python3 setup.py config_fc --fcompiler=gnu95 install --prefix=${MINGW_PREFIX} --root="${pkgdir}" --optimize=1
install -m755 -d "${pkgdir}${MINGW_PREFIX}/share/licenses/python3-${_realname}"
install -m644 LICENSE.txt "${pkgdir}${MINGW_PREFIX}/share/licenses/python3-${_realname}/"
install -m755 -d "${pkgdir}${MINGW_PREFIX}/include/python${_pyinc}"
cp -rf ${pkgdir}${MINGW_PREFIX}/lib/python${_pyver}/site-packages/${_realname}/core/include/${_realname} "${pkgdir}${MINGW_PREFIX}/include/python${_pyinc}/"
# fix python command in files
local _mingw_prefix=$(cygpath -am ${MINGW_PREFIX})
for _f in "${pkgdir}${MINGW_PREFIX}"/bin/*.py; do
sed -e "s|${_mingw_prefix}/bin/|/usr/bin/env |g" -i ${_f}
done
}
package_mingw-w64-i686-python2-numpy() {
package_python2-numpy
}
package_mingw-w64-i686-python3-numpy() {
package_python3-numpy
}
package_mingw-w64-x86_64-python2-numpy() {
package_python2-numpy
}
package_mingw-w64-x86_64-python3-numpy() {
package_python3-numpy
}