diff options
authorNatanael Copa <>2019-02-22 13:57:08 +0000
committerNatanael Copa <>2019-02-22 13:57:08 +0000
commit376ccc5bd695e792768a679409fbb428defe0770 (patch)
parent22753f570160c10ad093615f085a925d4643c359 (diff)
abuild: add support for pkg-config prefix pcprefix
Fix issue when two -dev packages provides same pkg-config wil but with different versions. For example libressl-dev and openssl-dev both ships libssl.pc and libcrypto.pc, which resulted in automatic provides of pc:libssl and pc:libcrypto. apk would end up picking libressl-dev over openssl-dev for packages that had automatic pc:libssl depends (for example libssl2-dev), when openssl-dev was the one that was used during build. To fix this we add support for a pcprefix so we can set pcprefix="libressl:" in libressl APKBUILD which makes libressl-dev provide pc:libressl:libssl. This is similar to what we do with sonameprefix. We do not yet automatically detect when the prefixed variant should be used so for now we will have to explicitly add libressl-dev. ref #9959
1 files changed, 12 insertions, 2 deletions
diff --git a/ b/
index cd3383b..d03e35f 100644
--- a/
+++ b/
@@ -1067,7 +1067,7 @@ prepare_pkgconfig_provides() {
local f=${i##*/}
local v=$(PKG_CONFIG_PATH="$dir"/usr/lib/pkgconfig PKG_CONFIG_MAXIMUM_TRAVERSE_DEPTH=1 pkg-config \
--modversion ${f%.pc})
- echo "${f%.pc}=${v:-0}" >> "$controldir"/.provides-pc
+ echo "$pcprefix${f%.pc}=${v:-0}" >> "$controldir"/.provides-pc
@@ -1175,6 +1175,11 @@ subpkg_provides_so() {
grep -q -w "^$1" "$pkgbasedir"/.control.*/.provides-so 2>/dev/null
+subpkg_provides_prefixed_pc() {
+ [ -n "$pcprefix" ] && grep -q -w "^$pcprefix$1" \
+ "$pkgbasedir"/.control.*/.provides-pc 2>/dev/null
subpkg_provides_pc() {
grep -q -w "^${1%%[<>=]*}" "$pkgbasedir"/.control.*/.provides-pc \
@@ -1243,7 +1248,12 @@ trace_apk_deps() {
# pkg-config depends
for i in $(sort -u "$dir"/.needs-pc 2>/dev/null); do
- if subpkg_provides_pc "$i" \
+ # first check if its provided by same apkbuild
+ grep -q -w "^$pcprefix$i" "$dir"/.provides-pc 2>/dev/null && continue
+ if subpkg_provides_prefixed_pc "$i"; then
+ autodeps="$autodeps pc:$pcprefix$i"
+ elif subpkg_provides_pc "$i" \
|| $APK $apkroot info --quiet --installed "pc:$i"; then
local provider=$(apk $apkroot search --quiet "pc:$i")
if list_has "$provider" $depends_dev; then