about summary refs log tree commit diff
path: root/pkgs/build-support/setup-hooks
diff options
context:
space:
mode:
authorNaïm Favier <n@monade.li>2022-05-10 15:51:43 +0200
committerNaïm Favier <n@monade.li>2022-05-10 22:07:56 +0200
commit0d6bcb513bf2f2fe92ff8b2fae75da95007a03e3 (patch)
treed76fd03a5245fb1ad01a48fb3d04f80d6203387c /pkgs/build-support/setup-hooks
parent3a79190750961431007e18e13b8d2799ac3b7367 (diff)
makeBinaryWrapper: move into its own folder
The derivation is complex enough to warrant moving out of
all-packages.nix
Diffstat (limited to 'pkgs/build-support/setup-hooks')
-rw-r--r--pkgs/build-support/setup-hooks/make-binary-wrapper/default.nix20
-rw-r--r--pkgs/build-support/setup-hooks/make-binary-wrapper/make-binary-wrapper.sh (renamed from pkgs/build-support/setup-hooks/make-binary-wrapper.sh)2
2 files changed, 21 insertions, 1 deletions
diff --git a/pkgs/build-support/setup-hooks/make-binary-wrapper/default.nix b/pkgs/build-support/setup-hooks/make-binary-wrapper/default.nix
new file mode 100644
index 0000000000000..f27a4c9fcdf2f
--- /dev/null
+++ b/pkgs/build-support/setup-hooks/make-binary-wrapper/default.nix
@@ -0,0 +1,20 @@
+{ stdenv
+, lib
+, makeSetupHook
+, dieHook
+, tests
+, cc ? stdenv.cc
+, sanitizers ? []
+}:
+
+makeSetupHook {
+  deps = [ dieHook cc ];
+
+  substitutions = {
+    cc = let
+      san = lib.escapeShellArgs (map (s: "-fsanitize=${s}") sanitizers);
+    in "${cc}/bin/cc ${san}";
+
+    passthru.tests = tests.makeBinaryWrapper;
+  };
+} ./make-binary-wrapper.sh
diff --git a/pkgs/build-support/setup-hooks/make-binary-wrapper.sh b/pkgs/build-support/setup-hooks/make-binary-wrapper/make-binary-wrapper.sh
index 3931b37c24295..abcde2429eeb3 100644
--- a/pkgs/build-support/setup-hooks/make-binary-wrapper.sh
+++ b/pkgs/build-support/setup-hooks/make-binary-wrapper/make-binary-wrapper.sh
@@ -43,7 +43,7 @@ makeWrapper() {
     mkdir -p "$(dirname "$wrapper")"
 
     makeDocumentedCWrapper "$original" "$@" | \
-      @CC@ \
+      @cc@ \
         -Wall -Werror -Wpedantic \
         -Wno-overlength-strings \
         -Os \