commit:     6704088e8bb795530c96a2a521000ec67ac47613
Author:     Horodniceanu Andrei <a.horodniceanu <AT> proton <DOT> me>
AuthorDate: Sun Feb 18 22:06:55 2024 +0000
Commit:     Horodniceanu Andrei <a.horodniceanu <AT> proton <DOT> me>
CommitDate: Sun Feb 18 22:42:26 2024 +0000
URL:        https://gitweb.gentoo.org/repo/user/dlang.git/commit/?id=6704088e

dev-lang/dmd: add 2.107.0

Fix static libraries being built when USE=!static-libs.

Signed-off-by: Horodniceanu Andrei <a.horodniceanu <AT> proton.me>

 dev-lang/dmd/Manifest                              |  1 +
 dev-lang/dmd/dmd-2.107.0.ebuild                    | 17 +++++++++
 .../dmd/files/2.107-druntime-support-DMD_DIR.patch | 15 ++++++++
 .../2.107-phobos-change-DMD_DIR-meaning.patch      | 43 ++++++++++++++++++++++
 eclass/dlang-compilers.eclass                      |  1 +
 eclass/dmd.eclass                                  | 30 ++++++++++++++-
 profiles/use.desc                                  |  1 +
 7 files changed, 106 insertions(+), 2 deletions(-)

diff --git a/dev-lang/dmd/Manifest b/dev-lang/dmd/Manifest
index 80dd434..0df2c9c 100644
--- a/dev-lang/dmd/Manifest
+++ b/dev-lang/dmd/Manifest
@@ -4,3 +4,4 @@ DIST dmd.2.103.1.linux.tar.xz 22747324 BLAKE2B 
b00f41b4ab48be9c5467342314995e693
 DIST dmd.2.104.2.linux.tar.xz 22478264 BLAKE2B 
6af63d7a5c976ae251bb16d4b48fc354d429730d00ef33a1f81ef4ec9e491486f49e120c376b2c26f3e57a13f956ccf2c31d1511f4d59db399ae613aa62ec785
 SHA512 
a0e6bb94887950977743545a908d80d040b2a69c48139164f61c591d1678399636538c75c1aba4d9c25cc163ee60023872f6a50c8b84cc6c09394d33c66c1367
 DIST dmd.2.105.3.linux.tar.xz 22582468 BLAKE2B 
bbff951452a3fa0ba8fd30ad4a24720ee2df9538abf123931366f4c596e2a224d2a3792e9d03370f3a285bf3b4f29b126b49a88874da912ea862da8eaf0d5d73
 SHA512 
6dc46d1d84cac5964eb0027cdae656525601e4e16ecaba8540f7f403182696300c2293e3971886fff6ad966bd440243acd5a1824a66638c8a09f584476b825a8
 DIST dmd.2.106.1.linux.tar.xz 22778396 BLAKE2B 
66ff621beed21ef4fada3562380fe000d57aa7ca962c53b0b4c18520a47a76a9c405fe7074d17e2882e03313cdef47c67e6f690442e8f6ada8baf8e1589a4579
 SHA512 
2f287c1774196ad35d48288eef0ab87670b3b470ebd4b4707388197fc79ccbc9af0c6e839b9ffd3d2f3f06624fabbedb9bf4fc1c0a670a2131f700be572a244f
+DIST dmd.2.107.0.linux.tar.xz 22438472 BLAKE2B 
551b2a723256b61b4c07fe44ace55c91c92f796fbd67aa5012c0efa9cb8c79010c1dcd9039dd85a19cb3c09163221792c1eb2200ecc6c1c9d74019df717f6fd1
 SHA512 
888369938fbf6dbcaf0c534ed899ffe055cef363e47282374fd45a3a702d97f96a7c7ce9a55a199915e5cc86e4b78ff86fccbd6334c4a4f1a940be5fa2872d11

