Index: bsd.port.mk =================================================================== --- bsd.port.mk (revision 340377) +++ bsd.port.mk (working copy) @@ -1308,6 +1308,8 @@ .endif # Reset value from bsd.own.mk. +# TODO: remove, once all ports are stage-safe. The strip-binaries: target +# will handle this .if defined(WITH_DEBUG) && !defined(WITHOUT_DEBUG) STRIP= #none .endif @@ -6412,6 +6414,25 @@ .endif .endif #DEVELOPER +.if !defined(WITH_DEBUG) || defined(WITHOUT_DEBUG) +_STRIPMATCHES= application/x-executable \ + application/x-sharedlib + +strip-binaries: + @${ECHO_MSG} "===> Stripping binaries (${.TARGET})"; + @vm="${_STRIPMATCHES}"; ns="${NO_STRIP}"; \ + find ${STAGEDIR}${PREFIX} -type f | while read fname; do \ + relname=$${fname##${PREFIX}/}; \ + if [ "x$${ns#*$${relname}}" != "x$${ns}" ]; then \ + continue; \ + fi; \ + output=`${FILE} -b --mime-type "$${fname}" 2>/dev/null`; \ + if [ "x$${vm#*$${output}}" != "x$${vm}" ]; then \ + ${STRIP_CMD} "$${fname}"; \ + fi; \ + done +.endif + # Please note that the order of the following targets is important, and # should not be modified. @@ -6456,7 +6477,7 @@ _STAGE_SUSEQ= create-users-groups do-install desktop-file-post-install kmod-post-install \ shared-mime-post-install webplugin-post-install \ post-install post-install-script move-uniquefiles post-stage compress-man \ - install-rc-script install-ldconfig-file install-license \ + strip-binaries install-rc-script install-ldconfig-file install-license \ install-desktop-entries add-plist-info add-plist-docs add-plist-examples \ add-plist-data add-plist-post move-uniquefiles-plist fix-plist-sequence .if defined(DEVELOPER) @@ -6465,10 +6486,10 @@ .else _STAGE_SEQ+= create-users-groups do-install desktop-file-post-install kmod-post-install \ shared-mime-post-install webplugin-post-install post-install post-install-script \ - move-uniquefiles post-stage compress-man install-rc-script install-ldconfig-file \ - install-license install-desktop-entries add-plist-info add-plist-docs \ - add-plist-examples add-plist-data add-plist-post move-uniquefiles-plist \ - fix-plist-sequence + move-uniquefiles post-stage compress-man strip-binaries install-rc-script \ + install-ldconfig-file install-license install-desktop-entries add-plist-info \ + add-plist-docs add-plist-examples add-plist-data add-plist-post \ + move-uniquefiles-plist fix-plist-sequence .if defined(DEVELOPER) _STAGE_SEQ+= stage-qa .endif Index: Scripts/qa.sh =================================================================== --- Scripts/qa.sh (revision 340330) +++ Scripts/qa.sh (working copy) @@ -64,18 +64,6 @@ done } -# For now do not raise an error, just warnings -stripped() { - [ -x /usr/bin/file ] || return # this is fatal - [ -n "${STRIP}" ] || return 0 - IFS="$LF" ; for f in `find ${STAGEDIR} -type f`; do - output=`/usr/bin/file ${f}` - case "${output}" in - *:*\ ELF\ *,\ not\ stripped*) warn "${f} is not stripped consider using \${STRIP_CMD}";; - esac - done -} - desktopfileutils() { if [ -z "${USESDESKTOPFILEUTILS}" ]; then grep -q MimeType= ${STAGEDIR}${PREFIX}/share/applications/*.desktop 2>/dev/null && @@ -109,7 +97,7 @@ return 0 } -checks="shebang symlinks paths stripped desktopfileutils sharedmimeinfo suidfiles" +checks="shebang symlinks paths desktopfileutils sharedmimeinfo suidfiles" ret=0 cd ${STAGEDIR}