writers: use platform's default strip

bintools points to the default bintools (e. g. cctools, binutils,
llvmPackages.bintools) for the next stage. So instead of using GNU
binutils' strip which may not support the current platform, we need to
use buildPackages.bintools-unwrapped.

Additionally we need to use `-S` over `--strip-unneeded` as the latter
is a GNU binutils-specific flag and not supported by cctools.

Also add the correct targetPrefix in order to support cross-compilation
correctly here at least.
This commit is contained in:
sternenseemann 2021-10-29 12:12:58 +02:00
parent 837ebb5ac9
commit 3090ed3f40

View File

@ -1,4 +1,4 @@
{ pkgs, lib, gawk, gnused, gixy }:
{ pkgs, buildPackages, lib, gawk, gnused, gixy }:
with lib;
rec {
@ -77,7 +77,7 @@ rec {
}) ''
${compileScript}
${lib.optionalString strip
"${pkgs.binutils-unwrapped}/bin/strip --strip-unneeded $out"}
"${lib.getBin buildPackages.bintools-unwrapped}/bin/${buildPackages.bintools-unwrapped.targetPrefix}strip -S $out"}
${optionalString (types.path.check nameOrPath) ''
mv $out tmp
mkdir -p $out/$(dirname "${nameOrPath}")