Skip to content

Commit b7d767c

Browse files
committed
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.
1 parent fc108c1 commit b7d767c

File tree

3 files changed

+248
-0
lines changed

3 files changed

+248
-0
lines changed

dev-lang/ldc2/ldc2-1.24.0-r2.ebuild

+82
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
# Copyright 1999-2021 Gentoo Authors
2+
# Distributed under the terms of the GNU General Public License v2
3+
4+
EAPI=7
5+
6+
inherit multilib-build cmake llvm
7+
8+
MY_PV="${PV//_/-}"
9+
MY_P="ldc-${MY_PV}-src"
10+
SRC_URI="https://github.com/ldc-developers/ldc/releases/download/v${MY_PV}/${MY_P}.tar.gz"
11+
S=${WORKDIR}/${MY_P}
12+
13+
DESCRIPTION="LLVM D Compiler"
14+
HOMEPAGE="https://github.com/ldc-developers/ldc"
15+
KEYWORDS="~amd64 ~arm ~arm64 ~ppc64 ~x86"
16+
LICENSE="BSD"
17+
SLOT="$(ver_cut 1-2)/$(ver_cut 3)"
18+
19+
IUSE="static-libs"
20+
21+
# We support LLVM 6.0 through 10.
22+
RDEPEND="dev-util/ninja
23+
|| (
24+
sys-devel/llvm:10
25+
sys-devel/llvm:11
26+
)
27+
<sys-devel/llvm-12:=
28+
>=app-eselect/eselect-dlang-20140709"
29+
DEPEND="${RDEPEND}"
30+
LLVM_MAX_SLOT=10
31+
PATCHES="${FILESDIR}/ldc2-1.15.0-link-defaultlib-shared.patch"
32+
33+
# For now, we support amd64 multilib. Anyone is free to add more support here.
34+
MULTILIB_COMPAT=( abi_x86_{32,64} )
35+
36+
DLANG_VERSION_RANGE="2.075-"
37+
DLANG_PACKAGE_TYPE="single"
38+
39+
inherit dlang
40+
41+
detect_hardened() {
42+
gcc --version | grep -o Hardened
43+
}
44+
45+
src_prepare() {
46+
cmake_src_prepare
47+
}
48+
49+
d_src_configure() {
50+
# Make sure libphobos2 is installed into ldc2's directory.
51+
export LIBDIR_${ABI}="${LIBDIR_HOST}"
52+
local mycmakeargs=(
53+
-DD_VERSION=2
54+
-DCMAKE_INSTALL_PREFIX=/usr/lib/ldc2/$(ver_cut 1-2)
55+
-DD_COMPILER="${DMD}"
56+
-DLDC_WITH_LLD=OFF
57+
)
58+
use static-libs && mycmakeargs+=( -DBUILD_SHARED_LIBS=BOTH ) || mycmakeargs+=( -DBUILD_SHARED_LIBS=ON )
59+
use abi_x86_32 && use abi_x86_64 && mycmakeargs+=( -DMULTILIB=ON )
60+
detect_hardened && mycmakeargs+=( -DADDITIONAL_DEFAULT_LDC_SWITCHES=' "-relocation-model=pic",' )
61+
cmake_src_configure
62+
}
63+
64+
d_src_compile()
65+
{
66+
cmake_src_compile
67+
}
68+
69+
d_src_install() {
70+
cmake_src_install
71+
72+
rm -rf "${ED}"/usr/share/bash-completion
73+
}
74+
75+
pkg_postinst() {
76+
# Update active ldc2
77+
"${ROOT}"/usr/bin/eselect dlang update ldc2
78+
}
79+
80+
pkg_postrm() {
81+
"${ROOT}"/usr/bin/eselect dlang update ldc2
82+
}

dev-lang/ldc2/ldc2-1.25.1-r1.ebuild

