commit: 1bb2eb6ab240eec201a15cb78ed0fed2d7c6f9c3
Author: Horodniceanu Andrei <a.horodniceanu <AT> proton <DOT> me>
AuthorDate: Thu Nov 30 19:13:46 2023 +0000
Commit: Marco Leise <marco.leise <AT> gmx <DOT> de>
CommitDate: Sun Dec 10 21:53:34 2023 +0000
URL: https://gitweb.gentoo.org/repo/user/dlang.git/commit/?id=1bb2eb6a
dlang.eclass: export PKG_CONFIG_* in phase functions
PKG_CONFIG_LIBDIR and PKG_CONFIG_PATH will now be set to a list of the
the system pkg-config directories and the compiler specific one, allowing
packages that use build systems to easily find both their C and D
dependencies.
Signed-off-by: Horodniceanu Andrei <a.horodniceanu <AT> proton.me>
eclass/dlang.eclass | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/eclass/dlang.eclass b/eclass/dlang.eclass
index 2817779..ab41b18 100644
--- a/eclass/dlang.eclass
+++ b/eclass/dlang.eclass
@@ -610,6 +610,17 @@ _dlang_use_build_vars() {
# The original value is exported as LIBDIR_HOST.
local libdir_var="LIBDIR_${ABI}"
export LIBDIR_HOST="${!libdir_var}"
+ # Save the default pkgconfig path
+ if [[ ! -v DLANG_SAVE_PKG_CONFIG_PATH ]]; then
+ # Copy the logic from meson.eclass for setting PKG_CONFIG_PATH
+ export
DLANG_SAVE_PKG_CONFIG_PATH="${PKG_CONFIG_PATH}${PKG_CONFIG_PATH:+:}/usr/share/pkgconfig"
+ fi
+ if [[ ! -v DLANG_SAVE_PKG_CONFIG_LIBDIR ]]; then
+ # either save the value or provide a sane default lest other
eclasses get confused.
+ # e.g. meson.eclass will set PKG_CONFIG_LIBDIR using
$(get_libdir) which won't
+ # work properly since we will overwrite $LIBDIR_$ABI
+ export
DLANG_SAVE_PKG_CONFIG_LIBDIR="${PKG_CONFIG_LIBDIR:-/usr/$(get_libdir)/pkgconfig}"
+ fi
export ABI="$(echo ${MULTIBUILD_VARIANT} | cut -d- -f1)"
export DC="$(echo ${MULTIBUILD_VARIANT} | cut -d- -f2)"
export DC_VERSION="$(echo ${MULTIBUILD_VARIANT} | cut -d- -f3)"
@@ -699,6 +710,13 @@ _dlang_use_build_vars() {
filter-ldflags -f{no-,}use-linker-plugin -f{no-,}lto -flto=*
fi
export LDFLAGS=`dlang_convert_ldflags`
+
+ # Add the compiler specific pkgconfig paths.
+ export
PKG_CONFIG_PATH="${DLANG_SAVE_PKG_CONFIG_PATH}:/usr/$(get_libdir)/pkgconfig"
+ # Technically, this value will stay the same so it's enough to export
it once
+ # but it's cleaner to keep these 2 variables close together.
+ export PKG_CONFIG_LIBDIR="${DLANG_SAVE_PKG_CONFIG_LIBDIR}"
+
"${@}"
}