Switch strip test to using readelf(1) instead of file(1) to identify symbols.

This has been slightly faster in my tests since readelf(1) will fail on the
file much quicker if it doesn't find the ELF headers.  This also more directly
finds the symbol table.

With hat:	portmgr
This commit is contained in:
Bryan Drewery 2015-10-19 16:59:49 +00:00
parent c183f5d5d6
commit 16f2336cda
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=399699

View file

@ -173,15 +173,13 @@ stripped() {
[ -n "${STRIP}" ] || return 0
# Split file and result into 2 lines and read separately to ensure
# files with spaces are kept intact.
find ${STAGEDIR} -type f \
-exec /usr/bin/file --exclude ascii -nNF "${LF}" {} + |
# Using readelf -h ... /ELF Header:/ will match on all ELF files.
find ${STAGEDIR} -type f ! -name '*.a' \
-exec readelf -S {} + 2>/dev/null | awk '\
/File:/ {sub(/File: /, "", $0); file=$0} \
/SYMTAB/ {print file}' |
while read f; do
read output
case "${output}" in
*ELF\ *\ executable,\ *FreeBSD*,\ not\ stripped*|*ELF\ *\ shared\ object,\ *FreeBSD*,\ not\ stripped*)
warn "'${f#${STAGEDIR}${PREFIX}/}' is not stripped consider trying INSTALL_TARGET=install-strip or using \${STRIP_CMD}"
;;
esac
warn "'${f#${STAGEDIR}${PREFIX}/}' is not stripped consider trying INSTALL_TARGET=install-strip or using \${STRIP_CMD}"
done
}