diff --git a/dev-lang/dmd/dmd-2.107.0.ebuild b/dev-lang/dmd/dmd-2.107.0.ebuild
new file mode 100644
index 0000000..56938d4
--- /dev/null
+++ b/dev-lang/dmd/dmd-2.107.0.ebuild
@@ -0,0 +1,17 @@
+# Copyright 1999-2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+KEYWORDS="-* ~amd64 ~x86"
+YEAR=2024
+DLANG_VERSION_RANGE="2.100-2.107"
+
+inherit dmd
+
+PATCHES=(
+       "${FILESDIR}/2.105-link-32-bit-shared-lib-with-ld.bfd.patch"
+       # See https://github.com/dlang/phobos/pull/8820
+       "${FILESDIR}/2.107-phobos-change-DMD_DIR-meaning.patch"
+       "${FILESDIR}/2.107-druntime-support-DMD_DIR.patch"
+)

diff --git a/dev-lang/dmd/files/2.107-druntime-support-DMD_DIR.patch 
b/dev-lang/dmd/files/2.107-druntime-support-DMD_DIR.patch
new file mode 100644
index 0000000..0c920ce
--- /dev/null
+++ b/dev-lang/dmd/files/2.107-druntime-support-DMD_DIR.patch
@@ -0,0 +1,15 @@
+diff --git a/druntime/Makefile b/druntime/Makefile
+index 50e4104..ddffc78 100644
+--- a/druntime/Makefile
++++ b/druntime/Makefile
+@@ -17,8 +17,9 @@ QUIET:=
+ 
+ DUB=dub
+ TOOLS_DIR=../../tools
++DMD_DIR=../
+ 
+-include ../compiler/src/osmodel.mak
++include $(DMD_DIR)/src/osmodel.mak
+ 
+ ifeq (windows,$(OS))
+     DOTEXE:=.exe

diff --git a/dev-lang/dmd/files/2.107-phobos-change-DMD_DIR-meaning.patch 
b/dev-lang/dmd/files/2.107-phobos-change-DMD_DIR-meaning.patch
new file mode 100644
index 0000000..d7c1e22
--- /dev/null
+++ b/dev-lang/dmd/files/2.107-phobos-change-DMD_DIR-meaning.patch
@@ -0,0 +1,43 @@
+diff --git a/phobos/Makefile b/phobos/Makefile
+index 9f5267e..9b1c1e2 100644
+--- a/phobos/Makefile
++++ b/phobos/Makefile
+@@ -37,9 +37,9 @@ QUIET:=@
+ 
+ DEBUGGER=gdb
+ GIT_HOME=https://github.com/dlang
+-DMD_DIR=../dmd
++DMD_DIR=../dmd/compiler
+ 
+-include $(DMD_DIR)/compiler/src/osmodel.mak
++include $(DMD_DIR)/src/osmodel.mak
+ 
+ ifeq (windows,$(OS))
+     DOTEXE:=.exe
+@@ -80,7 +80,7 @@ endif
+ 
+ # Configurable stuff that's rarely edited
+ INSTALL_DIR = ../install
+-DRUNTIME_PATH = $(DMD_DIR)/druntime
++DRUNTIME_PATH = $(DMD_DIR)/../druntime
+ DLANG_ORG_DIR = ../dlang.org
+ ZIPFILE = phobos.zip
+ ROOT_OF_THEM_ALL = generated
+@@ -107,7 +107,7 @@ ifeq ($(OS),win32wine)
+       DMD = wine dmd.exe
+       RUN = wine
+ else
+-      DMD = $(DMD_DIR)/generated/$(OS)/$(BUILD)/$(MODEL)/dmd$(DOTEXE)
++      DMD = $(DMD_DIR)/../generated/$(OS)/$(BUILD)/$(MODEL)/dmd$(DOTEXE)
+       ifeq ($(MODEL),32omf)
+               CC = dmc
+       else ifeq ($(OS),windows)
+@@ -186,7 +186,7 @@ LINKDL:=$(if $(findstring $(OS),linux),-L-ldl,)
+ TIMELIMIT:=$(if $(shell which timelimit 2>/dev/null || true),timelimit -t 90 
,)
+ 
+ # Set VERSION, where the file is that contains the version string
+-VERSION=$(DMD_DIR)/VERSION
++VERSION=$(DMD_DIR)/../VERSION
+ 
+ # Set LIB, the ultimate target
+ ifeq (,$(findstring win,$(OS)))

