aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Horodniceanu <a.horodniceanu@proton.me>2024-05-03 11:19:45 +0300
committerAndrei Horodniceanu <a.horodniceanu@proton.me>2024-05-03 11:19:45 +0300
commit1b5df51e2e9f98aa237b539ca44d7b25c96b6525 (patch)
tree8ebbde80e2377957cf565bcc61a379ed72de31dc
parentdev-util/dfmt: refactor src_compile to use upstream makefile (diff)
downloaddlang-1b5df51e2e9f98aa237b539ca44d7b25c96b6525.tar.gz
dlang-1b5df51e2e9f98aa237b539ca44d7b25c96b6525.tar.bz2
dlang-1b5df51e2e9f98aa237b539ca44d7b25c96b6525.zip
dlang-utils.eclass: add dlang_get_debug_flag
Signed-off-by: Andrei Horodniceanu <a.horodniceanu@proton.me>
-rw-r--r--eclass/dlang-utils.eclass19
-rwxr-xr-xeclass/tests/dlang-utils.sh4
2 files changed, 23 insertions, 0 deletions
diff --git a/eclass/dlang-utils.eclass b/eclass/dlang-utils.eclass
index 60eee53..3c634d6 100644
--- a/eclass/dlang-utils.eclass
+++ b/eclass/dlang-utils.eclass
@@ -277,6 +277,19 @@ dlang_get_be_version() {
echo "${DLANG_BE_VERSION}"
}
+# @FUNCTION: dlang_get_debug_flag
+# @USAGE: [<impl>]
+# @DESCRIPTION:
+# Obtain and print the compiler debug flag for the given
+# implementation. If no implementation is provided, ${EDC} will be
+# used.
+dlang_get_debug_flag() {
+ debug-print-function ${FUNCNAME} "${@}"
+
+ _dlang_export "${@}" DLANG_DEBUG_FLAG
+ echo "${DLANG_DEBUG_FLAG}"
+}
+
# @FUNCTION: dlang_get_linker_flag
# @USAGE: [<impl>]
# @DESCRIPTION:
@@ -984,6 +997,12 @@ _dlang_export() {
export DLANG_DMDW_LDFLAGS=${DLANG_LDFLAGS}
debug-print "${FUNCNAME}: DLANG_DMDW_LDFLAGS = ${DLANG_DMDW_LDFLAGS}"
;;
+ DLANG_DEBUG_FLAG)
+ export DLANG_DEBUG_FLAG=$(
+ _dlang_echo_implementation_string \
+ "${impl}" "-debug" "-fdebug" "-d-debug")
+ debug-print "${FUNCNAME}: DLANG_DEBUG_FLAG = ${DLANG_DEBUG_FLAG}"
+ ;;
DLANG_LINKER_FLAG)
export DLANG_LINKER_FLAG=$(
_dlang_echo_implementation_string \
diff --git a/eclass/tests/dlang-utils.sh b/eclass/tests/dlang-utils.sh
index 0f4b6da..28d10d9 100755
--- a/eclass/tests/dlang-utils.sh
+++ b/eclass/tests/dlang-utils.sh
@@ -95,6 +95,10 @@ test_var DLANG_DMDW_LDFLAGS dmd-2.106 "-L-O1 -L--as-needed -garbage"
test_var DLANG_DMDW_LDFLAGS gdc-13 "-L-O1 -L--as-needed -garbage -q,-shared-libphobos"
test_var DLANG_DMDW_LDFLAGS ldc2-1_35 "-L-O1 -L--as-needed -garbage"
+test_var DLANG_DEBUG_FLAG dmd-2.102 "-debug"
+test_var DLANG_DEBUG_FLAG gdc-13 "-fdebug"
+test_var DLANG_DEBUG_FLAG ldc2-1_36 "-d-debug"
+
test_var DLANG_LINKER_FLAG dmd-2.102 "-L"
test_var DLANG_LINKER_FLAG gdc-13 "-Wl,"
test_var DLANG_LINKER_FLAG ldc2-1_36 "-L"