1 |
commit: 4baf1e5c66e8ecdf33d45c38dde2ab8b286be63b |
2 |
Author: Michał Górny <mgorny <AT> gentoo <DOT> org> |
3 |
AuthorDate: Wed Jan 16 13:50:01 2019 +0000 |
4 |
Commit: Michał Górny <mgorny <AT> gentoo <DOT> org> |
5 |
CommitDate: Wed Jan 16 14:52:27 2019 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=4baf1e5c |
7 |
|
8 |
sys-devel/llvm: Add a live ebuild for 8.* branch |
9 |
|
10 |
Signed-off-by: Michał Górny <mgorny <AT> gentoo.org> |
11 |
|
12 |
sys-devel/llvm/llvm-8.0.9999.ebuild | 285 ++++++++++++++++++++++++++++++++++++ |
13 |
1 file changed, 285 insertions(+) |
14 |
|
15 |
diff --git a/sys-devel/llvm/llvm-8.0.9999.ebuild b/sys-devel/llvm/llvm-8.0.9999.ebuild |
16 |
new file mode 100644 |
17 |
index 00000000000..b31f34a9105 |
18 |
--- /dev/null |
19 |
+++ b/sys-devel/llvm/llvm-8.0.9999.ebuild |
20 |
@@ -0,0 +1,285 @@ |
21 |
+# Copyright 1999-2019 Gentoo Authors |
22 |
+# Distributed under the terms of the GNU General Public License v2 |
23 |
+ |
24 |
+EAPI=6 |
25 |
+ |
26 |
+: ${CMAKE_MAKEFILE_GENERATOR:=ninja} |
27 |
+# (needed due to CMAKE_BUILD_TYPE != Gentoo) |
28 |
+CMAKE_MIN_VERSION=3.7.0-r1 |
29 |
+PYTHON_COMPAT=( python2_7 ) |
30 |
+ |
31 |
+inherit cmake-utils eapi7-ver flag-o-matic git-r3 multilib-minimal \ |
32 |
+ multiprocessing pax-utils python-any-r1 toolchain-funcs |
33 |
+ |
34 |
+DESCRIPTION="Low Level Virtual Machine" |
35 |
+HOMEPAGE="https://llvm.org/" |
36 |
+SRC_URI="" |
37 |
+EGIT_REPO_URI="https://git.llvm.org/git/llvm.git |
38 |
+ https://github.com/llvm-mirror/llvm.git" |
39 |
+EGIT_BRANCH="release_80" |
40 |
+ |
41 |
+# Keep in sync with CMakeLists.txt |
42 |
+ALL_LLVM_TARGETS=( AArch64 AMDGPU ARM BPF Hexagon Lanai Mips MSP430 |
43 |
+ NVPTX PowerPC Sparc SystemZ X86 XCore ) |
44 |
+ALL_LLVM_TARGETS=( "${ALL_LLVM_TARGETS[@]/#/llvm_targets_}" ) |
45 |
+ |
46 |
+# Additional licenses: |
47 |
+# 1. OpenBSD regex: Henry Spencer's license ('rc' in Gentoo) + BSD. |
48 |
+# 2. ARM backend: LLVM Software Grant by ARM. |
49 |
+# 3. MD5 code: public-domain. |
50 |
+# 4. Tests (not installed): |
51 |
+# a. gtest: BSD. |
52 |
+# b. YAML tests: MIT. |
53 |
+ |
54 |
+LICENSE="UoI-NCSA rc BSD public-domain |
55 |
+ llvm_targets_ARM? ( LLVM-Grant )" |
56 |
+SLOT="$(ver_cut 1)" |
57 |
+KEYWORDS="" |
58 |
+IUSE="debug doc exegesis gold libedit +libffi ncurses test xar xml |
59 |
+ kernel_Darwin ${ALL_LLVM_TARGETS[*]}" |
60 |
+RESTRICT="!test? ( test )" |
61 |
+ |
62 |
+RDEPEND=" |
63 |
+ sys-libs/zlib:0= |
64 |
+ exegesis? ( dev-libs/libpfm:= ) |
65 |
+ gold? ( >=sys-devel/binutils-2.22:*[cxx] ) |
66 |
+ libedit? ( dev-libs/libedit:0=[${MULTILIB_USEDEP}] ) |
67 |
+ libffi? ( >=virtual/libffi-3.0.13-r1:0=[${MULTILIB_USEDEP}] ) |
68 |
+ ncurses? ( >=sys-libs/ncurses-5.9-r3:0=[${MULTILIB_USEDEP}] ) |
69 |
+ xar? ( app-arch/xar ) |
70 |
+ xml? ( dev-libs/libxml2:2=[${MULTILIB_USEDEP}] )" |
71 |
+# configparser-3.2 breaks the build (3.3 or none at all are fine) |
72 |
+DEPEND="${RDEPEND} |
73 |
+ dev-lang/perl |
74 |
+ || ( >=sys-devel/gcc-3.0 >=sys-devel/llvm-3.5 |
75 |
+ ( >=sys-freebsd/freebsd-lib-9.1-r10 sys-libs/libcxx ) |
76 |
+ ) |
77 |
+ kernel_Darwin? ( |
78 |
+ <sys-libs/libcxx-$(ver_cut 1-3).9999 |
79 |
+ >=sys-devel/binutils-apple-5.1 |
80 |
+ ) |
81 |
+ doc? ( $(python_gen_any_dep ' |
82 |
+ dev-python/recommonmark[${PYTHON_USEDEP}] |
83 |
+ dev-python/sphinx[${PYTHON_USEDEP}] |
84 |
+ ') ) |
85 |
+ !doc? ( ${PYTHON_DEPS} ) |
86 |
+ gold? ( sys-libs/binutils-libs ) |
87 |
+ libffi? ( virtual/pkgconfig ) |
88 |
+ !!<dev-python/configparser-3.3.0.2 |
89 |
+ ${PYTHON_DEPS}" |
90 |
+# There are no file collisions between these versions but having :0 |
91 |
+# installed means llvm-config there will take precedence. |
92 |
+RDEPEND="${RDEPEND} |
93 |
+ !sys-devel/llvm:0" |
94 |
+PDEPEND="sys-devel/llvm-common |
95 |
+ gold? ( >=sys-devel/llvmgold-${SLOT} )" |
96 |
+ |
97 |
+REQUIRED_USE="${PYTHON_REQUIRED_USE} |
98 |
+ || ( ${ALL_LLVM_TARGETS[*]} )" |
99 |
+ |
100 |
+# least intrusive of all |
101 |
+CMAKE_BUILD_TYPE=RelWithDebInfo |
102 |
+ |
103 |
+python_check_deps() { |
104 |
+ use doc || return 0 |
105 |
+ |
106 |
+ has_version "dev-python/recommonmark[${PYTHON_USEDEP}]" && |
107 |
+ has_version "dev-python/sphinx[${PYTHON_USEDEP}]" |
108 |
+} |
109 |
+ |
110 |
+src_prepare() { |
111 |
+ # Fix llvm-config for shared linking and sane flags |
112 |
+ # https://bugs.gentoo.org/show_bug.cgi?id=565358 |
113 |
+ eapply "${FILESDIR}"/9999/0007-llvm-config-Clean-up-exported-values-update-for-shar.patch |
114 |
+ |
115 |
+ # disable use of SDK on OSX, bug #568758 |
116 |
+ sed -i -e 's/xcrun/false/' utils/lit/lit/util.py || die |
117 |
+ |
118 |
+ # User patches + QA |
119 |
+ cmake-utils_src_prepare |
120 |
+} |
121 |
+ |
122 |
+# Is LLVM being linked against libc++? |
123 |
+is_libcxx_linked() { |
124 |
+ local code='#include <ciso646> |
125 |
+#if defined(_LIBCPP_VERSION) |
126 |
+ HAVE_LIBCXX |
127 |
+#endif |
128 |
+' |
129 |
+ local out=$($(tc-getCXX) ${CXXFLAGS} ${CPPFLAGS} -x c++ -E -P - <<<"${code}") || return 1 |
130 |
+ |
131 |
+ [[ ${out} == *HAVE_LIBCXX* ]] |
132 |
+} |
133 |
+ |
134 |
+multilib_src_configure() { |
135 |
+ local ffi_cflags ffi_ldflags |
136 |
+ if use libffi; then |
137 |
+ ffi_cflags=$($(tc-getPKG_CONFIG) --cflags-only-I libffi) |
138 |
+ ffi_ldflags=$($(tc-getPKG_CONFIG) --libs-only-L libffi) |
139 |
+ fi |
140 |
+ |
141 |
+ local libdir=$(get_libdir) |
142 |
+ local mycmakeargs=( |
143 |
+ # disable appending VCS revision to the version to improve |
144 |
+ # direct cache hit ratio |
145 |
+ -DLLVM_APPEND_VC_REV=OFF |
146 |
+ -DCMAKE_INSTALL_PREFIX="${EPREFIX}/usr/lib/llvm/${SLOT}" |
147 |
+ -DLLVM_LIBDIR_SUFFIX=${libdir#lib} |
148 |
+ |
149 |
+ -DBUILD_SHARED_LIBS=ON |
150 |
+ -DLLVM_TARGETS_TO_BUILD="${LLVM_TARGETS// /;}" |
151 |
+ -DLLVM_BUILD_TESTS=$(usex test) |
152 |
+ |
153 |
+ -DLLVM_ENABLE_FFI=$(usex libffi) |
154 |
+ -DLLVM_ENABLE_LIBEDIT=$(usex libedit) |
155 |
+ -DLLVM_ENABLE_TERMINFO=$(usex ncurses) |
156 |
+ -DLLVM_ENABLE_LIBXML2=$(usex xml) |
157 |
+ -DLLVM_ENABLE_ASSERTIONS=$(usex debug) |
158 |
+ -DLLVM_ENABLE_LIBPFM=$(usex exegesis) |
159 |
+ -DLLVM_ENABLE_EH=ON |
160 |
+ -DLLVM_ENABLE_RTTI=ON |
161 |
+ |
162 |
+ -DWITH_POLLY=OFF # TODO |
163 |
+ |
164 |
+ -DLLVM_HOST_TRIPLE="${CHOST}" |
165 |
+ |
166 |
+ -DFFI_INCLUDE_DIR="${ffi_cflags#-I}" |
167 |
+ -DFFI_LIBRARY_DIR="${ffi_ldflags#-L}" |
168 |
+ # used only for llvm-objdump tool |
169 |
+ -DHAVE_LIBXAR=$(multilib_native_usex xar 1 0) |
170 |
+ |
171 |
+ # disable OCaml bindings (now in dev-ml/llvm-ocaml) |
172 |
+ -DOCAMLFIND=NO |
173 |
+ ) |
174 |
+ |
175 |
+ if is_libcxx_linked; then |
176 |
+ # Smart hack: alter version suffix -> SOVERSION when linking |
177 |
+ # against libc++. This way we won't end up mixing LLVM libc++ |
178 |
+ # libraries with libstdc++ clang, and the other way around. |
179 |
+ mycmakeargs+=( |
180 |
+ -DLLVM_VERSION_SUFFIX="libcxx" |
181 |
+ ) |
182 |
+ fi |
183 |
+ |
184 |
+# Note: go bindings have no CMake rules at the moment |
185 |
+# but let's kill the check in case they are introduced |
186 |
+# if ! multilib_is_native_abi || ! use go; then |
187 |
+ mycmakeargs+=( |
188 |
+ -DGO_EXECUTABLE=GO_EXECUTABLE-NOTFOUND |
189 |
+ ) |
190 |
+# fi |
191 |
+ |
192 |
+ use test && mycmakeargs+=( |
193 |
+ -DLLVM_LIT_ARGS="-vv;-j;${LIT_JOBS:-$(makeopts_jobs "${MAKEOPTS}" "$(get_nproc)")}" |
194 |
+ ) |
195 |
+ |
196 |
+ if multilib_is_native_abi; then |
197 |
+ mycmakeargs+=( |
198 |
+ -DLLVM_BUILD_DOCS=$(usex doc) |
199 |
+ -DLLVM_ENABLE_OCAMLDOC=OFF |
200 |
+ -DLLVM_ENABLE_SPHINX=$(usex doc) |
201 |
+ -DLLVM_ENABLE_DOXYGEN=OFF |
202 |
+ -DLLVM_INSTALL_UTILS=ON |
203 |
+ ) |
204 |
+ use doc && mycmakeargs+=( |
205 |
+ -DCMAKE_INSTALL_MANDIR="${EPREFIX}/usr/lib/llvm/${SLOT}/share/man" |
206 |
+ -DLLVM_INSTALL_SPHINX_HTML_DIR="${EPREFIX}/usr/share/doc/${PF}/html" |
207 |
+ -DSPHINX_WARNINGS_AS_ERRORS=OFF |
208 |
+ ) |
209 |
+ use gold && mycmakeargs+=( |
210 |
+ -DLLVM_BINUTILS_INCDIR="${EPREFIX}"/usr/include |
211 |
+ ) |
212 |
+ fi |
213 |
+ |
214 |
+ if tc-is-cross-compiler; then |
215 |
+ local tblgen="${EPREFIX}/usr/lib/llvm/${SLOT}/bin/llvm-tblgen" |
216 |
+ [[ -x "${tblgen}" ]] \ |
217 |
+ || die "${tblgen} not found or usable" |
218 |
+ mycmakeargs+=( |
219 |
+ -DCMAKE_CROSSCOMPILING=ON |
220 |
+ -DLLVM_TABLEGEN="${tblgen}" |
221 |
+ ) |
222 |
+ fi |
223 |
+ |
224 |
+ # workaround BMI bug in gcc-7 (fixed in 7.4) |
225 |
+ # https://bugs.gentoo.org/649880 |
226 |
+ # apply only to x86, https://bugs.gentoo.org/650506 |
227 |
+ if tc-is-gcc && [[ ${MULTILIB_ABI_FLAG} == abi_x86* ]] && |
228 |
+ [[ $(gcc-major-version) -eq 7 && $(gcc-minor-version) -lt 4 ]] |
229 |
+ then |
230 |
+ local CFLAGS="${CFLAGS} -mno-bmi" |
231 |
+ local CXXFLAGS="${CXXFLAGS} -mno-bmi" |
232 |
+ fi |
233 |
+ |
234 |
+ # LLVM_ENABLE_ASSERTIONS=NO does not guarantee this for us, #614844 |
235 |
+ use debug || local -x CPPFLAGS="${CPPFLAGS} -DNDEBUG" |
236 |
+ cmake-utils_src_configure |
237 |
+} |
238 |
+ |
239 |
+multilib_src_compile() { |
240 |
+ cmake-utils_src_compile |
241 |
+ |
242 |
+ pax-mark m "${BUILD_DIR}"/bin/llvm-rtdyld |
243 |
+ pax-mark m "${BUILD_DIR}"/bin/lli |
244 |
+ pax-mark m "${BUILD_DIR}"/bin/lli-child-target |
245 |
+ |
246 |
+ if use test; then |
247 |
+ pax-mark m "${BUILD_DIR}"/unittests/ExecutionEngine/Orc/OrcJITTests |
248 |
+ pax-mark m "${BUILD_DIR}"/unittests/ExecutionEngine/MCJIT/MCJITTests |
249 |
+ pax-mark m "${BUILD_DIR}"/unittests/Support/SupportTests |
250 |
+ fi |
251 |
+} |
252 |
+ |
253 |
+multilib_src_test() { |
254 |
+ # respect TMPDIR! |
255 |
+ local -x LIT_PRESERVES_TMP=1 |
256 |
+ cmake-utils_src_make check |
257 |
+} |
258 |
+ |
259 |
+src_install() { |
260 |
+ local MULTILIB_CHOST_TOOLS=( |
261 |
+ /usr/lib/llvm/${SLOT}/bin/llvm-config |
262 |
+ ) |
263 |
+ |
264 |
+ local MULTILIB_WRAPPED_HEADERS=( |
265 |
+ /usr/include/llvm/Config/llvm-config.h |
266 |
+ ) |
267 |
+ |
268 |
+ local LLVM_LDPATHS=() |
269 |
+ multilib-minimal_src_install |
270 |
+ |
271 |
+ # move wrapped headers back |
272 |
+ mv "${ED%/}"/usr/include "${ED%/}"/usr/lib/llvm/${SLOT}/include || die |
273 |
+} |
274 |
+ |
275 |
+multilib_src_install() { |
276 |
+ cmake-utils_src_install |
277 |
+ |
278 |
+ # move headers to /usr/include for wrapping |
279 |
+ rm -rf "${ED%/}"/usr/include || die |
280 |
+ mv "${ED%/}"/usr/lib/llvm/${SLOT}/include "${ED%/}"/usr/include || die |
281 |
+ |
282 |
+ LLVM_LDPATHS+=( "${EPREFIX}/usr/lib/llvm/${SLOT}/$(get_libdir)" ) |
283 |
+} |
284 |
+ |
285 |
+multilib_src_install_all() { |
286 |
+ local revord=$(( 9999 - ${SLOT} )) |
287 |
+ newenvd - "10llvm-${revord}" <<-_EOF_ |
288 |
+ PATH="${EPREFIX}/usr/lib/llvm/${SLOT}/bin" |
289 |
+ # we need to duplicate it in ROOTPATH for Portage to respect... |
290 |
+ ROOTPATH="${EPREFIX}/usr/lib/llvm/${SLOT}/bin" |
291 |
+ MANPATH="${EPREFIX}/usr/lib/llvm/${SLOT}/share/man" |
292 |
+ LDPATH="$( IFS=:; echo "${LLVM_LDPATHS[*]}" )" |
293 |
+ _EOF_ |
294 |
+ |
295 |
+ docompress "/usr/lib/llvm/${SLOT}/share/man" |
296 |
+} |
297 |
+ |
298 |
+pkg_postinst() { |
299 |
+ elog "You can find additional opt-viewer utility scripts in:" |
300 |
+ elog " ${EROOT%/}/usr/lib/llvm/${SLOT}/share/opt-viewer" |
301 |
+ elog "To use these scripts, you will need Python 2.7 along with the following" |
302 |
+ elog "packages:" |
303 |
+ elog " dev-python/pygments (for opt-viewer)" |
304 |
+ elog " dev-python/pyyaml (for all of them)" |
305 |
+} |