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

Contents of /sys-devel/llvm/llvm-3.1-r2.ebuild

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.10 - (show annotations) (download)
Thu Mar 19 09:28:02 2015 UTC (16 months, 1 week ago) by voyageur
Branch: MAIN
CVS Tags: HEAD
Changes since 1.9: +3 -2 lines
Fix compilation with newer perl versions, bug #541132

(Portage version: 2.2.18/cvs/Linux x86_64, signed Manifest commit with key 00F7AB331B0F097F)

1 # Copyright 1999-2015 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: /var/cvsroot/gentoo-x86/sys-devel/llvm/llvm-3.1-r2.ebuild,v 1.9 2013/01/03 23:29:51 voyageur Exp $
4
5 EAPI="4"
6 PYTHON_DEPEND="2"
7 inherit eutils flag-o-matic multilib toolchain-funcs python pax-utils
8
9 DESCRIPTION="Low Level Virtual Machine"
10 HOMEPAGE="http://llvm.org/"
11 SRC_URI="http://llvm.org/releases/${PV}/${P}.src.tar.gz"
12
13 LICENSE="UoI-NCSA"
14 SLOT="0"
15 KEYWORDS="amd64 arm ppc x86 ~amd64-fbsd ~x86-fbsd ~x64-freebsd ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos"
16 IUSE="debug gold +libffi multitarget ocaml test udis86 vim-syntax"
17
18 DEPEND="dev-lang/perl
19 >=sys-devel/make-3.79
20 >=sys-devel/flex-2.5.4
21 >=sys-devel/bison-1.875d
22 || ( >=sys-devel/gcc-3.0 >=sys-devel/gcc-apple-4.2.1 )
23 || ( >=sys-devel/binutils-2.18 >=sys-devel/binutils-apple-3.2.3 )
24 gold? ( >=sys-devel/binutils-2.22[cxx] )
25 libffi? ( virtual/pkgconfig
26 virtual/libffi )
27 ocaml? ( dev-lang/ocaml )
28 udis86? ( dev-libs/udis86[pic(+)] )"
29 RDEPEND="dev-lang/perl
30 libffi? ( virtual/libffi )
31 vim-syntax? ( || ( app-editors/vim app-editors/gvim ) )"
32
33 S=${WORKDIR}/${P}.src
34
35 pkg_setup() {
36 # Required for test and build
37 python_set_active_version 2
38 python_pkg_setup
39
40 # need to check if the active compiler is ok
41
42 broken_gcc=" 3.2.2 3.2.3 3.3.2 4.1.1 "
43 broken_gcc_x86=" 3.4.0 3.4.2 "
44 broken_gcc_amd64=" 3.4.6 "
45
46 gcc_vers=$(gcc-fullversion)
47
48 if [[ ${broken_gcc} == *" ${version} "* ]] ; then
49 elog "Your version of gcc is known to miscompile llvm."
50 elog "Check http://www.llvm.org/docs/GettingStarted.html for"
51 elog "possible solutions."
52 die "Your currently active version of gcc is known to miscompile llvm"
53 fi
54
55 if [[ ${CHOST} == i*86-* && ${broken_gcc_x86} == *" ${version} "* ]] ; then
56 elog "Your version of gcc is known to miscompile llvm on x86"
57 elog "architectures. Check"
58 elog "http://www.llvm.org/docs/GettingStarted.html for possible"
59 elog "solutions."
60 die "Your currently active version of gcc is known to miscompile llvm"
61 fi
62
63 if [[ ${CHOST} == x86_64-* && ${broken_gcc_amd64} == *" ${version} "* ]];
64 then
65 elog "Your version of gcc is known to miscompile llvm in amd64"
66 elog "architectures. Check"
67 elog "http://www.llvm.org/docs/GettingStarted.html for possible"
68 elog "solutions."
69 die "Your currently active version of gcc is known to miscompile llvm"
70 fi
71 }
72
73 src_prepare() {
74 # unfortunately ./configure won't listen to --mandir and the-like, so take
75 # care of this.
76 einfo "Fixing install dirs"
77 sed -e 's,^PROJ_docsdir.*,PROJ_docsdir := $(PROJ_prefix)/share/doc/'${PF}, \
78 -e 's,^PROJ_etcdir.*,PROJ_etcdir := '"${EPREFIX}"'/etc/llvm,' \
79 -e 's,^PROJ_libdir.*,PROJ_libdir := $(PROJ_prefix)/'$(get_libdir)/${PN}, \
80 -i Makefile.config.in || die "Makefile.config sed failed"
81 sed -e "/ActiveLibDir = ActivePrefix/s/lib/$(get_libdir)\/${PN}/" \
82 -i tools/llvm-config/llvm-config.cpp || die "llvm-config sed failed"
83
84 einfo "Fixing rpath and CFLAGS"
85 sed -e 's,\$(RPATH) -Wl\,\$(\(ToolDir\|LibDir\)),$(RPATH) -Wl\,'"${EPREFIX}"/usr/$(get_libdir)/${PN}, \
86 -e '/OmitFramePointer/s/-fomit-frame-pointer//' \
87 -i Makefile.rules || die "rpath sed failed"
88 if use gold; then
89 sed -e 's,\$(SharedLibDir),'"${EPREFIX}"/usr/$(get_libdir)/${PN}, \
90 -i tools/gold/Makefile || die "gold rpath sed failed"
91 fi
92
93 # Specify python version
94 python_convert_shebangs -r 2 test/Scripts
95
96 epatch "${FILESDIR}"/${PN}-2.6-commandguide-nops.patch
97 epatch "${FILESDIR}"/${PN}-2.9-nodoctargz.patch
98 epatch "${FILESDIR}"/${PN}-3.0-PPC_macro.patch
99 epatch "${FILESDIR}"/${P}-ivybridge_support.patch
100 epatch "${FILESDIR}"/${P}-fix_debug_line_info.patch
101 epatch "${FILESDIR}"/${P}-ExecutionEngine_tests_xfail_arm.patch
102 epatch "${FILESDIR}"/${P}-docs-pod-markup-fixes.patch
103
104 # Apply r600 OpenCL-related patches, bug #425688
105 epatch "${FILESDIR}"/cl-patches/*.patch
106
107 # User patches
108 epatch_user
109 }
110
111 src_configure() {
112 local CONF_FLAGS="--enable-shared
113 --with-optimize-option=
114 $(use_enable !debug optimized)
115 $(use_enable debug assertions)
116 $(use_enable debug expensive-checks)"
117
118 if use multitarget; then
119 CONF_FLAGS="${CONF_FLAGS} --enable-targets=all"
120 else
121 CONF_FLAGS="${CONF_FLAGS} --enable-targets=host,cpp"
122 fi
123
124 if use amd64; then
125 CONF_FLAGS="${CONF_FLAGS} --enable-pic"
126 fi
127
128 if use gold; then
129 CONF_FLAGS="${CONF_FLAGS} --with-binutils-include=${EPREFIX}/usr/include/"
130 fi
131 if use ocaml; then
132 CONF_FLAGS="${CONF_FLAGS} --enable-bindings=ocaml"
133 else
134 CONF_FLAGS="${CONF_FLAGS} --enable-bindings=none"
135 fi
136
137 if use udis86; then
138 CONF_FLAGS="${CONF_FLAGS} --with-udis86"
139 fi
140
141 if use libffi; then
142 append-cppflags "$(pkg-config --cflags libffi)"
143 fi
144 CONF_FLAGS="${CONF_FLAGS} $(use_enable libffi)"
145
146 # llvm prefers clang over gcc, so we may need to force that
147 tc-export CC CXX
148 econf ${CONF_FLAGS}
149 }
150
151 src_compile() {
152 emake VERBOSE=1 KEEP_SYMBOLS=1 REQUIRES_RTTI=1
153
154 pax-mark m Release/bin/lli
155 if use test; then
156 pax-mark m unittests/ExecutionEngine/JIT/Release/JITTests
157 fi
158 }
159
160 src_install() {
161 emake KEEP_SYMBOLS=1 DESTDIR="${D}" install
162
163 if use vim-syntax; then
164 insinto /usr/share/vim/vimfiles/syntax
165 doins utils/vim/*.vim
166 fi
167
168 # Fix install_names on Darwin. The build system is too complicated
169 # to just fix this, so we correct it post-install
170 local lib= f= odylib=
171 if [[ ${CHOST} == *-darwin* ]] ; then
172 for lib in lib{EnhancedDisassembly,LLVM-${PV},LTO,profile_rt}.dylib {BugpointPasses,LLVMHello}.dylib ; do
173 # libEnhancedDisassembly is Darwin10 only, so non-fatal
174 [[ -f ${ED}/usr/lib/${PN}/${lib} ]] || continue
175 ebegin "fixing install_name of $lib"
176 install_name_tool \
177 -id "${EPREFIX}"/usr/lib/${PN}/${lib} \
178 "${ED}"/usr/lib/${PN}/${lib}
179 eend $?
180 done
181 for f in "${ED}"/usr/bin/* "${ED}"/usr/lib/${PN}/libLTO.dylib ; do
182 odylib=$(scanmacho -BF'%n#f' "${f}" | tr ',' '\n' | grep libLLVM-${PV}.dylib)
183 ebegin "fixing install_name reference to ${odylib} of ${f##*/}"
184 install_name_tool \
185 -change "${odylib}" \
186 "${EPREFIX}"/usr/lib/${PN}/libLLVM-${PV}.dylib \
187 "${f}"
188 eend $?
189 done
190 fi
191 }

  ViewVC Help
Powered by ViewVC 1.1.20