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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.4 - (show annotations) (download)
Sun Dec 19 22:45:55 2010 UTC (3 years, 4 months ago) by voyageur
Branch: MAIN
CVS Tags: HEAD
Changes since 1.3: +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-r2.ebuild,v 1.3 2010/10/24 17:42:05 grobian 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 # Fix toolchain lookup for Darwin/Prefix.
37 epatch "${FILESDIR}"/${PN}-2.8-darwin-prefix.patch
38 sed -e "s|@GENTOO_PORTAGE_CHOST_ARCH@|${CHOST%%-darwin*}-darwin|g" \
39 -e "s|@GENTOO_PORTAGE_CHOST@|${CHOST}|g" \
40 -e "s|@GENTOO_PORTAGE_EPREFIX@|${EPREFIX}|g" \
41 -i tools/clang/lib/Driver/ToolChains.cpp \
42 || die "fixing toolchain lookup"
43
44 # multilib-strict
45 sed -e "/PROJ_headers/s#lib/clang#$(get_libdir)/clang#" \
46 -i tools/clang/lib/Headers/Makefile \
47 || die "clang Makefile failed"
48 # fix the static analyzer for in-tree install
49 sed -e 's/import ScanView/from clang \0/' \
50 -i tools/clang/tools/scan-view/scan-view \
51 || die "scan-view sed failed"
52 sed -e "/scanview.css\|sorttable.js/s#\$RealBin#/usr/share/${PN}#" \
53 -i tools/clang/tools/scan-build/scan-build \
54 || die "scan-build sed failed"
55 # Specify python version
56 python_convert_shebangs 2 tools/clang/tools/scan-view/scan-view
57
58 # From llvm src_prepare
59 einfo "Fixing install dirs"
60 sed -e 's,^PROJ_docsdir.*,PROJ_docsdir := $(PROJ_prefix)/share/doc/'${PF}, \
61 -e 's,^PROJ_etcdir.*,PROJ_etcdir := '"${EPREFIX}"'/etc/llvm,' \
62 -e 's,^PROJ_libdir.*,PROJ_libdir := $(PROJ_prefix)/'$(get_libdir)/llvm, \
63 -i Makefile.config.in || die "Makefile.config sed failed"
64
65 einfo "Fixing rpath"
66 sed -e 's,\$(RPATH) -Wl\,\$(\(ToolDir\|LibDir\)),$(RPATH) -Wl\,'"${EPREFIX}"/usr/$(get_libdir)/llvm, \
67 -i Makefile.rules || die "rpath sed failed"
68 }
69
70 src_configure() {
71 local CONF_FLAGS="--enable-shared"
72
73 if use debug; then
74 CONF_FLAGS="${CONF_FLAGS} --disable-optimized"
75 einfo "Note: Compiling LLVM in debug mode will create huge and slow binaries"
76 # ...and you probably shouldn't use tmpfs, unless it can hold 900MB
77 else
78 CONF_FLAGS="${CONF_FLAGS} \
79 --enable-optimized \
80 --disable-assertions \
81 --disable-expensive-checks"
82 fi
83
84 # Setup the search path to include the Prefix includes
85 if use prefix ; then
86 CONF_FLAGS="${CONF_FLAGS} \
87 --with-c-include-dirs=${EPREFIX}/usr/include:/usr/include"
88 fi
89
90 if use alltargets; then
91 CONF_FLAGS="${CONF_FLAGS} --enable-targets=all"
92 else
93 CONF_FLAGS="${CONF_FLAGS} --enable-targets=host-only"
94 fi
95
96 if use amd64; then
97 CONF_FLAGS="${CONF_FLAGS} --enable-pic"
98 fi
99
100 # Skip llvm-gcc parts even if installed
101 CONF_FLAGS="${CONF_FLAGS} --with-llvmgccdir=/dev/null"
102
103 if use system-cxx-headers; then
104 # Try to get current gcc headers path
105 local CXX_PATH=$(gcc-config -X| cut -d: -f1 | sed 's,/include/g++-v4$,,')
106 CONF_FLAGS="${CONF_FLAGS} --with-c-include-dirs=/usr/include:${CXX_PATH}/include"
107 CONF_FLAGS="${CONF_FLAGS} --with-cxx-include-root=${CXX_PATH}/include/g++-v4"
108 CONF_FLAGS="${CONF_FLAGS} --with-cxx-include-arch=$CHOST"
109 if has_multilib_profile; then
110 CONF_FLAGS="${CONF_FLAGS} --with-cxx-include-32bit-dir=32"
111 fi
112 fi
113
114 econf ${CONF_FLAGS} || die "econf failed"
115 }
116
117 src_compile() {
118 emake VERBOSE=1 KEEP_SYMBOLS=1 REQUIRES_RTTI=1 clang-only || die "emake failed"
119 }
120
121 src_test() {
122 cd "${S}"/test || die "cd failed"
123 emake site.exp || die "updating llvm site.exp failed"
124
125 cd "${S}"/tools/clang || die "cd clang failed"
126
127 echo ">>> Test phase [test]: ${CATEGORY}/${PF}"
128 if ! emake -j1 VERBOSE=1 test; then
129 hasq test $FEATURES && die "Make test failed. See above for details."
130 hasq test $FEATURES || eerror "Make test failed. See above for details."
131 fi
132 }
133
134 src_install() {
135 cd "${S}"/tools/clang || die "cd clang failed"
136 emake KEEP_SYMBOLS=1 DESTDIR="${D}" install || die "install failed"
137
138 if use static-analyzer ; then
139 dobin tools/scan-build/ccc-analyzer
140 dosym ccc-analyzer /usr/bin/c++-analyzer
141 dobin tools/scan-build/scan-build
142
143 insinto /usr/share/${PN}
144 doins tools/scan-build/scanview.css
145 doins tools/scan-build/sorttable.js
146
147 cd tools/scan-view || die "cd scan-view failed"
148 dobin scan-view
149 install-scan-view() {
150 insinto "$(python_get_sitedir)"/clang
151 doins Reporter.py Resources ScanView.py startfile.py
152 touch "${ED}"/"$(python_get_sitedir)"/clang/__init__.py
153 }
154 python_execute_function install-scan-view
155 fi
156
157 # Fix install_names on Darwin. The build system is too complicated
158 # to just fix this, so we correct it post-install
159 if [[ ${CHOST} == *-darwin* ]] ; then
160 for lib in libclang.dylib ; do
161 ebegin "fixing install_name of $lib"
162 install_name_tool -id "${EPREFIX}"/usr/lib/llvm/${lib} \
163 "${ED}"/usr/lib/llvm/${lib}
164 eend $?
165 done
166 for f in usr/bin/{c-index-test,clang} usr/lib/llvm/libclang.dylib ; do
167 ebegin "fixing references in ${f##*/}"
168 install_name_tool \
169 -change "@rpath/libclang.dylib" \
170 "${EPREFIX}"/usr/lib/llvm/libclang.dylib \
171 -change "${S}"/Release/lib/libLLVM-${PV}.dylib \
172 "${EPREFIX}"/usr/lib/llvm/libLLVM-${PV}.dylib \
173 -change "${S}"/Release/lib/libclang.dylib \
174 "${EPREFIX}"/usr/lib/llvm/libclang.dylib \
175 "${ED}"/$f
176 eend $?
177 done
178 fi
179 }
180
181 pkg_postinst() {
182 python_mod_optimize clang
183 if use system-cxx-headers; then
184 elog "C++ headers search path is hardcoded to the active gcc profile one"
185 elog "If you change the active gcc profile, or update gcc to a new version,"
186 elog "you will have to remerge this package to update the search path"
187 else
188 elog "If clang++ fails to find C++ headers on your system,"
189 elog "you can remerge clang with USE=system-cxx-headers to use C++ headers"
190 elog "from the active gcc profile"
191 fi
192 }
193
194 pkg_postrm() {
195 python_mod_cleanup clang
196 }

  ViewVC Help
Powered by ViewVC 1.1.20