Commit 56e0763c authored by Ethan Sommer's avatar Ethan Sommer Committed by Allan McRae
Browse files

libmakepkg: use readelf instead of file for finding ELF file types


Signed-off-by: default avatarEthan Sommer <e5ten.arch@gmail.com>
Signed-off-by: Allan McRae's avatarAllan McRae <allan@archlinux.org>
parent b7f61aa5
......@@ -111,22 +111,20 @@ tidy_strip() {
local binary strip_flags
find . -type f -perm -u+w -print0 2>/dev/null | while IFS= read -rd '' binary ; do
case "$(file -bi "$binary")" in
*application/x-sharedlib*) # Libraries (.so)
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";;
*application/x-archive*) # Libraries (.a)
strip_flags="$STRIP_STATIC";;
*application/x-object*)
case "$binary" in
*.ko) # Kernel module
strip_flags="$STRIP_SHARED";;
*)
continue;;
esac;;
*application/x-executable*) # Binaries
*Type:*'EXEC (Executable file)'*) # Binaries
strip_flags="$STRIP_BINARIES";;
*application/x-pie-executable*) # Relocatable binaries
strip_flags="$STRIP_SHARED";;
*Type:*'REL (Relocatable file)'*) # Libraries (.a) or objects
if ar t "$binary" &>/dev/null; then # Libraries (.a)
strip_flags="$STRIP_STATIC"
elif [[ $binary = *'.ko' ]]; then # Kernel module
strip_flags="$STRIP_SHARED"
else
continue
fi
;;
*)
continue ;;
esac
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment