lol

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

`--enable-deterministic-archives` is a GNU specific strip flag and
causes other strip implementations (for example LLVM's, see #138013)
to fail. Since strip failures are ignored, this means that stripping
doesn't work at all in certain situation (causing unnecessary
dependencies etc.).

To fix this, no longer pass `--enable-deterministic-archives`
unconditionally, but instead add it in a GNU binutils specific strip
wrapper only.

`commonStripFlags` was only used for this flag, so we can remove
it altogether.

Future work could be to make a generic strip wrapper, with support for
nix-support/strip-flags-{before,after} and NIX_STRIP_FLAGS_{BEFORE,AFTER}.
This possibly overkill and unnecessary though -- also with the
additional challenge of incorporating the darwin strip wrapper somehow.

+16 -7
+10
pkgs/build-support/bintools-wrapper/default.nix
··· 324 324 echo "-arch ${targetPlatform.darwinArch}" >> $out/nix-support/libc-ldflags 325 325 '' 326 326 327 + ## 328 + ## GNU specific extra strip flags 329 + ## 330 + 331 + # TODO(@sternenseemann): make a generic strip wrapper? 332 + + optionalString (bintools.isGNU or false) '' 333 + wrap ${targetPrefix}strip ${./gnu-binutils-strip-wrapper.sh} \ 334 + "${bintools_bin}/bin/${targetPrefix}strip" 335 + '' 336 + 327 337 ### 328 338 ### Remove LC_UUID 329 339 ###
+4
pkgs/build-support/bintools-wrapper/gnu-binutils-strip-wrapper.sh
··· 1 + #! @shell@ 2 + # shellcheck shell=bash 3 + 4 + exec @prog@ --enable-deterministic-archives "$@"
+1 -1
pkgs/build-support/setup-hooks/strip.sh
··· 51 51 52 52 if [ -n "${dirs}" ]; then 53 53 header "stripping (with command $cmd and flags $stripFlags) in$dirs" 54 - find $dirs -type f -exec $cmd $commonStripFlags $stripFlags '{}' \; 2>/dev/null 54 + find $dirs -type f -exec $cmd $stripFlags '{}' \; 2>/dev/null 55 55 stopNest 56 56 fi 57 57 }
+1 -6
pkgs/stdenv/linux/default.nix
··· 375 375 targetPlatform = localSystem; 376 376 inherit config; 377 377 378 - preHook = '' 379 - # Make "strip" produce deterministic output, by setting 380 - # timestamps etc. to a fixed value. 381 - commonStripFlags="--enable-deterministic-archives" 382 - ${commonPreHook} 383 - ''; 378 + preHook = commonPreHook; 384 379 385 380 initialPath = 386 381 ((import ../common-path.nix) {pkgs = prevStage;});