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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (show annotations) (download)
Sat May 26 01:34:57 2012 UTC (2 years, 7 months ago) by ryao
Branch: MAIN
Fix bug #406163, bug #409269, bug #417171, bug #417537 and bug #417541 in Clang 3.1

(Portage version: 2.1.10.49/cvs/Linux x86_64)

1 # Copyright 1999-2012 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.1.ebuild,v 1.1 2012/05/23 20:46:57 mgorny Exp $
4
5 EAPI=4
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}.src.tar.gz
16 http://llvm.org/releases/${PV}/${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 kernel_FreeBSD multitarget +static-analyzer 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 sed -e "/PROJ_resources/s#lib/clang#$(get_libdir)/clang#" \
39 -i tools/clang/runtime/compiler-rt/Makefile \
40 || die "compiler-rt Makefile failed"
41 # fix the static analyzer for in-tree install
42 sed -e 's/import ScanView/from clang \0/' \
43 -i tools/clang/tools/scan-view/scan-view \
44 || die "scan-view sed failed"
45 sed -e "/scanview.css\|sorttable.js/s#\$RealBin#${EPREFIX}/usr/share/${PN}#" \
46 -i tools/clang/tools/scan-build/scan-build \
47 || die "scan-build sed failed"
48 # Set correct path for gold plugin
49 sed -e "/LLVMgold.so/s#lib/#$(get_libdir)/llvm/#" \
50 -i tools/clang/lib/Driver/Tools.cpp \
51 || die "gold plugin path sed failed"
52 # Specify python version
53 python_convert_shebangs 2 tools/clang/tools/scan-view/scan-view
54 python_convert_shebangs -r 2 test/Scripts
55
56 # From llvm src_prepare
57 einfo "Fixing install dirs"
58 sed -e 's,^PROJ_docsdir.*,PROJ_docsdir := $(PROJ_prefix)/share/doc/'${PF}, \
59 -e 's,^PROJ_etcdir.*,PROJ_etcdir := '"${EPREFIX}"'/etc/llvm,' \
60 -e 's,^PROJ_libdir.*,PROJ_libdir := $(PROJ_prefix)/'$(get_libdir)/llvm, \
61 -i Makefile.config.in || die "Makefile.config sed failed"
62
63 einfo "Fixing rpath and CFLAGS"
64 sed -e 's,\$(RPATH) -Wl\,\$(\(ToolDir\|LibDir\)),$(RPATH) -Wl\,'"${EPREFIX}"/usr/$(get_libdir)/llvm, \
65 -e '/OmitFramePointer/s/-fomit-frame-pointer//' \
66 -i Makefile.rules || die "rpath sed failed"
67
68 # Use system llc (from llvm ebuild) for tests
69 sed -e "/^llc_props =/s/os.path.join(llvm_tools_dir, 'llc')/'llc'/" \
70 -i tools/clang/test/lit.cfg || die "test path sed failed"
71
72 # Automatically select active system GCC's libraries, bug #406163
73 epatch "${FILESDIR}"/${P}-gentoo-runtime-gcc-detection.patch
74
75 # Fix search paths on FreeBSD, bug #409269
76 epatch "${FILESDIR}"/${P}-gentoo-freebsd-fix-lib-path.patch
77
78 # Fix regression caused by removal of USE=system-cxx-headers, bug #417541
79 epatch "${FILESDIR}"/${P}-gentoo-freebsd-fix-cxx-paths.patch
80
81 # Fix regression that prevents Clang from building itself on Linux, bug #417537
82 epatch "${FILESDIR}"/${P}-gentoo-linux-fix-cxx-include.patch
83
84 # User patches
85 epatch_user
86 }
87
88 src_configure() {
89 local CONF_FLAGS="--enable-shared
90 --with-optimize-option=
91 $(use_enable !debug optimized)
92 $(use_enable debug assertions)
93 $(use_enable debug expensive-checks)"
94
95 # Setup the search path to include the Prefix includes
96 if use prefix ; then
97 CONF_FLAGS="${CONF_FLAGS} \
98 --with-c-include-dirs=${EPREFIX}/usr/include:/usr/include"
99 fi
100
101 if use multitarget; then
102 CONF_FLAGS="${CONF_FLAGS} --enable-targets=all"
103 else
104 CONF_FLAGS="${CONF_FLAGS} --enable-targets=host-only"
105 fi
106
107 if use amd64; then
108 CONF_FLAGS="${CONF_FLAGS} --enable-pic"
109 fi
110
111 econf ${CONF_FLAGS}
112 }
113
114 src_compile() {
115 emake VERBOSE=1 KEEP_SYMBOLS=1 REQUIRES_RTTI=1 clang-only
116 }
117
118 src_test() {
119 cd "${S}"/test || die "cd failed"
120 emake site.exp
121
122 cd "${S}"/tools/clang || die "cd clang failed"
123
124 echo ">>> Test phase [test]: ${CATEGORY}/${PF}"
125
126 testing() {
127 if ! emake -j1 VERBOSE=1 test; then
128 has test $FEATURES && die "Make test failed. See above for details."
129 has test $FEATURES || eerror "Make test failed. See above for details."
130 fi
131 }
132 python_execute_function testing
133 }
134
135 src_install() {
136 cd "${S}"/tools/clang || die "cd clang failed"
137 emake KEEP_SYMBOLS=1 DESTDIR="${D}" install
138
139 if use static-analyzer ; then
140 dobin tools/scan-build/ccc-analyzer
141 dosym ccc-analyzer /usr/bin/c++-analyzer
142 dobin tools/scan-build/scan-build
143
144 insinto /usr/share/${PN}
145 doins tools/scan-build/scanview.css
146 doins tools/scan-build/sorttable.js
147
148 cd tools/scan-view || die "cd scan-view failed"
149 dobin scan-view
150 install-scan-view() {
151 insinto "$(python_get_sitedir)"/clang
152 doins Reporter.py Resources ScanView.py startfile.py
153 touch "${ED}"/"$(python_get_sitedir)"/clang/__init__.py
154 }
155 python_execute_function install-scan-view
156 fi
157
158 # Fix install_names on Darwin. The build system is too complicated
159 # to just fix this, so we correct it post-install
160 if [[ ${CHOST} == *-darwin* ]] ; then
161 for lib in libclang.dylib ; do
162 ebegin "fixing install_name of $lib"
163 install_name_tool -id "${EPREFIX}"/usr/lib/llvm/${lib} \
164 "${ED}"/usr/lib/llvm/${lib}
165 eend $?
166 done
167 for f in usr/bin/{c-index-test,clang} usr/lib/llvm/libclang.dylib ; do
168 ebegin "fixing references in ${f##*/}"
169 install_name_tool \
170 -change "@rpath/libclang.dylib" \
171 "${EPREFIX}"/usr/lib/llvm/libclang.dylib \
172 -change "@executable_path/../lib/libLLVM-${PV}.dylib" \
173 "${EPREFIX}"/usr/lib/llvm/libLLVM-${PV}.dylib \
174 -change "${S}"/Release/lib/libclang.dylib \
175 "${EPREFIX}"/usr/lib/llvm/libclang.dylib \
176 "${ED}"/$f
177 eend $?
178 done
179 fi
180
181 # Remove unnecessary headers on FreeBSD, bug #417171
182 use kernel_FreeBSD && rm "${ED}/usr/lib/clang/3.1/include/"{arm_neon,std,float,iso,limits,tgmath,varargs}*.h
183 }
184
185 pkg_postinst() {
186 python_mod_optimize clang
187 }
188
189 pkg_postrm() {
190 python_mod_cleanup clang
191 }

  ViewVC Help
Powered by ViewVC 1.1.20