commit:     c6ab2690ead707fa368813014edd75509b07727b
Author:     Horodniceanu Andrei <a.horodniceanu <AT> proton <DOT> me>
AuthorDate: Thu Nov 30 13:34:14 2023 +0000
Commit:     Marco Leise <marco.leise <AT> gmx <DOT> de>
CommitDate: Sat Dec  9 18:13:15 2023 +0000
URL:        https://gitweb.gentoo.org/repo/user/dlang.git/commit/?id=c6ab2690

dlang.eclass: Properly set LIBDIR_$ABI for single type packages

Previously, only packages that set DLANG_PACKAGE_TYPE to multi
received a valid value in LIBDIR_$ABI, the path to the compiler
specific directory for libraries, in order to know where to
install their libraries.

Now, both types of packages will have this value set properly,
alowing single type packages to know the exact path to the
compiler library directory for easy access to auxiliary files
like pkg-config files.

Signed-off-by: Horodniceanu Andrei <a.horodniceanu <AT> proton.me>

 eclass/dlang.eclass | 11 ++++++++---
 eclass/dmd.eclass   | 18 ++++++++++++++++++
 2 files changed, 26 insertions(+), 3 deletions(-)

diff --git a/eclass/dlang.eclass b/eclass/dlang.eclass
index 385a458..2817779 100644
--- a/eclass/dlang.eclass
+++ b/eclass/dlang.eclass
@@ -584,7 +584,7 @@ _dlang_build_configurations() {
                                                variants="${variants} 
${abi}-${version_component}"
                                        done
                                else
-                                       variants="default-${version_component}"
+                                       
variants="${DEFAULT_ABI:-default}-${version_component}"
                                fi
                                ;;
                        selfhost)
@@ -647,10 +647,15 @@ _dlang_use_build_vars() {
                # gcc's SLOT is its major version component.
                export 
DC="/usr/${CHOST_default}/gcc-bin/${DC_VERSION}/${CHOST_default}-gdc"
                export DMD="/usr/${CHOST_default}/gcc-bin/${DC_VERSION}/gdmd"
-               if [[ "${DLANG_PACKAGE_TYPE}" == "multi" ]] && 
multilib_is_native_abi; then
+               if [[ ${DLANG_PACKAGE_TYPE} != multi ]]; then
+                       # Both single and dmd enter this branch
                        export 
LIBDIR_${ABI}="lib/gcc/${CHOST_default}/${DC_VERSION}"
                else
-                       export 
LIBDIR_${ABI}="lib/gcc/${CHOST_default}/${DC_VERSION}/${MODEL}"
+                       if multilib_is_native_abi; then
+                               export 
LIBDIR_${ABI}="lib/gcc/${CHOST_default}/${DC_VERSION}"
+                       else
+                               export 
LIBDIR_${ABI}="lib/gcc/${CHOST_default}/${DC_VERSION}/${MODEL}"
+                       fi
                fi
                export DCFLAGS="${GDCFLAGS} -shared-libphobos"
                export DLANG_LINKER_FLAG="-Xlinker "

diff --git a/eclass/dmd.eclass b/eclass/dmd.eclass
index 7d9e1f5..2292e12 100644
--- a/eclass/dmd.eclass
+++ b/eclass/dmd.eclass
@@ -295,8 +295,26 @@ EOF
                fi
 
                # Install shared lib.
+               # dlang.eclass will set LIBDIR_$ABI to the path of the host 
compiler
+               # library direcory (if not selfhosting). We don't care about 
that
+               # location, however, and we instead want to have it point
+               # to the path where this package is supposed to install the 
libraries
+               # to, i.e. the system library directory. We can use $LIBDIR_HOST
+               # to restore that value to the correct one but only if the ABI
+               # this function is running into is the same as the one set
+               # by dlang.eclass. Since dlang.eclass treats dmd as a 'single'
+               # type package, it will only treat the case where $ABI is the
+               # native one.
+               if ! use selfhost && multilib_is_native_abi; then
+                       # We aren't going to use LIBDIR_$ABI for this ABI 
anymore
+                       # so just overwrite it, don't bother saving it.
+                       export LIBDIR_${ABI}="${LIBDIR_HOST}"
+               fi
+
+               # We are installing the real file into the system libdir.
                dolib.so phobos/generated/linux/release/${MODEL}/"${SONAME}"
                dosym "${SONAME}" /usr/"$(get_libdir)"/"${SONAME_SYM}"
+               # We create an additional symlink in this package's specific 
libdir.
                dosym ../../../../../usr/"$(get_libdir)"/"${SONAME}" 
/usr/"${libdir}"/libphobos2.so
 
                # Install static lib if requested.

Reply via email to