public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Marco Leise" <marco.leise@gmx.de>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] repo/user/dlang:master commit in: eclass/
Date: Sat, 23 Jul 2022 12:24:01 +0000 (UTC)	[thread overview]
Message-ID: <1658488823.675421df42f5689e496af2b54dd2b20c2804af3a.mleise@gentoo> (raw)

commit:     675421df42f5689e496af2b54dd2b20c2804af3a
Author:     Horodniceanu Andrei <a.horodniceanu <AT> protonmail <DOT> com>
AuthorDate: Fri Jul 22 11:20:23 2022 +0000
Commit:     Marco Leise <marco.leise <AT> gmx <DOT> de>
CommitDate: Fri Jul 22 11:20:23 2022 +0000
URL:        https://gitweb.gentoo.org/repo/user/dlang.git/commit/?id=675421df

Improve dmd.eclass support for gdc

Signed-off-by: Horodniceanu Andrei <a.horodniceanu <AT> protonmail.com>

 eclass/dlang.eclass | 31 +++++++++++++++++++++++++++++++
 eclass/dmd.eclass   |  6 ++++--
 2 files changed, 35 insertions(+), 2 deletions(-)

diff --git a/eclass/dlang.eclass b/eclass/dlang.eclass
index 80dea3a..5c86088 100644
--- a/eclass/dlang.eclass
+++ b/eclass/dlang.eclass
@@ -234,6 +234,37 @@ dlang_convert_ldflags() {
 	fi
 }
 
+# @FUNCTION: dlang_dmdw_dcflags
+# @DESCRIPTION:
+# Convertes compiler specific $DCFLAGS to something that can be passed to the
+# dmd wrapper of said compiler. Calls `die` if the flags could not be
+# converted.
+dlang_dmdw_dcflags() {
+	if [[ "${DLANG_VENDOR}" == "DigitalMars" ]]; then
+		# There's no translation that needs to be done.
+		echo "${DCFLAGS}"
+	elif [[ "${DLANG_VENDOR}" == "LDC" ]]; then
+		# ldmd2 passes all the arguments that it doesn't understand to ldc2.
+		echo "${DCFLAGS}"
+	elif [[ "${DLANG_VENDOR}" == "GNU" ]]; then
+		# From `gdmd --help`:   -q,arg1,...    pass arg1, arg2, etc. to gdc
+		if [[ "${DCFLAGS}" =~ .*,.* ]]; then
+			eerror "DCFLAGS (${DCFLAGS}) contain a comma and can not be passed to gdmd."
+			eerror "Please remove the comma, use a different compiler, or call gdc directly."
+			die "DCFLAGS contain an unconvertable comma."
+		fi
+
+		local set flags=()
+		for set in ${DCFLAGS}; do
+			flags+=("-q,${set}")
+		done
+		echo "${flags[@]}"
+	else
+		die "Set DLANG_VENDOR to DigitalMars, LDC or GNU prior to calling ${FUNCNAME}()."
+	fi
+}
+
+
 # @FUNCTION: dlang_system_imports
 # @DESCRIPTION:
 # Returns a list of standard system import paths (one per line) for the current

diff --git a/eclass/dmd.eclass b/eclass/dmd.eclass
index 3215f00..55f62e8 100644
--- a/eclass/dmd.eclass
+++ b/eclass/dmd.eclass
@@ -103,6 +103,8 @@ dmd_src_prepare() {
 	ln -s ../druntime src/druntime || die "Failed to symlink 'druntime' to 'src/druntime'"
 	ln -s ../phobos   src/phobos   || die "Failed to symlink 'phobos' to 'src/phobos'"
 
+	mkdir dmd/generated || die "Could not create output directory"
+
 	# Convert line-endings of file-types that start as cr-lf and are installed later on
 	for file in $( find . -name "*.txt" -o -name "*.html" -o -name "*.d" -o -name "*.di" -o -name "*.ddoc" -type f ); do
 		edos2unix $file || die "Failed to convert DOS line-endings to Unix."
@@ -153,9 +155,9 @@ dmd_src_compile() {
 	fi
 	if dmd_ge 2.094; then
 		einfo "Building dmd build script..."
-		DC="${DMD}" dlang_compile_bin dmd/generated/build dmd/src/build.d
+		dlang_compile_bin dmd/generated/build dmd/src/build.d
 		einfo "Building dmd..."
-		env VERBOSE=1 ${HOST_DMD}="${DMD}" CXX="$(tc-getCXX)" ${ENABLE_RELEASE}=1 ${LTO} dmd/generated/build dmd
+		env VERBOSE=1 ${HOST_DMD}="${DMD}" CXX="$(tc-getCXX)" ${ENABLE_RELEASE}=1 ${LTO} dmd/generated/build DFLAGS="$(dlang_dmdw_dcflags)" dmd
 	else
 		einfo "Building dmd..."
 		emake -C dmd/src -f posix.mak TARGET_CPU=X86 ${HOST_DMD}="${DMD}" ${HOST_CXX}="$(tc-getCXX)" ${ENABLE_RELEASE}=1 ${LTO}


             reply	other threads:[~2022-07-23 12:24 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-23 12:24 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-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
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=1658488823.675421df42f5689e496af2b54dd2b20c2804af3a.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