nixpkgs/pkgs/by-name/ma/makeBinaryWrapper/package.nix

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

28 lines
690 B
Nix
Raw Normal View History

{ targetPackages
, lib
, makeSetupHook
, dieHook
, writeShellScript
, tests
, cc ? targetPackages.stdenv.cc
, sanitizers ? []
}:
makeSetupHook {
2023-01-18 16:29:22 +00:00
name = "make-binary-wrapper-hook";
propagatedBuildInputs = [ dieHook ];
substitutions = {
cc = "${cc}/bin/${cc.targetPrefix}cc ${lib.escapeShellArgs (map (s: "-fsanitize=${s}") sanitizers)}";
};
passthru = {
# Extract the function call used to create a binary wrapper from its embedded docstring
extractCmd = writeShellScript "extract-binary-wrapper-cmd" ''
${cc.bintools.targetPrefix}strings -dw "$1" | sed -n '/^makeCWrapper/,/^$/ p'
'';
tests = tests.makeBinaryWrapper;
};
} ./make-binary-wrapper.sh