summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorPanu Matilainen <pmatilai@redhat.com>2007-07-31 12:06:34 +0300
committerPanu Matilainen <pmatilai@redhat.com>2007-07-31 12:06:34 +0300
commit6c4b0fc9e44ea3b9449e171404c1b2037d15d01e (patch)
treeaeeb8b3a1c85e428588107a48dc3ef23ed0a370d /scripts
parent345d1189aef724e893f8beb4f57db5111ddd6166 (diff)
downloadlibrpm-tizen-6c4b0fc9e44ea3b9449e171404c1b2037d15d01e.tar.gz
librpm-tizen-6c4b0fc9e44ea3b9449e171404c1b2037d15d01e.tar.bz2
librpm-tizen-6c4b0fc9e44ea3b9449e171404c1b2037d15d01e.zip
Extract pkgconfig and libtool dependencies automatically.
Ported from rpm5.org work of Jeff Johnson.
Diffstat (limited to 'scripts')
-rw-r--r--scripts/Makefile.am3
-rw-r--r--scripts/libtooldeps.sh42
-rwxr-xr-xscripts/pkgconfigdeps.sh42
3 files changed, 86 insertions, 1 deletions
diff --git a/scripts/Makefile.am b/scripts/Makefile.am
index db23b146f..21bc9691e 100644
--- a/scripts/Makefile.am
+++ b/scripts/Makefile.am
@@ -23,7 +23,8 @@ EXTRA_DIST = \
macros.perl.in macros.python.in \
macros.php.in find-requires.php find-provides.php \
find-php-provides find-php-requires \
- mono-find-requires mono-find-provides
+ mono-find-requires mono-find-provides \
+ pkgconfigdeps.sh libtooldeps.sh
installprefix = $(DESTDIR)
diff --git a/scripts/libtooldeps.sh b/scripts/libtooldeps.sh
new file mode 100644
index 000000000..d8937c829
--- /dev/null
+++ b/scripts/libtooldeps.sh
@@ -0,0 +1,42 @@
+#!/bin/sh
+
+[ $# -ge 2 ] || {
+ cat > /dev/null
+ exit 0
+}
+
+case $1 in
+-P|--provides)
+ shift
+ RPM_BUILD_ROOT="$1"
+ while read possible
+ do
+ case "$possible" in
+ *.la)
+ if grep -iq '^# Generated by ltmain.sh' "$possible" 2> /dev/null ; then
+ possible="`echo ${possible} | sed -e s,${RPM_BUILD_ROOT}/,/,`"
+ echo "libtool($possible)"
+ fi
+ ;;
+ esac
+ done
+ ;;
+-R|--requires)
+ while read possible ; do
+ case "$possible" in
+ *.la)
+ for dep in `grep '^dependency_libs='"$possible" 2> /dev/null | \
+ sed -e "s,^dependency_libs='\(.*\)',\1,g"`
+ do
+ case "$dep" in
+ /*.la)
+ echo "libtool($dep)"
+ ;;
+ esac
+ done
+ ;;
+ esac
+ done
+ ;;
+esac
+exit 0
diff --git a/scripts/pkgconfigdeps.sh b/scripts/pkgconfigdeps.sh
new file mode 100755
index 000000000..7a8123437
--- /dev/null
+++ b/scripts/pkgconfigdeps.sh
@@ -0,0 +1,42 @@
+#!/bin/bash
+
+pkgconfig=/usr/bin/pkg-config
+test -x $pkgconfig || {
+ cat > /dev/null
+ exit 0
+}
+
+[ $# -ge 1 ] || {
+ cat > /dev/null
+ exit 0
+}
+
+case $1 in
+-P|--provides)
+ while read filename ; do
+ case "${filename}" in
+ *.pc)
+ # Query the dependencies of the package.
+ $pkgconfig --print-provides "$filename" 2> /dev/null | while read n r v ; do
+ # We have a dependency. Make a note that we need the pkgconfig
+ # tool for this package.
+ echo "pkgconfig($n)" "$r" "$v"
+ done
+ ;;
+ esac
+ done
+ ;;
+-R|--requires)
+ while read filename ; do
+ case "${filename}" in
+ *.pc)
+ $pkgconfig --print-requires "$filename" 2> /dev/null | while read n r v ; do
+ i="`expr $i + 1`"
+ [ $i -eq 1 ] && echo "pkgconfig"
+ echo "pkgconfig($n)" "$r" "$v"
+ done
+ esac
+ done
+ ;;
+esac
+exit 0