2024-05-13 21:24:10 +00:00
|
|
|
{ targetPackages, lib, makeSetupHook, dieHook, writeShellScript, tests
|
|
|
|
, cc ? targetPackages.stdenv.cc, sanitizers ? [ ] }:
|
2024-05-02 00:46:19 +00:00
|
|
|
|
|
|
|
makeSetupHook {
|
|
|
|
name = "make-binary-wrapper-hook";
|
|
|
|
propagatedBuildInputs = [ dieHook ];
|
|
|
|
|
|
|
|
substitutions = {
|
2024-05-13 21:24:10 +00:00
|
|
|
cc = "${cc}/bin/${cc.targetPrefix}cc ${
|
|
|
|
lib.escapeShellArgs (map (s: "-fsanitize=${s}") sanitizers)
|
|
|
|
}";
|
2024-05-02 00:46:19 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
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
|