[pacman-dev] [PATCH 3/3] makepkg: add sodepends support
Florian Pritz
bluewind at xssn.at
Fri Oct 1 11:30:06 EDT 2010
Support-by: brain0 <thomas at archlinux.org>
Support-by: GNU\caustic <Christoph.Schied at uni-ulm.de>
Signed-off-by: Florian Pritz <bluewind at xssn.at>
---
scripts/makepkg.sh.in | 35 ++++++++++++++++++++++++++++++++++-
1 files changed, 34 insertions(+), 1 deletions(-)
diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
index f43d87d..891d80e 100644
--- a/scripts/makepkg.sh.in
+++ b/scripts/makepkg.sh.in
@@ -903,6 +903,27 @@ tidy_install() {
fi
}
+find_sodepends() {
+ local sodepends
+ find $pkgdir -type f | while read filename
+ do
+ soarch="$(objdump -a "$filename" 2>/dev/null | \
+ sed -rn 's/.* file format elf[0-9]+-(.*)$/\1/p' | tr - _)_$(uname -s)"
+ [ -n "$soarch" ] || continue
+ for sofile in $(readelf -d "$filename" 2> /dev/null | sed -nr 's/.*Shared library: \[(.*)\].*/\1/p')
+ do
+ soname=$(sed -rn 's/(.*)\.so.*/\1.so/p' <<< "$sofile")
+ soversion=$(sed -rn 's/.*\.so\.(.*)/\1/p' <<< "$sofile")
+ if in_array "${soname}" ${depends[@]}; then
+ if ! in_array "${soname}=${soversion}-${soarch}" ${sodepends[@]}; then
+ echo "${soname}=${soversion}-${soarch}"
+ sodepends=(${sodepends[@]} "${soname}=${soversion}-${soarch}")
+ fi
+ fi
+ done
+ done
+}
+
find_soprovides() {
local soprovides
find $pkgdir -type f -name \*.so\* | while read filename
@@ -957,7 +978,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[@]}"
@@ -965,7 +985,20 @@ write_pkginfo() {
local it
soprovides=$(find_soprovides)
+ sodepends=$(find_sodepends)
provides=("${provides[@]}" ${soprovides})
+ depends=("${depends[@]}" ${sodepends})
+
+ for it in "${depends[@]}"; do
+ if grep -q ".*\.so$" <<< "$it"; then
+ if ! grep -q "\(^\|\s\)${it}=.*" <<< $sodepends; 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
if grep -q ".*\.so$" <<< "$it"; then
--
1.7.3.1
More information about the pacman-dev
mailing list