Add support for parsing pkg-config files in /usr/share/pkgconfig

This commit is contained in:
Leo 2019-07-29 15:03:03 -03:00 committed by Natanael Copa
parent aa86438443
commit 6e5bd59d6f

View File

@ -1110,12 +1110,13 @@ prepare_pkgconfig_provides() {
local dir="${subpkgdir:-$pkgdir}" local dir="${subpkgdir:-$pkgdir}"
options_has "!tracedeps" && return 0 options_has "!tracedeps" && return 0
cd "$dir" || return 1 cd "$dir" || return 1
for i in usr/lib/pkgconfig/*.pc; do for i in usr/lib/pkgconfig/*.pc usr/share/pkgconfig/*.pc; do
if ! [ -e "$i" ]; then if ! [ -e "$i" ]; then
continue continue
fi fi
local f=${i##*/} local f=${i##*/}
local v=$(PKG_CONFIG_PATH="$dir"/usr/lib/pkgconfig PKG_CONFIG_MAXIMUM_TRAVERSE_DEPTH=1 pkg-config \ local v=$(PKG_CONFIG_PATH="$dir"/usr/lib/pkgconfig:"$dir"/usr/share/pkgconfig \
PKG_CONFIG_MAXIMUM_TRAVERSE_DEPTH=1 pkg-config \
--modversion ${f%.pc} | sed -E -e 's/-(alpha|beta|rc|pre)/_\1/') --modversion ${f%.pc} | sed -E -e 's/-(alpha|beta|rc|pre)/_\1/')
$APK version --check --quiet $v || die "$i: pkgconf version $v is invalid" $APK version --check --quiet $v || die "$i: pkgconf version $v is invalid"
echo "$pcprefix${f%.pc}=${v:-0}" >> "$controldir"/.provides-pc echo "$pcprefix${f%.pc}=${v:-0}" >> "$controldir"/.provides-pc
@ -1255,7 +1256,7 @@ trace_apk_deps() {
msg "Tracing dependencies..." msg "Tracing dependencies..."
# add pkgconfig if usr/lib/pkgconfig is found # add pkgconfig if usr/lib/pkgconfig is found
if [ -d "$pkgbasedir"/$name/usr/lib/pkgconfig ] \ if [ -d "$pkgbasedir"/$name/usr/lib/pkgconfig ] || [ -d "$pkgbasedir"/$name/usr/share/pkgconfig ] \
&& ! grep -q '^depend = pkgconfig' "$dir"/.PKGINFO; then && ! grep -q '^depend = pkgconfig' "$dir"/.PKGINFO; then
autodeps="$autodeps pkgconfig" autodeps="$autodeps pkgconfig"
fi fi
@ -1318,11 +1319,13 @@ trace_apk_deps() {
autodeps="$autodeps pc:$i" autodeps="$autodeps pc:$i"
else else
warning "Could not find any provider for pc:$i" warning "Could not find any provider for pc:$i"
local pcfile=/usr/lib/pkgconfig/"${i%%[<>=]*}".pc for d in share lib; do
if [ -e "$pcfile" ]; then local pcfile=/usr/$d/pkgconfig/"${i%%[<>=]*}".pc
local owner=$($APK $apkroot info --quiet --who-owns $pcfile) if [ -e "$pcfile" ]; then
warning "${owner:-package providing $pcfile} needs to be rebuilt" local owner=$($APK $apkroot info --quiet --who-owns $pcfile)
fi warning "${owner:-package providing $pcfile} needs to be rebuilt"
fi
done
fi fi
done done
@ -1496,7 +1499,8 @@ scan_pkgconfig_depends() {
name="$(pkginfo_val pkgname "$controldir"/.PKGINFO)" name="$(pkginfo_val pkgname "$controldir"/.PKGINFO)"
datadir="$pkgbasedir"/$name datadir="$pkgbasedir"/$name
for i in $(sort -u "$provides_pc"); do for i in $(sort -u "$provides_pc"); do
PKG_CONFIG_PATH="$datadir"/usr/lib/pkgconfig pkg-config \ PKG_CONFIG_PATH="$datadir"/usr/lib/pkgconfig:"$datadir"/usr/share/pkgconfig \
pkg-config \
--print-requires \ --print-requires \
--print-requires-private ${i%=*} \ --print-requires-private ${i%=*} \
| sed -E 's/\s*([<>=]+)\s*/\1/' \ | sed -E 's/\s*([<>=]+)\s*/\1/' \