]> git.ipfire.org Git - ipfire-3.x.git/commitdiff
build-essentials: Move stripping before setting capabilities.
authorMichael Tremer <michael.tremer@ipfire.org>
Sun, 13 Mar 2011 20:23:31 +0000 (21:23 +0100)
committerMichael Tremer <michael.tremer@ipfire.org>
Sun, 13 Mar 2011 20:23:31 +0000 (21:23 +0100)
The stripping caused a reset of the capabilities and needed to
move out of the quality agent.

Fixes #143.

pkgs/build-essentials/build-essentials.nm
pkgs/build-essentials/buildsystem-tools/stripper [new file with mode: 0755]
pkgs/build-essentials/buildsystem/Constants
pkgs/build-essentials/buildsystem/Functions
pkgs/build-essentials/quality-agent/quality-agent.d/099-strip [deleted file]

index 7c04a84f50ea024866191e42fc260608c5e102ae..9d4de3aa5bdaea2ac956e82d1cba8278b52d3ee3 100644 (file)
@@ -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 (executable)
index 0000000..b35d72e
--- /dev/null
@@ -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
index e23671afdb6acb1d430d6703f14a52cfb63dc066..500e2f10c33f31f275dddd19291cfdadcc5377d8 100644 (file)
@@ -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)
 
 ###############################################################################
 #
index 6aca8b9e9e02a7fe71f84ac3294f3f4a1a4eccec..53cceb6a89a46a743f86ba6bb4854edadab06242 100644 (file)
@@ -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 (executable)
index bd7a16a..0000000
+++ /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
-