nixpkgs/pkgs/build-support/setup-hooks/make-binary-wrapper/default.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

27 lines
680 B
Nix
Raw Normal View History

{ stdenv
, lib
, makeSetupHook
, dieHook
, writeShellScript
, tests
, cc ? stdenv.cc
, sanitizers ? []
}:
makeSetupHook {
deps = [ dieHook ]
# https://github.com/NixOS/nixpkgs/issues/148189
++ lib.optional (stdenv.isDarwin && stdenv.isAarch64) cc;
substitutions = {
2022-05-12 15:23:38 +02:00
cc = "${cc}/bin/cc ${lib.escapeShellArgs (map (s: "-fsanitize=${s}") sanitizers)}";
# Extract the function call used to create a binary wrapper from its embedded docstring
passthru.extractCmd = writeShellScript "extract-binary-wrapper-cmd" ''
strings -dw "$1" | sed -n '/^makeCWrapper/,/^$/ p'
'';
passthru.tests = tests.makeBinaryWrapper;
};
} ./make-binary-wrapper.sh