[pacman-dev] [PATCH 3/7] makepkg: move debug symbol stripping to separate function

Allan McRae allan at archlinux.org
Sun Sep 23 10:44:31 EDT 2012


Move stripping of files to a spearate function that will be expanded
for the handling of creating debug symbol packages.

Signed-off-by: Allan McRae <allan at archlinux.org>
---
 scripts/makepkg.sh.in | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
index 7b516ff..5283d73 100644
--- a/scripts/makepkg.sh.in
+++ b/scripts/makepkg.sh.in
@@ -1421,6 +1421,11 @@ run_package() {
 	run_function_safe "$pkgfunc"
 }
 
+strip_file() {
+	local binary=$1; shift
+	strip $@ $binary
+}
+
 tidy_install() {
 	cd_safe "$pkgdir"
 	msg "$(gettext "Tidying install...")"
@@ -1475,16 +1480,19 @@ tidy_install() {
 		# make sure library stripping variables are defined to prevent excess stripping
 		[[ -z ${STRIP_SHARED+x} ]] && STRIP_SHARED="-S"
 		[[ -z ${STRIP_STATIC+x} ]] && STRIP_STATIC="-S"
-		local binary
+		local binary strip_flags
 		find . -type f -perm -u+w -print0 2>/dev/null | while read -d '' binary ; do
 			case "$(file -bi "$binary")" in
 				*application/x-sharedlib*)  # Libraries (.so)
-					strip $STRIP_SHARED "$binary";;
+					strip_flags=($STRIP_SHARED);;
 				*application/x-archive*)    # Libraries (.a)
-					strip $STRIP_STATIC "$binary";;
+					strip_flags=($STRIP_STATIC);;
 				*application/x-executable*) # Binaries
-					strip $STRIP_BINARIES "$binary";;
+					strip_flags=($STRIP_BINARIES);;
+				*)
+					continue ;;
 			esac
+			strip_file $binary ${strip_flags[@]}
 		done
 	fi
 
-- 
1.7.12.1



More information about the pacman-dev mailing list