Skip to content

Commit bad887d

Browse files
committed
python3Packages.numpy: fix cross compilation
Add mesonEmulatorHook, along with a small hack to make it function properly with meson-python.
1 parent 4104fe9 commit bad887d

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

pkgs/development/python-modules/numpy/default.nix

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
, cython_3
1212
, gfortran
1313
, meson-python
14+
, mesonEmulatorHook
1415
, pkg-config
1516
, xcbuild
1617

@@ -96,6 +97,8 @@ in buildPythonPackage rec {
9697
pkg-config
9798
] ++ lib.optionals (stdenv.isDarwin) [
9899
xcbuild.xcrun
100+
] ++ lib.optionals (!stdenv.buildPlatform.canExecute stdenv.hostPlatform) [
101+
mesonEmulatorHook
99102
];
100103

101104
buildInputs = [
@@ -114,6 +117,11 @@ in buildPythonPackage rec {
114117
export OMP_NUM_THREADS=$((NIX_BUILD_CORES > 64 ? 64 : NIX_BUILD_CORES))
115118
'';
116119

120+
# HACK: copy mesonEmulatorHook's flags to the variable used by meson-python
121+
postConfigure = ''
122+
mesonFlags="$mesonFlags ''${mesonFlagsArray[@]}"
123+
'';
124+
117125
preBuild = ''
118126
ln -s ${cfg} site.cfg
119127
'';

0 commit comments

Comments
 (0)