Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stdenv: move --enable-deterministic-archives flag into GNU wrapper #138289

Merged
merged 2 commits into from
Oct 7, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions pkgs/build-support/bintools-wrapper/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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
###
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#! @shell@
# shellcheck shell=bash

exec @prog@ --enable-deterministic-archives "$@"
2 changes: 1 addition & 1 deletion pkgs/build-support/setup-hooks/strip.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
5 changes: 4 additions & 1 deletion pkgs/development/interpreters/python/cpython/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,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;

Expand Down
7 changes: 1 addition & 6 deletions pkgs/stdenv/linux/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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"
sternenseemann marked this conversation as resolved.
Show resolved Hide resolved
${commonPreHook}
'';
preHook = commonPreHook;

initialPath =
((import ../common-path.nix) {pkgs = prevStage;});
Expand Down