csomh / source-git / rpm

Forked from source-git/rpm 4 years ago
Clone
2ff057
#!/bin/sh
2ff057
# If using normal root, avoid changing anything.
2ff057
if [ -z "$RPM_BUILD_ROOT" -o "$RPM_BUILD_ROOT" = "/" ]; then
2ff057
	exit 0
2ff057
fi
2ff057
2ff057
STRIP=${1:-strip}
2ff057
2ff057
case `uname -a` in
2ff057
Darwin*) exit 0 ;;
2ff057
*) ;;
2ff057
esac
2ff057
2ff057
# Strip ELF binaries
2ff057
for f in `find "$RPM_BUILD_ROOT" -type f \( -perm -0100 -or -perm -0010 -or -perm -0001 \) -exec file {} \; | \
2ff057
        grep -v "^${RPM_BUILD_ROOT}/\?usr/lib/debug"  | \
2ff057
	grep -v ' shared object,' | \
2ff057
	sed -n -e 's/^\(.*\):[ 	]*ELF.*, not stripped.*/\1/p'`; do
2ff057
	$STRIP -g "$f" || :
2ff057
done