commit:     251def323a040201f48b3fae348f6dee9af3e064
Author:     Andrei Horodniceanu <a.horodniceanu <AT> proton <DOT> me>
AuthorDate: Mon Mar  4 19:07:23 2024 +0000
Commit:     Horodniceanu Andrei <a.horodniceanu <AT> proton <DOT> me>
CommitDate: Sat Apr 13 22:47:30 2024 +0000
URL:        https://gitweb.gentoo.org/repo/user/dlang.git/commit/?id=251def32

dev-lang/ldc2: port to dlang-single.eclass

Additional changes:
- remove the useless MULTILIB_COMPAT line since the variable was set
  post inherit and it is unwanted since ldc2 supports arm64.
- change ROOT to EROOT in pkg_post_*
- use llvm-r1.eclass instead of llvm.eclass

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

 dev-lang/ldc2/ldc2-1.36.0-r2.ebuild | 79 +++++++++++++++++++++++++++++++++++++
 1 file changed, 79 insertions(+)

diff --git a/dev-lang/ldc2/ldc2-1.36.0-r2.ebuild 
b/dev-lang/ldc2/ldc2-1.36.0-r2.ebuild
new file mode 100644
index 0000000..84a0413
--- /dev/null
+++ b/dev-lang/ldc2/ldc2-1.36.0-r2.ebuild
@@ -0,0 +1,79 @@
+# Copyright 1999-2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit flag-o-matic multilib-build cmake
+
+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";
+S=${WORKDIR}/${MY_P}
+
+DESCRIPTION="LLVM D Compiler"
+HOMEPAGE="https://github.com/ldc-developers/ldc";
+KEYWORDS="~amd64 ~arm64 ~x86"
+LICENSE="BSD"
+# For first bump, set the subslot below to 0 and only increase if there
+# is an actual ABI bkreakage.
+SLOT="$(ver_cut 1-2)/$(ver_cut 3)"
+
+IUSE="static-libs"
+RESTRICT="test"
+
+# Upstream supports LLVM 11.0 through 17.0.
+LLVM_COMPAT=( {15..17} )
+DLANG_COMPAT=( dmd-2_{106..107} gdc-13 ldc2-1_{35..36} )
+
+inherit llvm-r1 dlang-single
+
+REQUIRED_USE=${DLANG_REQUIRED_USE}
+DEPEND="
+       ${DLANG_DEPS}
+       $(llvm_gen_dep '
+         sys-devel/llvm:${LLVM_SLOT}=
+       ')
+"
+IDEPEND=">=app-eselect/eselect-dlang-20140709"
+RDEPEND="
+       ${DEPEND}
+       ${IDEPEND}
+"
+BDEPEND=${DLANG_DEPS}
+
+PATCHES="${FILESDIR}/ldc2-1.15.0-link-defaultlib-shared.patch"
+
+src_configure() {
+       # We disable assertions so we have to apply the same workaround as for
+       # sys-devel/llvm: add -DNDEBUG to CPPFLAGS.
+       local CPPFLAGS="${CPPFLAGS} -DNDEBUG"
+       # https://bugs.gentoo.org/show_bug.cgi?id=922590
+       append-flags -fno-strict-aliasing
+       local mycmakeargs=(
+               -DD_VERSION=2
+               -DCMAKE_INSTALL_PREFIX="${EPREFIX}"/usr/lib/ldc2/$(ver_cut 1-2)
+               -DD_COMPILER="$(dlang_get_dmdw) $(dlang_get_dmdw_dcflags)"
+               -DLDC_WITH_LLD=OFF
+               -DCOMPILE_D_MODULES_SEPARATELY=ON
+               -DLDC_ENABLE_ASSERTIONS=OFF
+               -DBUILD_SHARED_LIBS=$(usex static-libs BOTH ON)
+       )
+       use abi_x86_32 && use abi_x86_64 && mycmakeargs+=( -DMULTILIB=ON )
+
+       cmake_src_configure
+}
+
+src_install() {
+       cmake_src_install
+
+       rm -rf "${ED}"/usr/share/bash-completion
+}
+
+pkg_postinst() {
+       # Update active ldc2
+       "${EROOT}"/usr/bin/eselect dlang update ldc2
+}
+
+pkg_postrm() {
+       "${EROOT}"/usr/bin/eselect dlang update ldc2
+}

Reply via email to