repo/user/dlang:master commit in: dev-libs/ldc2-runtime/, profiles/, eclass/, dev-lang/ldc2/
"Horodniceanu Andrei" <[email protected]>
| Newsgroups | gmane.linux.gentoo.cvs |
|---|---|
| Message-ID | <1786033389.eec573f6d71f07dadf17b5d048f5c2be2d7c09e6.a.horodniceanu@gentoo> |
commit: eec573f6d71f07dadf17b5d048f5c2be2d7c09e6
Author: Andrei Horodniceanu <a.horodniceanu <AT> proton <DOT> me>
AuthorDate: Sun Aug 2 19:51:04 2026 +0000
Commit: Horodniceanu Andrei <a.horodniceanu <AT> proton <DOT> me>
CommitDate: Thu Aug 6 16:23:09 2026 +0000
URL: https://gitweb.gentoo.org/repo/user/dlang.git/commit/?id=eec573f6
dev-lang/ldc2: add 1.42.0
Closes: https://github.com/gentoo/dlang/issues/146
Signed-off-by: Andrei Horodniceanu <a.horodniceanu <AT> proton.me>
dev-lang/ldc2/Manifest | 2 +
dev-lang/ldc2/ldc2-1.42.0.ebuild | 206 ++++++++++++++++++++
dev-libs/ldc2-runtime/Manifest | 2 +
dev-libs/ldc2-runtime/ldc2-runtime-1.42.0.ebuild | 228 +++++++++++++++++++++++
eclass/dlang-compilers-r1.eclass | 3 +-
profiles/use.desc | 2 +
6 files changed, 442 insertions(+), 1 deletion(-)
diff --git a/dev-lang/ldc2/Manifest b/dev-lang/ldc2/Manifest
index 48c1506..3fbb020 100644
--- a/dev-lang/ldc2/Manifest
+++ b/dev-lang/ldc2/Manifest
@@ -3,8 +3,10 @@ DIST ldc-1.37.0-src.tar.gz 8555980 BLAKE2B ac93c903f9dbeec5b69e94c7cdf851ae3fa31
DIST ldc-1.38.0-src.tar.gz 8691096 BLAKE2B 7b25ba96c470a707d9ee7660ac030984c2cfecaf757a00015507dfb7c17075132ebcc546562ae700ab43eb19e117b4d1247cc1b2f62f455328a7cf9dc0ddf5d4 SHA512 1540a1a6f4bad3bc93da0f59bc28cd31dd4aeb58b8b4c744a204faa43692a1fe13d010ae56b3369e870a5e58724103b2aee58db8b40925698e7816f78f0f2de3
DIST ldc-1.39.0-src.tar.gz 8554301 BLAKE2B cb1dd5f6b4cc7a7344d8575d1e96fddbd1c34fc0e4f05cf96d29179bec725a997d7d8aee7bf0d97e53d0b36fb108f56e1c55eb66aa93e0075d1beb9d737e21e5 SHA512 d5c91043fa7d5faee9fc231fade52b6ac961907a7f6f8920d8337c9ba0b7052a5f98eb5f23ae56ca93510952c502ca78c9eec1d03f408aaa310fa4e4d57d9519
DIST ldc-1.40.0-src.tar.gz 8672131 BLAKE2B 88d37117ff1ff0ed53a39231dc0165e68fffc4860a8c1c503bfa4cc5bd9fcc277139d9baf1a93366d16e4a211d1dfa0eb6c74aa35484638a7c6c6c37db577896 SHA512 551fcc259fd609c6b9536352052ec3af44528bf41bfa85873597e0b76d97e8df0f5b1e0b3c18733bd64d2a9fb5ef588bba9d1d866d924629d663ae6ddcac67c0
+DIST ldc-1.42.0-src.tar.gz 9162109 BLAKE2B f6c11552cf1d1d2ecd124da1f9bb1bb3c8d5c9b7e0b122cc6bdd9678414f584e2d79910623a69d86957d5a28ee578cdf9d48a0d8d97cdcab2a8a53285889d0aa SHA512 561f22c3c8706547e62b35b801822ec82e938f796c90188b308a597d08e49f1bcf47d85bce79f7172e3e65a4c2b657d949c0c8099e98510c5409989e6275460b
DIST ldc2-1.36.0-patches-1.tar.gz 2526 BLAKE2B 016186abc61a174a3e880a167742eafc2f40c6579034e6ec733d22eaa8d2ea51cac1c00a4b80cb9fa995d44229b5473198b7b3d839085b9e94c5622726d4f41f SHA512 f7a124671cd3b7474419823f09d474f72f5be9e4b2c9a30f29743df88caf86491c1363ab2a8dbdfdde69e284789ab1918b78febc98dc0767100d26785cb9d6ba
DIST ldc2-1.37.0-patches-1.tar.gz 2523 BLAKE2B 397d701de640bc04bdf9246b9f981141287f4bd8069cf1233567f9430652da3fb1b89899b0c8c9a19877d239465a3a4c9758df32ca2dc1cd098ffffc0d729368 SHA512 b24318ec1f484d71c19db013893d94492b5a155f1bd2c5f7c993ad941e19635872b3e4dd15826094c6f80982c956240c58240c7e86f33b5f7af8344eb407090f
DIST ldc2-1.38.0-patches-1.tar.gz 8924 BLAKE2B 332ff175f3ba50b2c1c2a4e225a6c584621628fa7eda01bc26f318d04af03c5b40202ce2748392f2e55ce712ee6d8431026703419f278c8a6f38ee57a1601ce3 SHA512 00a84c4a5e3391ef3724b3e41b98af91186fb76a4a74a449cfea5cde86eb14889d6a0f06fb449903e95bda12be1448c3b16164bdc64ea990c933211b304ca2a2
DIST ldc2-1.39.0-patches-1.tar.gz 1176 BLAKE2B 7597fb1917f53ee5ee215cba73b92acf1d8347851d0d71223e5c01421da7ee6fd909ed7da217c99b162f3ca1602cdcddaf680ad13094db8957e98c635c72ecd1 SHA512 f78ddf97bb4ef0167328e1f58a3da7a35ec4a879a6c772f002dc161814bc9ac94b0ff543d3faf533375e0f5a9124a80c44b2371415810f0751617c2f13d56659
DIST ldc2-1.40.0-patches-1.tar.gz 3856 BLAKE2B 10ae16a7da8db875618f6e698414b818774ee8f9e79272592c253da9834cbeb702b797e742a8210b228403f16650c538b0ad0071f5f5037da9892099d2603509 SHA512 1c037a6cef8c466b08e372294e229933cc983c487ec1eba9618ddd05f2174c2ac319c25e6ebaedf35740b227627a8b4c13940b450f1f50dbc0c71b7c2bdbcb24
+DIST ldc2-1.42.0-patches-1.tar.gz 3736 BLAKE2B 7270cf03cd01a39bafc0a24619dc6d858d1c1782eff1f189f8e182a76521168a3dca23de409b7019a997f8481013fa4beaf2849e984491dbec68b9c462b3e2fe SHA512 f95e81f113851003b3582fd3ac18f1224fe4bd627e33c5d064a474656068afa98ed06f27ec1db4c4bfffcb529b750355363b6326d8da9f63af873cc357af84d1
diff --git a/dev-lang/ldc2/ldc2-1.42.0.ebuild b/dev-lang/ldc2/ldc2-1.42.0.ebuild
new file mode 100644
index 0000000..c86a737
--- /dev/null
+++ b/dev-lang/ldc2/ldc2-1.42.0.ebuild
@@ -0,0 +1,206 @@
+# Copyright 1999-2026 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+DLANG_COMPAT=( dmd-2_{107..111} gdc-1{3..5} ldc2-1_{36..40} ldc2-1_42 )
+LLVM_COMPAT=( {17..21} )
+PYTHON_COMPAT=( python3_{12..14} )
+inherit dlang-single llvm-r2 multiprocessing python-any-r1 toolchain-funcs cmake
+
+PATCH_VER=1
+PATCH_TAG_NAME="${PV}-patches-${PATCH_VER}"
+PATCH_URL_BASE="https://github.com/the-horo/ldc-patches/archive/refs/tags"
+
+DESCRIPTION="LLVM D Compiler"
+HOMEPAGE="https://github.com/ldc-developers/ldc"
+MY_PV="${PV//_/-}"
+MY_P="ldc-${MY_PV}-src"
+SRC_URI="
+ https://github.com/ldc-developers/ldc/releases/download/v${MY_PV}/${MY_P}.tar.gz
+ ${PATCH_URL_BASE}/${PATCH_TAG_NAME}.tar.gz -> ${P}-patches-${PATCH_VER}.tar.gz
+"
+S=${WORKDIR}/${MY_P}
+LICENSE="BSD"
+# dmd code but without the runtime libs, see dmd-r1.eclass for more details
+LICENSE+=" Boost-1.0 || ( CC0-1.0 Apache-2.0 )"
+# llvm bits
+LICENSE+=" Apache-2.0-with-LLVM-exceptions UoI-NCSA"
+# old gdc + dmd code
+LICENSE+=" GPL-2+ Artistic"
+
+SLOT="$(ver_cut 1-2)"
+KEYWORDS="~amd64 ~arm64 ~x86"
+
+IUSE="debug test"
+RESTRICT="!test? ( test )"
+
+REQUIRED_USE=${DLANG_REQUIRED_USE}
+COMMON_DEPEND="
+ ${DLANG_DEPS}
+ $(llvm_gen_dep '
+ llvm-core/llvm:${LLVM_SLOT}=[debug=]
+ ')
+"
+RDEPEND="${COMMON_DEPEND}"
+DEPEND="
+ ${COMMON_DEPEND}
+ test? (
+ dev-libs/ldc2-runtime:${SLOT}
+ )
+"
+BDEPEND="
+ ${DLANG_DEPS}
+ test? (
+ ${PYTHON_DEPS}
+ $(python_gen_any_dep '
+ dev-python/lit[${PYTHON_USEDEP}]
+ ')
+ )
+"
+IDEPEND=">=app-eselect/eselect-dlang-20241230"
+PDEPEND="dev-libs/ldc2-runtime:${SLOT}"
+
+INSTALL_PREFIX="${EPREFIX}/usr/lib/ldc2/${SLOT}" # /usr/lib/ldc2/1.40
+
+python_check_deps() {
+ python_has_version "dev-python/lit[${PYTHON_USEDEP}]"
+}
+
+pkg_setup() {
+ dlang_setup
+ llvm-r2_pkg_setup
+ use test && python_setup
+}
+
+src_prepare() {
+ # Disable GDB tests by passing GDB_FLAGS=OFF
+ # Put this here to avoid trigerring reconfigurations later on.
+ sed -i 's/\(GDB_FLAGS=\)\S\+/\1OFF/' "${S}"/tests/dmd/CMakeLists.txt || die
+
+ # Calls gcc directly
+ sed -i "s/gcc/$(tc-getCC)/" "${S}"/tests/dmd/runnable/importc-test1.sh || die
+
+ apply_patches
+
+ cmake_src_prepare
+}
+
+src_configure() {
+ local mycmakeargs=(
+ -DLDC_ENABLE_ASSERTIONS=$(usex debug ON OFF)
+ -DD_COMPILER="$(dlang_get_dmdw) $(dlang_get_dmdw_dcflags)"
+ -DCOMPILER_RT_BASE_DIR="${EPREFIX}"/usr/lib/clang
+ -DCOMPILER_RT_LIBDIR_OS=linux
+ # TODO: enable this
+ -DLDC_DYNAMIC_COMPILE=OFF
+
+ -DCMAKE_INSTALL_PREFIX="${INSTALL_PREFIX}"
+ -DPHOBOS_SYSTEM_ZLIB=ON
+ -DLDC_BUILD_RUNTIME=OFF
+ -DLDC_WITH_LLD=OFF
+ -DLDC_BUNDLE_LLVM_TOOLS=OFF
+ -DCOMPILE_D_MODULES_SEPARATELY=ON
+ -DTEST_COMPILER_RT_LIBRARIES=none
+ -DRT_SUPPORT_SANITIZERS=False
+ # Avoid collisions with other slots. We hardcode the path to
+ # make it easier for eselect-dlang to find the right compdir.
+ -DBASH_COMPLETION_COMPLETIONSDIR="${INSTALL_PREFIX}/usr/share/bash-completion/completions"
+ )
+ if use test; then
+ mycmakeargs+=(
+ -DGNU_MAKE_BIN="gmake" # tests/plugins/addFuncEntryCall/testPlugin.d
+ -DRUNTIME_DIR="${S}/runtime/druntime"
+ )
+ fi
+ cmake_src_configure
+}
+
+src_test() {
+ make_conf_file
+
+ # Call the same tests that .github/actions/main.yml does
+ local jobs=$(get_makeopts_jobs)
+
+ # We build it explicitly so that MAKEOPTS is respected
+ cmake_src_compile ldc2-unittest
+ cmake_src_test -R ldc2-unittest
+
+ # Instead of running cmake_src_test -R lit-tests we call lit directly
+ pushd "${BUILD_DIR}"/tests > /dev/null || die
+ "${EPYTHON}" runlit.py -j${jobs} -v . || die 'lit tests failed'
+ popd > /dev/null || die
+
+ # The dmd testsuite comes into debug and release variants. The debug
+ # one does compilable + fail_compilation + runnable, release only
+ # does runnable. Since it's a compiler I think it's fine to allow
+ # the duplicate tests. A few compilable tests fail with -O.
+ #
+ # These tests invoke a runner that runs the tests in parallel so
+ # specify the jobs only to the runner and not cmake. I'm pretty sure
+ # that some of the tests can't be run simultaneously by multiple
+ # runners so keep the cmake jobs to 1.
+ DMD_TESTSUITE_MAKE_ARGS=-j${jobs} cmake_src_test -j 1 -V -R dmd-testsuite
+}
+
+src_install() {
+ cmake_src_install
+
+ cat <<EOF > "${D}/${INSTALL_PREFIX}/etc/ldc2.conf/40-gentoo.conf" || die
+default: {
+ switches ~= [
+ "-link-defaultlib-shared",
+ ];
+}
+EOF
+
+ local ldc2_root="${INSTALL_PREFIX#${EPREFIX}}"
+ dosym -r "${ldc2_root}/bin/ldc2" "/usr/bin/ldc2-${SLOT}"
+ dosym -r "${ldc2_root}/bin/ldmd2" "/usr/bin/ldmd2-${SLOT}"
+ dosym -r "${ldc2_root}/etc/ldc2.conf" "/etc/ldc2/${SLOT}"
+}
+
+pkg_postinst() {
+ "${EROOT}"/usr/bin/eselect dlang update ldc2
+}
+
+pkg_postrm() {
+ "${EROOT}"/usr/bin/eselect dlang update ldc2
+}
+
+apply_patches() {
+ local patches_dir="${WORKDIR}/ldc-patches-${PATCH_TAG_NAME}"
+ local patch
+ einfo "Applying patches from: ${patches_dir}"
+ while read -rd '' patch; do
+ eapply "${patch}"
+ done < <(find "${patches_dir}" -mindepth 1 -maxdepth 2 \
+ -type f -name '*.patch' \
+ -print0)
+}
+
+# Generate a ldc2.conf file that uses the installed ldc2-runtime and the built headers
+make_conf_file() {
+ local conf_dir="${BUILD_DIR}/etc/ldc2.conf"
+ local conf="${conf_dir}/50-target-default.conf"
+
+ mkdir -p "${conf_dir}" || die
+ local libdir="${ESYSROOT}/usr/$(dlang_get_libdir ${PN}-${SLOT})"
+ cat > "${conf}" <<-EOF || die
+ default: {
+ switches ~= [
+ "-link-defaultlib-shared",
+ ];
+ post-switches = [
+ "-I${S}/runtime/druntime/src",
+ "-I${BUILD_DIR}/import",
+ "-I${S}/runtime/jit-rt/d",
+ "-I${S}/runtime/phobos",
+ ];
+ lib-dirs = [
+ "${libdir}",
+ ];
+ rpath = "${libdir}";
+ }
+ EOF
+}
diff --git a/dev-libs/ldc2-runtime/Manifest b/dev-libs/ldc2-runtime/Manifest
index e922f46..0eb2c75 100644
--- a/dev-libs/ldc2-runtime/Manifest
+++ b/dev-libs/ldc2-runtime/Manifest
@@ -1,2 +1,4 @@
DIST ldc-1.40.0-src.tar.gz 8672131 BLAKE2B 88d37117ff1ff0ed53a39231dc0165e68fffc4860a8c1c503bfa4cc5bd9fcc277139d9baf1a93366d16e4a211d1dfa0eb6c74aa35484638a7c6c6c37db577896 SHA512 551fcc259fd609c6b9536352052ec3af44528bf41bfa85873597e0b76d97e8df0f5b1e0b3c18733bd64d2a9fb5ef588bba9d1d866d924629d663ae6ddcac67c0
+DIST ldc-1.42.0-src.tar.gz 9162109 BLAKE2B f6c11552cf1d1d2ecd124da1f9bb1bb3c8d5c9b7e0b122cc6bdd9678414f584e2d79910623a69d86957d5a28ee578cdf9d48a0d8d97cdcab2a8a53285889d0aa SHA512 561f22c3c8706547e62b35b801822ec82e938f796c90188b308a597d08e49f1bcf47d85bce79f7172e3e65a4c2b657d949c0c8099e98510c5409989e6275460b
DIST ldc2-1.40.0-patches-1.tar.gz 3856 BLAKE2B 10ae16a7da8db875618f6e698414b818774ee8f9e79272592c253da9834cbeb702b797e742a8210b228403f16650c538b0ad0071f5f5037da9892099d2603509 SHA512 1c037a6cef8c466b08e372294e229933cc983c487ec1eba9618ddd05f2174c2ac319c25e6ebaedf35740b227627a8b4c13940b450f1f50dbc0c71b7c2bdbcb24
+DIST ldc2-1.42.0-patches-1.tar.gz 3736 BLAKE2B 7270cf03cd01a39bafc0a24619dc6d858d1c1782eff1f189f8e182a76521168a3dca23de409b7019a997f8481013fa4beaf2849e984491dbec68b9c462b3e2fe SHA512 f95e81f113851003b3582fd3ac18f1224fe4bd627e33c5d064a474656068afa98ed06f27ec1db4c4bfffcb529b750355363b6326d8da9f63af873cc357af84d1
diff --git a/dev-libs/ldc2-runtime/ldc2-runtime-1.42.0.ebuild b/dev-libs/ldc2-runtime/ldc2-runtime-1.42.0.ebuild
new file mode 100644
index 0000000..7d27a33
--- /dev/null
+++ b/dev-libs/ldc2-runtime/ldc2-runtime-1.42.0.ebuild
@@ -0,0 +1,228 @@
+# Copyright 2025-2026 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+DLANG_COMPAT=( ldc2-1_$(ver_cut 2) )
+inherit dlang-single multilib cmake-multilib
+
+PATCH_VER=1
+PATCH_TAG_NAME="${PV}-patches-${PATCH_VER}"
+PATCH_URL_BASE="https://github.com/the-horo/ldc-patches/archive/refs/tags"
+
+DESCRIPTION="LLVM D Compiler"
+HOMEPAGE="https://github.com/ldc-developers/ldc"
+MY_PV="${PV//_/-}"
+MY_P="ldc-${MY_PV}-src"
+SRC_URI="
+ https://github.com/ldc-developers/ldc/releases/download/v${MY_PV}/${MY_P}.tar.gz
+ ${PATCH_URL_BASE}/${PATCH_TAG_NAME}.tar.gz -> ldc2-${PV}-patches-${PATCH_VER}.tar.gz
+"
+S=${WORKDIR}/${MY_P}
+LICENSE="BSD"
+# runtime libs, see dmd-r1.eclass for more details
+LICENSE+=" Boost-1.0 BZIP2 ZLIB curl public-domain"
+
+# Only increase subslot in case of ABI breakage
+SLOT="$(ver_cut 1-2)/0"
+LDC2_SLOT="$(ver_cut 1-2)" # SLOT without subslot
+KEYWORDS="~amd64 ~arm64 ~x86"
+
+IUSE="static-libs test"
+RESTRICT="!test? ( test )"
+
+REQUIRED_USE=${DLANG_REQUIRED_USE}
+RDEPEND="
+ virtual/zlib:0/1
+ net-misc/curl[${MULTILIB_USEDEP}]
+"
+# curl is dlopened. The tests do need it though.
+DEPEND="
+ virtual/zlib:0/1
+ test? (
+ net-misc/curl[${MULTILIB_USEDEP}]
+ )
+"
+# We purposefully ignore DLANG_DEPS, we only need the ldc2 compiler and only in BROOT
+BDEPEND="dev-lang/ldc2:${LDC2_SLOT}"
+IDEPEND=">=app-eselect/eselect-dlang-20241230"
+
+INSTALL_PREFIX="${EPREFIX}/usr/lib/ldc2/${LDC2_SLOT}" # /usr/lib/ldc2/1.40
+STRING_IMPORTS_DIR="${T}/views"
+LDC2_CONF_DIR="${WORKDIR}/conf"
+
+src_prepare() {
+ mkdir -p "${STRING_IMPORTS_DIR}" || die
+ local tzpath="${STRING_IMPORTS_DIR}/TZDatabaseDirFile"
+ # std.datetime.timezone default search path, instead of /usr/share/zoneinfo/
+ echo "${EPREFIX}/usr/share/zoneinfo/" > "${tzpath}" || die
+
+ apply_patches
+
+ cmake_src_prepare
+
+ # Create wrappers for ldc2 because the cmake file only supports
+ # passing arguments to the compiler at the end of the command line.
+ # This breaks the -conf= argument that we want to use.
+ cat <<-EOF > "${T}/ldc2" || die
+ #!/bin/sh
+ exec "${DC}" -conf="${LDC2_CONF_DIR}" "\${@}"
+ EOF
+ cat <<-EOF > "${T}/ldmd2" || die
+ #!/bin/sh
+ exec "$(dlang_get_dmdw)" -conf="${LDC2_CONF_DIR}" "\${@}"
+ EOF
+ chmod +x "${T}/ldc2" "${T}/ldmd2" || die
+ # Needs to come after cmake_src_prepare because it uses ${BUILD_DIR}
+ make_conf_file
+}
+
+multilib_src_configure() {
+ local mycmakeargs=(
+ -DBUILD_SHARED_LIBS=$(usex static-libs BOTH ON)
+ # flags for the runtime, they need to be separated by ;
+ -DD_FLAGS_RELEASE="${DCFLAGS// /;}"
+ # Slight improvements with this
+ -DCOMPILE_ALL_D_FILES_AT_ONCE=OFF
+
+ -DCMAKE_INSTALL_PREFIX="${INSTALL_PREFIX}"
+ -DPHOBOS_SYSTEM_ZLIB=ON
+ -DLDC_EXE_FULL="${T}/ldc2"
+ -DLDMD_EXE_FULL="${T}/ldmd2"
+ # needed for the sake of EPREFIX
+ -DPHOBOS2_EXTRA_FLAGS="-J;${STRING_IMPORTS_DIR};-d-version=TZDatabaseDir"
+ # ${EDC} # ldc2-1.40
+ # .dlang_get_fe_version # 2.110
+ # .ver_cut(2) # 110
+ -DDMDFE_MINOR_VERSION="$(ver_cut 2 $(dlang_get_fe_version ${EDC}))"
+ -DDMDFE_PATCH_VERSION="$(ver_cut 3)"
+ )
+ if ! multilib_is_native_abi; then
+ # configure multilib flags
+ local triple_without_vendor=$(sed -e 's/-[^-]*/-.*/' <<<"${CHOST}") # i686-.*-linux-gnu
+ mycmakeargs+=(
+ -DD_EXTRA_FLAGS="$(dlang_get_model_flag)"
+ -DRT_CFLAGS="$(get_abi_CFLAGS)"
+ -DRT_CONF_BASE_NAME="55-target-$(get_libdir)"
+ -DRT_CONF_TRIPLE_REGEX="${triple_without_vendor}"
+ )
+ fi
+
+ CMAKE_USE_DIR="${S}/runtime" cmake_src_configure
+}
+
+multilib_src_compile() {
+ cmake_src_compile
+ symlinks_release_runtime_to_debug "${BUILD_DIR}"
+}
+
+multilib_src_test() {
+ # cmake.eclass modifies this internally but doesn't declare it as local making
+ # changes to it carry out across invocations of ${FUNCNAME}
+ local myctestargs
+
+ # We compile the tests first so that $MAKEOPTS is respect, if
+ # compiled during the tests, nproc jobs will be used.
+ cmake_src_compile all-test-runners
+
+ local CMAKE_SKIP_TESTS=(
+ # This one fails due to an uncaught error, probably due to the
+ # sandbox.
+ druntime-test-cycles
+ )
+ if [[ ${ARCH} == arm64 ]]; then
+ # https://github.com/ldc-developers/ldc/issues/4613
+
+ # fails due to "innacuracy"
+ CMAKE_SKIP_TESTS+=( std.internal.math.gammafunction )
+ # Bad code generation with optimizations?
+ CMAKE_SKIP_TESTS+=( std.math.exponential )
+ fi
+
+ # This test requires "${TEMP}/<some-file>" to be less than 108 characters.
+ # We will run it separately and force ${TEMP} to be a shorter path.
+ TMPDIR="." cmake_src_test -R std.socket
+ CMAKE_SKIP_TESTS+=( std.socket )
+
+ cmake_src_test
+}
+
+multilib_src_install() {
+ cmake_src_install
+ symlinks_release_runtime_to_debug "${D}/${INSTALL_PREFIX}"
+}
+
+pkg_postinst() {
+ "${EROOT}"/usr/bin/eselect dlang update ldc2
+}
+
+pkg_postrm() {
+ "${EROOT}"/usr/bin/eselect dlang update ldc2
+}
+
+apply_patches() {
+ local patches_dir="${WORKDIR}/ldc-patches-${PATCH_TAG_NAME}/runtime"
+ einfo "Applying patches from: ${patches_dir}"
+ local patch
+ while read -rd '' patch; do
+ eapply "${patch}"
+ done < <(find "${patches_dir}" -mindepth 1 -maxdepth 1 \
+ -type f -name '*.patch' \
+ -print0)
+}
+
+# Create symlinks to libdruntime-ldc-shared et al from libdruntime-ldc-debug-shared
+# Usage: <dir>
+# The symlinks are made in <dir>/$(get_libdir)
+symlinks_release_runtime_to_debug() {
+ rename_in_dir() {
+ local file find_cmd=(
+ find "${1}" -mindepth 1 -maxdepth 1
+ # Find files that look like a runtime library
+ -regex ".*/lib\(druntime\|phobos\)[^/]*"
+ # and are not a debug variant
+ -not -name '*debug*'
+ -printf '%f\0'
+ )
+ while read -rd '' file; do
+ # and symlink them:
+ # ${file} == libdruntime-ldc-shared
+ # ${file/-ldc/-ldc-debug} == libdruntime-ldc-debug-shared
+ ln -s "${file}" "${1}/${file/-ldc/-ldc-debug}" || die
+ done < <("${find_cmd[@]}")
+ }
+
+ rename_in_dir "${1}/$(get_libdir)"
+}
+
+# Create a ldc2.conf that uses the installed dev-lang/ldc2 headers and
+# built libraries
+make_conf_file() {
+ mkdir -p "${LDC2_CONF_DIR}" || die
+ cat <<-EOF > "${LDC2_CONF_DIR}/30-default.conf" || die
+ default: {
+ post-switches = [
+ "-I${BROOT}/usr/lib/ldc2/${LDC2_SLOT}/include/d",
+ ];
+ switches = [
+ "-defaultlib=phobos2-ldc,druntime-ldc",
+ "-link-defaultlib-shared",
+ ];
+ }
+ EOF
+
+ add_multilib_libdir_to_config() {
+ local triple_without_vendor=$(sed -e 's/-[^-]*/-.*/' <<<"${CHOST}") # i686-.*-linux-gnu
+ local libdir="${BUILD_DIR}/$(get_libdir)"
+ cat <<-EOF > "${LDC2_CONF_DIR}/55-target-$(get_libdir).conf" || die
+ "${triple_without_vendor}":
+ {
+ lib-dirs = [
+ "${libdir}",
+ ];
+ rpath = "${libdir}",
+ }
+ EOF
+ }
+ multilib_foreach_abi add_multilib_libdir_to_config
+}
diff --git a/eclass/dlang-compilers-r1.eclass b/eclass/dlang-compilers-r1.eclass
index 453d4a4..ea2ba97 100644
--- a/eclass/dlang-compilers-r1.eclass
+++ b/eclass/dlang-compilers-r1.eclass
@@ -1,4 +1,4 @@
-# Copyright 2024-2025 Gentoo Authors
+# Copyright 2024-2026 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
# @ECLASS: dlang-compilers-r1.eclass
@@ -83,6 +83,7 @@ readonly _DLANG_LDC2_FRONTENDS=(
"1.38 2.108 ~amd64 ~arm64 ~x86"
"1.39 2.109 ~amd64 ~arm64 ~x86"
"1.40 2.110 ~amd64 ~arm64 ~x86"
+ "1.42 2.112 ~amd64 ~arm64 ~x86"
)
# @FUNCTION: _dlang_accumulate_implementations
diff --git a/profiles/use.desc b/profiles/use.desc
index 60bda0f..797c35b 100644
--- a/profiles/use.desc
+++ b/profiles/use.desc
@@ -14,6 +14,7 @@ dlang_single_target_ldc2-1_37 - Build for ldc2 1.37 only
dlang_single_target_ldc2-1_38 - Build for ldc2 1.38 only
dlang_single_target_ldc2-1_39 - Build for ldc2 1.39 only
dlang_single_target_ldc2-1_40 - Build for ldc2 1.40 only
+dlang_single_target_ldc2-1_42 - Build for ldc2 1.42 only
dlang_targets_dmd-2_107 - Build with DMD 2.107
dlang_targets_dmd-2_108 - Build with DMD 2.108
@@ -31,3 +32,4 @@ dlang_targets_ldc2-1_37 - Build with ldc2 1.37
dlang_targets_ldc2-1_38 - Build with ldc2 1.38
dlang_targets_ldc2-1_39 - Build with ldc2 1.39
dlang_targets_ldc2-1_40 - Build with ldc2 1.40
+dlang_targets_ldc2-1_42 - Build with ldc2 1.42