On Tue, 22 Sep 2026 07:59:41 +0200,
Stuart Henderson <[email protected]> wrote:
>
> Makes sense. I wonder if we want to handle this better via MODGCC4_LANGS
> though, rather than hardcoding BUILD_DEPENDS.
>
I thought about this, it can be done like this.
Index: devel/dub/Makefile
===================================================================
RCS file: /cvs/ports/devel/dub/Makefile,v
diff -u -p -r1.9 Makefile
--- devel/dub/Makefile 21 Sep 2026 17:18:44 -0000 1.9
+++ devel/dub/Makefile 23 Sep 2026 00:49:21 -0000
@@ -4,6 +4,7 @@ CATEGORIES = devel
GH_ACCOUNT = dlang
GH_PROJECT = dub
GH_TAGNAME = v1.40.0
+REVISION = 0
# MIT
PERMIT_PACKAGE = Yes
@@ -25,9 +26,11 @@ DMD = ${LOCALBASE}/bin/dmd
.else
WANTLIB += c m pthread
+MODULES += lang/dlang
+
BUILD_DEPENDS = lang/gdmd
-RUN_DEPENDS = lang/gcc/16,-dlang
+RUN_DEPENDS = ${MODDLANG_BUILD_DEPENDS}
DC = ${LOCALBASE}/bin/egdc
DMD = ${LOCALBASE}/bin/gdmd
Index: lang/dlang/dlang.port.mk
===================================================================
RCS file: lang/dlang/dlang.port.mk
diff -N lang/dlang/dlang.port.mk
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lang/dlang/dlang.port.mk 23 Sep 2026 00:49:21 -0000
@@ -0,0 +1,15 @@
+MODDLANG_COMPILER ?= gdc
+
+.if empty(MODDLANG_COMPILER)
+ERRORS += "Fatal: need to specify MODDLANG_COMPILER"
+.endif
+
+.if ${MODDLANG_COMPILER:L} == "gdc"
+MODULES += gcc4
+MODGCC4_ARCHS ?= *
+MODGCC4_LANGS += d
+MODDLANG_BUILD_DEPENDS += ${MODGCC4_DLANGDEP}
+.else
+# gdmd and dmd doesn't support -B
+ERRORS += "Fatal: MODDLANG_COMPILER must be one of: gdc"
+.endif
Index: lang/gcc/16/gcc4.port.mk
===================================================================
RCS file: /cvs/ports/lang/gcc/16/gcc4.port.mk,v
diff -u -p -r1.1.1.1 gcc4.port.mk
--- lang/gcc/16/gcc4.port.mk 2 Jun 2026 20:00:16 -0000 1.1.1.1
+++ lang/gcc/16/gcc4.port.mk 23 Sep 2026 00:49:21 -0000
@@ -5,7 +5,7 @@ MODGCC4_LANGS ?=
# Always include support for this
MODGCC4_LANGS += c
-_MODGCC4_OKAY = c c++ fortran
+_MODGCC4_OKAY = c c++ d fortran
.for _l in ${MODGCC4_LANGS:L}
. if !${_MODGCC4_OKAY:M${_l}}
ERRORS += "Fatal: unknown language ${_l}"
@@ -29,6 +29,8 @@ MODGCC4_CPPDEP = lang/gcc/16,-c++>=16
MODGCC4_CPPWANTLIB = estdc++>=22 pthread
MODGCC4_ATOMICWANTLIB = atomic
+MODGCC4_DLANGDEP = lang/gcc/16,-dlang>=16,<17
+
MODGCC4_FORTRANDEP = lang/gcc/16,-f95>=16,<17
MODGCC4_FORTRANLIBDEP = lang/gcc/16,-libs>=16,<17
MODGCC4_FORTRANWANTLIB = gfortran>=11
@@ -55,6 +57,11 @@ LIBECXX = ${MODGCC4_CPPWANTLIB}
. if !${COMPILER_LINKS:Mg++}
COMPILER_LINKS += c++ ${LOCALBASE}/bin/eg++ g++ ${LOCALBASE}/bin/eg++
. endif
+. endif
+
+. if ${MODGCC4_LANGS:L:Md}
+BUILD_DEPENDS += ${MODGCC4_DLANGDEP}
+COMPILER_LINKS += gdc ${LOCALBASE}/bin/egdc
. endif
. if ${MODGCC4_LANGS:L:Mfortran}
Index: lang/gdmd/Makefile
===================================================================
RCS file: /cvs/ports/lang/gdmd/Makefile,v
diff -u -p -r1.7 Makefile
--- lang/gdmd/Makefile 18 Sep 2026 23:12:27 -0000 1.7
+++ lang/gdmd/Makefile 23 Sep 2026 00:49:21 -0000
@@ -1,6 +1,7 @@
COMMENT = dmd-like wrapper for gdc
DISTNAME = ${GH_PROJECT}-0.1.0
PKGNAME = ${DISTNAME}pl20260801
+REVISION = 0
CATEGORIES = lang
@@ -11,7 +12,9 @@ GH_COMMIT = d14f7301b4bbae44996bc962121c
# GPLv3+
PERMIT_PACKAGE = Yes
-RUN_DEPENDS = lang/gcc/16,-dlang
+MODULES += lang/dlang
+
+RUN_DEPENDS = ${MODDLANG_BUILD_DEPENDS}
USE_GMAKE = Yes
Index: sysutils/trash-d/Makefile
===================================================================
RCS file: /cvs/ports/sysutils/trash-d/Makefile,v
diff -u -p -r1.11 Makefile
--- sysutils/trash-d/Makefile 21 Sep 2026 22:15:41 -0000 1.11
+++ sysutils/trash-d/Makefile 23 Sep 2026 00:49:21 -0000
@@ -5,17 +5,18 @@ GH_ACCOUNT = rushsteve1
GH_PROJECT = trash-d
GH_TAGNAME = 21
-REVISION = 0
+REVISION = 1
# MIT
PERMIT_PACKAGE = Yes
WANTLIB += c m pthread
-BUILD_DEPENDS = lang/gcc/16,-dlang \
- textproc/scdoc
+MODULES += lang/dlang
-TEST_DEPENDS = lang/gcc/16,-dlang
+BUILD_DEPENDS += textproc/scdoc
+
+TEST_DEPENDS = ${MODDLANG_BUILD_DEPENDS}
do-build:
cd ${WRKSRC} && egdc -O -frelease -finline-functions -Isource -J. \
--
wbr, Kirill