Files
MINGW-packages/mingw-w64-python-numpy/PKGBUILD
2023-02-06 18:10:27 +01:00

127 lines
5.0 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}-python-${_realname}")
provides=("${MINGW_PACKAGE_PREFIX}-python3-${_realname}")
conflicts=("${MINGW_PACKAGE_PREFIX}-python3-${_realname}")
replaces=("${MINGW_PACKAGE_PREFIX}-python3-${_realname}")
pkgver=1.24.2
pkgrel=1
pkgdesc="Scientific tools for Python (mingw-w64)"
arch=('any')
mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64' 'clang32' 'clangarm64')
license=('BSD')
url="https://www.numpy.org/"
makedepends=("${MINGW_PACKAGE_PREFIX}-cython"
"${MINGW_PACKAGE_PREFIX}-python-setuptools"
"${MINGW_PACKAGE_PREFIX}-python-pytest"
"${MINGW_PACKAGE_PREFIX}-cc"
$( [[ ${MINGW_PACKAGE_PREFIX} == *-clang-* ]] || \
echo "${MINGW_PACKAGE_PREFIX}-gcc-fortran"))
depends=("${MINGW_PACKAGE_PREFIX}-python"
"${MINGW_PACKAGE_PREFIX}-openblas")
optdepends=("${MINGW_PACKAGE_PREFIX}-python-pytest: testsuite")
#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
0005-mincoming-stack-boundary-32bit-optimized-64bit.patch
0006-disable-visualcompaq-for-mingw.patch
0007-disable-64bit-experimental-warning.patch
0008-mingw-gcc-doesnt-support-visibility.patch
0011-dont-die-if-no-fcompiler.patch
0012-clang-no-gcc-workaround.patch)
sha256sums=('003a9f530e880cb2cd177cba1af7220b9aa42def9c4afc2a2fc3ee6be7eb2b22'
'94f111ab238c4a82e8613ed14e4cbeb553eabff26523f576e5fcafdbfdc8ee29'
'3aacb1d92e7764c9f0f24afa1a97b136a069fcd81d63c9fa55565c40c5a29974'
'2679482ce9396b551e1e1e7674f373d139b3e8a2f9729026000dd3c581de41d7'
'fb1a42a6eed1ea0795f9c91506623153157d4410a0f06ccb76eb80457fb6e8f5'
'fcacffaae853de592224bc51f1ecb3e617f2fc518d05373e1310aeabdf097254'
'cafc924fd11d8653a49970d0cce5b31869cce0e8996a3ae57bcbccca96bc8eb3'
'c7222c3cd85ff6af515514c5c3b8f3c02144c58c1373dec16683fa455504aa69'
'87bdd0a47a8662bdb8acaca18452901ee1f42cf08b985443ffb214f7facfdb2d'
'e21b48037928d797f46289439116d3585d697de2c58d51119873b47ee5410a92')
# Helper macros to help make tasks easier #
apply_patch_with_msg() {
for _patch in "$@"
do
msg2 "Applying ${_patch}"
patch -Nbp1 -i "${srcdir}/${_patch}"
done
}
prepare() {
cd ${_realname}-${pkgver}
apply_patch_with_msg \
0001-detect-mingw-environment.patch \
0002-fix-finding-python2.patch \
0003-gfortran-better-version-check.patch \
0006-disable-visualcompaq-for-mingw.patch \
0007-disable-64bit-experimental-warning.patch \
0008-mingw-gcc-doesnt-support-visibility.patch \
0011-dont-die-if-no-fcompiler.patch \
0012-clang-no-gcc-workaround.patch
apply_patch_with_msg \
0005-mincoming-stack-boundary-32bit-optimized-64bit.patch
# Note, -mincoming-stack-boundary (and the other flags set) doesn't get used except
# in a test compilation, AFAICT.
find . -type f -name "*.orig" -exec rm -f {} \;
cd ..
cp -a ${_realname}-${pkgver} ${_realname}-py-${MSYSTEM}
}
build() {
export ATLAS=None
export LDFLAGS="$LDFLAGS -shared"
# See: https://sourceforge.net/p/mingw-w64/mailman/message/36287627/
export CFLAGS="$CFLAGS -fno-asynchronous-unwind-tables"
local _fortran_config=""
if [[ ${MINGW_PACKAGE_PREFIX} != *-clang-* ]]; then
_fortran_config="config_fc --fcompiler=gnu95"
fi
cd ${_realname}-py-${MSYSTEM}
MSYS2_ARG_CONV_EXCL="--prefix=;--install-scripts=;--install-platlib=" \
${MINGW_PREFIX}/bin/python setup.py ${_fortran_config} build
}
package() {
_pyver=$(${MINGW_PREFIX}/bin/python -c "import sys;sys.stdout.write('.'.join(map(str, sys.version_info[:2])))")
_pyinc=${_pyver}
export ATLAS=None
export LDFLAGS="$LDFLAGS -shared"
export CFLAGS="$CFLAGS -fno-asynchronous-unwind-tables"
local _fortran_config=""
if [[ ${MINGW_PACKAGE_PREFIX} != *-clang-* ]]; then
_fortran_config="config_fc --fcompiler=gnu95"
fi
cd ${_realname}-py-${MSYSTEM}
MSYS2_ARG_CONV_EXCL="--prefix=;--install-scripts=;--install-platlib=" \
${MINGW_PREFIX}/bin/python setup.py ${_fortran_config} install --prefix=${MINGW_PREFIX} --root="${pkgdir}" --optimize=1
install -Dm644 LICENSE.txt ${pkgdir}${MINGW_PREFIX}/share/licenses/python-${_realname}/LICENSE.txt
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
}