summaryrefslogtreecommitdiff
blob: b4f1eabe641c9186a37c11010c679c5c852e7fd9 (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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
# Copyright 1999-2004 Gentoo Technologies, Inc.
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/sys-devel/kgcc/kgcc-2.95.3.ebuild,v 1.7 2004/06/24 02:46:00 agriffis Exp $

IUSE="static"

inherit eutils flag-o-matic

SRC_URI="ftp://gcc.gnu.org/pub/gcc/releases/gcc-${PV}/gcc-core-${PV}.tar.bz2"

S="${WORKDIR}/gcc-${PV}"
LOC="/usr"
DESCRIPTION="Modern GCC C compiler for building kernels on Sparc32 machines"
HOMEPAGE="http://www.gnu.org/software/gcc/gcc.html"
SLOT="0"
LICENSE="GPL-2 LGPL-2"
KEYWORDS="-x86 -ppc sparc"

DEPEND="virtual/glibc"
RDEPEND="virtual/glibc"
DEPEND="${DEPEND}
	>=sys-libs/ncurses-5.2-r2
	>=sys-apps/texinfo-4.2-r4"

src_unpack() {
	unpack gcc-core-${PV}.tar.bz2

	cd ${S}

	libtoolize --copy --force &> ${T}/foo-out

	# This new patch for the atexit problem occured with glibc-2.2.3 should
	# work with glibc-2.2.4.  This closes bug #3987 and #4004.
	#
	# Azarah - 29 Jun 2002
	#
	# http://archive.linuxfromscratch.org/mail-archives/lfs-dev/2001/08/0476.html
	# http://archive.linuxfromscratch.org/mail-archives/lfs-dev/2001/08/0589.html
	#
	#
	# Something to note, is that this patch makes gcc crash if its given
	# the "-mno-ieee-fp" flag ... libvorbis is an good example of this.
	# This however is on of those which one we want fixed most cases :/
	#
	# Azarah - 30 Jun 2002
	#
	epatch ${FILESDIR}/${P}-new-atexit.diff

}

src_compile() {
	local myconf=""
	myconf="${myconf} --enable-languages=c --enable-shared"

	filter-flags -fPIC -fstack-protector

	# gcc does not like optimization

	unset CFLAGS
	unset CXXFLAGS

	${S}/configure --prefix=${LOC} \
		--mandir=${LOC}/share/man \
		--infodir=${LOC}/share/info \
		--enable-version-specific-runtime-libs \
		--host=${CHOST} \
		--build=${CHOST} \
		--target=${CHOST} \
		--enable-threads \
		--with-local-prefix=${LOC}/local \
		${myconf} || die

	# Setup -j in MAKEOPTS
	get_number_of_jobs

	if ! use static
	then
		emake bootstrap-lean || die
	else
		emake LDFLAGS=-static bootstrap || die
	fi
}

src_install() {
	cd ${S}
	make install \
		prefix=${D}${LOC} \
		mandir=${D}${LOC}/share/man \
		infodir=${D}${LOC}/share/info || die

	# binutils libiberty.a and we want to use that version
	# closes bug #2262
	rm -f ${D}/usr/lib/libiberty.a

	# Don't need man and info files
	cd ${D}/usr/share
	rm -rf info man

	cd ${D}/usr/bin
	mv -f gcc kgcc
	rm -rf cpp gcov unprotoize protoize *-gnu-gcc

	cd ${D}/usr
	rm -rf *-linux-gnu

	cd ${S}
	docinto /
	dodoc COPYING COPYING.LIB README* FAQ MAINTAINERS
	docinto html
	dodoc faq.html
	docinto gcc
	cd ${S}/gcc
	dodoc BUGS ChangeLog* COPYING* FSFChangeLog* LANGUAGES NEWS PROBLEMS README* SERVICE TESTS.FLUNK
}