summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Stubbs <jstubbs@gentoo.org>2005-08-28 08:37:44 +0000
committerJason Stubbs <jstubbs@gentoo.org>2005-08-28 08:37:44 +0000
commitd9fc4acc572c6647a4f27b838d35d27d805d190e (patch)
tree262a8de35d8c7567312757da5f1f66efdc8cece5 /bin/prepstrip
downloadportage-multirepo-d9fc4acc572c6647a4f27b838d35d27d805d190e.tar.gz
portage-multirepo-d9fc4acc572c6647a4f27b838d35d27d805d190e.tar.bz2
portage-multirepo-d9fc4acc572c6647a4f27b838d35d27d805d190e.zip
Migration (without history) of the current stable line to subversion.
svn path=/main/branches/2.0/; revision=1941
Diffstat (limited to 'bin/prepstrip')
-rwxr-xr-xbin/prepstrip48
1 files changed, 48 insertions, 0 deletions
diff --git a/bin/prepstrip b/bin/prepstrip
new file mode 100755
index 00000000..f5a51a37
--- /dev/null
+++ b/bin/prepstrip
@@ -0,0 +1,48 @@
+#!/bin/bash
+# Copyright 1999-2005 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-src/portage/bin/prepstrip,v 1.23.2.3 2005/08/15 02:58:20 vapier Exp $
+
+if [ "${FEATURES//*nostrip*/true}" == "true" ] || [ "${RESTRICT//*nostrip*/true}" == "true" ] ; then
+ echo "nostrip"
+ STRIP="/bin/false"
+ PORTAGE_STRIP_FLAGS=""
+else
+ STRIP="${STRIP:-${CHOST}-strip}"
+ type -p ${STRIP} > /dev/null || STRIP=strip
+ PORTAGE_STRIP_FLAGS=${PORTAGE_STRIP_FLAGS:---strip-unneeded}
+fi
+
+banner=1
+retval=0
+
+for x in "$@" ; do
+ if [ -d "${x}" ]; then
+ # We only want files. So make a pass for each directory and call again.
+ find "${x}" -type f \( -perm -0100 -or -perm -0010 -or -perm -0001 -or -name '*.so' -or -name '*.so.*' \) -print0 |
+ $XARGS -0 -n500 prepstrip
+ else
+ if [ ${banner} -eq 1 ] ; then
+ echo "strip: ${STRIP} ${PORTAGE_STRIP_FLAGS}"
+ banner=0
+ fi
+
+ f=$(file "${x}") || continue
+ [ -z "${f}" ] && continue
+
+ if [ -z "${f/*current ar archive*/}" ]; then
+ echo " ${x:${#D}:${#x}}"
+ ${STRIP} -g "${x}"
+ fi
+ if [ -z "${f/*SB executable*/}" ]; then
+ echo " ${x:${#D}:${#x}}"
+ ${STRIP} "${x}"
+ fi
+ if [ -z "${f/*SB shared object*/}" ]; then
+ echo " ${x:${#D}:${#x}}"
+ ${STRIP} ${PORTAGE_STRIP_FLAGS} "${x}"
+ fi
+ fi
+done
+
+exit ${retval}