Gentoo Archives: gentoo-commits

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