From: "Marco Leise" <marco.leise@gmx.de>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] repo/user/dlang:master commit in: eclass/
Date: Sun, 17 Dec 2023 11:58:07 +0000 (UTC) [thread overview]
Message-ID: <1702245234.8c977f9dc9d15ebcf73032411eed7acf033782fb.mleise@gentoo> (raw)
commit: 8c977f9dc9d15ebcf73032411eed7acf033782fb
Author: Horodniceanu Andrei <a.horodniceanu <AT> proton <DOT> me>
AuthorDate: Thu Nov 30 19:32:20 2023 +0000
Commit: Marco Leise <marco.leise <AT> gmx <DOT> de>
CommitDate: Sun Dec 10 21:53:54 2023 +0000
URL: https://gitweb.gentoo.org/repo/user/dlang.git/commit/?id=8c977f9d
dlang.eclass: Support DLANG_COMPILER_DISABLED_BACKENDS
Add support for filtering out possible compilers by their backend,
on top of the frontend version filtering already implemented.
This allows packages that do not support a particular compiler backend
not to advertise USE flags that will fail to build.
Signed-off-by: Horodniceanu Andrei <a.horodniceanu <AT> proton.me>
eclass/dlang.eclass | 91 +++++++++++++++++++++++++++++++++++------------------
1 file changed, 60 insertions(+), 31 deletions(-)
diff --git a/eclass/dlang.eclass b/eclass/dlang.eclass
index ab41b18..5c7d3f9 100644
--- a/eclass/dlang.eclass
+++ b/eclass/dlang.eclass
@@ -30,6 +30,14 @@
# @DESCRIPTION:
# The path that is used to install include files. A sub-directory specific to the package should be used.
+# @ECLASS_VARIABLE: DLANG_COMPILER_DISABLED_BACKENDS
+# @PRE_INHERIT
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# Optional list of D compiler backends to disable as a Bash array.
+# Possible values include dmd, ldc2, and gdc.
+# Set before inheritting the eclass.
+
if [[ ${_ECLASS_ONCE_DLANG} != "recur -_+^+_- spank" ]] ; then
_ECLASS_ONCE_DLANG="recur -_+^+_- spank"
@@ -402,39 +410,45 @@ _dlang_compiler_masked_archs_for_version_range() {
_dlang_filter_compilers() {
local dc_version mapping iuse depend
- # filter for DMD (hardcoding support for x86 and amd64 only)
- for dc_version in "${!_dlang_dmd_frontend[@]}"; do
- mapping="${_dlang_dmd_frontend[${dc_version}]}"
- iuse="dmd-$(ver_rs 1- _ $dc_version)"
- if [ "${DLANG_PACKAGE_TYPE}" == "multi" ]; then
- depend="[${MULTILIB_USEDEP}]"
- else
- depend=""
- fi
- depend="dev-lang/dmd:$dc_version=$depend"
- _dlang_compiler_masked_archs_for_version_range "$iuse" "$depend" "$mapping" "$1" "$2"
- done
+ if _dlang_compiler_backend_is_enabled "dmd"; then
+ # filter for DMD (hardcoding support for x86 and amd64 only)
+ for dc_version in "${!_dlang_dmd_frontend[@]}"; do
+ mapping="${_dlang_dmd_frontend[${dc_version}]}"
+ iuse="dmd-$(ver_rs 1- _ $dc_version)"
+ if [ "${DLANG_PACKAGE_TYPE}" == "multi" ]; then
+ depend="[${MULTILIB_USEDEP}]"
+ else
+ depend=""
+ fi
+ depend="dev-lang/dmd:$dc_version=$depend"
+ _dlang_compiler_masked_archs_for_version_range "$iuse" "$depend" "$mapping" "$1" "$2"
+ done
+ fi
- # 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-${dc_version}"
- depend="sys-devel/gcc:$dc_version[d,-d-bootstrap(-)]"
- _dlang_compiler_masked_archs_for_version_range "$iuse" "$depend" "$mapping" "$1" "$2"
- done
+ if _dlang_compiler_backend_is_enabled "gdc"; then
+ # 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-${dc_version}"
+ depend="sys-devel/gcc:$dc_version[d,-d-bootstrap(-)]"
+ _dlang_compiler_masked_archs_for_version_range "$iuse" "$depend" "$mapping" "$1" "$2"
+ done
+ fi
- # filter for LDC2
- for dc_version in "${!_dlang_ldc2_frontend[@]}"; do
- mapping="${_dlang_ldc2_frontend[${dc_version}]}"
- iuse=ldc2-$(ver_rs 1- _ $dc_version)
- if [ "${DLANG_PACKAGE_TYPE}" == "multi" ]; then
- depend="[${MULTILIB_USEDEP}]"
- else
- depend=""
- fi
- depend="dev-lang/ldc2:$dc_version=$depend"
- _dlang_compiler_masked_archs_for_version_range "$iuse" "$depend" "$mapping" "$1" "$2"
- done
+ if _dlang_compiler_backend_is_enabled "ldc2"; then
+ # filter for LDC2
+ for dc_version in "${!_dlang_ldc2_frontend[@]}"; do
+ mapping="${_dlang_ldc2_frontend[${dc_version}]}"
+ iuse=ldc2-$(ver_rs 1- _ $dc_version)
+ if [ "${DLANG_PACKAGE_TYPE}" == "multi" ]; then
+ depend="[${MULTILIB_USEDEP}]"
+ else
+ depend=""
+ fi
+ depend="dev-lang/ldc2:$dc_version=$depend"
+ _dlang_compiler_masked_archs_for_version_range "$iuse" "$depend" "$mapping" "$1" "$2"
+ done
+ fi
}
# @FUNCTION: _dlang_filter_versions
@@ -762,6 +776,21 @@ _dlang_additional_flags() {
$(_dlang_prefix_words "${DLANG_LINKER_FLAG}-l" $libs)
}
+# @FUNCTION: _dlang_compiler_backend_is_enabled
+# @USAGE: _dlang_compiler_backend_is_enabled <backend>
+# @RETURN: Truth if the backend is enabled
+# @INTERNAL
+# @DESCRIPTION:
+# Check if the given backend is enabled.
+# Possible values for the backend are: dmd, ldc2 and gdc
+_dlang_compiler_backend_is_enabled() {
+ local disabled_backend
+ for disabled_backend in "${DLANG_COMPILER_DISABLED_BACKENDS[@]}"; do
+ [[ ${disabled_backend} == ${1} ]] && return 1
+ done
+ return 0
+}
+
# Setting DLANG_USE_COMPILER skips the generation of USE-flags for compilers
if [ -z ${DLANG_USE_COMPILER+x} ]; then
set -f; _dlang_filter_versions; set +f
next reply other threads:[~2023-12-17 11:58 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-17 11:58 Marco Leise [this message]
-- strict thread matches above, loose matches on Subject: below --
2024-11-08 14:56 [gentoo-commits] repo/user/dlang:master commit in: eclass/ Horodniceanu Andrei
2024-08-30 7:58 Horodniceanu Andrei
2024-07-14 19:44 Horodniceanu Andrei
2024-07-12 18:59 Horodniceanu Andrei
2024-07-12 18:59 Horodniceanu Andrei
2024-07-12 18:59 Horodniceanu Andrei
2024-04-26 20:25 Horodniceanu Andrei
2024-04-22 20:03 Horodniceanu Andrei
2024-04-13 23:04 Horodniceanu Andrei
2024-04-13 23:04 Horodniceanu Andrei
2024-04-13 23:04 Horodniceanu Andrei
2024-04-13 23:04 Horodniceanu Andrei
2024-02-20 17:54 Horodniceanu Andrei
2024-02-18 22:49 Horodniceanu Andrei
2024-02-18 22:49 Horodniceanu Andrei
2023-12-17 11:58 Marco Leise
2023-12-17 11:58 Marco Leise
2023-11-17 21:44 Horodniceanu Andrei
2023-11-17 21:44 Horodniceanu Andrei
2023-10-01 14:01 Horodniceanu Andrei
2023-09-28 4:56 Marco Leise
2023-09-28 4:56 Marco Leise
2023-09-28 4:56 Marco Leise
2023-09-04 19:18 Marco Leise
2023-08-15 2:32 Marco Leise
2023-07-22 14:13 Marco Leise
2023-07-22 14:13 Marco Leise
2023-07-22 11:46 Marco Leise
2022-07-23 12:24 Marco Leise
2020-08-15 1:50 Marco Leise
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1702245234.8c977f9dc9d15ebcf73032411eed7acf033782fb.mleise@gentoo \
--to=marco.leise@gmx.de \
--cc=gentoo-commits@lists.gentoo.org \
--cc=gentoo-dev@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox