Pass __strip and __objdump macros

This commit is contained in:
Elliot Lee 2002-11-21 16:54:33 +00:00
parent 3b777d0999
commit 1de7d81cf0
5 changed files with 19 additions and 8 deletions

View File

@ -3,11 +3,12 @@
if [ -z "$RPM_BUILD_ROOT" -o "$RPM_BUILD_ROOT" = "/" ]; then
exit 0
fi
[ -z "$STRIP" -a -n "$1" ] && STRIP="$1"
[ -z "$STRIP" ] && STRIP=strip
# Strip ELF binaries
for f in `find $RPM_BUILD_ROOT -type f \( -perm -0100 -or -perm -0010 -or -perm -0001 \) -exec file {} \; | \
grep -v "^${RPM_BUILD_ROOT}/\?usr/lib/debug" | \
grep -v ' shared object,' | \
sed -n -e 's/^\(.*\):[ ]*ELF.*, not stripped/\1/p'`; do
strip -g $f || :
$STRIP -g $f || :
done

View File

@ -4,15 +4,20 @@ if [ -z "$RPM_BUILD_ROOT" -o "$RPM_BUILD_ROOT" = "/" ]; then
exit 0
fi
[ -z "$STRIP" -a -n "$1" ] && STRIP="$1"
[ -z "$OBJDUMP" -a -n "$2" ] && OBJDUMP="$2"
[ -z "$STRIP" ] && STRIP=strip
[ -z "$OBJDUMP" ] && OBJDUMP=objdump
# Strip .comment and .note sections (the latter only if it is not allocated)
# for already stripped elf files in the build root
for f in `find $RPM_BUILD_ROOT -type f \( -perm -0100 -or -perm -0010 -or -perm -0001 \) -exec file {} \; | \
grep -v "^${RPM_BUILD_ROOT}/\?usr/lib/debug" | \
sed -n -e 's/^\(.*\):[ ]*ELF.*, stripped/\1/p'`; do
note="-R .note"
if objdump -h $f | grep '^[ ]*[0-9]*[ ]*.note[ ]' -A 1 | \
if $OBJDUMP -h $f | grep '^[ ]*[0-9]*[ ]*.note[ ]' -A 1 | \
grep ALLOC >/dev/null; then
note=
fi
strip -R .comment $note $f || :
$STRIP -R .comment $note $f || :
done

View File

@ -7,6 +7,8 @@ if [ -z "$RPM_BUILD_ROOT" -o "$RPM_BUILD_ROOT" = "/" ]; then
exit 0
fi
[ -z "$STRIP" -a -n "$1" ] && STRIP="$1"
[ -z "$STRIP" ] && STRIP=strip
# Strip ELF shared objects
# Please note we don't restrict our search to executable files because
# our libraries are not (should not be, at least) +x.
@ -14,5 +16,5 @@ for f in `find $RPM_BUILD_ROOT -type f -a -exec file {} \; | \
grep -v "^${RPM_BUILD_ROOT}/\?usr/lib/debug" | \
grep ' shared object,' | \
sed -n -e 's/^\(.*\):[ ]*ELF.*, not stripped/\1/p'`; do
strip --strip-unneeded $f
$STRIP --strip-unneeded $f
done

4
macros
View File

@ -82,8 +82,8 @@
%__os_install_post \
/usr/lib/rpm/redhat/brp-compress \
/usr/lib/rpm/redhat/brp-strip \
/usr/lib/rpm/redhat/brp-strip-comment-note \
/usr/lib/rpm/redhat/brp-strip %{__strip} \
/usr/lib/rpm/redhat/brp-strip-comment-note %{__strip} %{__objdump} \
%{nil}
%__spec_install_post\

View File

@ -1,6 +1,6 @@
Summary: Red Hat specific rpm configuration files.
Name: redhat-rpm-config
Version: 8.0.5
Version: 8.0.6
Release: 1
License: GPL
Group: Development/System
@ -27,6 +27,9 @@ rm -rf ${RPM_BUILD_ROOT}
%{_prefix}/lib/rpm/redhat
%changelog
* Thu Nov 21 2002 Elliot Lee <sopwith@redhat.com> 8.0.6-1
- Pass __strip and __objdump macros
* Thu Nov 21 2002 Elliot Lee <sopwith@redhat.com> 8.0.5-1
- Update macros to specify find-provides/find-requires