You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
701 B
27 lines
701 B
{ stdenv
|
|
, lib
|
|
, darwin
|
|
, makeSetupHook
|
|
, dieHook
|
|
, writeShellScript
|
|
, tests
|
|
, cc ? stdenv.cc
|
|
, sanitizers ? []
|
|
}:
|
|
|
|
makeSetupHook {
|
|
deps = [ dieHook ]
|
|
# https://github.com/NixOS/nixpkgs/issues/148189
|
|
++ lib.optional (stdenv.isDarwin && stdenv.isAarch64) darwin.cctools;
|
|
|
|
substitutions = {
|
|
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
|
|
|