1 |
commit: 88614750d54f4fb38a26d775a44166eafe87f40a |
2 |
Author: Michał Górny <mgorny <AT> gentoo <DOT> org> |
3 |
AuthorDate: Wed Jan 3 20:18:15 2018 +0000 |
4 |
Commit: Michał Górny <mgorny <AT> gentoo <DOT> org> |
5 |
CommitDate: Wed Jan 3 22:21:35 2018 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=88614750 |
7 |
|
8 |
sys-devel/llvm: Add a live ebuild for 6.0 branch |
9 |
|
10 |
sys-devel/llvm/llvm-6.0.9999.ebuild | 231 ++++++++++++++++++++++++++++++++++++ |
11 |
1 file changed, 231 insertions(+) |
12 |
|
13 |
diff --git a/sys-devel/llvm/llvm-6.0.9999.ebuild b/sys-devel/llvm/llvm-6.0.9999.ebuild |
14 |
new file mode 100644 |
15 |
index 00000000000..0164813c3fc |
16 |
--- /dev/null |
17 |
+++ b/sys-devel/llvm/llvm-6.0.9999.ebuild |
18 |
@@ -0,0 +1,231 @@ |
19 |
+# Copyright 1999-2018 Gentoo Foundation |
20 |
+# Distributed under the terms of the GNU General Public License v2 |
21 |
+ |
22 |
+EAPI=6 |
23 |
+ |
24 |
+: ${CMAKE_MAKEFILE_GENERATOR:=ninja} |
25 |
+# (needed due to CMAKE_BUILD_TYPE != Gentoo) |
26 |
+CMAKE_MIN_VERSION=3.7.0-r1 |
27 |
+PYTHON_COMPAT=( python2_7 ) |
28 |
+ |
29 |
+inherit cmake-utils eapi7-ver flag-o-matic git-r3 multilib-minimal \ |
30 |
+ pax-utils python-any-r1 toolchain-funcs |
31 |
+ |
32 |
+DESCRIPTION="Low Level Virtual Machine" |
33 |
+HOMEPAGE="https://llvm.org/" |
34 |
+SRC_URI="" |
35 |
+EGIT_REPO_URI="https://git.llvm.org/git/llvm.git |
36 |
+ https://github.com/llvm-mirror/llvm.git" |
37 |
+EGIT_BRANCH="release_60" |
38 |
+ |
39 |
+# Those are in lib/Targets, without explicit CMakeLists.txt mention |
40 |
+ALL_LLVM_EXPERIMENTAL_TARGETS=( AVR Nios2 RISCV WebAssembly ) |
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_EXPERIMENTAL_TARGETS[@]}" ) |
45 |
+ALL_LLVM_TARGETS=( "${ALL_LLVM_TARGETS[@]/#/llvm_targets_}" ) |
46 |
+ |
47 |
+# Additional licenses: |
48 |
+# 1. OpenBSD regex: Henry Spencer's license ('rc' in Gentoo) + BSD. |
49 |
+# 2. ARM backend: LLVM Software Grant by ARM. |
50 |
+# 3. MD5 code: public-domain. |
51 |
+# 4. Tests (not installed): |
52 |
+# a. gtest: BSD. |
53 |
+# b. YAML tests: MIT. |
54 |
+ |
55 |
+LICENSE="UoI-NCSA rc BSD public-domain |
56 |
+ llvm_targets_ARM? ( LLVM-Grant )" |
57 |
+SLOT="$(ver_cut 1)" |
58 |
+KEYWORDS="" |
59 |
+IUSE="debug doc gold libedit +libffi ncurses test |
60 |
+ kernel_Darwin ${ALL_LLVM_TARGETS[*]}" |
61 |
+RESTRICT="!test? ( test )" |
62 |
+ |
63 |
+RDEPEND=" |
64 |
+ sys-libs/zlib:0= |
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 |
+# configparser-3.2 breaks the build (3.3 or none at all are fine) |
70 |
+DEPEND="${RDEPEND} |
71 |
+ dev-lang/perl |
72 |
+ || ( >=sys-devel/gcc-3.0 >=sys-devel/llvm-3.5 |
73 |
+ ( >=sys-freebsd/freebsd-lib-9.1-r10 sys-libs/libcxx ) |
74 |
+ ) |
75 |
+ || ( >=sys-devel/binutils-2.18 >=sys-devel/binutils-apple-5.1 ) |
76 |
+ kernel_Darwin? ( <sys-libs/libcxx-$(ver_cut 1-3).9999 ) |
77 |
+ doc? ( dev-python/sphinx ) |
78 |
+ gold? ( sys-libs/binutils-libs ) |
79 |
+ libffi? ( virtual/pkgconfig ) |
80 |
+ !!<dev-python/configparser-3.3.0.2 |
81 |
+ ${PYTHON_DEPS}" |
82 |
+# There are no file collisions between these versions but having :0 |
83 |
+# installed means llvm-config there will take precedence. |
84 |
+RDEPEND="${RDEPEND} |
85 |
+ !sys-devel/llvm:0" |
86 |
+PDEPEND="sys-devel/llvm-common |
87 |
+ gold? ( sys-devel/llvmgold )" |
88 |
+ |
89 |
+REQUIRED_USE="${PYTHON_REQUIRED_USE} |
90 |
+ || ( ${ALL_LLVM_TARGETS[*]} )" |
91 |
+ |
92 |
+# least intrusive of all |
93 |
+CMAKE_BUILD_TYPE=RelWithDebInfo |
94 |
+ |
95 |
+src_prepare() { |
96 |
+ # Fix llvm-config for shared linking and sane flags |
97 |
+ # https://bugs.gentoo.org/show_bug.cgi?id=565358 |
98 |
+ eapply "${FILESDIR}"/9999/0007-llvm-config-Clean-up-exported-values-update-for-shar.patch |
99 |
+ |
100 |
+ # disable use of SDK on OSX, bug #568758 |
101 |
+ sed -i -e 's/xcrun/false/' utils/lit/lit/util.py || die |
102 |
+ |
103 |
+ # User patches + QA |
104 |
+ cmake-utils_src_prepare |
105 |
+} |
106 |
+ |
107 |
+multilib_src_configure() { |
108 |
+ local ffi_cflags ffi_ldflags |
109 |
+ if use libffi; then |
110 |
+ ffi_cflags=$($(tc-getPKG_CONFIG) --cflags-only-I libffi) |
111 |
+ ffi_ldflags=$($(tc-getPKG_CONFIG) --libs-only-L libffi) |
112 |
+ fi |
113 |
+ |
114 |
+ local libdir=$(get_libdir) |
115 |
+ local mycmakeargs=( |
116 |
+ # disable appending VCS revision to the version to improve |
117 |
+ # direct cache hit ratio |
118 |
+ -DLLVM_APPEND_VC_REV=OFF |
119 |
+ -DCMAKE_INSTALL_PREFIX="${EPREFIX}/usr/lib/llvm/${SLOT}" |
120 |
+ -DLLVM_LIBDIR_SUFFIX=${libdir#lib} |
121 |
+ |
122 |
+ -DBUILD_SHARED_LIBS=ON |
123 |
+ # cheap hack: LLVM combines both anyway, and the only difference |
124 |
+ # is that the former list is explicitly verified at cmake time |
125 |
+ -DLLVM_TARGETS_TO_BUILD="" |
126 |
+ -DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD="${LLVM_TARGETS// /;}" |
127 |
+ -DLLVM_BUILD_TESTS=$(usex test) |
128 |
+ |
129 |
+ -DLLVM_ENABLE_FFI=$(usex libffi) |
130 |
+ -DLLVM_ENABLE_LIBEDIT=$(usex libedit) |
131 |
+ -DLLVM_ENABLE_TERMINFO=$(usex ncurses) |
132 |
+ -DLLVM_ENABLE_ASSERTIONS=$(usex debug) |
133 |
+ -DLLVM_ENABLE_EH=ON |
134 |
+ -DLLVM_ENABLE_RTTI=ON |
135 |
+ |
136 |
+ -DWITH_POLLY=OFF # TODO |
137 |
+ |
138 |
+ -DLLVM_HOST_TRIPLE="${CHOST}" |
139 |
+ |
140 |
+ -DFFI_INCLUDE_DIR="${ffi_cflags#-I}" |
141 |
+ -DFFI_LIBRARY_DIR="${ffi_ldflags#-L}" |
142 |
+ |
143 |
+ # disable OCaml bindings (now in dev-ml/llvm-ocaml) |
144 |
+ -DOCAMLFIND=NO |
145 |
+ ) |
146 |
+ |
147 |
+# Note: go bindings have no CMake rules at the moment |
148 |
+# but let's kill the check in case they are introduced |
149 |
+# if ! multilib_is_native_abi || ! use go; then |
150 |
+ mycmakeargs+=( |
151 |
+ -DGO_EXECUTABLE=GO_EXECUTABLE-NOTFOUND |
152 |
+ ) |
153 |
+# fi |
154 |
+ |
155 |
+ use test && mycmakeargs+=( |
156 |
+ -DLLVM_LIT_ARGS="-vv" |
157 |
+ ) |
158 |
+ |
159 |
+ if multilib_is_native_abi; then |
160 |
+ mycmakeargs+=( |
161 |
+ -DLLVM_BUILD_DOCS=$(usex doc) |
162 |
+ -DLLVM_ENABLE_OCAMLDOC=OFF |
163 |
+ -DLLVM_ENABLE_SPHINX=$(usex doc) |
164 |
+ -DLLVM_ENABLE_DOXYGEN=OFF |
165 |
+ -DLLVM_INSTALL_UTILS=ON |
166 |
+ ) |
167 |
+ use doc && mycmakeargs+=( |
168 |
+ -DLLVM_INSTALL_SPHINX_HTML_DIR="${EPREFIX}/usr/share/doc/${PF}/html" |
169 |
+ -DSPHINX_WARNINGS_AS_ERRORS=OFF |
170 |
+ ) |
171 |
+ use gold && mycmakeargs+=( |
172 |
+ -DLLVM_BINUTILS_INCDIR="${EPREFIX}"/usr/include |
173 |
+ ) |
174 |
+ fi |
175 |
+ |
176 |
+ if tc-is-cross-compiler; then |
177 |
+ local tblgen="${EPREFIX}/usr/lib/llvm/${SLOT}/bin/llvm-tblgen" |
178 |
+ [[ -x "${tblgen}" ]] \ |
179 |
+ || die "${tblgen} not found or usable" |
180 |
+ mycmakeargs+=( |
181 |
+ -DCMAKE_CROSSCOMPILING=ON |
182 |
+ -DLLVM_TABLEGEN="${tblgen}" |
183 |
+ ) |
184 |
+ fi |
185 |
+ |
186 |
+ # LLVM_ENABLE_ASSERTIONS=NO does not guarantee this for us, #614844 |
187 |
+ use debug || local -x CPPFLAGS="${CPPFLAGS} -DNDEBUG" |
188 |
+ cmake-utils_src_configure |
189 |
+} |
190 |
+ |
191 |
+multilib_src_compile() { |
192 |
+ cmake-utils_src_compile |
193 |
+ |
194 |
+ pax-mark m "${BUILD_DIR}"/bin/llvm-rtdyld |
195 |
+ pax-mark m "${BUILD_DIR}"/bin/lli |
196 |
+ pax-mark m "${BUILD_DIR}"/bin/lli-child-target |
197 |
+ |
198 |
+ if use test; then |
199 |
+ pax-mark m "${BUILD_DIR}"/unittests/ExecutionEngine/Orc/OrcJITTests |
200 |
+ pax-mark m "${BUILD_DIR}"/unittests/ExecutionEngine/MCJIT/MCJITTests |
201 |
+ pax-mark m "${BUILD_DIR}"/unittests/Support/SupportTests |
202 |
+ fi |
203 |
+} |
204 |
+ |
205 |
+multilib_src_test() { |
206 |
+ # respect TMPDIR! |
207 |
+ local -x LIT_PRESERVES_TMP=1 |
208 |
+ cmake-utils_src_make check |
209 |
+} |
210 |
+ |
211 |
+src_install() { |
212 |
+ local MULTILIB_CHOST_TOOLS=( |
213 |
+ /usr/lib/llvm/${SLOT}/bin/llvm-config |
214 |
+ ) |
215 |
+ |
216 |
+ local MULTILIB_WRAPPED_HEADERS=( |
217 |
+ /usr/include/llvm/Config/llvm-config.h |
218 |
+ ) |
219 |
+ |
220 |
+ local LLVM_LDPATHS=() |
221 |
+ multilib-minimal_src_install |
222 |
+ |
223 |
+ # move wrapped headers back |
224 |
+ mv "${ED%/}"/usr/include "${ED%/}"/usr/lib/llvm/${SLOT}/include || die |
225 |
+} |
226 |
+ |
227 |
+multilib_src_install() { |
228 |
+ cmake-utils_src_install |
229 |
+ |
230 |
+ # move headers to /usr/include for wrapping |
231 |
+ rm -rf "${ED%/}"/usr/include || die |
232 |
+ mv "${ED%/}"/usr/lib/llvm/${SLOT}/include "${ED%/}"/usr/include || die |
233 |
+ |
234 |
+ LLVM_LDPATHS+=( "${EPREFIX}/usr/lib/llvm/${SLOT}/$(get_libdir)" ) |
235 |
+} |
236 |
+ |
237 |
+multilib_src_install_all() { |
238 |
+ local revord=$(( 9999 - ${SLOT} )) |
239 |
+ cat <<-_EOF_ > "${T}/10llvm-${revord}" || die |
240 |
+ PATH="${EPREFIX}/usr/lib/llvm/${SLOT}/bin" |
241 |
+ # we need to duplicate it in ROOTPATH for Portage to respect... |
242 |
+ ROOTPATH="${EPREFIX}/usr/lib/llvm/${SLOT}/bin" |
243 |
+ MANPATH="${EPREFIX}/usr/lib/llvm/${SLOT}/share/man" |
244 |
+ LDPATH="$( IFS=:; echo "${LLVM_LDPATHS[*]}" )" |
245 |
+_EOF_ |
246 |
+ doenvd "${T}/10llvm-${revord}" |
247 |
+ |
248 |
+ docompress "/usr/lib/llvm/${SLOT}/share/man" |
249 |
+} |