summaryrefslogtreecommitdiffstats
path: root/install/strip
diff options
context:
space:
mode:
authorDave Reisner <dreisner@archlinux.org>2012-05-26 21:40:54 +0200
committerDave Reisner <dreisner@archlinux.org>2012-07-15 16:29:08 +0200
commit59ae6346ba32ecbf59dcef2feddb1bd81527465d (patch)
tree6794e2f910c054019e3e656eb2b762389f6e6819 /install/strip
parentc257b0d7b4dd1c3f9b63c6a27b68a27bc246acea (diff)
downloadmkinitcpio-59ae6346ba32ecbf59dcef2feddb1bd81527465d.tar.gz
mkinitcpio-59ae6346ba32ecbf59dcef2feddb1bd81527465d.tar.xz
add 'strip' install hook
Mostly a convenience for myself, and anyone else who runs builds of things like util-linux or kmod, where having debug symbols on these libraries can add a large amount of weight to the image. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Diffstat (limited to 'install/strip')
-rw-r--r--install/strip32
1 files changed, 32 insertions, 0 deletions
diff --git a/install/strip b/install/strip
new file mode 100644
index 0000000..8ed9240
--- /dev/null
+++ b/install/strip
@@ -0,0 +1,32 @@
+#!/bin/bash
+
+build() {
+ find "$BUILDROOT" -type f -perm -u+w -print0 2>/dev/null | while read -d '' bin; do
+ case $(file -bi "$bin") in
+ *application/x-sharedlib*)
+ # Libraries (.so)
+ strip --strip-unneeded "$bin"
+ ;;
+ *application/x-archive*)
+ # Libraries (.a)
+ strip --strip-debug "$bin"
+ ;;
+ *application/x-executable*)
+ # Binaries
+ strip --strip-all "$bin"
+ ;;
+ esac
+ done
+}
+
+help() {
+ cat <<HELPEOF
+This hook will locate and strip binaries on your image before archival and
+compression. This hook should be last, as any binaries added to the image after
+this hook runs will not be stripped. This is mostly useful for users who run
+local debug builds but whom do not want or need the extra weight of debug
+symbols on their image.
+HELPEOF
+}
+
+# vim: set ft=sh ts=4 sw=4 et: