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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (show annotations) (download)
Wed Nov 9 22:55:22 2011 UTC (3 years, 1 month ago) by voyageur
Branch: MAIN
CVS Tags: HEAD
Changes since 1.1: +1 -1 lines
FILE REMOVED
Update rc ebuild and cxx_include_root patch, some more ebuild cleanups

(Portage version: 2.2.0_alpha72/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_rc1.ebuild,v 1.1 2011/11/09 15:11:48 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/pre-releases/${PV/_rc*}/${PV/3.0_}/sources/llvm-${PV/_}.src.tar.gz
16 http://llvm.org/pre-releases/${PV/_rc*}/${PV/3.0_}/sources/${P/_}.src.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 # 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 RDEPEND="~sys-devel/llvm-${PV}[multitarget=]"
26
27 S="${WORKDIR}/llvm-${PV/_}"
28
29 src_prepare() {
30 # Leftover in rc1, remove for real release
31 rm -f "${S}"/tools/clang
32
33 mv "${WORKDIR}"/clang-${PV/_} "${S}"/tools/clang || die "clang source directory not found"
34
35 # Same as llvm doc patches
36 epatch "${FILESDIR}"/${PN}-2.7-fixdoc.patch
37
38 # multilib-strict
39 sed -e "/PROJ_headers/s#lib/clang#$(get_libdir)/clang#" \
40 -i tools/clang/lib/Headers/Makefile \
41 || die "clang Makefile failed"
42 # Fix cxx_include_root path for Gentoo
43 epatch "${FILESDIR}"/${P/_*}-fix_cxx_include_root.patch
44 # fix the static analyzer for in-tree install
45 sed -e 's/import ScanView/from clang \0/' \
46 -i tools/clang/tools/scan-view/scan-view \
47 || die "scan-view sed failed"
48 sed -e "/scanview.css\|sorttable.js/s#\$RealBin#${EPREFIX}/usr/share/${PN}#" \
49 -i tools/clang/tools/scan-build/scan-build \
50 || die "scan-build sed failed"
51 # Specify python version
52 python_convert_shebangs 2 tools/clang/tools/scan-view/scan-view
53
54 # From llvm src_prepare
55 einfo "Fixing install dirs"
56 sed -e 's,^PROJ_docsdir.*,PROJ_docsdir := $(PROJ_prefix)/share/doc/'${PF}, \
57 -e 's,^PROJ_etcdir.*,PROJ_etcdir := '"${EPREFIX}"'/etc/llvm,' \
58 -e 's,^PROJ_libdir.*,PROJ_libdir := $(PROJ_prefix)/'$(get_libdir)/llvm, \
59 -i Makefile.config.in || die "Makefile.config sed failed"
60
61 einfo "Fixing rpath and CFLAGS"
62 sed -e 's,\$(RPATH) -Wl\,\$(\(ToolDir\|LibDir\)),$(RPATH) -Wl\,'"${EPREFIX}"/usr/$(get_libdir)/llvm, \
63 -e '/OmitFramePointer/s/-fomit-frame-pointer//' \
64 -i Makefile.rules || die "rpath sed failed"
65 }
66
67 src_configure() {
68 local CONF_FLAGS="--enable-shared
69 --with-optimize-option=
70 $(use_enable !debug optimized)
71 $(use_enable debug assertions)
72 $(use_enable debug expensive-checks)"
73
74 # Setup the search path to include the Prefix includes
75 if use prefix ; then
76 CONF_FLAGS="${CONF_FLAGS} \
77 --with-c-include-dirs=${EPREFIX}/usr/include:/usr/include"
78 fi
79
80 if use multitarget; then
81 CONF_FLAGS="${CONF_FLAGS} --enable-targets=all"
82 else
83 CONF_FLAGS="${CONF_FLAGS} --enable-targets=host-only"
84 fi
85
86 if use amd64; then
87 CONF_FLAGS="${CONF_FLAGS} --enable-pic"
88 fi
89
90 if use system-cxx-headers; then
91 # Try to get current gcc headers path
92 local CXX_PATH=$(gcc-config -X| cut -d: -f1 | sed 's,/include/g++-v4$,,')
93 CONF_FLAGS="${CONF_FLAGS} --with-c-include-dirs=/usr/include:${CXX_PATH}/include"
94 CONF_FLAGS="${CONF_FLAGS} --with-cxx-include-root=${CXX_PATH}/include/g++-v4"
95 CONF_FLAGS="${CONF_FLAGS} --with-cxx-include-arch=$CHOST"
96 if has_multilib_profile; then
97 CONF_FLAGS="${CONF_FLAGS} --with-cxx-include-32bit-dir=32"
98 fi
99 fi
100
101 econf ${CONF_FLAGS} || die "econf failed"
102 }
103
104 src_compile() {
105 emake VERBOSE=1 KEEP_SYMBOLS=1 REQUIRES_RTTI=1 clang-only || die "emake failed"
106 }
107
108 src_test() {
109 cd "${S}"/test || die "cd failed"
110 emake site.exp || die "updating llvm site.exp failed"
111
112 cd "${S}"/tools/clang || die "cd clang failed"
113
114 echo ">>> Test phase [test]: ${CATEGORY}/${PF}"
115 if ! emake -j1 VERBOSE=1 test; then
116 has test $FEATURES && die "Make test failed. See above for details."
117 has test $FEATURES || eerror "Make test failed. See above for details."
118 fi
119 }
120
121 src_install() {
122 cd "${S}"/tools/clang || die "cd clang failed"
123 emake KEEP_SYMBOLS=1 DESTDIR="${D}" install || die "install failed"
124
125 if use static-analyzer ; then
126 dobin tools/scan-build/ccc-analyzer
127 dosym ccc-analyzer /usr/bin/c++-analyzer
128 dobin tools/scan-build/scan-build
129
130 insinto /usr/share/${PN}
131 doins tools/scan-build/scanview.css
132 doins tools/scan-build/sorttable.js
133
134 cd tools/scan-view || die "cd scan-view failed"
135 dobin scan-view
136 install-scan-view() {
137 insinto "$(python_get_sitedir)"/clang
138 doins Reporter.py Resources ScanView.py startfile.py
139 touch "${ED}"/"$(python_get_sitedir)"/clang/__init__.py
140 }
141 python_execute_function install-scan-view
142 fi
143
144 # Fix install_names on Darwin. The build system is too complicated
145 # to just fix this, so we correct it post-install
146 if [[ ${CHOST} == *-darwin* ]] ; then
147 for lib in libclang.dylib ; do
148 ebegin "fixing install_name of $lib"
149 install_name_tool -id "${EPREFIX}"/usr/lib/llvm/${lib} \
150 "${ED}"/usr/lib/llvm/${lib}
151 eend $?
152 done
153 for f in usr/bin/{c-index-test,clang} usr/lib/llvm/libclang.dylib ; do
154 ebegin "fixing references in ${f##*/}"
155 install_name_tool \
156 -change "@rpath/libclang.dylib" \
157 "${EPREFIX}"/usr/lib/llvm/libclang.dylib \
158 -change "@executable_path/../lib/libLLVM-${PV}.dylib" \
159 "${EPREFIX}"/usr/lib/llvm/libLLVM-${PV}.dylib \
160 -change "${S}"/Release/lib/libclang.dylib \
161 "${EPREFIX}"/usr/lib/llvm/libclang.dylib \
162 "${ED}"/$f
163 eend $?
164 done
165 fi
166 }
167
168 pkg_postinst() {
169 python_mod_optimize clang
170 if use system-cxx-headers; then
171 elog "C++ headers search path is hardcoded to the active gcc profile one"
172 elog "If you change the active gcc profile, or update gcc to a new version,"
173 elog "you will have to remerge this package to update the search path"
174 else
175 elog "If clang++ fails to find C++ headers on your system,"
176 elog "you can remerge clang with USE=system-cxx-headers to use C++ headers"
177 elog "from the active gcc profile"
178 fi
179 }
180
181 pkg_postrm() {
182 python_mod_cleanup clang
183 }

  ViewVC Help
Powered by ViewVC 1.1.20