1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-11-21 13:10:33 +00:00

Merge pull request #138289 from sternenseemann/fix-non-gnu-strip

stdenv: move --enable-deterministic-archives flag into GNU wrapper
This commit is contained in:
sterni 2021-10-07 12:29:59 +02:00 committed by GitHub
commit 5d0972c63b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 20 additions and 8 deletions

View file

@ -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
###

View file

@ -0,0 +1,4 @@
#! @shell@
# shellcheck shell=bash
exec @prog@ --enable-deterministic-archives "$@"

View file

@ -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
}

View file

@ -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;

View file

@ -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;});