Elliot Lee 03bb291
#!/bin/sh
Elliot Lee 03bb291
# Conectiva brp - strip shared libraries. Based on Red Hat's brp-strip.
Elliot Lee 03bb291
# Thu Apr 20 - Guilherme Manika <gwm@conectiva.com.br>
Elliot Lee 03bb291
#              Created file
Elliot Lee 03bb291
Elliot Lee 03bb291
if [ -z "$RPM_BUILD_ROOT" -o "$RPM_BUILD_ROOT" = "/" ]; then
Elliot Lee 03bb291
	exit 0
Elliot Lee 03bb291
fi
Elliot Lee 03bb291
Elliot Lee 1de7d81
[ -z "$STRIP" -a -n "$1" ] && STRIP="$1"
Elliot Lee 1de7d81
[ -z "$STRIP" ] && STRIP=strip
Elliot Lee 03bb291
# Strip ELF shared objects
Elliot Lee 03bb291
# Please note we don't restrict our search to executable files because
Elliot Lee 03bb291
# our libraries are not (should not be, at least) +x.
Elliot Lee 03bb291
for f in `find $RPM_BUILD_ROOT -type f -a -exec file {} \; | \
27ac144
        grep -v "^${RPM_BUILD_ROOT}/\?usr/lib/debug"  | \
Elliot Lee 03bb291
	grep ' shared object,' | \
Elliot Lee 03bb291
	sed -n -e 's/^\(.*\):[ 	]*ELF.*, not stripped/\1/p'`; do
Elliot Lee 5fc6cf0
	$STRIP --strip-unneeded "$f"
Elliot Lee 03bb291
done