Gentoo Archives: gentoo-commits

From: "Michał Górny" <mgorny@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: sys-devel/llvm/, sys-devel/llvm/files/3.6.2/
Date: Sat, 03 Jun 2017 08:28:09
Message-Id: 1496478459.9892a35655772e217d5a21c3460203afb5d9719d.mgorny@gentoo
1 commit: 9892a35655772e217d5a21c3460203afb5d9719d
2 Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
3 AuthorDate: Wed May 24 15:49:12 2017 +0000
4 Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
5 CommitDate: Sat Jun 3 08:27:39 2017 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=9892a356
7
8 sys-devel/llvm: Minimize 3.6 to be Darwin Prefix-compat only
9
10 sys-devel/llvm/Manifest | 1 -
11 .../llvm/files/3.6.2/ocaml-ctypes-0.4.0.patch | 35 --
12 sys-devel/llvm/llvm-3.6.2-r100.ebuild | 279 ++++++++++
13 sys-devel/llvm/llvm-3.6.2.ebuild | 559 ---------------------
14 4 files changed, 279 insertions(+), 595 deletions(-)
15
16 diff --git a/sys-devel/llvm/Manifest b/sys-devel/llvm/Manifest
17 index a0cc649999f..f0b9db5c0e4 100644
18 --- a/sys-devel/llvm/Manifest
19 +++ b/sys-devel/llvm/Manifest
20 @@ -5,7 +5,6 @@ DIST cfe-3.7.1.src.tar.xz 9110616 SHA256 56e2164c7c2a1772d5ed2a3e57485ff73ff06c9
21 DIST cfe-3.8.1.src.tar.xz 9605548 SHA256 4cd3836dfb4b88b597e075341cae86d61c63ce3963e45c7fe6a8bf59bb382cdf SHA512 72d23a410271b50f97371b13dd7a6c6c5c0a993e35df436ab716ece8521d83406aa3d4bf8fdecd8154139f39fd5e011e480d405225d8c3ff152d0a2ac4573e04 WHIRLPOOL 7bcc9e6fed871b7490e2a280f2ad36008150a0af3605357fbe529aea8a7acbbed41c7da273dd150f8f50869cd321f114e909236261c4dd05ed7f644c75f208c4
22 DIST cfe-3.9.0.src.tar.xz 10390440 SHA256 7596a7c7d9376d0c89e60028fe1ceb4d3e535e8ea8b89e0eb094e0dcb3183d28 SHA512 f405b5819fd19276b2de4da80a51171a3b1c5c00df810e1f284184c693e410775fe2933576f942b881664dd3b75e78f0f15b7e5a3eca7819ffbcfe528d9a578e WHIRLPOOL cb4ff4eaababa3017b4a96548b7fe1dc5f4926bd27dc6de56c3ae1fc450c8af1faf1edea2e909e40289477ebaf79860fca3a9695b22402dc9385031d7b8ad5bf
23 DIST cfe-3.9.1.src.tar.xz 10363080 SHA256 e6c4cebb96dee827fa0470af313dff265af391cb6da8d429842ef208c8f25e63 SHA512 3f0eea194597e438bbe49ce9ef5fdced81459c21cbdd2653750b2fe02c55a0154d6a33a8cfd02e607b83314a8e35b2c300f944462120ab6de1d4139d85db56b8 WHIRLPOOL 9f70688c7c2857426bf5fbf039b9723ec73ec57e8d3b36da37589bcbdbdb090aa36cd1800f0521ef0c30065bf03083eade0ac81ef0939412919423db7779a6f8
24 -DIST clang-tools-extra-3.6.2.src.tar.xz 248624 SHA256 6a0ec627d398f501ddf347060f7a2ccea4802b2494f1d4fd7bda3e0442d04feb SHA512 1b7710a7deee30cefb6a3b4edb026a96d8935a0c6f3056ccdb7a45564d10baf01a4f6722ae853ad9a3bad17e8de32a3c0ec99c5cf6144647a5e182809d403f7a WHIRLPOOL 3dc8888c302bac84f53b673784dec092a2c59ea2985d9983e87f057b9aa7b5d3e34cf13d2b0f1f60ea44f342b8167377204a510036872a087037cf02335c19cd
25 DIST clang-tools-extra-3.7.1.src.tar.xz 277476 SHA256 4a91edaccad1ce984c7c49a4a87db186b7f7b21267b2b03bcf4bd7820715bc6b SHA512 06e2db8af75f1e6ee82da6ee723b5256b9e3f6ba196428f18944ec02d07df26d04329ca8824a083c5f25274ce7e3469aa75e3a29ccfbdb6375524841d65e3ad7 WHIRLPOOL 2c1a459d6aff6bc24d5c8d38120ab665adbef61394050781a9707d50e83dae1b4997ed19459086e9bd7f6dd38a09c295d135e33515c947d64a7f1ab714ad8beb
26 DIST clang-tools-extra-3.8.1.src.tar.xz 334768 SHA256 664a5c60220de9c290bf2a5b03d902ab731a4f95fe73a00856175ead494ec396 SHA512 ec8c4a6ac4fd1a0e24fc15e56ba00828e0d718c2f7bd477ea134ab094c67f4f4b2f603f128ec11a03b7f25f3e9b8fe75181e40730c56b7b683f54e3f37573137 WHIRLPOOL b05213cbe21b778e718233cecbf4d01b92c1f133eced6fdd3fa5059c4b10e5f0407549634f65032af177ba1614250f5c02e283c2b03563db3e227b1afcae424b
27 DIST clang-tools-extra-3.9.0.src.tar.xz 455144 SHA256 5b7aec46ec8e999ec683c87ad744082e1133781ee4b01905b4bdae5d20785f14 SHA512 7d5f8d3b44e45022db65434f4d141f23706edf6aa9f3c28ded43e84e85c7c4878ffe98bf15f71e4c71fd176dfc49ce5180892d710bc5eccf95de1ed12f3c8074 WHIRLPOOL 44863889eaa33face00b9644f5c1465446bec39f88bc5ea32835dfa091a83161e292c2b3bcdcccb7cb34cdc3f1970bb3bbfbf6918c425b11a1465bedc3e0611f
28
29 diff --git a/sys-devel/llvm/files/3.6.2/ocaml-ctypes-0.4.0.patch b/sys-devel/llvm/files/3.6.2/ocaml-ctypes-0.4.0.patch
30 deleted file mode 100644
31 index 154c9cc25f7..00000000000
32 --- a/sys-devel/llvm/files/3.6.2/ocaml-ctypes-0.4.0.patch
33 +++ /dev/null
34 @@ -1,35 +0,0 @@
35 -diff -Naur llvm-3.6.0.src.orig/bindings/ocaml/executionengine/llvm_executionengine.ml llvm-3.6.0.src/bindings/ocaml/executionengine/llvm_executionengine.ml
36 ---- llvm-3.6.0.src.orig/bindings/ocaml/executionengine/llvm_executionengine.ml 2015-03-17 11:49:27.274824345 +0100
37 -+++ llvm-3.6.0.src/bindings/ocaml/executionengine/llvm_executionengine.ml 2015-03-17 11:49:40.333829421 +0100
38 -@@ -43,11 +43,11 @@
39 - = "llvm_ee_run_static_dtors"
40 - external data_layout : llexecutionengine -> Llvm_target.DataLayout.t
41 - = "llvm_ee_get_data_layout"
42 --external add_global_mapping_ : Llvm.llvalue -> int64 -> llexecutionengine -> unit
43 -+external add_global_mapping_ : Llvm.llvalue -> nativeint -> llexecutionengine -> unit
44 - = "llvm_ee_add_global_mapping"
45 --external get_global_value_address_ : string -> llexecutionengine -> int64
46 -+external get_global_value_address_ : string -> llexecutionengine -> nativeint
47 - = "llvm_ee_get_global_value_address"
48 --external get_function_address_ : string -> llexecutionengine -> int64
49 -+external get_function_address_ : string -> llexecutionengine -> nativeint
50 - = "llvm_ee_get_function_address"
51 -
52 - let add_global_mapping llval ptr ee =
53 -@@ -55,14 +55,14 @@
54 -
55 - let get_global_value_address name typ ee =
56 - let vptr = get_global_value_address_ name ee in
57 -- if Int64.to_int vptr <> 0 then
58 -+ if Nativeint.to_int vptr <> 0 then
59 - let open Ctypes in !@ (coerce (ptr void) (ptr typ) (ptr_of_raw_address vptr))
60 - else
61 - raise (Error ("Value " ^ name ^ " not found"))
62 -
63 - let get_function_address name typ ee =
64 - let fptr = get_function_address_ name ee in
65 -- if Int64.to_int fptr <> 0 then
66 -+ if Nativeint.to_int fptr <> 0 then
67 - let open Ctypes in coerce (ptr void) typ (ptr_of_raw_address fptr)
68 - else
69 - raise (Error ("Function " ^ name ^ " not found"))
70
71 diff --git a/sys-devel/llvm/llvm-3.6.2-r100.ebuild b/sys-devel/llvm/llvm-3.6.2-r100.ebuild
72 new file mode 100644
73 index 00000000000..89a1cabd9bb
74 --- /dev/null
75 +++ b/sys-devel/llvm/llvm-3.6.2-r100.ebuild
76 @@ -0,0 +1,279 @@
77 +# Copyright 1999-2017 Gentoo Foundation
78 +# Distributed under the terms of the GNU General Public License v2
79 +
80 +EAPI=5
81 +
82 +PYTHON_COMPAT=( python2_7 )
83 +inherit eutils check-reqs flag-o-matic multilib pax-utils prefix \
84 + python-any-r1 toolchain-funcs
85 +
86 +DESCRIPTION="Low Level Virtual Machine"
87 +HOMEPAGE="http://llvm.org/"
88 +SRC_URI="http://llvm.org/releases/${PV}/${P}.src.tar.xz
89 + clang? ( http://llvm.org/releases/${PV}/compiler-rt-${PV}.src.tar.xz
90 + http://llvm.org/releases/${PV}/cfe-${PV}.src.tar.xz )
91 + https://dev.gentoo.org/~voyageur/distfiles/${PN}-3.6.1-manpages.tar.bz2"
92 +
93 +# Additional licenses:
94 +# 1. OpenBSD regex: Henry Spencer's license ('rc' in Gentoo) + BSD.
95 +# 2. ARM backend: LLVM Software Grant by ARM.
96 +# 3. MD5 code: public-domain.
97 +# 4. autoconf (not installed): some undefined M.I.T. license.
98 +# 5. Tests (not installed):
99 +# a. gtest: BSD.
100 +# b. YAML tests: MIT.
101 +
102 +LICENSE="UoI-NCSA rc BSD public-domain"
103 +SLOT="0/3.6"
104 +KEYWORDS="~ppc-macos ~x64-macos ~x86-macos"
105 +IUSE="clang +libffi"
106 +
107 +COMMON_DEPEND="
108 + sys-libs/zlib:0=
109 + libffi? ( >=virtual/libffi-3.0.13-r1:0= )"
110 +# configparser-3.2 breaks the build (3.3 or none at all are fine)
111 +DEPEND="${COMMON_DEPEND}
112 + app-arch/xz-utils
113 + dev-lang/perl
114 + >=sys-devel/make-3.81
115 + >=sys-devel/flex-2.5.4
116 + >=sys-devel/bison-1.875d
117 + || ( >=sys-devel/gcc-apple-4.2.1 >=sys-devel/llvm-3.3 )
118 + >=sys-devel/binutils-apple-5.1
119 + libffi? ( virtual/pkgconfig )
120 + !!<dev-python/configparser-3.3.0.2
121 + ${PYTHON_DEPS}"
122 +RDEPEND="${COMMON_DEPEND}
123 + clang? ( !<=sys-devel/clang-${PV}-r99
124 + !>=sys-devel/clang-9999 )"
125 +PDEPEND="clang? ( =sys-devel/clang-${PV}-r100 )"
126 +
127 +S=${WORKDIR}/${P}.src
128 +
129 +check_space() {
130 + # in megs
131 + # !clang !debug !multitarget -O2 400
132 + # !clang !debug multitarget -O2 550
133 + # clang !debug !multitarget -O2 950
134 + # clang !debug multitarget -O2 1200
135 + # !clang debug multitarget -O2 5G
136 + # clang !debug multitarget -O0 -g 12G
137 + # clang debug multitarget -O2 16G
138 + # clang debug multitarget -O0 -g 14G
139 +
140 + local build_size=550
141 + use clang && build_size=1200
142 +
143 + if is-flagq '-g?(gdb)?([1-9])'; then
144 + ewarn "The C++ compiler -g option is known to increase the size of the package"
145 + ewarn "considerably. If you run out of space, please consider removing it."
146 + ewarn
147 +
148 + (( build_size *= 10 ))
149 + fi
150 +
151 + local CHECKREQS_DISK_BUILD=${build_size}M
152 + check-reqs_pkg_pretend
153 +
154 + if [[ ${MERGE_TYPE} != binary ]]; then
155 + echo 'int main() {return 0;}' > "${T}"/test.cxx || die
156 + ebegin "Trying to build a C++11 test program"
157 + if ! $(tc-getCXX) -std=c++11 -o /dev/null "${T}"/test.cxx; then
158 + eerror "LLVM-${PV} requires C++11-capable C++ compiler. Your current compiler"
159 + eerror "does not seem to support -std=c++11 option. Please upgrade your compiler"
160 + eerror "to gcc-4.7 or an equivalent version supporting C++11."
161 + die "Currently active compiler does not support -std=c++11"
162 + fi
163 + eend ${?}
164 + fi
165 +}
166 +
167 +pkg_pretend() {
168 + check_space
169 +}
170 +
171 +pkg_setup() {
172 + check_space
173 +}
174 +
175 +src_unpack() {
176 + default
177 +
178 + rm -f "${S}"/tools/clang "${S}"/projects/compiler-rt \
179 + || die "symlinks removal failed"
180 +
181 + if use clang; then
182 + mv "${WORKDIR}"/cfe-${PV/_}.src "${S}"/tools/clang \
183 + || die "clang source directory move failed"
184 + mv "${WORKDIR}"/compiler-rt-${PV/_}.src "${S}"/projects/compiler-rt \
185 + || die "compiler-rt source directory move failed"
186 + fi
187 +}
188 +
189 +src_prepare() {
190 + epatch "${FILESDIR}"/3.6.2/nodoctargz.patch
191 + epatch "${FILESDIR}"/3.6.2/gcc-4.9.patch
192 + epatch "${FILESDIR}"/3.6.2/gentoo-install.patch
193 +
194 + if use clang; then
195 + # Automatically select active system GCC's libraries, bugs #406163 and #417913
196 + epatch "${FILESDIR}"/3.9.0/clang/gentoo-runtime-gcc-detection-v3.patch
197 +
198 + epatch "${FILESDIR}"/3.7.1/clang/gentoo-install.patch
199 + epatch "${FILESDIR}"/3.9.1/clang/darwin_prefix-include-paths.patch
200 + eprefixify tools/clang/lib/Frontend/InitHeaderSearch.cpp
201 +
202 + # Fix build fails with using gcc-4.9 on Gentoo/FreeBSD, bug #548444
203 + epatch "${FILESDIR}"/3.6.2/clang/fbsd-gcc49.patch
204 + fi
205 +
206 + if use prefix && use clang; then
207 + sed -i -e "/^CFLAGS /s@-Werror@-I${EPREFIX}/usr/include@" \
208 + projects/compiler-rt/make/platform/clang_*.mk || die
209 + fi
210 +
211 + # disable use of SDK on OSX, bug #568758
212 + sed -i -e 's/xcrun/false/' utils/lit/lit/util.py || die
213 +
214 + local sub_files=(
215 + Makefile.config.in
216 + Makefile.rules
217 + tools/llvm-config/llvm-config.cpp
218 + )
219 + use clang && sub_files+=(
220 + tools/clang/lib/Driver/Tools.cpp
221 + tools/clang/tools/scan-build/scan-build
222 + )
223 +
224 + # unfortunately ./configure won't listen to --mandir and the-like, so take
225 + # care of this.
226 + # note: we're setting the main libdir intentionally.
227 + # where per-ABI is appropriate, we use $(GENTOO_LIBDIR) make.
228 + einfo "Fixing install dirs"
229 + sed -e "s,@libdir@,$(get_libdir),g" \
230 + -e "s,@PF@,${PF},g" \
231 + -e "s,@EPREFIX@,${EPREFIX},g" \
232 + -i "${sub_files[@]}" \
233 + || die "install paths sed failed"
234 +
235 + if use clang; then
236 + # constantly fails for a long time, likely due to our patches
237 + rm tools/clang/test/Driver/cross-linux.c || die
238 + fi
239 +
240 + # User patches
241 + epatch_user
242 +
243 + python_setup
244 +}
245 +
246 +src_configure() {
247 + # disable timestamps since they confuse ccache
248 + local conf_flags=(
249 + --disable-timestamps
250 + --enable-keep-symbols
251 + --enable-shared
252 + --with-optimize-option=
253 + --enable-optimized
254 + --disable-assertions
255 + --disable-expensive-checks
256 + --disable-libedit
257 + --disable-terminfo
258 + $(use_enable libffi)
259 +
260 + --enable-bindings=none
261 + --enable-targets=host
262 +
263 + ac_cv_prog_XML2CONFIG=""
264 + )
265 +
266 + if use libffi; then
267 + local CPPFLAGS=${CPPFLAGS}
268 + append-cppflags "$($(tc-getPKG_CONFIG) --cflags libffi)"
269 + fi
270 +
271 + # Enable large file support, bug #550708
272 + append-lfs-flags
273 + # llvm prefers clang over gcc, so we may need to force that
274 + tc-export CC CXX
275 +
276 + ECONF_SOURCE=${S} \
277 + econf "${conf_flags[@]}"
278 +}
279 +
280 +src_compile() {
281 + LLVM_MAKEARGS=(
282 + VERBOSE=1
283 + REQUIRES_RTTI=1
284 + GENTOO_LIBDIR=$(get_libdir)
285 + )
286 +
287 + emake "${LLVM_MAKEARGS[@]}"
288 +
289 + pax-mark m Release/bin/llvm-rtdyld
290 + pax-mark m Release/bin/lli
291 + pax-mark m Release/bin/lli-child-target
292 +}
293 +
294 +src_install() {
295 + emake "${LLVM_MAKEARGS[@]}" DESTDIR="${D}" install
296 +
297 + if ! use clang; then
298 + rm "${WORKDIR}"/${PN}-3.6.1-manpages/clang.1 || die
299 + else
300 + for tool in clang{,++} ; do
301 + dosym ${tool} /usr/bin/${CHOST}-${tool}
302 + done
303 + fi
304 + doman "${WORKDIR}"/${PN}-3.6.1-manpages/*.1
305 +
306 + # Fix install_names on Darwin. The build system is too complicated
307 + # to just fix this, so we correct it post-install
308 + local lib= f= odylib= ndylib= libpv=${PV}
309 + if [[ ${CHOST} == *-darwin* ]] ; then
310 + eval $(grep PACKAGE_VERSION= configure)
311 + [[ -n ${PACKAGE_VERSION} ]] && libpv=${PACKAGE_VERSION}
312 + libpvminor=${libpv%.[0-9]*}
313 + for lib in lib{EnhancedDisassembly,LLVM-${libpv},LTO,profile_rt,clang}.dylib LLVMHello.dylib clang/${libpv}/lib/darwin/libclang_rt.asan_{osx,iossim}_dynamic.dylib; do
314 + # libEnhancedDisassembly is Darwin10 only, so non-fatal
315 + # + omit clang libs if not enabled
316 + [[ -f ${ED}/usr/lib/${lib} ]] || continue
317 +
318 + ebegin "fixing install_name of $lib"
319 + install_name_tool \
320 + -id "${EPREFIX}"/usr/lib/${lib} \
321 + "${ED}"/usr/lib/${lib}
322 + eend $?
323 + done
324 + for f in "${ED}"/usr/bin/* "${ED}"/usr/lib/lib*.dylib "${ED}"/usr/lib/clang/${libpv}/lib/darwin/*.dylib ; do
325 + # omit clang libs if not enabled
326 + [[ -f "${f}" ]] || continue
327 +
328 + scanmacho -BF'%n#f' "${f}" | tr ',' '\n' | \
329 + while read odylib ; do
330 + ndylib=
331 + case ${odylib} in
332 + */libclang.dylib)
333 + ndylib="${EPREFIX}"/usr/lib/libclang.dylib
334 + ;;
335 + */libLLVM-${libpv}.dylib)
336 + ndylib="${EPREFIX}"/usr/lib/libLLVM-${libpv}.dylib
337 + ;;
338 + */libLLVM-${libpvminor}.dylib)
339 + ndylib="${EPREFIX}"/usr/lib/libLLVM-${libpvminor}.dylib
340 + ;;
341 + */libLTO.dylib)
342 + ndylib="${EPREFIX}"/usr/lib/libLTO.dylib
343 + ;;
344 + esac
345 + if [[ -n ${ndylib} ]] ; then
346 + ebegin "fixing install_name reference to ${odylib} of ${f##*/}"
347 + install_name_tool \
348 + -change "${odylib}" "${ndylib}" \
349 + "${f}"
350 + eend $?
351 + fi
352 + done
353 + done
354 + fi
355 +}
356
357 diff --git a/sys-devel/llvm/llvm-3.6.2.ebuild b/sys-devel/llvm/llvm-3.6.2.ebuild
358 deleted file mode 100644
359 index 4fe633a4eed..00000000000
360 --- a/sys-devel/llvm/llvm-3.6.2.ebuild
361 +++ /dev/null
362 @@ -1,559 +0,0 @@
363 -# Copyright 1999-2017 Gentoo Foundation
364 -# Distributed under the terms of the GNU General Public License v2
365 -
366 -EAPI=5
367 -
368 -PYTHON_COMPAT=( python2_7 pypy )
369 -
370 -inherit eutils flag-o-matic multibuild multilib \
371 - multilib-minimal python-r1 toolchain-funcs pax-utils check-reqs prefix
372 -
373 -DESCRIPTION="Low Level Virtual Machine"
374 -HOMEPAGE="http://llvm.org/"
375 -SRC_URI="http://llvm.org/releases/${PV}/${P}.src.tar.xz
376 - clang? ( http://llvm.org/releases/${PV}/compiler-rt-${PV}.src.tar.xz
377 - http://llvm.org/releases/${PV}/cfe-${PV}.src.tar.xz
378 - http://llvm.org/releases/${PV}/clang-tools-extra-${PV}.src.tar.xz )
379 - !doc? ( https://dev.gentoo.org/~voyageur/distfiles/${PN}-3.6.1-manpages.tar.bz2 )"
380 -
381 -# Additional licenses:
382 -# 1. OpenBSD regex: Henry Spencer's license ('rc' in Gentoo) + BSD.
383 -# 2. ARM backend: LLVM Software Grant by ARM.
384 -# 3. MD5 code: public-domain.
385 -# 4. autoconf (not installed): some undefined M.I.T. license.
386 -# 5. Tests (not installed):
387 -# a. gtest: BSD.
388 -# b. YAML tests: MIT.
389 -
390 -LICENSE="UoI-NCSA rc BSD public-domain
391 - arm? ( LLVM-Grant )
392 - arm64? ( LLVM-Grant )
393 - multitarget? ( LLVM-Grant )"
394 -SLOT="0/3.6"
395 -KEYWORDS="~amd64 ~arm ~arm64 ~x86 ~amd64-fbsd ~x86-fbsd ~amd64-linux ~arm-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos"
396 -IUSE="clang debug doc gold libedit +libffi multitarget ncurses ocaml python
397 - +static-analyzer test xml video_cards_radeon
398 - kernel_Darwin kernel_FreeBSD"
399 -
400 -COMMON_DEPEND="
401 - sys-libs/zlib:0=
402 - clang? (
403 - python? ( ${PYTHON_DEPS} )
404 - static-analyzer? (
405 - dev-lang/perl:*
406 - ${PYTHON_DEPS}
407 - )
408 - xml? ( dev-libs/libxml2:2= )
409 - )
410 - gold? ( >=sys-devel/binutils-2.22:*[cxx] )
411 - libedit? ( dev-libs/libedit:0=[${MULTILIB_USEDEP}] )
412 - libffi? ( >=virtual/libffi-3.0.13-r1:0=[${MULTILIB_USEDEP}] )
413 - ncurses? ( >=sys-libs/ncurses-5.9-r3:0=[${MULTILIB_USEDEP}] )
414 - ocaml? (
415 - dev-lang/ocaml:0=
416 - dev-ml/findlib
417 - dev-ml/ocaml-ctypes )"
418 -# configparser-3.2 breaks the build (3.3 or none at all are fine)
419 -DEPEND="${COMMON_DEPEND}
420 - app-arch/xz-utils
421 - dev-lang/perl
422 - >=sys-devel/make-3.81
423 - >=sys-devel/flex-2.5.4
424 - >=sys-devel/bison-1.875d
425 - || ( >=sys-devel/gcc-3.0 >=sys-devel/llvm-3.5
426 - ( >=sys-freebsd/freebsd-lib-9.1-r10 sys-libs/libcxx )
427 - )
428 - || ( >=sys-devel/binutils-2.18 >=sys-devel/binutils-apple-5.1 )
429 - kernel_Darwin? ( <sys-libs/libcxx-${PV%_rc*}.9999 )
430 - clang? ( xml? ( virtual/pkgconfig ) )
431 - doc? ( dev-python/sphinx )
432 - libffi? ( virtual/pkgconfig )
433 - !!<dev-python/configparser-3.3.0.2
434 - ocaml? ( test? ( dev-ml/ounit ) )
435 - ${PYTHON_DEPS}"
436 -RDEPEND="${COMMON_DEPEND}
437 - clang? ( !<=sys-devel/clang-${PV}-r99
438 - !>=sys-devel/clang-9999 )
439 - abi_x86_32? ( !<=app-emulation/emul-linux-x86-baselibs-20130224-r2
440 - !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)] )"
441 -PDEPEND="clang? ( =sys-devel/clang-${PV}-r100 )"
442 -
443 -# pypy gives me around 1700 unresolved tests due to open file limit
444 -# being exceeded. probably GC does not close them fast enough.
445 -REQUIRED_USE="${PYTHON_REQUIRED_USE}
446 - test? ( || ( $(python_gen_useflags 'python*') ) )"
447 -
448 -S=${WORKDIR}/${P/_}.src
449 -
450 -# Some people actually override that in make.conf. That sucks since
451 -# we need to run install per-directory, and ninja can't do that...
452 -# so why did it call itself ninja in the first place?
453 -CMAKE_MAKEFILE_GENERATOR=emake
454 -
455 -check_space() {
456 - # in megs
457 - # !clang !debug !multitarget -O2 400
458 - # !clang !debug multitarget -O2 550
459 - # clang !debug !multitarget -O2 950
460 - # clang !debug multitarget -O2 1200
461 - # !clang debug multitarget -O2 5G
462 - # clang !debug multitarget -O0 -g 12G
463 - # clang debug multitarget -O2 16G
464 - # clang debug multitarget -O0 -g 14G
465 -
466 - local build_size=550
467 - use clang && build_size=1200
468 -
469 - if use debug; then
470 - ewarn "USE=debug is known to increase the size of package considerably"
471 - ewarn "and cause the tests to fail."
472 - ewarn
473 -
474 - (( build_size *= 14 ))
475 - elif is-flagq '-g?(gdb)?([1-9])'; then
476 - ewarn "The C++ compiler -g option is known to increase the size of the package"
477 - ewarn "considerably. If you run out of space, please consider removing it."
478 - ewarn
479 -
480 - (( build_size *= 10 ))
481 - fi
482 -
483 - # Multiply by number of ABIs :).
484 - local abis=( $(multilib_get_enabled_abis) )
485 - (( build_size *= ${#abis[@]} ))
486 -
487 - local CHECKREQS_DISK_BUILD=${build_size}M
488 - check-reqs_pkg_pretend
489 -
490 - if [[ ${MERGE_TYPE} != binary ]]; then
491 - echo 'int main() {return 0;}' > "${T}"/test.cxx || die
492 - ebegin "Trying to build a C++11 test program"
493 - if ! $(tc-getCXX) -std=c++11 -o /dev/null "${T}"/test.cxx; then
494 - eerror "LLVM-${PV} requires C++11-capable C++ compiler. Your current compiler"
495 - eerror "does not seem to support -std=c++11 option. Please upgrade your compiler"
496 - eerror "to gcc-4.7 or an equivalent version supporting C++11."
497 - die "Currently active compiler does not support -std=c++11"
498 - fi
499 - eend ${?}
500 - fi
501 -}
502 -
503 -pkg_pretend() {
504 - check_space
505 -}
506 -
507 -pkg_setup() {
508 - check_space
509 -}
510 -
511 -src_unpack() {
512 - default
513 -
514 - rm -f "${S}"/tools/clang "${S}"/projects/compiler-rt \
515 - || die "symlinks removal failed"
516 -
517 - if use clang; then
518 - mv "${WORKDIR}"/cfe-${PV/_}.src "${S}"/tools/clang \
519 - || die "clang source directory move failed"
520 - mv "${WORKDIR}"/compiler-rt-${PV/_}.src "${S}"/projects/compiler-rt \
521 - || die "compiler-rt source directory move failed"
522 - mv "${WORKDIR}"/clang-tools-extra-${PV/_}.src "${S}"/tools/clang/tools/extra \
523 - || die "clang-tools-extra source directory move failed"
524 - fi
525 -}
526 -
527 -src_prepare() {
528 - epatch "${FILESDIR}"/3.6.2/nodoctargz.patch
529 - epatch "${FILESDIR}"/3.6.2/gcc-4.9.patch
530 - epatch "${FILESDIR}"/3.6.2/gentoo-install.patch
531 - epatch "${FILESDIR}"/3.6.2/ocaml-ctypes-0.4.0.patch
532 - # Make ocaml warnings non-fatal, bug #537308
533 - sed -e "/RUN/s/-warn-error A//" -i test/Bindings/OCaml/*ml || die
534 -
535 - if use clang; then
536 - # Automatically select active system GCC's libraries, bugs #406163 and #417913
537 - epatch "${FILESDIR}"/3.9.0/clang/gentoo-runtime-gcc-detection-v3.patch
538 -
539 - epatch "${FILESDIR}"/3.7.1/clang/gentoo-install.patch
540 - epatch "${FILESDIR}"/3.9.1/clang/darwin_prefix-include-paths.patch
541 - eprefixify tools/clang/lib/Frontend/InitHeaderSearch.cpp
542 -
543 - # Fix build fails with using gcc-4.9 on Gentoo/FreeBSD, bug #548444
544 - epatch "${FILESDIR}"/3.6.2/clang/fbsd-gcc49.patch
545 - fi
546 -
547 - if use prefix && use clang; then
548 - sed -i -e "/^CFLAGS /s@-Werror@-I${EPREFIX}/usr/include@" \
549 - projects/compiler-rt/make/platform/clang_*.mk || die
550 - fi
551 -
552 - # disable use of SDK on OSX, bug #568758
553 - sed -i -e 's/xcrun/false/' utils/lit/lit/util.py || die
554 -
555 - local sub_files=(
556 - Makefile.config.in
557 - Makefile.rules
558 - tools/llvm-config/llvm-config.cpp
559 - )
560 - use clang && sub_files+=(
561 - tools/clang/lib/Driver/Tools.cpp
562 - tools/clang/tools/scan-build/scan-build
563 - )
564 -
565 - # unfortunately ./configure won't listen to --mandir and the-like, so take
566 - # care of this.
567 - # note: we're setting the main libdir intentionally.
568 - # where per-ABI is appropriate, we use $(GENTOO_LIBDIR) make.
569 - einfo "Fixing install dirs"
570 - sed -e "s,@libdir@,$(get_libdir),g" \
571 - -e "s,@PF@,${PF},g" \
572 - -e "s,@EPREFIX@,${EPREFIX},g" \
573 - -i "${sub_files[@]}" \
574 - || die "install paths sed failed"
575 -
576 - if use clang; then
577 - # constantly fails for a long time, likely due to our patches
578 - rm tools/clang/test/Driver/cross-linux.c || die
579 - fi
580 -
581 - # User patches
582 - epatch_user
583 -
584 - python_setup
585 -}
586 -
587 -multilib_src_configure() {
588 - # disable timestamps since they confuse ccache
589 - local conf_flags=(
590 - --disable-timestamps
591 - --enable-keep-symbols
592 - --enable-shared
593 - --with-optimize-option=
594 - $(tc-is-static-only && echo --disable-shared)
595 - $(use_enable !debug optimized)
596 - $(use_enable debug assertions)
597 - $(use_enable debug expensive-checks)
598 - $(use_enable libedit)
599 - $(use_enable ncurses terminfo)
600 - $(use_enable libffi)
601 - )
602 -
603 - # well, it's used only by clang executable c-index-test
604 - if multilib_is_native_abi && use clang && use xml; then
605 - conf_flags+=( XML2CONFIG="$(tc-getPKG_CONFIG) libxml-2.0" )
606 - else
607 - conf_flags+=( ac_cv_prog_XML2CONFIG="" )
608 - fi
609 -
610 - local targets bindings
611 - if use multitarget; then
612 - targets='all'
613 - else
614 - targets='host,cpp'
615 - use video_cards_radeon && targets+=',r600'
616 - fi
617 - conf_flags+=( --enable-targets=${targets} )
618 -
619 - if multilib_is_native_abi; then
620 - use gold && conf_flags+=( --with-binutils-include="${EPREFIX}"/usr/include/ )
621 - # extra commas don't hurt
622 - use ocaml && bindings+=',ocaml'
623 - fi
624 -
625 - [[ ${bindings} ]] || bindings='none'
626 - conf_flags+=( --enable-bindings=${bindings} )
627 -
628 - if use libffi; then
629 - local CPPFLAGS=${CPPFLAGS}
630 - append-cppflags "$($(tc-getPKG_CONFIG) --cflags libffi)"
631 - fi
632 -
633 - # Enable large file support, bug #550708
634 - append-lfs-flags
635 - # llvm prefers clang over gcc, so we may need to force that
636 - tc-export CC CXX
637 -
638 - ECONF_SOURCE=${S} \
639 - econf "${conf_flags[@]}"
640 -}
641 -
642 -set_makeargs() {
643 - MAKEARGS=(
644 - VERBOSE=1
645 - REQUIRES_RTTI=1
646 - GENTOO_LIBDIR=$(get_libdir)
647 - )
648 -
649 - # for tests, we want it all! otherwise, we may use a little filtering...
650 - # adding ONLY_TOOLS also disables unittest building...
651 - if [[ ${EBUILD_PHASE_FUNC} != src_test ]]; then
652 - local tools=( llvm-config )
653 - use clang && tools+=( clang )
654 -
655 - if multilib_is_native_abi; then
656 - tools+=(
657 - opt llvm-as llvm-dis llc llvm-ar llvm-nm llvm-link lli
658 - llvm-extract llvm-mc llvm-bcanalyzer llvm-diff macho-dump
659 - llvm-objdump llvm-readobj llvm-rtdyld llvm-dwarfdump llvm-cov
660 - llvm-size llvm-stress llvm-mcmarkup llvm-profdata
661 - llvm-symbolizer obj2yaml yaml2obj lto bugpoint
662 - )
663 -
664 - # the build system runs explicitly specified tools in parallel,
665 - # so we need to split it into two runs
666 - if [[ ${1} != -1 ]]; then
667 - # those require lto
668 - tools+=( llvm-lto )
669 - use gold && tools+=( gold )
670 -
671 - # those require clang :)
672 - # we need to explicitly specify all its tools
673 - # since we're passing BUILD_CLANG_ONLY
674 - use clang && tools+=(
675 - clang/tools/{clang-check,clang-format,extra}
676 - )
677 - fi
678 - fi
679 -
680 - MAKEARGS+=(
681 - # filter tools + disable unittests implicitly
682 - ONLY_TOOLS="${tools[*]}"
683 -
684 - # this disables unittests & docs from clang
685 - BUILD_CLANG_ONLY=YES
686 - )
687 - fi
688 -}
689 -
690 -multilib_src_compile() {
691 - local MAKEARGS
692 - set_makeargs -1
693 - emake "${MAKEARGS[@]}"
694 -
695 - if multilib_is_native_abi; then
696 - set_makeargs
697 - emake -C tools "${MAKEARGS[@]}"
698 -
699 - if use doc; then
700 - emake -C "${S}"/docs -f Makefile.sphinx man
701 - use clang && emake -C "${S}"/tools/clang/docs/tools \
702 - BUILD_FOR_WEBSITE=1 DST_MAN_DIR="${T}"/ man
703 - emake -C "${S}"/docs -f Makefile.sphinx html
704 - fi
705 - fi
706 -
707 - if use debug; then
708 - pax-mark m Debug+Asserts+Checks/bin/llvm-rtdyld
709 - pax-mark m Debug+Asserts+Checks/bin/lli
710 - pax-mark m Debug+Asserts+Checks/bin/lli-child-target
711 - else
712 - pax-mark m Release/bin/llvm-rtdyld
713 - pax-mark m Release/bin/lli
714 - pax-mark m Release/bin/lli-child-target
715 - fi
716 -}
717 -
718 -multilib_src_test() {
719 - local MAKEARGS
720 - set_makeargs
721 -
722 - # build the remaining tools & unittests
723 - emake "${MAKEARGS[@]}"
724 -
725 - pax-mark m unittests/ExecutionEngine/JIT/Release/JITTests
726 - pax-mark m unittests/ExecutionEngine/MCJIT/Release/MCJITTests
727 - pax-mark m unittests/Support/Release/SupportTests
728 -
729 - # respect TMPDIR!
730 - local -x LIT_PRESERVES_TMP=1
731 - emake "${MAKEARGS[@]}" check
732 - use clang && emake "${MAKEARGS[@]}" -C tools/clang test
733 -}
734 -
735 -src_install() {
736 - local MULTILIB_CHOST_TOOLS=(
737 - /usr/bin/llvm-config
738 - )
739 -
740 - local MULTILIB_WRAPPED_HEADERS=(
741 - /usr/include/llvm/Config/config.h
742 - /usr/include/llvm/Config/llvm-config.h
743 - )
744 -
745 - if use clang; then
746 - # note: magic applied below
747 - MULTILIB_CHOST_TOOLS+=(
748 - /usr/bin/clang
749 - /usr/bin/clang++
750 - /usr/bin/clang-${PV}
751 - /usr/bin/clang++-${PV}
752 - )
753 -
754 - MULTILIB_WRAPPED_HEADERS+=(
755 - /usr/include/clang/Config/config.h
756 - )
757 - fi
758 -
759 - multilib-minimal_src_install
760 -
761 - # Remove unnecessary headers on FreeBSD, bug #417171
762 - use kernel_FreeBSD && use clang && rm "${ED}"usr/lib/clang/${PV}/include/{std,float,iso,limits,tgmath,varargs}*.h
763 -}
764 -
765 -multilib_src_install() {
766 - local MAKEARGS
767 - set_makeargs
768 -
769 - local root=${D}/_${ABI}
770 -
771 - emake "${MAKEARGS[@]}" DESTDIR="${root}" install
772 - multibuild_merge_root "${root}" "${D}"
773 -
774 - if ! multilib_is_native_abi; then
775 - # Backwards compat, will be happily removed someday.
776 - dosym "${CHOST}"-llvm-config /usr/bin/llvm-config.${ABI}
777 - else
778 - # Install docs.
779 - if use doc; then
780 - doman "${S}"/docs/_build/man/*.1
781 - use clang && doman "${T}"/clang.1
782 - dohtml -r "${S}"/docs/_build/html/
783 - else
784 - if ! use clang; then
785 - rm "${WORKDIR}"/${PN}-3.6.1-manpages/clang.1 || die
786 - fi
787 - doman "${WORKDIR}"/${PN}-3.6.1-manpages/*.1
788 - fi
789 -
790 - # Symlink the gold plugin.
791 - if use gold; then
792 - dodir /usr/${CHOST}/binutils-bin/lib/bfd-plugins
793 - dosym ../../../../$(get_libdir)/LLVMgold.so \
794 - /usr/${CHOST}/binutils-bin/lib/bfd-plugins/LLVMgold.so
795 - fi
796 - fi
797 -
798 - # apply CHOST and PV to clang executables
799 - # they're statically linked so we don't have to worry about the lib
800 - if use clang; then
801 - local clang_tools=( clang clang++ )
802 - local i
803 -
804 - # append ${PV} and symlink back
805 - # TODO: use alternatives.eclass? does that make any sense?
806 - # maybe with USE=-clang on :0 and USE=clang on older
807 - for i in "${clang_tools[@]}"; do
808 - mv "${ED%/}/usr/bin/${i}"{,-${PV}} || die
809 - dosym "${i}"-${PV} /usr/bin/${i}
810 - done
811 -
812 - # now prepend ${CHOST} and let the multilib-build.eclass symlink it
813 - if ! multilib_is_native_abi; then
814 - # non-native? let's replace it with a simple wrapper
815 - for i in "${clang_tools[@]}"; do
816 - rm "${ED%/}/usr/bin/${i}-${PV}" || die
817 - cat > "${T}"/wrapper.tmp <<-_EOF_
818 - #!${EPREFIX}/bin/sh
819 - exec "${i}-${PV}" $(get_abi_CFLAGS) "\${@}"
820 - _EOF_
821 - newbin "${T}"/wrapper.tmp "${i}-${PV}"
822 - done
823 - fi
824 - fi
825 -
826 - # Fix install_names on Darwin. The build system is too complicated
827 - # to just fix this, so we correct it post-install
828 - local lib= f= odylib= ndylib= libpv=${PV}
829 - if [[ ${CHOST} == *-darwin* ]] ; then
830 - eval $(grep PACKAGE_VERSION= configure)
831 - [[ -n ${PACKAGE_VERSION} ]] && libpv=${PACKAGE_VERSION}
832 - libpvminor=${libpv%.[0-9]*}
833 - for lib in lib{EnhancedDisassembly,LLVM-${libpv},LTO,profile_rt,clang}.dylib LLVMHello.dylib clang/${libpv}/lib/darwin/libclang_rt.asan_{osx,iossim}_dynamic.dylib; do
834 - # libEnhancedDisassembly is Darwin10 only, so non-fatal
835 - # + omit clang libs if not enabled
836 - [[ -f ${ED}/usr/lib/${lib} ]] || continue
837 -
838 - ebegin "fixing install_name of $lib"
839 - install_name_tool \
840 - -id "${EPREFIX}"/usr/lib/${lib} \
841 - "${ED}"/usr/lib/${lib}
842 - eend $?
843 - done
844 - for f in "${ED}"/usr/bin/* "${ED}"/usr/lib/lib*.dylib "${ED}"/usr/lib/clang/${libpv}/lib/darwin/*.dylib ; do
845 - # omit clang libs if not enabled
846 - [[ -f "${f}" ]] || continue
847 -
848 - scanmacho -BF'%n#f' "${f}" | tr ',' '\n' | \
849 - while read odylib ; do
850 - ndylib=
851 - case ${odylib} in
852 - */libclang.dylib)
853 - ndylib="${EPREFIX}"/usr/lib/libclang.dylib
854 - ;;
855 - */libLLVM-${libpv}.dylib)
856 - ndylib="${EPREFIX}"/usr/lib/libLLVM-${libpv}.dylib
857 - ;;
858 - */libLLVM-${libpvminor}.dylib)
859 - ndylib="${EPREFIX}"/usr/lib/libLLVM-${libpvminor}.dylib
860 - ;;
861 - */libLTO.dylib)
862 - ndylib="${EPREFIX}"/usr/lib/libLTO.dylib
863 - ;;
864 - esac
865 - if [[ -n ${ndylib} ]] ; then
866 - ebegin "fixing install_name reference to ${odylib} of ${f##*/}"
867 - install_name_tool \
868 - -change "${odylib}" "${ndylib}" \
869 - "${f}"
870 - eend $?
871 - fi
872 - done
873 - done
874 - fi
875 -}
876 -
877 -multilib_src_install_all() {
878 - insinto /usr/share/vim/vimfiles/syntax
879 - doins utils/vim/*.vim
880 -
881 - if use clang; then
882 - cd tools/clang || die
883 -
884 - if use static-analyzer ; then
885 - dobin tools/scan-build/ccc-analyzer
886 - dosym ccc-analyzer /usr/bin/c++-analyzer
887 - dobin tools/scan-build/scan-build
888 -
889 - insinto /usr/share/${PN}
890 - doins tools/scan-build/scanview.css
891 - doins tools/scan-build/sorttable.js
892 - fi
893 -
894 - python_inst() {
895 - if use static-analyzer ; then
896 - pushd tools/scan-view >/dev/null || die
897 -
898 - python_doscript scan-view
899 -
900 - touch __init__.py || die
901 - python_moduleinto clang
902 - python_domodule __init__.py Reporter.py Resources ScanView.py startfile.py
903 -
904 - popd >/dev/null || die
905 - fi
906 -
907 - if use python ; then
908 - pushd bindings/python/clang >/dev/null || die
909 -
910 - python_moduleinto clang
911 - python_domodule __init__.py cindex.py enumerations.py
912 -
913 - popd >/dev/null || die
914 - fi
915 -
916 - # AddressSanitizer symbolizer (currently separate)
917 - python_doscript "${S}"/projects/compiler-rt/lib/asan/scripts/asan_symbolize.py
918 - }
919 - python_foreach_impl python_inst
920 - fi
921 -}