index : pacman | |
Archlinux32 fork of pacman | gitolite user |
summaryrefslogtreecommitdiff |
author | Florian Pritz <bluewind@xssn.at> | 2010-02-10 17:11:37 +0100 |
---|---|---|
committer | Florian Pritz <bluewind@server-speed.net> | 2011-06-01 21:34:16 +0200 |
commit | 73d5eb1edf03e628ca1d3a09168e4e940adea914 (patch) | |
tree | 0b85bc1844565318614f9bd310e85701d5535fd5 /scripts | |
parent | 79f1a3c4a17223af2bfe35802c50e1ae431d25b5 (diff) |
-rw-r--r-- | scripts/makepkg.sh.in | 41 |
diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index 6855aa6f..34be1e69 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -932,6 +932,31 @@ tidy_install() { fi } +find_libdepends() { + local libdepends + find "$pkgdir" -type f -perm -u+x | while read filename + do + # get architecture of the file; if soarch is empty it's not an ELF binary + soarch=$(LC_ALL=C readelf -h "$filename" 2>/dev/null | sed -n 's/.*Class.*ELF\(32\|64\)/\1/p') + [ -n "$soarch" ] || continue + # process all libraries needed by the binary + for sofile in $(LC_ALL=C readelf -d "$filename" 2>/dev/null | sed -nr 's/.*Shared library: \[(.*)\].*/\1/p') + do + # extract the library name: libfoo.so + soname="${sofile%%\.so\.*}.so" + # extract the major version: 1 + soversion="${sofile##*\.so\.}" + if in_array "${soname}" ${depends[@]}; then + if ! in_array "${soname}=${soversion}-${soarch}" ${libdepends[@]}; then + # libfoo.so=1-64 + echo "${soname}=${soversion}-${soarch}" + libdepends=(${libdepends[@]} "${soname}=${soversion}-${soarch}") + fi + fi + done + done +} + find_libprovides() { local libprovides find "$pkgdir" -type f -name \*.so\* | while read filename @@ -988,7 +1013,6 @@ write_pkginfo() { [[ $license ]] && printf "license = %s\n" "${license[@]}" [[ $replaces ]] && printf "replaces = %s\n" "${replaces[@]}" [[ $groups ]] && printf "group = %s\n" "${groups[@]}" - [[ $depends ]] && printf "depend = %s\n" "${depends[@]}" [[ $optdepends ]] && printf "optdepend = %s\n" "${optdepends[@]}" [[ $conflicts ]] && printf "conflict = %s\n" "${conflicts[@]}" [[ $backup ]] && printf "backup = %s\n" "${backup[@]}" @@ -996,7 +1020,22 @@ write_pkginfo() { local it libprovides=$(find_libprovides) + libdepends=$(find_libdepends) provides=("${provides[@]}" ${libprovides}) + depends=("${depends[@]}" ${libdepends}) + + for it in "${depends[@]}"; do + if [[ $it = *.so ]]; then + # check if the entry has been found by find_libdepends + # if not, it's unneeded; tell the user so he can remove it + if [[ ! $libdepends =~ (^|\s)${it}=.* ]]; then + error "$(gettext "Can't find library listed in \$depends: %s")" "$it" + return 1 + fi + else + echo "depend = $it" + fi + done for it in "${provides[@]}"; do # ignore versionless entires (those come from the PKGBUILD) |