Gentoo Archives: gentoo-commits

From: "Bernard Cafarelli (voyageur)" <voyageur@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-x86 commit in sys-devel/llvm: ChangeLog llvm-3.4.2.ebuild
Date: Mon, 23 Jun 2014 23:00:46
Message-Id: 20140623230042.986E62004E@flycatcher.gentoo.org
1 voyageur 14/06/23 23:00:42
2
3 Modified: ChangeLog
4 Added: llvm-3.4.2.ebuild
5 Log:
6 Version bump, mostly fixes a gcc 4.9 build failure and change of libLLVM's DT_SONAME
7
8 (Portage version: 2.2.10/cvs/Linux x86_64, signed Manifest commit with key C74525F2)
9
10 Revision Changes Path
11 1.201 sys-devel/llvm/ChangeLog
12
13 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-devel/llvm/ChangeLog?rev=1.201&view=markup
14 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-devel/llvm/ChangeLog?rev=1.201&content-type=text/plain
15 diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-devel/llvm/ChangeLog?r1=1.200&r2=1.201
16
17 Index: ChangeLog
18 ===================================================================
19 RCS file: /var/cvsroot/gentoo-x86/sys-devel/llvm/ChangeLog,v
20 retrieving revision 1.200
21 retrieving revision 1.201
22 diff -u -r1.200 -r1.201
23 --- ChangeLog 15 Jun 2014 14:30:03 -0000 1.200
24 +++ ChangeLog 23 Jun 2014 23:00:42 -0000 1.201
25 @@ -1,6 +1,12 @@
26 # ChangeLog for sys-devel/llvm
27 # Copyright 1999-2014 Gentoo Foundation; Distributed under the GPL v2
28 -# $Header: /var/cvsroot/gentoo-x86/sys-devel/llvm/ChangeLog,v 1.200 2014/06/15 14:30:03 mgorny Exp $
29 +# $Header: /var/cvsroot/gentoo-x86/sys-devel/llvm/ChangeLog,v 1.201 2014/06/23 23:00:42 voyageur Exp $
30 +
31 +*llvm-3.4.2 (23 Jun 2014)
32 +
33 + 23 Jun 2014; Bernard Cafarelli <voyageur@g.o> +llvm-3.4.2.ebuild:
34 + Version bump, mostly fixes a gcc 4.9 build failure and change of libLLVM's
35 + DT_SONAME
36
37 15 Jun 2014; Michał Górny <mgorny@g.o>
38 files/clang-3.3-gentoo-install.patch, llvm-3.3-r3.ebuild:
39
40
41
42 1.1 sys-devel/llvm/llvm-3.4.2.ebuild
43
44 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-devel/llvm/llvm-3.4.2.ebuild?rev=1.1&view=markup
45 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-devel/llvm/llvm-3.4.2.ebuild?rev=1.1&content-type=text/plain
46
47 Index: llvm-3.4.2.ebuild
48 ===================================================================
49 # Copyright 1999-2014 Gentoo Foundation
50 # Distributed under the terms of the GNU General Public License v2
51 # $Header: /var/cvsroot/gentoo-x86/sys-devel/llvm/llvm-3.4.2.ebuild,v 1.1 2014/06/23 23:00:42 voyageur Exp $
52
53 EAPI=5
54
55 PYTHON_COMPAT=( python2_7 pypy )
56 # this causes some issues so make it optional for now.
57 # 3.5 will have CMakeFiles support in autotools.
58 WANT_CMAKE=cmake
59
60 inherit cmake-utils eutils flag-o-matic multibuild multilib \
61 multilib-minimal python-r1 toolchain-funcs pax-utils check-reqs
62
63 DESCRIPTION="Low Level Virtual Machine"
64 HOMEPAGE="http://llvm.org/"
65 SRC_URI="http://llvm.org/releases/${PV}/${P}.src.tar.gz
66 clang? ( http://llvm.org/releases/${PV}/compiler-rt-3.4.src.tar.gz
67 http://llvm.org/releases/${PV}/cfe-${PV}.src.tar.gz
68 http://llvm.org/releases/${PV}/clang-tools-extra-3.4.src.tar.gz )
69 !doc? ( http://dev.gentoo.org/~mgorny/dist/${PN}-3.4-manpages.tar.bz2 )"
70
71 LICENSE="UoI-NCSA"
72 SLOT="0/3.4"
73 KEYWORDS="~amd64 ~arm ~ppc ~ppc64 ~sparc ~x86 ~amd64-fbsd ~x86-fbsd ~x64-freebsd ~amd64-linux ~arm-linux ~x86-linux ~ppc-macos ~x64-macos"
74 IUSE="clang debug doc gold +libffi multitarget ncurses ocaml python
75 +static-analyzer test udis86 xml video_cards_radeon
76 kernel_Darwin kernel_FreeBSD"
77
78 COMMON_DEPEND="
79 sys-libs/zlib:0=
80 clang? (
81 python? ( ${PYTHON_DEPS} )
82 static-analyzer? (
83 dev-lang/perl:*
84 ${PYTHON_DEPS}
85 )
86 xml? ( dev-libs/libxml2:2= )
87 )
88 gold? ( >=sys-devel/binutils-2.22:*[cxx] )
89 libffi? ( virtual/libffi:0=[${MULTILIB_USEDEP}] )
90 ncurses? ( sys-libs/ncurses:5=[${MULTILIB_USEDEP}] )
91 ocaml? ( dev-lang/ocaml:0= )
92 udis86? ( dev-libs/udis86:0=[pic(+),${MULTILIB_USEDEP}] )"
93 DEPEND="${COMMON_DEPEND}
94 dev-lang/perl
95 >=sys-devel/make-3.81
96 >=sys-devel/flex-2.5.4
97 >=sys-devel/bison-1.875d
98 || ( >=sys-devel/gcc-3.0 >=sys-devel/gcc-apple-4.2.1
99 ( >=sys-freebsd/freebsd-lib-9.1-r10 sys-libs/libcxx )
100 )
101 || ( >=sys-devel/binutils-2.18 >=sys-devel/binutils-apple-3.2.3 )
102 clang? ( xml? ( virtual/pkgconfig ) )
103 doc? ( dev-python/sphinx )
104 libffi? ( virtual/pkgconfig )
105 ${PYTHON_DEPS}"
106 RDEPEND="${COMMON_DEPEND}
107 clang? ( !<=sys-devel/clang-3.4-r99
108 !>=sys-devel/clang-9999 )
109 abi_x86_32? ( !<=app-emulation/emul-linux-x86-baselibs-20130224-r2
110 !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)] )"
111 PDEPEND="clang? ( =sys-devel/clang-${PV}-r100 )"
112
113 # pypy gives me around 1700 unresolved tests due to open file limit
114 # being exceeded. probably GC does not close them fast enough.
115 REQUIRED_USE="${PYTHON_REQUIRED_USE}
116 test? ( || ( $(python_gen_useflags 'python*') ) )"
117
118 S=${WORKDIR}/${P}.src
119
120 # Some people actually override that in make.conf. That sucks since
121 # we need to run install per-directory, and ninja can't do that...
122 # so why did it call itself ninja in the first place?
123 CMAKE_MAKEFILE_GENERATOR=emake
124
125 MULTILIB_CHOST_TOOLS=(
126 /usr/bin/llvm-config
127 )
128
129 pkg_pretend() {
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 use debug; then
144 ewarn "USE=debug is known to increase the size of package considerably"
145 ewarn "and cause the tests to fail."
146 ewarn
147
148 (( build_size *= 14 ))
149 elif is-flagq -g || is-flagq -ggdb; then
150 ewarn "The C++ compiler -g option is known to increase the size of the package"
151 ewarn "considerably. If you run out of space, please consider removing it."
152 ewarn
153
154 (( build_size *= 10 ))
155 fi
156
157 # Multiply by number of ABIs :).
158 local abis=( $(multilib_get_enabled_abis) )
159 (( build_size *= ${#abis[@]} ))
160
161 local CHECKREQS_DISK_BUILD=${build_size}M
162 check-reqs_pkg_pretend
163 }
164
165 pkg_setup() {
166 pkg_pretend
167
168 # need to check if the active compiler is ok
169
170 broken_gcc=( 3.2.2 3.2.3 3.3.2 4.1.1 )
171 broken_gcc_x86=( 3.4.0 3.4.2 )
172 broken_gcc_amd64=( 3.4.6 )
173
174 gcc_vers=$(gcc-fullversion)
175
176 if has "${gcc_vers}" "${broken_gcc[@]}"; then
177 elog "Your version of gcc is known to miscompile llvm."
178 elog "Check http://www.llvm.org/docs/GettingStarted.html for"
179 elog "possible solutions."
180 die "Your currently active version of gcc is known to miscompile llvm"
181 fi
182
183 if use abi_x86_32 && has "${gcc_vers}" "${broken_gcc_x86[@]}"; then
184 elog "Your version of gcc is known to miscompile llvm on x86"
185 elog "architectures. Check"
186 elog "http://www.llvm.org/docs/GettingStarted.html for possible"
187 elog "solutions."
188 die "Your currently active version of gcc is known to miscompile llvm"
189 fi
190
191 if use abi_x86_64 && has "${gcc_vers}" "${broken_gcc_amd64[@]}"; then
192 elog "Your version of gcc is known to miscompile llvm in amd64"
193 elog "architectures. Check"
194 elog "http://www.llvm.org/docs/GettingStarted.html for possible"
195 elog "solutions."
196 die "Your currently active version of gcc is known to miscompile llvm"
197 fi
198 }
199
200 src_unpack() {
201 default
202
203 rm -f "${S}"/tools/clang "${S}"/projects/compiler-rt \
204 || die "symlinks removal failed"
205
206 if use clang; then
207 mv "${WORKDIR}"/cfe-${PV}.src "${S}"/tools/clang \
208 || die "clang source directory move failed"
209 mv "${WORKDIR}"/compiler-rt-3.4 "${S}"/projects/compiler-rt \
210 || die "compiler-rt source directory move failed"
211 mv "${WORKDIR}"/clang-tools-extra-3.4 "${S}"/tools/clang/tools/extra \
212 || die "clang-tools-extra source directory move failed"
213 fi
214 }
215
216 src_prepare() {
217 epatch "${FILESDIR}"/${PN}-3.2-nodoctargz.patch
218 epatch "${FILESDIR}"/${PN}-3.4-gentoo-install.patch
219 # Hack cmake search path for Gentoo, bug #496480
220 epatch "${FILESDIR}"/${PN}-3.3-cmake-modulepath.patch
221 # Use built-in ConfigParser to avoid failures with configparser-3.2
222 # https://bugs.gentoo.org/show_bug.cgi?id=500856
223 epatch "${FILESDIR}"/${PN}-3.4-cmake-configparser.patch
224
225 if use clang; then
226 # Automatically select active system GCC's libraries, bugs #406163 and #417913
227 epatch "${FILESDIR}"/clang-3.1-gentoo-runtime-gcc-detection-v3.patch
228
229 epatch "${FILESDIR}"/clang-3.4-gentoo-install.patch
230 fi
231
232 if use prefix && use clang; then
233 sed -e "/^CFLAGS /s@-Werror@-I${EPREFIX}/usr/include@" \
234 -i 'projects/compiler-rt/make/platform/clang_linux.mk' || die
235 fi
236
237 local sub_files=(
238 Makefile.config.in
239 Makefile.rules
240 tools/llvm-config/llvm-config.cpp
241 )
242 use clang && sub_files+=(
243 tools/clang/lib/Driver/Tools.cpp
244 tools/clang/tools/scan-build/scan-build
245 )
246
247 # unfortunately ./configure won't listen to --mandir and the-like, so take
248 # care of this.
249 # note: we're setting the main libdir intentionally.
250 # where per-ABI is appropriate, we use $(GENTOO_LIBDIR) make.
251 einfo "Fixing install dirs"
252 sed -e "s,@libdir@,$(get_libdir),g" \
253 -e "s,@PF@,${PF},g" \
254 -e "s,@EPREFIX@,${EPREFIX},g" \
255 -i "${sub_files[@]}" \
256 || die "install paths sed failed"
257
258 # User patches
259 epatch_user
260
261 python_setup
262 }
263
264 multilib_src_configure() {
265 # disable timestamps since they confuse ccache
266 local conf_flags=(
267 --disable-timestamps
268 --enable-keep-symbols
269 --enable-shared
270 --with-optimize-option=
271 $(use_enable !debug optimized)
272 $(use_enable debug assertions)
273 $(use_enable debug expensive-checks)
274 $(use_enable ncurses terminfo)
275 $(use_enable libffi)
276 )
277
278 if use clang; then
279 conf_flags+=( --with-clang-resource-dir=../lib/clang/${PV} )
280 fi
281 # well, it's used only by clang executable c-index-test
282 if multilib_is_native_abi && use clang && use xml; then
283 conf_flags+=( XML2CONFIG="$(tc-getPKG_CONFIG) libxml-2.0" )
284 else
285 conf_flags+=( ac_cv_prog_XML2CONFIG="" )
286 fi
287
288 local targets bindings
289 if use multitarget; then
290 targets='all'
291 else
292 targets='host,cpp'
293 use video_cards_radeon && targets+=',r600'
294 fi
295 conf_flags+=( --enable-targets=${targets} )
296
297 if multilib_is_native_abi; then
298 use gold && conf_flags+=( --with-binutils-include="${EPREFIX}"/usr/include/ )
299 # extra commas don't hurt
300 use ocaml && bindings+=',ocaml'
301 fi
302
303 [[ ${bindings} ]] || bindings='none'
304 conf_flags+=( --enable-bindings=${bindings} )
305
306 if use udis86; then
307 conf_flags+=( --with-udis86 )
308 fi
309
310 if use libffi; then
311 local CPPFLAGS=${CPPFLAGS}
312 append-cppflags "$(pkg-config --cflags libffi)"
313 fi
314
315 # llvm prefers clang over gcc, so we may need to force that
316 tc-export CC CXX
317
318 ECONF_SOURCE=${S} \
319 econf "${conf_flags[@]}"
320
321 multilib_is_native_abi && cmake_configure
322 }
323
324 cmake_configure() {
325 # sadly, cmake doesn't seem to have host autodetection
326 # but it's fairly easy to steal this from configured autotools
327 local targets=$(sed -n -e 's/^TARGETS_TO_BUILD=//p' Makefile.config || die)
328 local libdir=$(get_libdir)
329 local mycmakeargs=(
330 # just the stuff needed to get correct cmake modules
331 $(cmake-utils_use ncurses LLVM_ENABLE_TERMINFO)
332
333 -DLLVM_TARGETS_TO_BUILD="${targets// /;}"
334 -DLLVM_LIBDIR_SUFFIX=${libdir#lib}
335 )
336
337 BUILD_DIR=${S%/}_cmake \
338 cmake-utils_src_configure
339 }
340
341 set_makeargs() {
342 MAKEARGS=(
343 VERBOSE=1
344 REQUIRES_RTTI=1
345 GENTOO_LIBDIR=$(get_libdir)
346 )
347
348 # for tests, we want it all! otherwise, we may use a little filtering...
349 # adding ONLY_TOOLS also disables unittest building...
350 if [[ ${EBUILD_PHASE_FUNC} != src_test ]]; then
351 local tools=( llvm-config )
352 use clang && tools+=( clang )
353
354 if multilib_is_native_abi; then
355 tools+=(
356 opt llvm-as llvm-dis llc llvm-ar llvm-nm llvm-link lli
357 llvm-extract llvm-mc llvm-bcanalyzer llvm-diff macho-dump
358 llvm-objdump llvm-readobj llvm-rtdyld llvm-dwarfdump llvm-cov
359 llvm-size llvm-stress llvm-mcmarkup llvm-symbolizer obj2yaml
360 yaml2obj lto bugpoint
361 )
362
363 # the build system runs explicitly specified tools in parallel,
364 # so we need to split it into two runs
365 if [[ ${1} != -1 ]]; then
366 # those require lto
367 tools+=( llvm-lto )
368 use gold && tools+=( gold )
369
370 # those require clang :)
371 # we need to explicitly specify all its tools
372 # since we're passing BUILD_CLANG_ONLY
373 use clang && tools+=(
374 clang/tools/{clang-check,clang-format,extra}
375 )
376 fi
377 fi
378
379 MAKEARGS+=(
380 # filter tools + disable unittests implicitly
381 ONLY_TOOLS="${tools[*]}"
382
383 # this disables unittests & docs from clang
384 BUILD_CLANG_ONLY=YES
385 )
386 fi
387 }
388
389 multilib_src_compile() {
390 local MAKEARGS
391 set_makeargs -1
392 emake "${MAKEARGS[@]}"
393
394 if multilib_is_native_abi; then
395 set_makeargs
396 emake -C tools "${MAKEARGS[@]}"
397
398 if use doc; then
399 emake -C "${S}"/docs -f Makefile.sphinx man
400 use clang && emake -C "${S}"/tools/clang/docs/tools \
401 BUILD_FOR_WEBSITE=1 DST_MAN_DIR="${T}"/ man
402 emake -C "${S}"/docs -f Makefile.sphinx html
403 fi
404 fi
405
406 if use debug; then
407 pax-mark m Debug+Asserts+Checks/bin/llvm-rtdyld
408 pax-mark m Debug+Asserts+Checks/bin/lli
409 else
410 pax-mark m Release/bin/llvm-rtdyld
411 pax-mark m Release/bin/lli
412 fi
413 }
414
415 multilib_src_test() {
416 local MAKEARGS
417 set_makeargs
418
419 # build the remaining tools & unittests
420 emake "${MAKEARGS[@]}"
421
422 pax-mark m unittests/ExecutionEngine/JIT/Release/JITTests
423 pax-mark m unittests/ExecutionEngine/MCJIT/Release/MCJITTests
424 pax-mark m unittests/Support/Release/SupportTests
425
426 # respect TMPDIR!
427 local -x LIT_PRESERVES_TMP=1
428 emake "${MAKEARGS[@]}" check
429 use clang && emake "${MAKEARGS[@]}" -C tools/clang test
430 }
431
432 src_install() {
433 local MULTILIB_WRAPPED_HEADERS=(
434 /usr/include/llvm/Config/config.h
435 /usr/include/llvm/Config/llvm-config.h
436 )
437
438 use clang && MULTILIB_WRAPPED_HEADERS+=(
439 /usr/include/clang/Config/config.h
440 )
441
442 multilib-minimal_src_install
443
444 # Remove unnecessary headers on FreeBSD, bug #417171
445 use kernel_FreeBSD && use clang && rm "${ED}"usr/lib/clang/${PV}/include/{std,float,iso,limits,tgmath,varargs}*.h
446 }
447
448 multilib_src_install() {
449 local MAKEARGS
450 set_makeargs
451
452 local root=${D}/_${ABI}
453
454 emake "${MAKEARGS[@]}" DESTDIR="${root}" install
455 multibuild_merge_root "${root}" "${D}"
456
457 if ! multilib_is_native_abi; then
458 # Backwards compat, will be happily removed someday.
459 dosym "${CHOST}"-llvm-config /usr/bin/llvm-config.${ABI}
460 else
461 # Install docs.
462 if use doc; then
463 doman "${S}"/docs/_build/man/*.1
464 use clang && doman "${T}"/clang.1
465 dohtml -r "${S}"/docs/_build/html/
466 else
467 if ! use clang; then
468 rm "${WORKDIR}"/${PN}-3.4-manpages/clang.1 || die
469 fi
470 doman "${WORKDIR}"/${PN}-3.4-manpages/*.1
471 fi
472
473 # Symlink the gold plugin.
474 if use gold; then
475 dodir /usr/${CHOST}/binutils-bin/lib/bfd-plugins
476 dosym ../../../../$(get_libdir)/LLVMgold.so \
477 /usr/${CHOST}/binutils-bin/lib/bfd-plugins/LLVMgold.so
478 fi
479
480 # install cmake modules
481 if use cmake; then
482 emake -C "${S%/}"_cmake/cmake/modules DESTDIR="${D}" install
483 fi
484 fi
485
486 # Fix install_names on Darwin. The build system is too complicated
487 # to just fix this, so we correct it post-install
488 local lib= f= odylib= libpv=${PV}
489 if [[ ${CHOST} == *-darwin* ]] ; then
490 eval $(grep PACKAGE_VERSION= configure)
491 [[ -n ${PACKAGE_VERSION} ]] && libpv=${PACKAGE_VERSION}
492 for lib in lib{EnhancedDisassembly,LLVM-${libpv},LTO,profile_rt,clang}.dylib LLVMHello.dylib ; do
493 # libEnhancedDisassembly is Darwin10 only, so non-fatal
494 # + omit clang libs if not enabled
495 [[ -f ${ED}/usr/lib/${lib} ]] || continue
496
497 ebegin "fixing install_name of $lib"
498 install_name_tool \
499 -id "${EPREFIX}"/usr/lib/${lib} \
500 "${ED}"/usr/lib/${lib}
501 eend $?
502 done
503 for f in "${ED}"/usr/bin/* "${ED}"/usr/lib/lib{LTO,clang}.dylib ; do
504 # omit clang libs if not enabled
505 [[ -f ${ED}/usr/lib/${lib} ]] || continue
506
507 odylib=$(scanmacho -BF'%n#f' "${f}" | tr ',' '\n' | grep libLLVM-${libpv}.dylib)
508 ebegin "fixing install_name reference to ${odylib} of ${f##*/}"
509 install_name_tool \
510 -change "${odylib}" \
511 "${EPREFIX}"/usr/lib/libLLVM-${libpv}.dylib \
512 -change "@rpath/libclang.dylib" \
513 "${EPREFIX}"/usr/lib/libclang.dylib \
514 -change "${S}"/Release/lib/libclang.dylib \
515 "${EPREFIX}"/usr/lib/libclang.dylib \
516 "${f}"
517 eend $?
518 done
519 fi
520 }
521
522 multilib_src_install_all() {
523 insinto /usr/share/vim/vimfiles/syntax
524 doins utils/vim/*.vim
525
526 if use clang; then
527 cd tools/clang || die
528
529 if use static-analyzer ; then
530 dobin tools/scan-build/ccc-analyzer
531 dosym ccc-analyzer /usr/bin/c++-analyzer
532 dobin tools/scan-build/scan-build
533
534 insinto /usr/share/${PN}
535 doins tools/scan-build/scanview.css
536 doins tools/scan-build/sorttable.js
537 fi
538
539 python_inst() {
540 if use static-analyzer ; then
541 pushd tools/scan-view >/dev/null || die
542
543 python_doscript scan-view
544
545 touch __init__.py || die
546 python_moduleinto clang
547 python_domodule __init__.py Reporter.py Resources ScanView.py startfile.py
548
549 popd >/dev/null || die
550 fi
551
552 if use python ; then
553 pushd bindings/python/clang >/dev/null || die
554
555 python_moduleinto clang
556 python_domodule __init__.py cindex.py enumerations.py
557
558 popd >/dev/null || die
559 fi
560
561 # AddressSanitizer symbolizer (currently separate)
562 python_doscript "${S}"/projects/compiler-rt/lib/asan/scripts/asan_symbolize.py
563 }
564 python_foreach_impl python_inst
565 fi
566 }