python3Packages.numpy: fix cross compilation

Add mesonEmulatorHook, along with a small hack to make it function
properly with meson-python.

(cherry picked from commit bad887d926)
This commit is contained in:
Thomas Watson
2023-11-19 16:10:11 -06:00
committed by github-actions[bot]
parent 78e248d826
commit 43c623e660

View File

@@ -11,6 +11,7 @@
, cython_3
, gfortran
, meson-python
, mesonEmulatorHook
, pkg-config
, xcbuild
@@ -96,6 +97,8 @@ in buildPythonPackage rec {
pkg-config
] ++ lib.optionals (stdenv.isDarwin) [
xcbuild.xcrun
] ++ lib.optionals (!stdenv.buildPlatform.canExecute stdenv.hostPlatform) [
mesonEmulatorHook
];
buildInputs = [
@@ -114,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
'';