From: Michael Tremer Date: Sun, 13 Mar 2011 20:23:31 +0000 (+0100) Subject: build-essentials: Move stripping before setting capabilities. X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=6ea175e4b3ca6ae193ec3ba83351678b566d4476;p=ipfire-3.x.git build-essentials: Move stripping before setting capabilities. The stripping caused a reset of the capabilities and needed to move out of the quality agent. Fixes #143. --- diff --git a/pkgs/build-essentials/build-essentials.nm b/pkgs/build-essentials/build-essentials.nm index 7c04a84f5..9d4de3aa5 100644 --- a/pkgs/build-essentials/build-essentials.nm +++ b/pkgs/build-essentials/build-essentials.nm @@ -26,7 +26,7 @@ include $(PKGROOT)/Include PKG_NAME = build-essentials PKG_VER = $(DISTRO_VERSION) -PKG_REL = 6 +PKG_REL = 7 PKG_EPOCH = 1 PKG_ARCH = noarch diff --git a/pkgs/build-essentials/buildsystem-tools/stripper b/pkgs/build-essentials/buildsystem-tools/stripper new file mode 100755 index 000000000..b35d72e13 --- /dev/null +++ b/pkgs/build-essentials/buildsystem-tools/stripper @@ -0,0 +1,31 @@ +#!/bin/bash + +# Based on RedHat's brp-strip*. + +BUILDROOT=${1} + +for f in `find ${BUILDROOT} -type f \( -perm -0100 -or -perm -0010 -or -perm -0001 \) -exec file {} \; | \ + grep -v "^${BUILDROOT}/\?usr/lib/debug" | \ + grep -v ' shared object,' | \ + sed -n -e 's/^\(.*\):[ ]*ELF.*, not stripped/\1/p'`; do + + # Strip ELF binaries + strip -g "$f" || : + + note="-R .note" + if objdump -h $f | grep '^[ ]*[0-9]*[ ]*.note[ ]' -A 1 | \ + grep ALLOC >/dev/null; then + note= + fi + strip -R .comment $note "$f" || : +done + +# 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. +for f in `find ${BUILDROOT} -type f -a -exec file {} \; | \ + grep -v "^${BUILDROOT}/\?usr/lib/debug" | \ + grep ' shared object,' | \ + sed -n -e 's/^\(.*\):[ ]*ELF.*, not stripped/\1/p'`; do + strip --strip-unneeded "$f" +done diff --git a/pkgs/build-essentials/buildsystem/Constants b/pkgs/build-essentials/buildsystem/Constants index e23671afd..500e2f10c 100644 --- a/pkgs/build-essentials/buildsystem/Constants +++ b/pkgs/build-essentials/buildsystem/Constants @@ -25,6 +25,7 @@ VPATH = $(DIR_DL) # Paths to scripts DO_EXTRACT = tar xaf DO_QUALITY_AGENT = quality-agent +DO_STRIP = /usr/lib/buildsystem-tools/stripper $(BUILDROOT) ############################################################################### # diff --git a/pkgs/build-essentials/buildsystem/Functions b/pkgs/build-essentials/buildsystem/Functions index 6aca8b9e9..53cceb6a8 100644 --- a/pkgs/build-essentials/buildsystem/Functions +++ b/pkgs/build-essentials/buildsystem/Functions @@ -144,12 +144,15 @@ define DO_INSTALL $(DO_INSTALL_INIT) $(DO_INSTALL_PAM) - $(DO_PYTHON_COMPILE) - @echo "#####################################################################" @echo "# $(PKG_NAME) - Install finished" @echo "#####################################################################" + $(DO_STRIP) + $(DO_PYTHON_COMPILE) + + $(STAGE_INSTALL_POST) + $(DO_QUALITY_AGENT) $(DO_FILELIST) endef diff --git a/pkgs/build-essentials/quality-agent/quality-agent.d/099-strip b/pkgs/build-essentials/quality-agent/quality-agent.d/099-strip deleted file mode 100755 index bd7a16a45..000000000 --- a/pkgs/build-essentials/quality-agent/quality-agent.d/099-strip +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/bash - -. $(dirname ${0})/qa-include - -DESC="Stripping reduces size of binary files." - -function check() { - # Strip debugging symbols - for f in $(find ${BUILDROOT} -type f \( -perm -0100 -or -perm -0010 -or -perm -0001 \)); do - if (file $f | grep -q ' shared object,'); then - strip --strip-debug "$f" || : - fi - done - - for f in $(find ${BUILDROOT} -type f); do - if (file $f | grep -q ' shared object,'); then - strip --strip-unneeded "$f" || : - fi - done -} - -run -