diff --git a/eclass/dlang-compilers.eclass b/eclass/dlang-compilers.eclass
index cfe18f8..6249824 100644
--- a/eclass/dlang-compilers.eclass
+++ b/eclass/dlang-compilers.eclass
@@ -30,6 +30,7 @@ dlang-compilers_declare_versions() {
                ["2.104"]="2.104 x86 amd64"
                ["2.105"]="2.105 x86 amd64"
                ["2.106"]="2.106 x86 amd64"
+               ["2.107"]="2.107 ~x86 ~amd64"
        )
 
        # GDC (hppa, sparc: masked "d" USE-flag)

diff --git a/eclass/dmd.eclass b/eclass/dmd.eclass
index 52e4209..fb57d19 100644
--- a/eclass/dmd.eclass
+++ b/eclass/dmd.eclass
@@ -217,12 +217,38 @@ dmd_src_compile() {
                        CC="$(tc-getCC)"
                        DMD_DIR=../dmd
                )
+               # <2.107 use posix.mak, >=dmd-2.107 use Makefile
+               ! dmd_ge 2.107 && mymakeargs+=(-f posix.mak)
+
+               local druntimeMakeArgs=(
+                       MANIFEST=
+               )
+               local phobosMakeArgs=(
+                       CUSTOM_DRUNTIME=1
+                       DRUNTIME_PATH=../druntime
+               )
+               # Let's try to specify the build args to avoid building both
+               # shared+static libraries with !static-libs. Do this only for
+               # >=2.107, if it's useful backport the improvements later.
+               if dmd_ge 2.107; then
+                       phobosMakeArgs=( $(usex static-libs 'lib dll' 'dll') )
+                       # druntime's notion of a shared library is a static 
archive
+                       # that is embedded into the phobos shared library.
+                       #
+                       # Technically there is the dll_so target which is the 
proper
+                       # so file but who's gonna use it? Perhaps if phobos 
would
+                       # not incorporate druntime we could install them as 
separate
+                       # libraries (like ldc2 and gdc).
+                       druntimeMakeArgs=( $(usex static-libs 'lib dll' 'dll') )
+                       # Either way, now we no longer build static-libs
+                       # indiscriminately.
+               fi
 
                einfo 'Building druntime...'
-               emake -C druntime -f posix.mak "${mymakeargs[@]}" MANIFEST=
+               emake -C druntime "${mymakeargs[@]}" "${druntimeMakeArgs[@]}"
 
                einfo 'Building Phobos 2...'
-               emake -C phobos -f posix.mak "${mymakeargs[@]}" 
CUSTOM_DRUNTIME=1 DRUNTIME_PATH=../druntime
+               emake -C phobos "${mymakeargs[@]}" "${phobosMakeArgs[@]}"
        }
 
        dmd_foreach_abi compile_libraries

diff --git a/profiles/use.desc b/profiles/use.desc
index 3e5463d..eb8b622 100644
--- a/profiles/use.desc
+++ b/profiles/use.desc
@@ -4,6 +4,7 @@ dmd-2_103 - Build for DMD 2.103
 dmd-2_104 - Build for DMD 2.104
 dmd-2_105 - Build for DMD 2.105
 dmd-2_106 - Build for DMD 2.106
+dmd-2_107 - Build for DMD 2.107
 gdc-11 - Build for GCC 11
 gdc-12 - Build for GCC 12
 gdc-13 - Build for GCC 13

Reply via email to