Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 29b32b8910
Fetching contributors…

Cannot retrieve contributors at this time

executable file 29 lines (22 sloc) 0.674 kb
#!/bin/bash
#
# resolve ELF library deps to pacman packages
#
declare -r lddregex=$'(.+) => (.+) \(0x[a-fA-F0-9]+\)'
resolve_bin() {
declare -A depmap
declare -a linkage
local lddout=$(ldd "$1" 2>/dev/null) || return
# leverage the linker to do lib resolution
while read -r line; do
[[ $line =~ $lddregex ]] || continue
depmap["${BASH_REMATCH[1]}"]=${BASH_REMATCH[2]}
done <<< "$lddout"
pacman -Ql | grep -Ff \
<(objdump -p "$1" | while read section soname; do
[[ $section == NEEDED && ${depmap[$soname]} ]] && printf '%s\n' "${depmap[$soname]}"
done) | cut '-d ' -f1 | sort -u
}
for bin; do
resolve_bin "$bin"
done | sort -u
Jump to Line
Something went wrong with that request. Please try again.