diff options
author | sterni <sternenseemann@systemli.org> | 2021-10-07 12:29:59 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-07 12:29:59 +0200 |
commit | 5d0972c63b95954e8f834efa1ffc38c739d8f089 (patch) | |
tree | 3dcf70382ca48db594a180fca683acb8898dba31 | |
parent | f609e8290d7538f27c30dc05136ff207603eefcc (diff) | |
parent | 11fe2fc3cfccb95f7b99f2a2d1096c851868e582 (diff) | |
download | nixlib-5d0972c63b95954e8f834efa1ffc38c739d8f089.tar nixlib-5d0972c63b95954e8f834efa1ffc38c739d8f089.tar.gz nixlib-5d0972c63b95954e8f834efa1ffc38c739d8f089.tar.bz2 nixlib-5d0972c63b95954e8f834efa1ffc38c739d8f089.tar.lz nixlib-5d0972c63b95954e8f834efa1ffc38c739d8f089.tar.xz nixlib-5d0972c63b95954e8f834efa1ffc38c739d8f089.tar.zst nixlib-5d0972c63b95954e8f834efa1ffc38c739d8f089.zip |
Merge pull request #138289 from sternenseemann/fix-non-gnu-strip
stdenv: move --enable-deterministic-archives flag into GNU wrapper
-rw-r--r-- | pkgs/build-support/bintools-wrapper/default.nix | 10 | ||||
-rw-r--r-- | pkgs/build-support/bintools-wrapper/gnu-binutils-strip-wrapper.sh | 4 | ||||
-rw-r--r-- | pkgs/build-support/setup-hooks/strip.sh | 2 | ||||
-rw-r--r-- | pkgs/development/interpreters/python/cpython/default.nix | 5 | ||||
-rw-r--r-- | pkgs/stdenv/linux/default.nix | 7 |
5 files changed, 20 insertions, 8 deletions
diff --git a/pkgs/build-support/bintools-wrapper/default.nix b/pkgs/build-support/bintools-wrapper/default.nix index 3d64639d33fa..53f367b9b84d 100644 --- a/pkgs/build-support/bintools-wrapper/default.nix +++ b/pkgs/build-support/bintools-wrapper/default.nix @@ -324,6 +324,16 @@ stdenv.mkDerivation { echo "-arch ${targetPlatform.darwinArch}" >> $out/nix-support/libc-ldflags '' + ## + ## GNU specific extra strip flags + ## + + # TODO(@sternenseemann): make a generic strip wrapper? + + optionalString (bintools.isGNU or false) '' + wrap ${targetPrefix}strip ${./gnu-binutils-strip-wrapper.sh} \ + "${bintools_bin}/bin/${targetPrefix}strip" + '' + ### ### Remove LC_UUID ### diff --git a/pkgs/build-support/bintools-wrapper/gnu-binutils-strip-wrapper.sh b/pkgs/build-support/bintools-wrapper/gnu-binutils-strip-wrapper.sh new file mode 100644 index 000000000000..5b5136e3d14c --- /dev/null +++ b/pkgs/build-support/bintools-wrapper/gnu-binutils-strip-wrapper.sh @@ -0,0 +1,4 @@ +#! @shell@ +# shellcheck shell=bash + +exec @prog@ --enable-deterministic-archives "$@" diff --git a/pkgs/build-support/setup-hooks/strip.sh b/pkgs/build-support/setup-hooks/strip.sh index c31a50eba57b..2d8e66a89fa3 100644 --- a/pkgs/build-support/setup-hooks/strip.sh +++ b/pkgs/build-support/setup-hooks/strip.sh @@ -51,7 +51,7 @@ stripDirs() { if [ -n "${dirs}" ]; then header "stripping (with command $cmd and flags $stripFlags) in$dirs" - find $dirs -type f -exec $cmd $commonStripFlags $stripFlags '{}' \; 2>/dev/null + find $dirs -type f -exec $cmd $stripFlags '{}' \; 2>/dev/null stopNest fi } diff --git a/pkgs/development/interpreters/python/cpython/default.nix b/pkgs/development/interpreters/python/cpython/default.nix index 7bb2bb288931..e4a974a255b8 100644 --- a/pkgs/development/interpreters/python/cpython/default.nix +++ b/pkgs/development/interpreters/python/cpython/default.nix @@ -284,7 +284,10 @@ in with passthru; stdenv.mkDerivation { CPPFLAGS = concatStringsSep " " (map (p: "-I${getDev p}/include") buildInputs); LDFLAGS = concatStringsSep " " (map (p: "-L${getLib p}/lib") buildInputs); LIBS = "${optionalString (!stdenv.isDarwin) "-lcrypt"} ${optionalString (ncurses != null) "-lncurses"}"; - NIX_LDFLAGS = optionalString (stdenv.isLinux && !stdenv.hostPlatform.isMusl) "-lgcc_s" + optionalString stdenv.hostPlatform.isMusl "-lgcc_eh"; + NIX_LDFLAGS = lib.optionalString stdenv.cc.isGNU ({ + "glibc" = "-lgcc_s"; + "musl" = "-lgcc_eh"; + }."${stdenv.hostPlatform.libc}" or ""); # Determinism: We fix the hashes of str, bytes and datetime objects. PYTHONHASHSEED=0; diff --git a/pkgs/stdenv/linux/default.nix b/pkgs/stdenv/linux/default.nix index 1fbd3cba27ef..d2c74f7722d3 100644 --- a/pkgs/stdenv/linux/default.nix +++ b/pkgs/stdenv/linux/default.nix @@ -375,12 +375,7 @@ in targetPlatform = localSystem; inherit config; - preHook = '' - # Make "strip" produce deterministic output, by setting - # timestamps etc. to a fixed value. - commonStripFlags="--enable-deterministic-archives" - ${commonPreHook} - ''; + preHook = commonPreHook; initialPath = ((import ../common-path.nix) {pkgs = prevStage;}); |