f9efe2
#!/usr/bin/sh
f9efe2
# If using normal root, avoid changing anything.
f9efe2
if [ -z "$RPM_BUILD_ROOT" ] || [ "$RPM_BUILD_ROOT" = "/" ]; then
f9efe2
	exit 0
f9efe2
fi
f9efe2
f9efe2
STRIP=${1:-strip}
f9efe2
NCPUS=${RPM_BUILD_NCPUS:-1}
f9efe2
f9efe2
case `uname -a` in
f9efe2
Darwin*) exit 0 ;;
f9efe2
*) ;;
f9efe2
esac
f9efe2
f9efe2
# Strip ELF binaries
f9efe2
find "$RPM_BUILD_ROOT" -type f -name '*.[ao]' \! -regex "$RPM_BUILD_ROOT/*usr/lib/debug.*" -print0 | \
f9efe2
  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