Elliot Lee 03bb291
#!/bin/sh
Elliot Lee 03bb291
# If using normal root, avoid changing anything.
Elliot Lee 03bb291
if [ -z "$RPM_BUILD_ROOT" -o "$RPM_BUILD_ROOT" = "/" ]; then
Elliot Lee 03bb291
	exit 0
Elliot Lee 03bb291
fi
Elliot Lee 1de7d81
[ -z "$STRIP" -a -n "$1" ] && STRIP="$1"
Elliot Lee 1de7d81
[ -z "$STRIP" ] && STRIP=strip
Elliot Lee 03bb291
# Strip ELF binaries
Elliot Lee 03bb291
for f in `find $RPM_BUILD_ROOT -type f \( -perm -0100 -or -perm -0010 -or -perm -0001 \) -exec file {} \; | \
27ac144
        grep -v "^${RPM_BUILD_ROOT}/\?usr/lib/debug"  | \
Elliot Lee 03bb291
	grep -v ' shared object,' | \
Elliot Lee 03bb291
	sed -n -e 's/^\(.*\):[ 	]*ELF.*, not stripped/\1/p'`; do
Elliot Lee 5fc6cf0
	$STRIP -g "$f" || :
Elliot Lee 03bb291
done