From 00d2b1f90261bf77eaaf262d2504af016562f2ac Mon Sep 17 00:00:00 2001 From: Morten Linderud Date: Sun, 17 Dec 2023 16:03:36 +0100 Subject: [PATCH] strip: don't create debug packages from .a files .a files are not valid ELF files so we can't run objcopy nor debugedit on them. Rename STRIPLTO to STATICLIB to be more descriptive. Signed-off-by: Morten Linderud --- scripts/libmakepkg/tidy/strip.sh.in | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/libmakepkg/tidy/strip.sh.in b/scripts/libmakepkg/tidy/strip.sh.in index 6c435058..e0a30353 100644 --- a/scripts/libmakepkg/tidy/strip.sh.in +++ b/scripts/libmakepkg/tidy/strip.sh.in @@ -156,7 +156,7 @@ tidy_strip() { local binary strip_flags find . -type f -perm -u+w -print0 2>/dev/null | LC_ALL=C sort -z | while IFS= read -rd '' binary ; do - local STRIPLTO=0 + local STATICLIB=0 case "$(LC_ALL=C readelf -h "$binary" 2>/dev/null)" in *Type:*'DYN (Shared object file)'*) # Libraries (.so) or Relocatable binaries strip_flags="$STRIP_SHARED";; @@ -167,7 +167,7 @@ tidy_strip() { *Type:*'REL (Relocatable file)'*) # Libraries (.a) or objects if ar t "$binary" &>/dev/null; then # Libraries (.a) strip_flags="$STRIP_STATIC" - STRIPLTO=1 + STATICLIB=1 elif [[ $binary = *'.ko' || $binary = *'.o' ]]; then # Kernel module or object file strip_flags="$STRIP_SHARED" else @@ -177,9 +177,9 @@ tidy_strip() { *) continue ;; esac - collect_debug_symbols "$binary" + (( ! STATICLIB )) && collect_debug_symbols "$binary" strip_file "$binary" ${strip_flags} - (( STRIPLTO )) && strip_lto "$binary" + (( STATICLIB )) && strip_lto "$binary" done elif check_option "debug" "y"; then