From a25725530acf26a1f72fa0cd15cfe7ddc6ec8baa Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Mon, 28 Jun 2021 09:38:03 +0000 Subject: [PATCH] pkg_fix_deps: simplify path resolution --- kiss | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/kiss b/kiss index 41a8ba0..de593ec 100755 --- a/kiss +++ b/kiss @@ -460,13 +460,15 @@ pkg_fix_deps() { find "$pkg_dir/${PWD##*/}/" -type f 2>/dev/null | while read -r file; do + ldd_buf=$(ldd -- "$file" 2>/dev/null) ||: + case $elf_cmd in *readelf) "$elf_cmd" -d "$file" ;; *) - ldd -- "$file" + printf '%s\n' "$ldd_buf" ;; esac 2>/dev/null | @@ -474,11 +476,15 @@ pkg_fix_deps() { case $line in *NEEDED*\[*\] | *'=>'*) # readelf: 0x0000 (NEEDED) Shared library: [libjson-c.so.5] - line=${line##*[} - line=${line%%]*} + line=${line##*\[} + line=${line%%\]*} - # ldd: libjson-c.so.5 => /lib/libjson-c.so.5 ... - line=${line##*=> } + # Resolve library path. + # ldd: libjson-c.so.5 => /lib/libjson-c.so.5 ... + case $elf_cmd in + *readelf) line=${ldd_buf#*" $line => "} ;; + *) line=${line##*=> } ;; + esac line=${line%% *} # Skip files owned by libc and POSIX.