commit:     55d8c7fdfbf7402c778cbbe14613a6d226781933
Author:     Horodniceanu Andrei <a.horodniceanu <AT> proton <DOT> me>
AuthorDate: Mon Oct 16 19:28:12 2023 +0000
Commit:     Horodniceanu Andrei <a.horodniceanu <AT> proton <DOT> me>
CommitDate: Sun Oct 29 09:57:33 2023 +0000
URL:        https://gitweb.gentoo.org/repo/user/dlang.git/commit/?id=55d8c7fd

dlang.eclass: move to gdc-SLOT like USE flags

Since gcc will keep ABI compatibility on a given stabilized branch, it
is enough to depend only on a gcc branch (slot), rather than a full
version. This simplifies gdc USE flags a lot and maintaining them
becomes easier.

Suggested-by: Arsen Arsenović <arsen <AT> gentoo.org>
Signed-off-by: Horodniceanu Andrei <a.horodniceanu <AT> proton.me>

 dev-util/gdmd/gdmd-13.ebuild  |  2 +-
 eclass/dlang-compilers.eclass | 11 +++--------
 eclass/dlang.eclass           | 28 ++++++++++++----------------
 profiles/use.desc             | 11 +++--------
 4 files changed, 19 insertions(+), 33 deletions(-)

diff --git a/dev-util/gdmd/gdmd-13.ebuild b/dev-util/gdmd/gdmd-13.ebuild
index 1e36f20..630df46 100644
--- a/dev-util/gdmd/gdmd-13.ebuild
+++ b/dev-util/gdmd/gdmd-13.ebuild
@@ -8,7 +8,7 @@ HOMEPAGE="https://www.gdcproject.org/";
 LICENSE="GPL-3+"
 
 SLOT="${PV}"
-KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 
~riscv ~s390 ~x86"
+KEYWORDS="~alpha amd64 arm arm64 ~ia64 ~loong ~m68k ~mips ~ppc ppc64 ~riscv 
~s390 x86"
 RDEPEND="sys-devel/gcc:${PV}[d]"
 RELEASE="0.1.0"
 
SRC_URI="https://codeload.github.com/D-Programming-GDC/gdmd/tar.gz/script-${RELEASE}
 -> gdmd-${RELEASE}.tar.gz"

