aboutsummaryrefslogtreecommitdiff
blob: 3ae9826a427c6fe8cb0ffc2f8cc1c3891d1f11af (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# Copyright 1999-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

inherit cmake

MY_POSTFIX="${PN}-v${PV}"

DESCRIPTION="The OpenCilk concurrency platform for parallel programming"
HOMEPAGE="https://opencilk.org/"

p=https://github.com/OpenCilk
SRC_URI="
	${p}/opencilk-project/archive/refs/tags/opencilk/v${PV}.tar.gz -> ${PN}-project-${PV}.tar.gz
	${p}/cheetah/archive/refs/tags/opencilk/v${PV}.tar.gz -> ${PN}-cheetah-${PV}.tar.gz
	${p}/productivity-tools/archive/refs/tags/opencilk/v${PV}.tar.gz -> ${PN}-productivity-tools-${PV}.tar.gz
"

S="${WORKDIR}/${PN}-project-${MY_POSTFIX}"

# Since opencilk-project is a fork of LLVM 12, this lists the licenses
# of LLVM 12, while opencilk-project states that it us under "MIT with
# the OpenCilk Addendum", which basically states that you can
# distributed it under the LLVM licences. I am also not sure if OpenCilk
# is able to change the license of LLVM (which source code they use),
# hence this needs more investigation and we only list t he LLVM 12
# licenses, because those definetly are correct.
LICENSE="Apache-2.0-with-LLVM-exceptions UoI-NCSA BSD public-domain rc"
SLOT="0"
KEYWORDS="~amd64"

IUSE="debug"

CMAKE_USE_DIR="${S}/llvm"

RDEPEND="
	dev-libs/libxml2
	sys-libs/ncurses:=
	sys-libs/zlib
"

src_prepare() {
	local -A symlinks
	symlinks["${S}/cheetah"]="${WORKDIR}/cheetah-${MY_POSTFIX}"
	symlinks["${S}/cilktools"]="${WORKDIR}/productivity-tools-${MY_POSTFIX}"

	local link target
	for link in "${!symlinks[@]}"; do
		target="${symlinks[${link}]}"
		ln -rs "${target}" "${link}" || die
	done

	cmake_src_prepare
}

src_configure() {
	local libdir=$(get_libdir)
	local mycmakeargs=(
		-DLLVM_ENABLE_PROJECTS="clang;compiler-rt"
		-DLLVM_ENABLE_RUNTIMES="cheetah;cilktools"
		-DLLVM_TARGETS_TO_BUILD=host
		-DLLVM_ENABLE_ASSERTIONS=$(usex debug)
		-DCMAKE_INSTALL_PREFIX="${EPREFIX}/opt/${P}"
		-DLLVM_LIBDIR_SUFFIX=${libdir#lib}
		-DBUILD_SHARED_LIBS=OFF
		-DLLVM_HOST_TRIPLE="${CHOST}"
	)
	cmake_src_configure
}

src_compile() {
	# It appears there is a missing dependency declaration in OpenCilk's
	# cmake build where llvm-link not getting build, leading to
	# LLVM_LINK-NOTFOUND spilling into the make/ninja generator
	# files. Ensure that llvm-link is always build.
	cmake_build llvm-link

	cmake_build
}

src_install() {
	cmake_src_install
	# Do not install man pages which may conflict with llvm/clang/etc.
	rm "${ED}/usr/share/man/man1/scan-build.1" || die
}