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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (show annotations) (download)
Sun Dec 19 22:45:55 2010 UTC (3 years, 3 months ago) by voyageur
Branch: MAIN
CVS Tags: HEAD
Changes since 1.1: +1 -1 lines
FILE REMOVED
Backport to rename alignof, fixes C++'0x compilers support. Also adds gcc 4.4.4 headers support by default, thanks to Bertjan Broeksema <broeksema@kde.org> in bug #345683

(Portage version: 2.2.0_alpha9/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.8-r1.ebuild,v 1.1 2010/10/12 09:24:54 voyageur Exp $
4
5 EAPI=3
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 # Drop the -> on 2.9
16 SRC_URI="http://llvm.org/releases/${PV}/llvm-${PV}.tgz -> llvm-${PV}-r1.tgz
17 http://llvm.org/releases/${PV}/${P}.tgz"
18
19 LICENSE="UoI-NCSA"
20 SLOT="0"
21 KEYWORDS="~amd64 ~x86 ~amd64-linux ~ppc-macos"
22 IUSE="alltargets debug +static-analyzer system-cxx-headers test"
23
24 # Note: for LTO support, clang will depend on binutils with gold plugins, and LLVM built after that - http://llvm.org/docs/GoldPlugin.html
25 DEPEND="static-analyzer? ( dev-lang/perl )"
26 RDEPEND="~sys-devel/llvm-${PV}[alltargets=]"
27
28 S="${WORKDIR}/llvm-${PV}"
29
30 src_prepare() {
31 mv "${WORKDIR}"/clang-${PV} "${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 := '"${EPREFIX}"'/etc/llvm,' \
54 -e 's,^PROJ_libdir.*,PROJ_libdir := $(PROJ_prefix)/'$(get_libdir)/llvm, \
55 -i Makefile.config.in || die "Makefile.config sed failed"
56
57 einfo "Fixing rpath"
58 sed -e 's,\$(RPATH) -Wl\,\$(\(ToolDir\|LibDir\)),$(RPATH) -Wl\,'"${EPREFIX}"/usr/$(get_libdir)/llvm, \
59 -i Makefile.rules || die "rpath sed failed"
60 }
61
62 src_configure() {
63 local CONF_FLAGS="--enable-shared"
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 # Setup the search path to include the Prefix includes
77 if use prefix ; then
78 CONF_FLAGS="${CONF_FLAGS} \
79 --with-c-include-dirs=${EPREFIX}/usr/include:/usr/include"
80 fi
81
82 if use alltargets; then
83 CONF_FLAGS="${CONF_FLAGS} --enable-targets=all"
84 else
85 CONF_FLAGS="${CONF_FLAGS} --enable-targets=host-only"
86 fi
87
88 if use amd64; then
89 CONF_FLAGS="${CONF_FLAGS} --enable-pic"
90 fi
91
92 # Skip llvm-gcc parts even if installed
93 CONF_FLAGS="${CONF_FLAGS} --with-llvmgccdir=/dev/null"
94
95 if use system-cxx-headers; then
96 # Try to get current C++ headers path
97 CONF_FLAGS="${CONF_FLAGS} --with-cxx-include-root=$(gcc-config -X| cut -d: -f1 | sed '/-v4$/! s,$,/include/g++-v4,')"
98 CONF_FLAGS="${CONF_FLAGS} --with-cxx-include-arch=$CHOST"
99 if has_multilib_profile; then
100 CONF_FLAGS="${CONF_FLAGS} --with-cxx-include-32bit-dir=32"
101 fi
102 fi
103
104 econf ${CONF_FLAGS} || die "econf failed"
105 }
106
107 src_compile() {
108 emake VERBOSE=1 KEEP_SYMBOLS=1 REQUIRES_RTTI=1 clang-only || die "emake failed"
109 }
110
111 src_test() {
112 cd "${S}"/test || die "cd failed"
113 emake site.exp || die "updating llvm site.exp failed"
114
115 cd "${S}"/tools/clang || die "cd clang failed"
116
117 echo ">>> Test phase [test]: ${CATEGORY}/${PF}"
118 if ! emake -j1 VERBOSE=1 test; then
119 hasq test $FEATURES && die "Make test failed. See above for details."
120 hasq test $FEATURES || eerror "Make test failed. See above for details."
121 fi
122 }
123
124 src_install() {
125 cd "${S}"/tools/clang || die "cd clang failed"
126 emake KEEP_SYMBOLS=1 DESTDIR="${D}" install || die "install failed"
127
128 if use static-analyzer ; then
129 dobin tools/scan-build/ccc-analyzer
130 dosym ccc-analyzer /usr/bin/c++-analyzer
131 dobin tools/scan-build/scan-build
132
133 insinto /usr/share/${PN}
134 doins tools/scan-build/scanview.css
135 doins tools/scan-build/sorttable.js
136
137 cd tools/scan-view || die "cd scan-view failed"
138 dobin scan-view
139 install-scan-view() {
140 insinto "$(python_get_sitedir)"/clang
141 doins Reporter.py Resources ScanView.py startfile.py
142 touch "${ED}"/"$(python_get_sitedir)"/clang/__init__.py
143 }
144 python_execute_function install-scan-view
145 fi
146
147 # Fix install_names on Darwin. The build system is too complicated
148 # to just fix this, so we correct it post-install
149 if [[ ${CHOST} == *-darwin* ]] ; then
150 for lib in libCIndex.dylib ; do
151 install_name_tool -id "${EPREFIX}"/usr/lib/llvm/${lib} \
152 "${ED}"/usr/lib/llvm/${lib}
153 done
154 fi
155 }
156
157 pkg_postinst() {
158 python_mod_optimize clang
159 if use system-cxx-headers; then
160 elog "C++ headers search path is hardcoded to the active gcc profile one"
161 elog "If you change the active gcc profile, or update gcc to a new version,"
162 elog "you will have to remerge this package to update the search path"
163 else
164 elog "If clang++ fails to find C++ headers on your system,"
165 elog "you can remerge clang with USE=system-cxx-headers to use C++ headers"
166 elog "from the active gcc profile"
167 fi
168 }
169
170 pkg_postrm() {
171 python_mod_cleanup clang
172 }

  ViewVC Help
Powered by ViewVC 1.1.20