libmakepkg: use readelf instead of file for finding ELF file types
Signed-off-by: Ethan Sommer <e5ten.arch@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
This commit is contained in:
parent
b7f61aa557
commit
56e0763c6d
1 changed files with 12 additions and 14 deletions
|
@ -111,22 +111,20 @@ tidy_strip() {
|
||||||
|
|
||||||
local binary strip_flags
|
local binary strip_flags
|
||||||
find . -type f -perm -u+w -print0 2>/dev/null | while IFS= read -rd '' binary ; do
|
find . -type f -perm -u+w -print0 2>/dev/null | while IFS= read -rd '' binary ; do
|
||||||
case "$(file -bi "$binary")" in
|
case "$(LC_ALL=C readelf -h "$binary" 2>/dev/null)" in
|
||||||
*application/x-sharedlib*) # Libraries (.so)
|
*Type:*'DYN (Shared object file)'*) # Libraries (.so) or Relocatable binaries
|
||||||
strip_flags="$STRIP_SHARED";;
|
strip_flags="$STRIP_SHARED";;
|
||||||
*application/x-archive*) # Libraries (.a)
|
*Type:*'EXEC (Executable file)'*) # Binaries
|
||||||
strip_flags="$STRIP_STATIC";;
|
|
||||||
*application/x-object*)
|
|
||||||
case "$binary" in
|
|
||||||
*.ko) # Kernel module
|
|
||||||
strip_flags="$STRIP_SHARED";;
|
|
||||||
*)
|
|
||||||
continue;;
|
|
||||||
esac;;
|
|
||||||
*application/x-executable*) # Binaries
|
|
||||||
strip_flags="$STRIP_BINARIES";;
|
strip_flags="$STRIP_BINARIES";;
|
||||||
*application/x-pie-executable*) # Relocatable binaries
|
*Type:*'REL (Relocatable file)'*) # Libraries (.a) or objects
|
||||||
strip_flags="$STRIP_SHARED";;
|
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 ;;
|
continue ;;
|
||||||
esac
|
esac
|
||||||
|
|
Loading…
Add table
Reference in a new issue