1 # Copyright 1999-2019 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
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 )
11 inherit cmake-utils llvm multiprocessing python-single-r1 \
15 LLVM_P=llvm-${PV/_/}.src
17 DESCRIPTION="The LLVM debugger"
18 HOMEPAGE="https://llvm.org/"
19 SRC_URI="https://releases.llvm.org/${PV/_//}/${MY_P}.tar.xz
20 test? ( https://releases.llvm.org/${PV/_//}/${LLVM_P}.tar.xz )"
24 KEYWORDS="amd64 arm64 x86"
25 IUSE="libedit ncurses +python test"
26 # Tests are known to fail, and we are not going to address the failures
31 libedit? ( dev-libs/libedit:0= )
32 ncurses? ( >=sys-libs/ncurses-5.9-r3:0= )
33 python? ( dev-python/six[${PYTHON_USEDEP}]
35 ~sys-devel/clang-${PV}[xml]
39 python? ( >=dev-lang/swig-3.0.11 )
40 test? ( ~dev-python/lit-${PV}[${PYTHON_USEDEP}] )
43 REQUIRED_USE=${PYTHON_REQUIRED_USE}
47 # least intrusive of all
48 CMAKE_BUILD_TYPE=RelWithDebInfo
51 LLVM_MAX_SLOT=${PV%%.*} llvm_pkg_setup
52 python-single-r1_pkg_setup
56 einfo "Unpacking ${MY_P}.tar.xz ..."
57 tar -xf "${DISTDIR}/${MY_P}.tar.xz" || die
60 einfo "Unpacking parts of ${LLVM_P}.tar.xz ..."
61 tar -xf "${DISTDIR}/${LLVM_P}.tar.xz" \
62 "${LLVM_P}"/{lib/Testing/Support,utils/unittest} || die
63 mv "${LLVM_P}" llvm || die
69 -DLLDB_DISABLE_CURSES=$(usex !ncurses)
70 -DLLDB_DISABLE_LIBEDIT=$(usex !libedit)
71 -DLLDB_DISABLE_PYTHON=$(usex !python)
72 -DLLDB_USE_SYSTEM_SIX=1
73 -DLLVM_ENABLE_TERMINFO=$(usex ncurses)
75 -DLLDB_INCLUDE_TESTS=$(usex test)
77 # TODO: fix upstream to detect this properly
81 # normally we'd have to set LLVM_ENABLE_TERMINFO, HAVE_TERMINFO
82 # and TERMINFO_LIBS... so just force FindCurses.cmake to use
83 # ncurses with complete library set (including autodetection
85 -DCURSES_NEED_NCURSES=ON
87 use test && mycmakeargs+=(
88 -DLLVM_BUILD_TESTS=$(usex test)
89 # compilers for lit tests
90 -DLLDB_TEST_C_COMPILER="$(type -P clang)"
91 -DLLDB_TEST_CXX_COMPILER="$(type -P clang++)"
93 -DLLVM_MAIN_SRC_DIR="${WORKDIR}/llvm"
94 -DLLVM_EXTERNAL_LIT="${EPREFIX}/usr/bin/lit"
95 -DLLVM_LIT_ARGS="-vv;-j;${LIT_JOBS:-$(makeopts_jobs "${MAKEOPTS}" "$(get_nproc)")}"
98 cmake-utils_src_configure
102 cmake-utils_src_make check-lldb-lit
103 use python && cmake-utils_src_make check-lldb
107 cmake-utils_src_install
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
117 # byte-compile the modules