forked from mirrors/nixpkgs
mesonEmulatorHook: check if the target binaries can be executed
this prevents having to bring in the emulator when compiling e.g. pkgsStatic
This commit is contained in:
parent
71cbf3b809
commit
2cbce6b012
|
@ -155,14 +155,14 @@ doCheck = stdenv.hostPlatform == stdenv.buildPlatform;
|
|||
|
||||
#### Package using Meson needs to run binaries for the host platform during build. {#cross-meson-runs-host-code}
|
||||
|
||||
Add `mesonEmulatorHook` cross conditionally to `nativeBuildInputs`.
|
||||
Add `mesonEmulatorHook` to `nativeBuildInputs` conditionally on if the target binaries can be executed.
|
||||
|
||||
e.g.
|
||||
|
||||
```
|
||||
nativeBuildInputs = [
|
||||
meson
|
||||
] ++ lib.optionals (stdenv.buildPlatform != stdenv.hostPlatform) [
|
||||
] ++ lib.optionals (!stdenv.buildPlatform.canExecute stdenv.hostPlatform) [
|
||||
mesonEmulatorHook
|
||||
];
|
||||
```
|
||||
|
|
|
@ -4131,7 +4131,7 @@ with pkgs;
|
|||
# example of an error which this fixes
|
||||
# [Errno 8] Exec format error: './gdk3-scan'
|
||||
mesonEmulatorHook =
|
||||
if (stdenv.buildPlatform != stdenv.targetPlatform) then
|
||||
if (!stdenv.buildPlatform.canExecute stdenv.targetPlatform) then
|
||||
makeSetupHook
|
||||
{
|
||||
name = "mesonEmulatorHook";
|
||||
|
@ -4142,7 +4142,7 @@ with pkgs;
|
|||
'';
|
||||
};
|
||||
} ../development/tools/build-managers/meson/emulator-hook.sh
|
||||
else throw "mesonEmulatorHook has to be in a cross conditional i.e. (stdenv.buildPlatform != stdenv.hostPlatform)";
|
||||
else throw "mesonEmulatorHook has to be in a conditional to check if the target binaries can be executed i.e. (!stdenv.buildPlatform.canExecute stdenv.hostPlatform)";
|
||||
|
||||
meson-tools = callPackage ../misc/meson-tools { };
|
||||
|
||||
|
|
Loading…
Reference in a new issue