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

Contents of /sys-devel/clang/clang-3.0.ebuild

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (show annotations) (download)
Fri Feb 3 14:29:44 2012 UTC (2 years, 7 months ago) by voyageur
Branch: MAIN
CVS Tags: HEAD
Changes since 1.1: +1 -1 lines
FILE REMOVED
Fix path to gold plugin, thanks mgorny in bug #397547

(Portage version: 2.2.0_alpha84/cvs/Linux x86_64)

1 # Copyright 1999-2011 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: /var/cvsroot/gentoo-x86/sys-devel/clang/clang-3.0.ebuild,v 1.1 2011/12/02 13:20:51 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 SRC_URI="http://llvm.org/releases/${PV}/llvm-${PV}.tar.gz
16 http://llvm.org/releases/${PV}/${P}.tar.gz"
17
18 LICENSE="UoI-NCSA"
19 SLOT="0"
20 KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-linux ~ppc-macos"
21 IUSE="debug multitarget +static-analyzer +system-cxx-headers test"
22
23 DEPEND="static-analyzer? ( dev-lang/perl )"
24 RDEPEND="~sys-devel/llvm-${PV}[multitarget=]"
25
26 S=${WORKDIR}/llvm-${PV}.src
27
28 src_prepare() {
29 mv "${WORKDIR}"/clang-${PV}.src "${S}"/tools/clang || die "clang source directory move failed"
30
31 # Same as llvm doc patches
32 epatch "${FILESDIR}"/${PN}-2.7-fixdoc.patch
33
34 # multilib-strict
35 sed -e "/PROJ_headers/s#lib/clang#$(get_libdir)/clang#" \
36 -i tools/clang/lib/Headers/Makefile \
37 || die "clang Makefile failed"
38 # Fix cxx_include_root path for Gentoo
39 epatch "${FILESDIR}"/${P/_*}-fix_cxx_include_root.patch
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#${EPREFIX}/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 and CFLAGS"
58 sed -e 's,\$(RPATH) -Wl\,\$(\(ToolDir\|LibDir\)),$(RPATH) -Wl\,'"${EPREFIX}"/usr/$(get_libdir)/llvm, \
59 -e '/OmitFramePointer/s/-fomit-frame-pointer//' \
60 -i Makefile.rules || die "rpath sed failed"
61 }
62
63 src_configure() {
64 local CONF_FLAGS="--enable-shared
65 --with-optimize-option=
66 $(use_enable !debug optimized)
67 $(use_enable debug assertions)
68 $(use_enable debug expensive-checks)"
69
70 # Setup the search path to include the Prefix includes
71 if use prefix ; then
72 CONF_FLAGS="${CONF_FLAGS} \
73 --with-c-include-dirs=${EPREFIX}/usr/include:/usr/include"
74 fi
75
76 if use multitarget; then
77 CONF_FLAGS="${CONF_FLAGS} --enable-targets=all"
78 else
79 CONF_FLAGS="${CONF_FLAGS} --enable-targets=host-only"
80 fi
81
82 if use amd64; then
83 CONF_FLAGS="${CONF_FLAGS} --enable-pic"
84 fi
85
86 if use system-cxx-headers; then
87 # Try to get current gcc headers path
88 local CXX_PATH=$(gcc-config -L| cut -d: -f1)
89 CONF_FLAGS="${CONF_FLAGS} --with-c-include-dirs=/usr/include:${CXX_PATH}/include"
90 CONF_FLAGS="${CONF_FLAGS} --with-cxx-include-root=${CXX_PATH}/include/g++-v4"
91 CONF_FLAGS="${CONF_FLAGS} --with-cxx-include-arch=$CHOST"
92 if has_multilib_profile; then
93 CONF_FLAGS="${CONF_FLAGS} --with-cxx-include-32bit-dir=32"
94 fi
95 fi
96
97 econf ${CONF_FLAGS} || die "econf failed"
98 }
99
100 src_compile() {
101 local COMPILE_TARGET
102 if use test; then
103 COMPILE_TARGET="all"
104 else
105 COMPILE_TARGET="clang-only"
106 fi
107 emake VERBOSE=1 KEEP_SYMBOLS=1 REQUIRES_RTTI=1 \
108 ${COMPILE_TARGET} || 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 # Broken test always assuming i386 host with multilib gcc 4.6.0
118 # http://llvm.org/bugs/show_bug.cgi?id=11094
119 rm -f test/Driver/linux-ld.c
120
121 echo ">>> Test phase [test]: ${CATEGORY}/${PF}"
122 if ! emake -j1 VERBOSE=1 test; then
123 has test $FEATURES && die "Make test failed. See above for details."
124 has test $FEATURES || eerror "Make test failed. See above for details."
125 fi
126 }
127
128 src_install() {
129 cd "${S}"/tools/clang || die "cd clang failed"
130 emake KEEP_SYMBOLS=1 DESTDIR="${D}" install || die "install failed"
131
132 if use static-analyzer ; then
133 dobin tools/scan-build/ccc-analyzer
134 dosym ccc-analyzer /usr/bin/c++-analyzer
135 dobin tools/scan-build/scan-build
136
137 insinto /usr/share/${PN}
138 doins tools/scan-build/scanview.css
139 doins tools/scan-build/sorttable.js
140
141 cd tools/scan-view || die "cd scan-view failed"
142 dobin scan-view
143 install-scan-view() {
144 insinto "$(python_get_sitedir)"/clang
145 doins Reporter.py Resources ScanView.py startfile.py
146 touch "${ED}"/"$(python_get_sitedir)"/clang/__init__.py
147 }
148 python_execute_function install-scan-view
149 fi
150
151 # Fix install_names on Darwin. The build system is too complicated
152 # to just fix this, so we correct it post-install
153 if [[ ${CHOST} == *-darwin* ]] ; then
154 for lib in libclang.dylib ; do
155 ebegin "fixing install_name of $lib"
156 install_name_tool -id "${EPREFIX}"/usr/lib/llvm/${lib} \
157 "${ED}"/usr/lib/llvm/${lib}
158 eend $?
159 done
160 for f in usr/bin/{c-index-test,clang} usr/lib/llvm/libclang.dylib ; do
161 ebegin "fixing references in ${f##*/}"
162 install_name_tool \
163 -change "@rpath/libclang.dylib" \
164 "${EPREFIX}"/usr/lib/llvm/libclang.dylib \
165 -change "@executable_path/../lib/libLLVM-${PV}.dylib" \
166 "${EPREFIX}"/usr/lib/llvm/libLLVM-${PV}.dylib \
167 -change "${S}"/Release/lib/libclang.dylib \
168 "${EPREFIX}"/usr/lib/llvm/libclang.dylib \
169 "${ED}"/$f
170 eend $?
171 done
172 fi
173 }
174
175 pkg_postinst() {
176 python_mod_optimize clang
177 if use system-cxx-headers; then
178 elog "C++ headers search path is hardcoded to the active gcc profile one"
179 elog "If you change the active gcc profile, or update gcc to a new version,"
180 elog "you will have to remerge this package to update the search path"
181 else
182 elog "If clang++ fails to find C++ headers on your system,"
183 elog "you can remerge clang with USE=system-cxx-headers to use C++ headers"
184 elog "from the active gcc profile"
185 fi
186 }
187
188 pkg_postrm() {
189 python_mod_cleanup clang
190 }

  ViewVC Help
Powered by ViewVC 1.1.20