aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Stephen P. Bennett <spb@exherbo.org> 2006-03-28 05:47:44 +0000
committerAvatar Stephen P. Bennett <spb@exherbo.org> 2006-03-28 05:47:44 +0000
commit08d4ad1d60e8082c1a71864218bb1fbe75bfeb45 (patch)
tree876802a1c0d833478ba5a3fe17f267e795b216df
parent6354722b8d87a2c63ae40be0f9eb2b3ac6d8f0c8 (diff)
downloadpaludis-08d4ad1d60e8082c1a71864218bb1fbe75bfeb45.tar.gz
paludis-08d4ad1d60e8082c1a71864218bb1fbe75bfeb45.tar.xz
Initial stripping support. Could use a more elegant solution, perhaps, but ought to work.
-rw-r--r--ebuild/builtin_strip.bash20
1 files changed, 19 insertions, 1 deletions
diff --git a/ebuild/builtin_strip.bash b/ebuild/builtin_strip.bash
index 92e84c4..d445ba1 100644
--- a/ebuild/builtin_strip.bash
+++ b/ebuild/builtin_strip.bash
@@ -2,6 +2,7 @@
# vim: set sw=4 sts=4 et :
# Copyright (c) 2006 Ciaran McCreesh <ciaranm@gentoo.org>
+# Copyright (c) 2006 Stephen Bennett <spb@gentoo.org>
#
# This file is part of the Paludis package manager. Paludis is free software;
# you can redistribute it and/or modify it under the terms of the GNU General
@@ -19,7 +20,24 @@
builtin_strip()
{
- :
+ STRIP=${STRIP:-${CHOST}-strip}
+ if ! type -p -- ${STRIP} >/dev/null; then
+ STRIP=strip
+ fi
+ PALUDIS_STRIP_FLAGS=${PALUDIS_STRIP_FLAGS:---strip-unneeded}
+
+ for fn in $(find "${D}" -type f \( -perm -0100 -or -perm -0010 -or -perm -0001 -or -name '*.so' -or -name '*.so.*' \)); do
+ local ft=$(file "${fn}")
+ if [[ $? != 0 || -z ${ft} ]]; then
+ return 1
+ fi
+
+ if [[ ${ft} == *"current ar archive"* ]]; then
+ ${STRIP} -g "${fn}"
+ elif [[ ${ft} == *"SB executable"* || ${ft} == *"SB shared object"* ]]; then
+ ${STRIP} ${PALUDIS_STRIP_FLAGS} "${fn}"
+ fi
+ done
}
ebuild_f_strip()