+83
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
# Copyright 1999-2021 Gentoo Authors
2+
# Distributed under the terms of the GNU General Public License v2
3+
4+
EAPI=7
5+
6+
inherit multilib-build cmake llvm
7+
8+
MY_PV="${PV//_/-}"
9+
MY_P="ldc-${MY_PV}-src"
10+
SRC_URI="https://github.com/ldc-developers/ldc/releases/download/v${MY_PV}/${MY_P}.tar.gz"
11+
S=${WORKDIR}/${MY_P}
12+
13+
DESCRIPTION="LLVM D Compiler"
14+
HOMEPAGE="https://github.com/ldc-developers/ldc"
15+
KEYWORDS="~amd64 ~arm ~arm64 ~ppc64 ~x86"
16+
LICENSE="BSD"
17+
SLOT="$(ver_cut 1-2)/$(ver_cut 3)"
18+
19+
IUSE="static-libs"
20+
21+
# We support LLVM 6.0 through 10.
22+
RDEPEND="dev-util/ninja
23+
|| (
24+
sys-devel/llvm:10
25+
sys-devel/llvm:11
26+
sys-devel/llvm:12
27+
)
28+
<sys-devel/llvm-13:=
29+
>=app-eselect/eselect-dlang-20140709"
30+
DEPEND="${RDEPEND}"
31+
LLVM_MAX_SLOT=10
32+
PATCHES="${FILESDIR}/ldc2-1.15.0-link-defaultlib-shared.patch"
33+
34+
# For now, we support amd64 multilib. Anyone is free to add more support here.
35+
MULTILIB_COMPAT=( abi_x86_{32,64} )
36+
37+
DLANG_VERSION_RANGE="2.075-"
38+
DLANG_PACKAGE_TYPE="single"
39+
40+
inherit dlang
41+
42+
detect_hardened() {
43+
gcc --version | grep -o Hardened
44+
}
45+
46+
src_prepare() {
47+
cmake_src_prepare
48+
}
49+
50+
d_src_configure() {
51+
# Make sure libphobos2 is installed into ldc2's directory.
52+
export LIBDIR_${ABI}="${LIBDIR_HOST}"
53+
local mycmakeargs=(
54+
-DD_VERSION=2
55+
-DCMAKE_INSTALL_PREFIX=/usr/lib/ldc2/$(ver_cut 1-2)
56+
-DD_COMPILER="${DMD}"
57+
-DLDC_WITH_LLD=OFF
58+
)
59+
use static-libs && mycmakeargs+=( -DBUILD_SHARED_LIBS=BOTH ) || mycmakeargs+=( -DBUILD_SHARED_LIBS=ON )
60+
use abi_x86_32 && use abi_x86_64 && mycmakeargs+=( -DMULTILIB=ON )
61+
detect_hardened && mycmakeargs+=( -DADDITIONAL_DEFAULT_LDC_SWITCHES=' "-relocation-model=pic",' )
62+
cmake_src_configure
63+
}
64+
65+
d_src_compile()
66+
{
67+
cmake_src_compile
68+
}
69+
70+
d_src_install() {
71+
cmake_src_install
72+
73+
rm -rf "${ED}"/usr/share/bash-completion
74+
}
75+
76+
pkg_postinst() {
77+
# Update active ldc2
78+
"${ROOT}"/usr/bin/eselect dlang update ldc2
79+
}
80+
81+
pkg_postrm() {
82+
"${ROOT}"/usr/bin/eselect dlang update ldc2
83+
}

dev-lang/ldc2/ldc2-1.26.0-r1.ebuild

+83
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
# Copyright 1999-2021 Gentoo Authors
2+
# Distributed under the terms of the GNU General Public License v2
3+
4+
EAPI=7
5+
6+
inherit multilib-build cmake llvm
7+
8+
MY_PV="${PV//_/-}"
9+
MY_P="ldc-${MY_PV}-src"
10+
SRC_URI="https://github.com/ldc-developers/ldc/releases/download/v${MY_PV}/${MY_P}.tar.gz"
11+
S=${WORKDIR}/${MY_P}
12+
13+
DESCRIPTION="LLVM D Compiler"
14+
HOMEPAGE="https://github.com/ldc-developers/ldc"
15+
KEYWORDS="~amd64 ~arm ~arm64 ~ppc64 ~x86"
16+
LICENSE="BSD"
17+
SLOT="$(ver_cut 1-2)/$(ver_cut 3)"
18+
19+
IUSE="static-libs"
20+
21+
# We support LLVM 6.0 through 10.
22+
RDEPEND="dev-util/ninja
23+
|| (
24+
sys-devel/llvm:10
25+
sys-devel/llvm:11
26+
sys-devel/llvm:12
27+
)
28+
<sys-devel/llvm-13:=
29+
>=app-eselect/eselect-dlang-20140709"
30+
DEPEND="${RDEPEND}"
31+
LLVM_MAX_SLOT=10
32+
PATCHES="${FILESDIR}/ldc2-1.15.0-link-defaultlib-shared.patch"
33+
34+
# For now, we support amd64 multilib. Anyone is free to add more support here.
35+
MULTILIB_COMPAT=( abi_x86_{32,64} )
36+
37+
DLANG_VERSION_RANGE="2.075-"
38+
DLANG_PACKAGE_TYPE="single"
39+
40+
inherit dlang
41+
42+
detect_hardened() {
43+
gcc --version | grep -o Hardened
44+
}
45+
46+
src_prepare() {
47+
cmake_src_prepare
48+
}
49+
50+
d_src_configure() {
51+
# Make sure libphobos2 is installed into ldc2's directory.
52+
export LIBDIR_${ABI}="${LIBDIR_HOST}"
53+
local mycmakeargs=(
54+
-DD_VERSION=2
55+
-DCMAKE_INSTALL_PREFIX=/usr/lib/ldc2/$(ver_cut 1-2)
56+
-DD_COMPILER="${DMD}"
57+
-DLDC_WITH_LLD=OFF
58+
)
59+
use static-libs && mycmakeargs+=( -DBUILD_SHARED_LIBS=BOTH ) || mycmakeargs+=( -DBUILD_SHARED_LIBS=ON )
60+
use abi_x86_32 && use abi_x86_64 && mycmakeargs+=( -DMULTILIB=ON )
61+
detect_hardened && mycmakeargs+=( -DADDITIONAL_DEFAULT_LDC_SWITCHES=' "-relocation-model=pic",' )
62+
cmake_src_configure
63+
}
64+
65+
d_src_compile()
66+
{
67+
cmake_src_compile
68+
}
69+
70+
d_src_install() {
71+
cmake_src_install
72+
73+
rm -rf "${ED}"/usr/share/bash-completion
74+
}
75+
76+
pkg_postinst() {
77+
# Update active ldc2
78+
"${ROOT}"/usr/bin/eselect dlang update ldc2
79+
}
80+
81+
pkg_postrm() {
82+
"${ROOT}"/usr/bin/eselect dlang update ldc2
83+
}

0 commit comments

Comments
 (0)