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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (show annotations) (download)
Sat May 26 01:34:57 2012 UTC (3 years, 1 month ago) by ryao
Branch: MAIN
CVS Tags: HEAD
Changes since 1.1: +1 -1 lines
FILE REMOVED
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 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 # User patches
73 epatch_user
74 }
75
76 src_configure() {
77 local CONF_FLAGS="--enable-shared
78 --with-optimize-option=
79 $(use_enable !debug optimized)
80 $(use_enable debug assertions)
81 $(use_enable debug expensive-checks)"
82
83 # Setup the search path to include the Prefix includes
84 if use prefix ; then
85 CONF_FLAGS="${CONF_FLAGS} \
86 --with-c-include-dirs=${EPREFIX}/usr/include:/usr/include"
87 fi
88
89 if use multitarget; then
90 CONF_FLAGS="${CONF_FLAGS} --enable-targets=all"
91 else
92 CONF_FLAGS="${CONF_FLAGS} --enable-targets=host-only"
93 fi
94
95 if use amd64; then
96 CONF_FLAGS="${CONF_FLAGS} --enable-pic"
97 fi
98
99 econf ${CONF_FLAGS}
100 }
101
102 src_compile() {
103 emake VERBOSE=1 KEEP_SYMBOLS=1 REQUIRES_RTTI=1 clang-only
104 }
105
106 src_test() {
107 cd "${S}"/test || die "cd failed"
108 emake site.exp
109
110 cd "${S}"/tools/clang || die "cd clang failed"
111
112 echo ">>> Test phase [test]: ${CATEGORY}/${PF}"
113
114 testing() {
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 python_execute_function testing
121 }
122
123 src_install() {
124 cd "${S}"/tools/clang || die "cd clang failed"
125 emake KEEP_SYMBOLS=1 DESTDIR="${D}" install
126
127 if use static-analyzer ; then
128 dobin tools/scan-build/ccc-analyzer
129 dosym ccc-analyzer /usr/bin/c++-analyzer
130 dobin tools/scan-build/scan-build
131
132 insinto /usr/share/${PN}
133 doins tools/scan-build/scanview.css
134 doins tools/scan-build/sorttable.js
135
136 cd tools/scan-view || die "cd scan-view failed"
137 dobin scan-view
138 install-scan-view() {
139 insinto "$(python_get_sitedir)"/clang
140 doins Reporter.py Resources ScanView.py startfile.py
141 touch "${ED}"/"$(python_get_sitedir)"/clang/__init__.py
142 }
143 python_execute_function install-scan-view
144 fi
145
146 # Fix install_names on Darwin. The build system is too complicated
147 # to just fix this, so we correct it post-install
148 if [[ ${CHOST} == *-darwin* ]] ; then
149 for lib in libclang.dylib ; do
150 ebegin "fixing install_name of $lib"
151 install_name_tool -id "${EPREFIX}"/usr/lib/llvm/${lib} \
152 "${ED}"/usr/lib/llvm/${lib}
153 eend $?
154 done
155 for f in usr/bin/{c-index-test,clang} usr/lib/llvm/libclang.dylib ; do
156 ebegin "fixing references in ${f##*/}"
157 install_name_tool \
158 -change "@rpath/libclang.dylib" \
159 "${EPREFIX}"/usr/lib/llvm/libclang.dylib \
160 -change "@executable_path/../lib/libLLVM-${PV}.dylib" \
161 "${EPREFIX}"/usr/lib/llvm/libLLVM-${PV}.dylib \
162 -change "${S}"/Release/lib/libclang.dylib \
163 "${EPREFIX}"/usr/lib/llvm/libclang.dylib \
164 "${ED}"/$f
165 eend $?
166 done
167 fi
168 }
169
170 pkg_postinst() {
171 python_mod_optimize clang
172 }
173
174 pkg_postrm() {
175 python_mod_cleanup clang
176 }

  ViewVC Help
Powered by ViewVC 1.1.20