media-sound/asunder: Revbump to handle .desktop file properly.
[gentoo.git] / dev-util / lldb / lldb-9999.ebuild
1 # Copyright 1999-2017 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=6
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=( python2_7 )
10
11 inherit cmake-utils git-r3 llvm python-single-r1 toolchain-funcs
12
13 DESCRIPTION="The LLVM debugger"
14 HOMEPAGE="https://llvm.org/"
15 SRC_URI=""
16 EGIT_REPO_URI="https://git.llvm.org/git/lldb.git
17         https://github.com/llvm-mirror/lldb.git"
18
19 LICENSE="UoI-NCSA"
20 SLOT="0"
21 KEYWORDS=""
22 IUSE="libedit ncurses python test"
23
24 RDEPEND="
25         libedit? ( dev-libs/libedit:0= )
26         ncurses? ( >=sys-libs/ncurses-5.9-r3:0= )
27         python? ( dev-python/six[${PYTHON_USEDEP}]
28                 ${PYTHON_DEPS} )
29         ~sys-devel/clang-${PV}[xml]
30         ~sys-devel/llvm-${PV}
31         !<sys-devel/llvm-4.0"
32 # swig-3.0.9+ generates invalid wrappers, #598708
33 # upstream: https://github.com/swig/swig/issues/769
34 DEPEND="${RDEPEND}
35         python? ( <dev-lang/swig-3.0.9 )
36         test? ( ~dev-python/lit-${PV}[${PYTHON_USEDEP}] )
37         ${PYTHON_DEPS}"
38
39 REQUIRED_USE=${PYTHON_REQUIRED_USE}
40
41 # least intrusive of all
42 CMAKE_BUILD_TYPE=RelWithDebInfo
43
44 pkg_setup() {
45         llvm_pkg_setup
46         python-single-r1_pkg_setup
47 }
48
49 src_unpack() {
50         if use test; then
51                 # needed for patched gtest
52                 git-r3_fetch "https://git.llvm.org/git/llvm.git
53                         https://github.com/llvm-mirror/llvm.git"
54         fi
55         git-r3_fetch
56
57         if use test; then
58                 git-r3_checkout https://llvm.org/git/llvm.git \
59                         "${WORKDIR}"/llvm
60         fi
61         git-r3_checkout
62 }
63
64 src_configure() {
65         local mycmakeargs=(
66                 -DLLDB_DISABLE_CURSES=$(usex !ncurses)
67                 -DLLDB_DISABLE_LIBEDIT=$(usex !libedit)
68                 -DLLDB_DISABLE_PYTHON=$(usex !python)
69                 -DLLVM_ENABLE_TERMINFO=$(usex ncurses)
70
71                 -DLLDB_INCLUDE_TESTS=$(usex test)
72                 -DLLVM_BUILD_TESTS=$(usex test)
73                 # compilers for lit tests
74                 -DLLDB_TEST_C_COMPILER="$(type -P clang)"
75                 -DLLDB_TEST_CXX_COMPILER="$(type -P clang++)"
76                 # compiler for ole' python tests
77                 -DLLDB_TEST_COMPILER="$(type -P clang)"
78
79                 # TODO: fix upstream to detect this properly
80                 -DHAVE_LIBDL=ON
81                 -DHAVE_LIBPTHREAD=ON
82
83                 # normally we'd have to set LLVM_ENABLE_TERMINFO, HAVE_TERMINFO
84                 # and TERMINFO_LIBS... so just force FindCurses.cmake to use
85                 # ncurses with complete library set (including autodetection
86                 # of -ltinfo)
87                 -DCURSES_NEED_NCURSES=ON
88         )
89         use test && mycmakeargs+=(
90                 -DLLVM_MAIN_SRC_DIR="${WORKDIR}/llvm"
91                 -DLLVM_EXTERNAL_LIT="${EPREFIX}/usr/bin/lit"
92                 -DLLVM_LIT_ARGS="-vv"
93         )
94
95         cmake-utils_src_configure
96 }
97
98 src_test() {
99         cmake-utils_src_make check-lldb-lit
100         use python && cmake-utils_src_make check-lldb
101 }
102
103 src_install() {
104         cmake-utils_src_install
105
106         # oh my...
107         if use python; then
108                 # remove bundled six module
109                 rm "${D}$(python_get_sitedir)/six.py" || die
110
111                 # remove custom readline.so for now
112                 # TODO: figure out how to deal with it
113                 # upstream is basically building a custom readline.so with -ledit
114                 # to avoid symbol collisions between readline and libedit...
115                 rm "${D}$(python_get_sitedir)/readline.so" || die
116
117                 # byte-compile the modules
118                 python_optimize
119         fi
120 }