python311Packages.moto: 4.2.6 -> 4.2.10
[NixPkgs.git] / pkgs / build-support / setup-hooks / make-binary-wrapper / default.nix
blobf364dd5de753d3dbbbda16d6bb3d763c52c7bf92
1 { targetPackages
2 , lib
3 , makeSetupHook
4 , dieHook
5 , writeShellScript
6 , tests
7 , cc ? targetPackages.stdenv.cc
8 , sanitizers ? []
9 }:
11 makeSetupHook {
12   name = "make-binary-wrapper-hook";
13   propagatedBuildInputs = [ dieHook ];
15   substitutions = {
16     cc = "${cc}/bin/${cc.targetPrefix}cc ${lib.escapeShellArgs (map (s: "-fsanitize=${s}") sanitizers)}";
17   };
19   passthru = {
20     # Extract the function call used to create a binary wrapper from its embedded docstring
21     extractCmd = writeShellScript "extract-binary-wrapper-cmd" ''
22       ${cc.bintools.targetPrefix}strings -dw "$1" | sed -n '/^makeCWrapper/,/^$/ p'
23     '';
25     tests = tests.makeBinaryWrapper;
26   };
27 } ./make-binary-wrapper.sh