/[gentoo-x86]/sys-devel/clang/clang-2.7-r1.ebuild
Gentoo

Contents of /sys-devel/clang/clang-2.7-r1.ebuild

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (show annotations) (download)
Tue Jul 27 13:06:47 2010 UTC (4 years, 4 months ago) by voyageur
Branch: MAIN
CVS Tags: HEAD
Changes since 1.1: +1 -1 lines
FILE REMOVED
Add a USE-flag for system CXX headers, fix for x86. llvm-gcc users should leave the flag off
(Portage version: 2.2_rc67/cvs/Linux x86_64)

1 # Copyright 1999-2010 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: /var/cvsroot/gentoo-x86/sys-devel/clang/clang-2.7-r1.ebuild,v 1.1 2010/07/20 09:35:43 voyageur Exp $
4
5 EAPI=2
6
7 RESTRICT_PYTHON_ABIS="3.*"
8 SUPPORT_PYTHON_ABIS="1"
9
10 inherit eutils multilib python
11
12 DESCRIPTION="C language family frontend for LLVM"
13 HOMEPAGE="http://clang.llvm.org/"
14 # Fetching LLVM as well: see http://llvm.org/bugs/show_bug.cgi?id=4840
15 SRC_URI="http://llvm.org/releases/${PV}/llvm-${PV}.tgz
16 http://llvm.org/releases/${PV}/${P}.tgz"
17
18 LICENSE="UoI-NCSA"
19 SLOT="0"
20 KEYWORDS="~amd64 ~x86"
21 IUSE="debug +static-analyzer test"
22
23 # Note: for LTO support, clang will depend on binutils with gold plugins, and LLVM built after that - http://llvm.org/docs/GoldPlugin.html
24 DEPEND="static-analyzer? ( dev-lang/perl )
25 test? ( dev-util/dejagnu )"
26 RDEPEND="~sys-devel/llvm-${PV}"
27
28 S="${WORKDIR}/llvm-2.7"
29
30 src_prepare() {
31 mv "${WORKDIR}"/clang-2.7 "${S}"/tools/clang || die "clang source directory not found"
32
33 # Same as llvm doc patches
34 epatch "${FILESDIR}"/${PN}-2.7-fixdoc.patch
35
36 # multilib-strict
37 sed -e "/PROJ_headers/s#lib/clang#$(get_libdir)/clang#" \
38 -i tools/clang/lib/Headers/Makefile \
39 || die "clang Makefile failed"
40 # fix the static analyzer for in-tree install
41 sed -e 's/import ScanView/from clang \0/' \
42 -i tools/clang/tools/scan-view/scan-view \
43 || die "scan-view sed failed"
44 sed -e "/scanview.css\|sorttable.js/s#\$RealBin#/usr/share/${PN}#" \
45 -i tools/clang/tools/scan-build/scan-build \
46 || die "scan-build sed failed"
47 # Specify python version
48 python_convert_shebangs 2 tools/clang/tools/scan-view/scan-view
49
50 # From llvm src_prepare
51 einfo "Fixing install dirs"
52 sed -e 's,^PROJ_docsdir.*,PROJ_docsdir := $(PROJ_prefix)/share/doc/'${PF}, \
53 -e 's,^PROJ_etcdir.*,PROJ_etcdir := /etc/llvm,' \
54 -e 's,^PROJ_libdir.*,PROJ_libdir := $(PROJ_prefix)/'$(get_libdir), \
55 -i Makefile.config.in || die "Makefile.config sed failed"
56
57 einfo "Fixing rpath"
58 sed -e 's/\$(RPATH) -Wl,\$(\(ToolDir\|LibDir\))//g' -i Makefile.rules \
59 || die "rpath sed failed"
60 }
61
62 src_configure() {
63 local CONF_FLAGS=""
64
65 if use debug; then
66 CONF_FLAGS="${CONF_FLAGS} --disable-optimized"
67 einfo "Note: Compiling LLVM in debug mode will create huge and slow binaries"
68 # ...and you probably shouldn't use tmpfs, unless it can hold 900MB
69 else
70 CONF_FLAGS="${CONF_FLAGS} \
71 --enable-optimized \
72 --disable-assertions \
73 --disable-expensive-checks"
74 fi
75
76 if use amd64; then
77 CONF_FLAGS="${CONF_FLAGS} --enable-pic"
78 fi
79
80 # Skip llvm-gcc parts even if installed
81 CONF_FLAGS="${CONF_FLAGS} --with-llvmgccdir=/dev/null"
82
83 # Try to get current C++ headers path
84 CONF_FLAGS="${CONF_FLAGS} --with-cxx-include-root=$(gcc-config -X| cut -d: -f1)/include/g++-v4"
85 CONF_FLAGS="${CONF_FLAGS} --with-cxx-include-arch=$CHOST"
86 if has_multilib_profile; then
87 CONF_FLAGS="${CONF_FLAGS} --with-cxx-include-32bit-dir=32"
88 fi
89 econf ${CONF_FLAGS} || die "econf failed"
90 }
91
92 src_compile() {
93 emake VERBOSE=1 KEEP_SYMBOLS=1 REQUIRES_RTTI=1 clang-only || die "emake failed"
94 }
95
96 src_test() {
97 cd "${S}"/test || die "cd failed"
98 emake site.exp || die "updating llvm site.exp failed"
99
100 cd "${S}"/tools/clang || die "cd clang failed"
101
102 echo ">>> Test phase [test]: ${CATEGORY}/${PF}"
103 if ! emake -j1 VERBOSE=1 test; then
104 hasq test $FEATURES && die "Make test failed. See above for details."
105 hasq test $FEATURES || eerror "Make test failed. See above for details."
106 fi
107 }
108
109 src_install() {
110 cd "${S}"/tools/clang || die "cd clang failed"
111 emake KEEP_SYMBOLS=1 DESTDIR="${D}" install || die "install failed"
112
113 if use static-analyzer ; then
114 dobin tools/scan-build/ccc-analyzer
115 dosym ccc-analyzer /usr/bin/c++-analyzer
116 dobin tools/scan-build/scan-build
117
118 insinto /usr/share/${PN}
119 doins tools/scan-build/scanview.css
120 doins tools/scan-build/sorttable.js
121
122 cd tools/scan-view || die "cd scan-view failed"
123 dobin scan-view
124 install-scan-view() {
125 insinto "$(python_get_sitedir)"/clang
126 doins Reporter.py Resources ScanView.py startfile.py
127 touch "${D}"/"$(python_get_sitedir)"/clang/__init__.py
128 }
129 python_execute_function install-scan-view
130 fi
131 }
132
133 pkg_postinst() {
134 python_mod_optimize clang
135 elog "C++ headers search path is hardcoded to the active gcc profile one"
136 elog "If you change the active gcc profile, or update gcc to a new version,"
137 elog "you will have to remerge this package to update the search path"
138 }
139
140 pkg_postrm() {
141 python_mod_cleanup clang
142 }

  ViewVC Help
Powered by ViewVC 1.1.20