Merge pull request #268587 from tpwrules/numpy-fix-cross

python3Packages.numpy: fix cross compilation
This commit is contained in:
Martin Weinelt 2023-11-24 14:54:50 +01:00 committed by GitHub
commit 82afea34b9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -11,6 +11,7 @@
, cython_3
, gfortran
, meson-python
, mesonEmulatorHook
, pkg-config
, xcbuild
@ -83,6 +84,10 @@ in buildPythonPackage rec {
rm numpy/core/tests/test_cython.py
patchShebangs numpy/_build_utils/*.py
# remove needless reference to full Python path stored in built wheel
substituteInPlace numpy/meson.build \
--replace 'py.full_path()' "'python'"
'';
nativeBuildInputs = [
@ -92,6 +97,8 @@ in buildPythonPackage rec {
pkg-config
] ++ lib.optionals (stdenv.isDarwin) [
xcbuild.xcrun
] ++ lib.optionals (!stdenv.buildPlatform.canExecute stdenv.hostPlatform) [
mesonEmulatorHook
];
buildInputs = [
@ -110,6 +117,11 @@ in buildPythonPackage rec {
export OMP_NUM_THREADS=$((NIX_BUILD_CORES > 64 ? 64 : NIX_BUILD_CORES))
'';
# HACK: copy mesonEmulatorHook's flags to the variable used by meson-python
postConfigure = ''
mesonFlags="$mesonFlags ''${mesonFlagsArray[@]}"
'';
preBuild = ''
ln -s ${cfg} site.cfg
'';