summaryrefslogtreecommitdiff
path: root/brp-strip-lto
diff options
context:
space:
mode:
authorCoprDistGit <infra@openeuler.org>2024-09-18 07:06:26 +0000
committerCoprDistGit <infra@openeuler.org>2024-09-18 07:06:26 +0000
commitd68770f6939ab160ff27ec4e65ccc88cd3677bd0 (patch)
tree5fc00dcf6a9f1ac8a974f9d3b42e07001796a3b6 /brp-strip-lto
parentc22cb56acddf5bc4147f60908d5ebd770a079070 (diff)
automatic import of openEuler-rpm-config
Diffstat (limited to 'brp-strip-lto')
-rw-r--r--brp-strip-lto17
1 files changed, 17 insertions, 0 deletions
diff --git a/brp-strip-lto b/brp-strip-lto
new file mode 100644
index 0000000..8890541
--- /dev/null
+++ b/brp-strip-lto
@@ -0,0 +1,17 @@
+#!/usr/bin/sh
+# If using normal root, avoid changing anything.
+if [ -z "$RPM_BUILD_ROOT" ] || [ "$RPM_BUILD_ROOT" = "/" ]; then
+ exit 0
+fi
+
+STRIP=${1:-strip}
+NCPUS=${RPM_BUILD_NCPUS:-1}
+
+case `uname -a` in
+Darwin*) exit 0 ;;
+*) ;;
+esac
+
+# Strip ELF binaries
+find "$RPM_BUILD_ROOT" -type f -name '*.[ao]' \! -regex "$RPM_BUILD_ROOT/*usr/lib/debug.*" -print0 | \
+ eu-elfclassify --not-program --not-library --not-linux-kernel-module --stdin0 --print0 | xargs -0 -r -P$NCPUS -n32 sh -c "$STRIP -p -R .gnu.lto_* -R .gnu.debuglto_* -N __gnu_lto_v1 \"\$@\"" ARG0