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