[pacman-dev] [PATCH] add support for .so dependencies

bluewind at server-speed.net bluewind at server-speed.net
Sat Aug 15 07:03:58 EDT 2009


From: Florian Pritz <bluewind at xssn.at>

Support-by: brain0 <thomas at archlinux.org>
Support-by: GNU\caustic <Christoph.Schied at uni-ulm.de>
---
 etc/makepkg.conf.in   |    3 ++-
 scripts/makepkg.sh.in |   43 +++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 45 insertions(+), 1 deletions(-)

diff --git a/etc/makepkg.conf.in b/etc/makepkg.conf.in
index 3a3a415..c3caf3c 100644
--- a/etc/makepkg.conf.in
+++ b/etc/makepkg.conf.in
@@ -67,8 +67,9 @@ BUILDENV=(fakeroot !distcc color !ccache)
 #-- emptydirs: Leave empty directories in packages
 #-- zipman:    Compress manual (man and info) pages in MAN_DIRS with gzip
 #-- purge:     Remove files specified by PURGE_TARGETS
+#-- sodepends: add .so files to depends/provides arrays
 #
-OPTIONS=(strip docs libtool emptydirs zipman purge)
+OPTIONS=(strip docs libtool emptydirs zipman purge !sodepends)
 
 #-- File integrity checks to use. Valid: md5, sha1, sha256, sha384, sha512
 INTEGRITY_CHECK=(md5)
diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
index daa9585..405f3cb 100644
--- a/scripts/makepkg.sh.in
+++ b/scripts/makepkg.sh.in
@@ -872,6 +872,33 @@ tidy_install() {
 	fi
 }
 
+find_sodependencies()
+{
+	find $pkgdir | while read filename
+	do
+		arch=$(readelf -h "$filename" 2> /dev/null| sed -nr 's/.*Class:.*ELF(.*).*/\1/p')
+		[ -n "$arch" ] || continue
+
+		readelf -d "$filename" 2> /dev/null | sed -nr 's/.*Shared library: \[(.*)\].*/\1/p' \
+		| while read dep
+		do
+			echo sodep-${arch}-${dep}
+		done
+	done
+}
+
+find_soprovides()
+{
+	find $pkgdir -name \*.so | while read filename
+	do
+		arch=$(readelf -h "$filename" 2> /dev/null| sed -nr 's/.*Class:.*ELF(.*).*/\1/p')
+		[ -n "$arch" ] || continue
+		soname=$(readelf -d "$filename" 2>/dev/null | sed -nr 's/.*Library soname: \[(.*)\].*/\1/p')
+		[ -n "$soname" ] || continue
+		echo sodep-${arch}-${soname}
+	done
+}
+
 write_pkginfo() {
 	local builddate=$(date -u "+%s")
 	if [ -n "$PACKAGER" ]; then
@@ -902,6 +929,22 @@ write_pkginfo() {
 		echo "force = true" >> .PKGINFO
 	fi
 
+	if [ "$(check_option sodepends)" = "y" ]; then
+		sodepends=$(find_sodependencies)
+		soprovides=$(find_soprovides)
+		
+		OLDIFS="$IFS"
+		IFS=""
+
+		# filter .so files provided by the package itself
+		sodepends=$(echo $sodepends $soprovides $soprovides | sort | uniq -u)
+		
+		IFS="$OLDIFS"
+
+		depends=($depends $sodepends)
+		provices=($provides $soprovides)
+	fi
+
 	local it
 	for it in "${license[@]}"; do
 		echo "license = $it" >>.PKGINFO
-- 
1.6.4



More information about the pacman-dev mailing list