pkgconfig.req: factored common code
This commit is contained in:
parent
318e056f29
commit
3fa83b4f4f
@ -26,26 +26,11 @@ PKG_CONFIG_PATH=$RPM_LIBDIR/pkgconfig:/usr/share/pkgconfig
|
||||
PKG_CONFIG_PATH=$RPM_BUILD_ROOT$RPM_LIBDIR/pkgconfig:$RPM_BUILD_ROOT/usr/share/pkgconfig:$PKG_CONFIG_PATH
|
||||
export PKG_CONFIG_PATH
|
||||
|
||||
PkgconfigReq()
|
||||
reqprov=
|
||||
PkgconfigReqProv()
|
||||
{
|
||||
local f="$1" out=; shift
|
||||
out=$(pkg-config --print-errors --print-requires "$f") ||
|
||||
Fatal "failed to process $f"
|
||||
[ -n "$out" ] || return 0
|
||||
echo "$out" |while read -r line; do
|
||||
set -- $line
|
||||
case $# in
|
||||
1) echo "pkgconfig($1)" ;;
|
||||
3) echo "pkgconfig($1) $2 $3" ;;
|
||||
*) Fatal "$f: invalid pkg-config output: $line"
|
||||
esac
|
||||
done
|
||||
}
|
||||
|
||||
PkgconfigProv()
|
||||
{
|
||||
local f="$1" out=; shift
|
||||
out=$(pkg-config --print-errors --print-provides "$f") ||
|
||||
out=$(pkg-config --print-errors --print-"${reqprov:?}" "$f") ||
|
||||
Fatal "failed to process $f"
|
||||
[ -n "$out" ] || return 0
|
||||
echo "$out" |while read -r line; do
|
||||
@ -59,7 +44,7 @@ PkgconfigProv()
|
||||
}
|
||||
|
||||
case "${0##*/}" in
|
||||
pkgconfig.req*) ArgvFileAction PkgconfigReq "$@" ;;
|
||||
pkgconfig.prov*) ArgvFileAction PkgconfigProv "$@" ;;
|
||||
pkgconfig.req*) reqprov=requires ArgvFileAction PkgconfigReqProv "$@" ;;
|
||||
pkgconfig.prov*) reqprov=provides ArgvFileAction PkgconfigReqProv "$@" ;;
|
||||
*) Fatal "req/prov method not recognized" ;;
|
||||
esac
|
||||
|
Loading…
x
Reference in New Issue
Block a user