commit:     2966167d6db5018b0ea1eb50f2a277324ffbd229
Author:     Niko Böckerman <niko.bockerman <AT> protonmail <DOT> com>
AuthorDate: Thu Feb  3 19:29:34 2022 +0000
Commit:     Marco Leise <marco.leise <AT> gmx <DOT> de>
CommitDate: Thu Feb  3 19:36:52 2022 +0000
URL:        https://gitweb.gentoo.org/repo/user/dlang.git/commit/?id=2966167d

ldc2: Add support for newer llvm versions

LDC2 1.24 added support for LLVM 11 and LDC 1.25 added support also for
LLVM 12.

Signed-off-by: Niko Böckerman <niko.bockerman <AT> protonmail.com>

 dev-lang/ldc2/ldc2-1.24.0-r2.ebuild | 82 ++++++++++++++++++++++++++++++++++++
 dev-lang/ldc2/ldc2-1.25.1-r1.ebuild | 83 +++++++++++++++++++++++++++++++++++++
 dev-lang/ldc2/ldc2-1.26.0-r1.ebuild | 83 +++++++++++++++++++++++++++++++++++++
 3 files changed, 248 insertions(+)

diff --git a/dev-lang/ldc2/ldc2-1.24.0-r2.ebuild 
b/dev-lang/ldc2/ldc2-1.24.0-r2.ebuild
new file mode 100644
index 0000000..181f1b5
--- /dev/null
+++ b/dev-lang/ldc2/ldc2-1.24.0-r2.ebuild
@@ -0,0 +1,82 @@
+# Copyright 1999-2021 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+inherit multilib-build cmake llvm
+
+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 ~arm ~arm64 ~ppc64 ~x86"
+LICENSE="BSD"
+SLOT="$(ver_cut 1-2)/$(ver_cut 3)"
+
+IUSE="static-libs"
+
+# We support LLVM 6.0 through 10.
+RDEPEND="dev-util/ninja
+       || (
+               sys-devel/llvm:10
+               sys-devel/llvm:11
+       )
+       <sys-devel/llvm-12:=
+       >=app-eselect/eselect-dlang-20140709"
+DEPEND="${RDEPEND}"
+LLVM_MAX_SLOT=11
+PATCHES="${FILESDIR}/ldc2-1.15.0-link-defaultlib-shared.patch"
+
+# For now, we support amd64 multilib. Anyone is free to add more support here.
+MULTILIB_COMPAT=( abi_x86_{32,64} )
+
+DLANG_VERSION_RANGE="2.075-"
+DLANG_PACKAGE_TYPE="single"
+
+inherit dlang
+
+detect_hardened() {
+       gcc --version | grep -o Hardened
+}
+
+src_prepare() {
+       cmake_src_prepare
+}
+
+d_src_configure() {
+       # Make sure libphobos2 is installed into ldc2's directory.
+       export LIBDIR_${ABI}="${LIBDIR_HOST}"
+       local mycmakeargs=(
+               -DD_VERSION=2
+               -DCMAKE_INSTALL_PREFIX=/usr/lib/ldc2/$(ver_cut 1-2)
+               -DD_COMPILER="${DMD}"
+               -DLDC_WITH_LLD=OFF
+       )
+       use static-libs && mycmakeargs+=( -DBUILD_SHARED_LIBS=BOTH ) || 
mycmakeargs+=( -DBUILD_SHARED_LIBS=ON )
+       use abi_x86_32 && use abi_x86_64 && mycmakeargs+=( -DMULTILIB=ON )
+       detect_hardened && mycmakeargs+=( -DADDITIONAL_DEFAULT_LDC_SWITCHES=' 
"-relocation-model=pic",' )
+       cmake_src_configure
+}
+
+d_src_compile()
+{
+       cmake_src_compile
+}
+
+d_src_install() {
+       cmake_src_install
+
+       rm -rf "${ED}"/usr/share/bash-completion
+}
+
+pkg_postinst() {
+       # Update active ldc2
+       "${ROOT}"/usr/bin/eselect dlang update ldc2
+}
+
+pkg_postrm() {
+       "${ROOT}"/usr/bin/eselect dlang update ldc2
+}

diff --git a/dev-lang/ldc2/ldc2-1.25.1-r1.ebuild 
b/dev-lang/ldc2/ldc2-1.25.1-r1.ebuild
new file mode 100644
index 0000000..1171863
--- /dev/null
+++ b/dev-lang/ldc2/ldc2-1.25.1-r1.ebuild
@@ -0,0 +1,83 @@
+# Copyright 1999-2021 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+inherit multilib-build cmake llvm
+
+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 ~arm ~arm64 ~ppc64 ~x86"
+LICENSE="BSD"
+SLOT="$(ver_cut 1-2)/$(ver_cut 3)"
+
+IUSE="static-libs"
+
+# We support LLVM 6.0 through 10.
+RDEPEND="dev-util/ninja
+       || (
+               sys-devel/llvm:10
+               sys-devel/llvm:11
+               sys-devel/llvm:12
+       )
+       <sys-devel/llvm-13:=
+       >=app-eselect/eselect-dlang-20140709"
+DEPEND="${RDEPEND}"
+LLVM_MAX_SLOT=12
+PATCHES="${FILESDIR}/ldc2-1.15.0-link-defaultlib-shared.patch"
+
+# For now, we support amd64 multilib. Anyone is free to add more support here.
+MULTILIB_COMPAT=( abi_x86_{32,64} )
+
+DLANG_VERSION_RANGE="2.075-"
+DLANG_PACKAGE_TYPE="single"
+
+inherit dlang
+
+detect_hardened() {
+       gcc --version | grep -o Hardened
+}
+
+src_prepare() {
+       cmake_src_prepare
+}
+
+d_src_configure() {
+       # Make sure libphobos2 is installed into ldc2's directory.
+       export LIBDIR_${ABI}="${LIBDIR_HOST}"
+       local mycmakeargs=(
+               -DD_VERSION=2
+               -DCMAKE_INSTALL_PREFIX=/usr/lib/ldc2/$(ver_cut 1-2)
+               -DD_COMPILER="${DMD}"
+               -DLDC_WITH_LLD=OFF
+       )
+       use static-libs && mycmakeargs+=( -DBUILD_SHARED_LIBS=BOTH ) || 
mycmakeargs+=( -DBUILD_SHARED_LIBS=ON )
+       use abi_x86_32 && use abi_x86_64 && mycmakeargs+=( -DMULTILIB=ON )
+       detect_hardened && mycmakeargs+=( -DADDITIONAL_DEFAULT_LDC_SWITCHES=' 
"-relocation-model=pic",' )
+       cmake_src_configure
+}
+
+d_src_compile()
+{
+       cmake_src_compile
+}
+
+d_src_install() {
+       cmake_src_install
+
+       rm -rf "${ED}"/usr/share/bash-completion
+}
+
+pkg_postinst() {
+       # Update active ldc2
+       "${ROOT}"/usr/bin/eselect dlang update ldc2
+}
+
+pkg_postrm() {
+       "${ROOT}"/usr/bin/eselect dlang update ldc2
+}

diff --git a/dev-lang/ldc2/ldc2-1.26.0-r1.ebuild 
b/dev-lang/ldc2/ldc2-1.26.0-r1.ebuild
new file mode 100644
index 0000000..1171863
--- /dev/null
+++ b/dev-lang/ldc2/ldc2-1.26.0-r1.ebuild
@@ -0,0 +1,83 @@
+# Copyright 1999-2021 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+inherit multilib-build cmake llvm
+
+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 ~arm ~arm64 ~ppc64 ~x86"
+LICENSE="BSD"
+SLOT="$(ver_cut 1-2)/$(ver_cut 3)"
+
+IUSE="static-libs"
+
+# We support LLVM 6.0 through 10.
+RDEPEND="dev-util/ninja
+       || (
+               sys-devel/llvm:10
+               sys-devel/llvm:11
+               sys-devel/llvm:12
+       )
+       <sys-devel/llvm-13:=
+       >=app-eselect/eselect-dlang-20140709"
+DEPEND="${RDEPEND}"
+LLVM_MAX_SLOT=12
+PATCHES="${FILESDIR}/ldc2-1.15.0-link-defaultlib-shared.patch"
+
+# For now, we support amd64 multilib. Anyone is free to add more support here.
+MULTILIB_COMPAT=( abi_x86_{32,64} )
+
+DLANG_VERSION_RANGE="2.075-"
+DLANG_PACKAGE_TYPE="single"
+
+inherit dlang
+
+detect_hardened() {
+       gcc --version | grep -o Hardened
+}
+
+src_prepare() {
+       cmake_src_prepare
+}
+
+d_src_configure() {
+       # Make sure libphobos2 is installed into ldc2's directory.
+       export LIBDIR_${ABI}="${LIBDIR_HOST}"
+       local mycmakeargs=(
+               -DD_VERSION=2
+               -DCMAKE_INSTALL_PREFIX=/usr/lib/ldc2/$(ver_cut 1-2)
+               -DD_COMPILER="${DMD}"
+               -DLDC_WITH_LLD=OFF
+       )
+       use static-libs && mycmakeargs+=( -DBUILD_SHARED_LIBS=BOTH ) || 
mycmakeargs+=( -DBUILD_SHARED_LIBS=ON )
+       use abi_x86_32 && use abi_x86_64 && mycmakeargs+=( -DMULTILIB=ON )
+       detect_hardened && mycmakeargs+=( -DADDITIONAL_DEFAULT_LDC_SWITCHES=' 
"-relocation-model=pic",' )
+       cmake_src_configure
+}
+
+d_src_compile()
+{
+       cmake_src_compile
+}
+
+d_src_install() {
+       cmake_src_install
+
+       rm -rf "${ED}"/usr/share/bash-completion
+}
+
+pkg_postinst() {
+       # Update active ldc2
+       "${ROOT}"/usr/bin/eselect dlang update ldc2
+}
+
+pkg_postrm() {
+       "${ROOT}"/usr/bin/eselect dlang update ldc2
+}

Reply via email to