diff --git a/eclass/dlang-compilers.eclass b/eclass/dlang-compilers.eclass
index 611fce7..497d456 100644
--- a/eclass/dlang-compilers.eclass
+++ b/eclass/dlang-compilers.eclass
@@ -70,14 +70,9 @@ dlang-compilers_declare_versions() {
 
        # GDC (hppa, sparc: masked "d" USE-flag)
        _dlang_gdc_frontend=(
-               ["11.3.1_p20230427"]="2.076 ~alpha amd64 arm arm64 ~ia64 ~m68k 
~mips ppc ppc64 ~riscv ~s390 x86"
-               ["11.4.0"]="2.076 ~alpha ~amd64 ~arm ~arm64 ~ia64 ~m68k ~mips 
~ppc ~ppc64 ~riscv ~s390 ~x86"
-               ["11.4.1_p20230622"]="2.076 ~alpha ~amd64 ~arm ~arm64 ~ia64 
~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 x86"
-               ["12.2.1_p20230428"]="2.100 ~alpha amd64 arm arm64 ~ia64 ~m68k 
~mips ~ppc ppc64 ~riscv ~s390 x86"
-               ["12.3.1_p20230526"]="2.100 ~alpha amd64 arm arm64 ~ia64 ~m68k 
~mips ~ppc ppc64 ~riscv ~s390 x86"
-               ["12.3.1_p20230623"]="2.100 ~alpha ~amd64 ~arm ~arm64 ~ia64 
~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~x86"
-               ["13.1.1_p20230527"]="2.103 ~alpha ~amd64 ~arm ~arm64 ~ia64 
~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~x86"
-               ["13.2.0"]="2.103 ~alpha ~amd64 ~arm ~arm64 ~ia64 ~loong ~m68k 
~mips ~ppc ~ppc64 ~riscv ~s390 ~x86"
+               ["11"]="2.076 ~alpha amd64 arm arm64 ~ia64 ~m68k ~mips ppc 
ppc64 ~riscv ~s390 x86"
+               ["12"]="2.100 ~alpha amd64 arm arm64 ~ia64 ~m68k ~mips ~ppc 
ppc64 ~riscv ~s390 x86"
+               ["13"]="2.103 ~alpha amd64 arm arm64 ~ia64 ~loong ~m68k ~mips 
~ppc ppc64 ~riscv ~s390 x86"
        )
 
        # LDC

diff --git a/eclass/dlang.eclass b/eclass/dlang.eclass
index b86f3bc..dc8d56e 100644
--- a/eclass/dlang.eclass
+++ b/eclass/dlang.eclass
@@ -45,7 +45,6 @@ fi
 
 EXPORT_FUNCTIONS src_prepare src_configure src_compile src_test src_install
 
-
 # Definition of know compilers and supported front-end versions from 
dlang-compilers.eclass
 dlang-compilers_declare_versions
 
@@ -57,11 +56,11 @@ dlang-compilers_declare_versions
 # MODEL: This is either 32 or 64.
 # DLANG_VENDOR: Either DigitalMars, GNU or LDC.
 # DC: D compiler command. E.g.
-#   /usr/x86_64-pc-linux-gnu/gcc-bin/9.1.1/x86_64-pc-linux-gnu-gdc,
+#   /usr/x86_64-pc-linux-gnu/gcc-bin/12/x86_64-pc-linux-gnu-gdc,
 #   /usr/lib/dmd/2.067/bin/dmd, or
 #   /usr/lib/ldc2/0.17/bin/ldc2
 # DMD: DMD compiler command. E.g.
-#   /usr/x86_64-pc-linux-gnu/gcc-bin/9.1.1/x86_64-pc-linux-gnu-gdmd,
+#   /usr/x86_64-pc-linux-gnu/gcc-bin/12/x86_64-pc-linux-gnu-gdmd,
 #   /usr/lib/dmd/2.086/bin/dmd, or
 #   /usr/lib/ldc2/0.17/bin/ldmd2
 # DC_VERSION: Release version of the compiler. This is the version excluding 
any
@@ -146,7 +145,6 @@ dlang_src_install() {
        _dlang_phase_wrapper install
 }
 
-
 # @FUNCTION: dlang_exec
 # @DESCRIPTION:
 # Run and print a shell command. Aborts the ebuild on error using "die".
@@ -274,7 +272,6 @@ dlang_dmdw_dcflags() {
        fi
 }
 
-
 # @FUNCTION: dlang_system_imports
 # @DESCRIPTION:
 # Returns a list of standard system import paths (one per line) for the current
@@ -285,7 +282,7 @@ dlang_system_imports() {
                echo "/usr/lib/dmd/${DC_VERSION}/import"
        elif [[ "${DLANG_VENDOR}" == "GNU" ]]; then
                # gcc's SLOT is its major version component.
-               echo "/usr/lib/gcc/${CHOST_default}/$(ver_cut 1 
${DC_VERSION})/include/d"
+               echo "/usr/lib/gcc/${CHOST_default}/${DC_VERSION}/include/d"
        elif [[ "${DLANG_VENDOR}" == "LDC" ]]; then
                echo "/usr/lib/ldc2/${DC_VERSION}/include/d"
                echo "/usr/lib/ldc2/${DC_VERSION}/include/d/ldc"
@@ -336,7 +333,7 @@ declare -a _dlang_depends
 _dlang_compiler_masked_archs_for_version_range() {
        local iuse=$1
        if [[ "$iuse" == gdc* ]]; then
-               local depend="$iuse? ( $2 dev-util/gdmd:$(ver_cut 1 
${iuse#gdc-}) )"
+               local depend="$iuse? ( $2 dev-util/gdmd:${iuse#gdc-} )"
        else
                local depend="$iuse? ( $2 )"
        fi
@@ -419,8 +416,8 @@ _dlang_filter_compilers() {
        # GDC (doesn't support sub-slots, to stay compatible with upstream GCC)
        for dc_version in "${!_dlang_gdc_frontend[@]}"; do
                mapping="${_dlang_gdc_frontend[${dc_version}]}"
-               iuse=gdc-$(ver_rs 1-2 _ $dc_version)
-               depend="~sys-devel/gcc-$dc_version[d,-d-bootstrap(-)]"
+               iuse="gdc-${dc_version}"
+               depend="sys-devel/gcc:$dc_version[d,-d-bootstrap(-)]"
                _dlang_compiler_masked_archs_for_version_range "$iuse" 
"$depend" "$mapping" "$1" "$2"
        done
 
@@ -568,13 +565,12 @@ _dlang_build_configurations() {
                                # on the right, the correct $version_component:
                                #
                                # dmd-2_088              dmd-2.088
-                               # gdc-12_2_0             gdc-12.2.0
-                               # gdc-11_3_1_p20230303   gdc-11.3.1_p20230303
+                               # gdc-12                 gdc-12
+                               # gdc-11                 gdc-11
                                # ldc-1_29               ldc-1.29
                                # ldc2-1_30              ldc2-1.30
                                #
                                # Note: for ldc2 there is an empty separater 
betwen the 'c' and the '2'.
-                               # Same thing for gdc, between the 'p' and the 
'2'.
                                if [[ "${use_flag}" =~ ldc2-* ]]; then
                                        version_component=$(ver_rs 3 . 
${use_flag})
                                else
@@ -647,12 +643,12 @@ _dlang_use_build_vars() {
        elif [[ "${DLANG_VENDOR}" == "GNU" ]]; then
                # Note that ldc2 expects the compiler name to be 'gdmd', not 
'x86_64-pc-linux-gnu-gdmd'.
                # gcc's SLOT is its major version component.
-               export DC="/usr/${CHOST_default}/gcc-bin/$(ver_cut 1 
${DC_VERSION})/${CHOST_default}-gdc"
-               export DMD="/usr/${CHOST_default}/gcc-bin/$(ver_cut 1 
${DC_VERSION})/gdmd"
+               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
-                       export 
LIBDIR_${ABI}="lib/gcc/${CHOST_default}/$(ver_cut 1 ${DC_VERSION})"
+                       export 
LIBDIR_${ABI}="lib/gcc/${CHOST_default}/${DC_VERSION}"
                else
-                       export 
LIBDIR_${ABI}="lib/gcc/${CHOST_default}/$(ver_cut 1 ${DC_VERSION})/${MODEL}"
+                       export 
LIBDIR_${ABI}="lib/gcc/${CHOST_default}/${DC_VERSION}/${MODEL}"
                fi
                export DCFLAGS="${GDCFLAGS} -shared-libphobos"
                export DLANG_LINKER_FLAG="-Xlinker "

diff --git a/profiles/use.desc b/profiles/use.desc
index 9cc5b06..0b89183 100644
--- a/profiles/use.desc
+++ b/profiles/use.desc
@@ -40,14 +40,9 @@ dmd-2_102 - Build for DMD 2.102
 dmd-2_103 - Build for DMD 2.103
 dmd-2_104 - Build for DMD 2.104
 dmd-2_105 - Build for DMD 2.105
-gdc-11_3_1_p20230427 - Build for GCC 11.3.1_p20230427
-gdc-11_4_0 - Build for GCC 11.4.0
-gdc-11_4_1_p20230622 - Build for GCC 11.4.1_p20230622
-gdc-12_2_1_p20230428 - Build for GCC 12.2.1_p20230428
-gdc-12_3_1_p20230526 - Build for GCC 12.3.1_p20230526
-gdc-12_3_1_p20230623 - Build for GCC 12.3.1_p20230623
-gdc-13_1_1_p20230527 - Build for GCC 13.1.1_p20230527
-gdc-13_2_0 - Build for GCC 13.2.0
+gdc-11 - Build for GCC 11
+gdc-12 - Build for GCC 12
+gdc-13 - Build for GCC 13
 ldc2-1_29 - Build for ldc2 1.29
 ldc2-1_30 - Build for ldc2 1.30
 ldc2-1_31 - Build for ldc2 1.31

Reply via email to