summaryrefslogtreecommitdiff
blob: d9c52336972f2fb1ce0aeafb1a6664c16d448b50 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# Copyright 1999-2009 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/sys-devel/llvm-gcc/llvm-gcc-2.6.ebuild,v 1.2 2009/10/27 22:59:59 voyageur Exp $

EAPI=2
inherit multilib

LLVM_GCC_VERSION=4.2
MY_PV=${LLVM_GCC_VERSION}-${PV/_pre*}

DESCRIPTION="LLVM C front-end"
HOMEPAGE="http://llvm.org"
SRC_URI="http://llvm.org/releases/${PV}/${PN}-${MY_PV}.source.tar.gz"

LICENSE="GPL-2"
SLOT=0
KEYWORDS="~amd64 ~ppc ~x86"
IUSE="bootstrap fortran multilib nls objc objc++ test"

RDEPEND=">=sys-devel/llvm-$PV"
DEPEND="${RDEPEND}
	>=sys-apps/texinfo-4.2-r4
	>=sys-devel/binutils-2.18
	>=sys-devel/bison-1.875
	test? ( dev-util/dejagnu )"

S=${WORKDIR}/llvm-gcc${MY_PV}.source/obj

src_prepare() {
	#we keep the directory structure suggested by README.LLVM,
	mkdir -p "${S}"
}

src_configure() {
	# Target options are handled by econf

	EXTRALANGS=""
	use fortran && EXTRALANGS="${EXTRALANGS},fortran"
	use objc && EXTRALANGS="${EXTRALANGS},objc"
	use objc++ && EXTRALANGS="${EXTRALANGS},obj-c++"

	ECONF_SOURCE="${WORKDIR}"/llvm-gcc${MY_PV}.source econf --prefix=/usr/$(get_libdir)/${PN}-${MY_PV} \
		$(use_enable multilib) \
		--program-prefix=${PN}-${MY_PV}- \
		--enable-llvm=/usr --enable-languages=c,c++${EXTRALANGS} \
		|| die "configure failed"
}

src_compile() {
	BUILDOPTIONS="LLVM_VERSION_INFO=${MY_PV}"
	use bootstrap && BUILDOPTIONS="${BUILDOPTIONS} bootstrap"
	emake ${BUILDOPTIONS} || die "emake failed"
}

src_install() {
	emake DESTDIR="${D}" install || die "installation failed"
	rm -rf "${D}"/usr/share/man/man7
	if ! use nls; then
		einfo "nls USE flag disabled, not installing locale files"
		rm -rf "${D}"/usr/share/locale
	fi

	# Add some symlinks
	dodir /usr/bin
	cd "${D}/usr/bin"
	for X in c++ g++ cpp gcc gcov gccbug ; do
		ln -s /usr/$(get_libdir)/${PN}-${MY_PV}/bin/${PN}-${MY_PV}-${X}  llvm-${X}
	done
	use fortran && \
		ln -s /usr/$(get_libdir)/${PN}-${MY_PV}/bin/${PN}-${MY_PV}-gfortran llvm-gfortran
}