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