about summary refs log tree commit diff
path: root/pkgs/build-support/setup-hooks
diff options
context:
space:
mode:
authorArtturin <Artturin@artturin.com>2023-07-19 22:34:46 +0300
committerArtturin <Artturin@artturin.com>2023-07-21 21:57:44 +0300
commit5093766f79b6d14a6a833de1b91f5557b4160232 (patch)
treef01aca61e901d62a836ae15c419c32cf06ba2c3e /pkgs/build-support/setup-hooks
parentd191233603db7cab2d0970ae94cac7d314f467e7 (diff)
setup-hooks/strip: Print strip stderr if command fails
This is easiest to do through a file.

mktemp needs six X because busybox only accepts exactly six X.
Diffstat (limited to 'pkgs/build-support/setup-hooks')
-rw-r--r--pkgs/build-support/setup-hooks/strip.sh8
1 files changed, 6 insertions, 2 deletions
diff --git a/pkgs/build-support/setup-hooks/strip.sh b/pkgs/build-support/setup-hooks/strip.sh
index 8f0543b7ee739..032b816154a89 100644
--- a/pkgs/build-support/setup-hooks/strip.sh
+++ b/pkgs/build-support/setup-hooks/strip.sh
@@ -61,13 +61,17 @@ stripDirs() {
 
     if [ -n "${paths}" ]; then
         echo "stripping (with command $cmd and flags $stripFlags) in $paths"
+        local striperr
+        striperr="$(mktemp 'striperr.XXXXXX')"
         # Do not strip lib/debug. This is a directory used by setup-hooks/separate-debug-info.sh.
         find $paths -type f -a '!' -path "$prefix/lib/debug/*" -print0 |
-            xargs -r -0 -n1 -P "$NIX_BUILD_CORES" $cmd $stripFlags 2>/dev/null || exit_code=$?
+            xargs -r -0 -n1 -P "$NIX_BUILD_CORES" $cmd $stripFlags 2>"$striperr" || exit_code=$?
         # xargs exits with status code 123 if some but not all of the
         # processes fail. We don't care if some of the files couldn't
         # be stripped, so ignore specifically this code.
-        [[ "$exit_code" = 123 || -z "$exit_code" ]]
+        [[ "$exit_code" = 123 || -z "$exit_code" ]] || (cat "$striperr" 1>&2 && exit 1)
+
+        rm "$striperr"
         # 'strip' does not normally preserve archive index in .a files.
         # This usually causes linking failures against static libs like:
         #   ld: ...-i686-w64-mingw32-stage-final-gcc-13.0.0-lib/i686-w64-mingw32/lib/libstdc++.dll.a: