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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.3 - (show annotations) (download)
Mon Mar 28 13:51:22 2011 UTC (3 years, 6 months ago) by voyageur
Branch: MAIN
CVS Tags: HEAD
Changes since 1.2: +1 -1 lines
FILE REMOVED
Drop 2.7 versions

(Portage version: 2.2.0_alpha28/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-2.7-r4.ebuild,v 1.2 2011/01/26 17:48:41 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 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 ~amd64-linux ~ppc-macos"
21 IUSE="debug +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 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 # Fix toolchain lookup for Darwin/Prefix.
37 epatch "${FILESDIR}"/${PN}-2.7-darwin-prefix.patch
38 sed -e "s|@GENTOO_PORTAGE_CHOST@|${CHOST%%-darwin*}-darwin|g" \
39 -e "s|@GENTOO_PORTAGE_EPREFIX@|${EPREFIX}|g" \
40 -i tools/clang/lib/Driver/ToolChains.cpp \
41 || die "fixing toolchain lookup"
42
43 # multilib-strict
44 sed -e "/PROJ_headers/s#lib/clang#$(get_libdir)/clang#" \
45 -i tools/clang/lib/Headers/Makefile \
46 || die "clang Makefile failed"
47 # fix the static analyzer for in-tree install
48 sed -e 's/import ScanView/from clang \0/' \
49 -i tools/clang/tools/scan-view/scan-view \
50 || die "scan-view sed failed"
51 sed -e "/scanview.css\|sorttable.js/s#\$RealBin#${EPREFIX}/usr/share/${PN}#" \
52 -i tools/clang/tools/scan-build/scan-build \
53 || die "scan-build sed failed"
54 # Specify python version
55 python_convert_shebangs 2 tools/clang/tools/scan-view/scan-view
56
57 # From llvm src_prepare
58 einfo "Fixing install dirs"
59 sed -e 's,^PROJ_docsdir.*,PROJ_docsdir := $(PROJ_prefix)/share/doc/'${PF}, \
60 -e 's,^PROJ_etcdir.*,PROJ_etcdir := '"${EPREFIX}"'/etc/llvm,' \
61 -e 's,^PROJ_libdir.*,PROJ_libdir := $(PROJ_prefix)/'$(get_libdir)/llvm, \
62 -i Makefile.config.in || die "Makefile.config sed failed"
63
64 einfo "Fixing rpath"
65 sed -e 's,\$(RPATH) -Wl\,\$(\(ToolDir\|LibDir\)),$(RPATH) -Wl\,'"${EPREFIX}"/usr/$(get_libdir)/llvm, \
66 -i Makefile.rules || die "rpath sed failed"
67 }
68
69 src_configure() {
70 # --enable-shared: undefined symbol, bug #338231
71 local CONF_FLAGS=""
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 amd64; then
91 CONF_FLAGS="${CONF_FLAGS} --enable-pic"
92 fi
93
94 # Skip llvm-gcc parts even if installed
95 CONF_FLAGS="${CONF_FLAGS} --with-llvmgccdir=/dev/null"
96
97 if use system-cxx-headers; then
98 # Try to get current C++ headers path
99 CONF_FLAGS="${CONF_FLAGS} --with-cxx-include-root=$(gcc-config -X| cut -d: -f1 | sed '/-v4$/! s,$,/include/g++-v4,')"
100 CONF_FLAGS="${CONF_FLAGS} --with-cxx-include-arch=$CHOST"
101 if has_multilib_profile; then
102 CONF_FLAGS="${CONF_FLAGS} --with-cxx-include-32bit-dir=32"
103 fi
104 fi
105
106 econf ${CONF_FLAGS} || die "econf failed"
107 }
108
109 src_compile() {
110 emake VERBOSE=1 KEEP_SYMBOLS=1 REQUIRES_RTTI=1 clang-only || die "emake failed"
111 }
112
113 src_test() {
114 cd "${S}"/test || die "cd failed"
115 emake site.exp || die "updating llvm site.exp failed"
116
117 cd "${S}"/tools/clang || die "cd clang failed"
118
119 echo ">>> Test phase [test]: ${CATEGORY}/${PF}"
120 if ! emake -j1 VERBOSE=1 test; then
121 hasq test $FEATURES && die "Make test failed. See above for details."
122 hasq test $FEATURES || eerror "Make test failed. See above for details."
123 fi
124 }
125
126 src_install() {
127 cd "${S}"/tools/clang || die "cd clang failed"
128 emake KEEP_SYMBOLS=1 DESTDIR="${D}" install || die "install failed"
129
130 if use static-analyzer ; then
131 dobin tools/scan-build/ccc-analyzer
132 dosym ccc-analyzer /usr/bin/c++-analyzer
133 dobin tools/scan-build/scan-build
134
135 insinto /usr/share/${PN}
136 doins tools/scan-build/scanview.css
137 doins tools/scan-build/sorttable.js
138
139 cd tools/scan-view || die "cd scan-view failed"
140 dobin scan-view
141 install-scan-view() {
142 insinto "$(python_get_sitedir)"/clang
143 doins Reporter.py Resources ScanView.py startfile.py
144 touch "${ED}"/"$(python_get_sitedir)"/clang/__init__.py
145 }
146 python_execute_function install-scan-view
147 fi
148
149 # Fix install_names on Darwin. The build system is too complicated
150 # to just fix this, so we correct it post-install
151 if [[ ${CHOST} == *-darwin* ]] ; then
152 for lib in libCIndex.dylib ; do
153 install_name_tool -id "${EPREFIX}"/usr/lib/llvm/${lib} \
154 "${ED}"/usr/lib/llvm/${lib}
155 done
156 fi
157 }
158
159 pkg_postinst() {
160 python_mod_optimize clang
161 if use system-cxx-headers; then
162 elog "C++ headers search path is hardcoded to the active gcc profile one"
163 elog "If you change the active gcc profile, or update gcc to a new version,"
164 elog "you will have to remerge this package to update the search path"
165 else
166 elog "If clang++ fails to find C++ headers on your system,"
167 elog "you can remerge clang with USE=system-cxx-headers to use C++ headers"
168 elog "from the active gcc profile"
169 fi
170 }
171
172 pkg_postrm() {
173 python_mod_cleanup clang
174 }

  ViewVC Help
Powered by ViewVC 1.1.20