diff options
author | Dominik Xaver Hörl <hoe.dom@gmx.de> | 2021-01-11 22:13:51 +0100 |
---|---|---|
committer | Dominik Xaver Hörl <hoe.dom@gmx.de> | 2021-01-11 22:13:51 +0100 |
commit | e4dae65515fa70434359723d72d2da61de4872f8 (patch) | |
tree | b6bb3ebacfaf3451bb5836159aaeb249d3d901f7 /pkgs/build-support | |
parent | db132fe8db548325fbf288981523a51d0e48b215 (diff) |
writers: deduplicate binary stripping logic
Diffstat (limited to 'pkgs/build-support')
-rw-r--r-- | pkgs/build-support/writers/default.nix | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/pkgs/build-support/writers/default.nix b/pkgs/build-support/writers/default.nix index 9c709921d2104..5945dc42c20e6 100644 --- a/pkgs/build-support/writers/default.nix +++ b/pkgs/build-support/writers/default.nix @@ -63,7 +63,7 @@ rec { # # Examples: # writeSimpleC = makeBinWriter { compileScript = name: "gcc -o $out $contentPath"; } - makeBinWriter = { compileScript }: nameOrPath: content: + makeBinWriter = { compileScript, strip ? true }: nameOrPath: content: assert lib.or (types.path.check nameOrPath) (builtins.match "([0-9A-Za-z._])[0-9A-Za-z._-]*" nameOrPath != null); assert lib.or (types.path.check content) (types.str.check content); let @@ -76,6 +76,8 @@ rec { contentPath = content; }) '' ${compileScript} + ${ lib.optionalString strip + "${pkgs.binutils-unwrapped}/bin/strip --strip-unneeded $out" } ${optionalString (types.path.check nameOrPath) '' mv $out tmp mkdir -p $out/$(dirname "${nameOrPath}") @@ -131,7 +133,6 @@ rec { -Wall \ -x c \ "$contentPath" - strip --strip-unneeded "$out" ''; } name; @@ -172,7 +173,6 @@ rec { cp $contentPath tmp.hs ${ghc.withPackages (_: libraries )}/bin/ghc ${lib.escapeShellArgs ghcArgs} tmp.hs mv tmp $out - ${pkgs.binutils-unwrapped}/bin/strip --strip-unneeded "$out" ''; } name; |