core/pkgs/by-name/me/meson/packages.nix

32 lines
1.2 KiB
Nix
Raw Normal View History

2024-05-02 00:46:19 +00:00
{ ... }:
res: pkgs: super:
2024-05-13 21:24:10 +00:00
with pkgs; {
2024-05-02 00:46:19 +00:00
meson = callPackage ./. { };
# while building documentation meson may want to run binaries for host
# which needs an emulator
# example of an error which this fixes
# [Errno 8] Exec format error: './gdk3-scan'
2024-05-13 21:24:10 +00:00
mesonEmulatorHook = makeSetupHook {
name = "mesonEmulatorHook";
substitutions = {
crossFile = writeText "cross-file.conf" ''
[binaries]
exe_wrapper = ${
lib.escapeShellArg (stdenv.targetPlatform.emulator pkgs)
}
'';
};
}
# The throw is moved into the `makeSetupHook` derivation, so that its
# outer level, but not its outPath can still be evaluated if the condition
# doesn't hold. This ensures that splicing still can work correctly.
(if (!stdenv.hostPlatform.canExecute stdenv.targetPlatform) then
../by-name/me/meson/emulator-hook.sh
else
throw
"mesonEmulatorHook may only be added to nativeBuildInputs when the target binaries can't be executed; however you are attempting to use it in a situation where ${stdenv.hostPlatform.config} can execute ${stdenv.targetPlatform.config}. Consider only adding mesonEmulatorHook according to a conditional based canExecute in your package expression.");
2024-05-02 00:46:19 +00:00
}