sys-devel/lld: Bump -9999 to EAPI 7
[gentoo.git] / sys-devel / lld / lld-9999.ebuild
1 # Copyright 1999-2019 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=7
5
6 : ${CMAKE_MAKEFILE_GENERATOR:=ninja}
7 # (needed due to CMAKE_BUILD_TYPE != Gentoo)
8 CMAKE_MIN_VERSION=3.7.0-r1
9 PYTHON_COMPAT=( python{2_7,3_{5,6,7}} )
10
11 inherit cmake-utils git-r3 llvm multiprocessing python-any-r1
12
13 DESCRIPTION="The LLVM linker (link editor)"
14 HOMEPAGE="https://llvm.org/"
15 SRC_URI=""
16 EGIT_REPO_URI="https://git.llvm.org/git/lld.git
17         https://github.com/llvm-mirror/lld.git"
18
19 LICENSE="UoI-NCSA"
20 SLOT="0"
21 KEYWORDS=""
22 IUSE="test"
23 RESTRICT="!test? ( test )"
24
25 RDEPEND="~sys-devel/llvm-${PV}"
26 DEPEND="${RDEPEND}
27         test? ( $(python_gen_any_dep "~dev-python/lit-${PV}[\${PYTHON_USEDEP}]") )"
28
29 # least intrusive of all
30 CMAKE_BUILD_TYPE=RelWithDebInfo
31
32 python_check_deps() {
33         has_version "dev-python/lit[${PYTHON_USEDEP}]"
34 }
35
36 pkg_setup() {
37         llvm_pkg_setup
38         use test && python-any-r1_pkg_setup
39 }
40
41 src_unpack() {
42         if use test; then
43                 # needed for patched gtest
44                 git-r3_fetch "https://git.llvm.org/git/llvm.git
45                         https://github.com/llvm-mirror/llvm.git"
46         fi
47         git-r3_fetch
48
49         if use test; then
50                 git-r3_checkout https://llvm.org/git/llvm.git \
51                         "${WORKDIR}"/llvm '' utils/{lit,unittest}
52         fi
53         git-r3_checkout
54 }
55
56 src_configure() {
57         local mycmakeargs=(
58                 -DBUILD_SHARED_LIBS=ON
59
60                 -DLLVM_INCLUDE_TESTS=$(usex test)
61         )
62         use test && mycmakeargs+=(
63                 -DLLVM_BUILD_TESTS=ON
64                 -DLLVM_MAIN_SRC_DIR="${WORKDIR}/llvm"
65                 -DLLVM_EXTERNAL_LIT="${EPREFIX}/usr/bin/lit"
66                 -DLLVM_LIT_ARGS="-vv;-j;${LIT_JOBS:-$(makeopts_jobs "${MAKEOPTS}" "$(get_nproc)")}"
67         )
68
69         cmake-utils_src_configure
70 }
71
72 src_test() {
73         local -x LIT_PRESERVES_TMP=1
74         cmake-utils_src_make check-lld
75 }