Blame brp-strip-comment-note
|
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 |
03bb291 |
|
|
Elliot Lee |
1de7d81 |
[ -z "$STRIP" -a -n "$1" ] && STRIP="$1"
|
|
Elliot Lee |
1de7d81 |
[ -z "$OBJDUMP" -a -n "$2" ] && OBJDUMP="$2"
|
|
Elliot Lee |
1de7d81 |
[ -z "$STRIP" ] && STRIP=strip
|
|
Elliot Lee |
1de7d81 |
[ -z "$OBJDUMP" ] && OBJDUMP=objdump
|
|
Elliot Lee |
1de7d81 |
|
|
Elliot Lee |
03bb291 |
# Strip .comment and .note sections (the latter only if it is not allocated)
|
|
Elliot Lee |
03bb291 |
# for already stripped elf files in the build root
|
|
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 |
sed -n -e 's/^\(.*\):[ ]*ELF.*, stripped/\1/p'`; do
|
|
Elliot Lee |
03bb291 |
note="-R .note"
|
|
Elliot Lee |
1de7d81 |
if $OBJDUMP -h $f | grep '^[ ]*[0-9]*[ ]*.note[ ]' -A 1 | \
|
|
Elliot Lee |
03bb291 |
grep ALLOC >/dev/null; then
|
|
Elliot Lee |
03bb291 |
note=
|
|
Elliot Lee |
03bb291 |
fi
|
|
Elliot Lee |
5fc6cf0 |
$STRIP -R .comment $note "$f" || :
|
|
Elliot Lee |
03bb291 |
done
|