From 6c4b0fc9e44ea3b9449e171404c1b2037d15d01e Mon Sep 17 00:00:00 2001 From: Panu Matilainen Date: Tue, 31 Jul 2007 12:06:34 +0300 Subject: Extract pkgconfig and libtool dependencies automatically. Ported from rpm5.org work of Jeff Johnson. --- scripts/Makefile.am | 3 ++- scripts/libtooldeps.sh | 42 ++++++++++++++++++++++++++++++++++++++++++ scripts/pkgconfigdeps.sh | 42 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 86 insertions(+), 1 deletion(-) create mode 100644 scripts/libtooldeps.sh create mode 100755 scripts/pkgconfigdeps.sh (limited to 'scripts') 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 -- cgit v1.2.3