summaryrefslogtreecommitdiff
blob: 336ace28a1c2592fd06b06a5592536ec79ab5306 (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
# Copyright 1999-2002 Gentoo Technologies, Inc.
# Distributed under the terms of the GNU General Public License, v2 or later
# $Header: /var/cvsroot/gentoo-x86/sys-devel/egcs64-sparc/egcs64-sparc-19980921-r1.ebuild,v 1.8 2002/08/14 03:45:02 murphy Exp $

EGCSDATE=`echo $P| sed -e 's/egcs64-sparc-\([0-9]*\).*/\1/'`
EGCSVER=2.92.11
S=${WORKDIR}/egcs64-${EGCSDATE}
A="egcs64_${EGCSDATE}.orig.tar.gz"
DESCRIPTION="sparc64 crosscompiler for building sparc64 kernels on sparc32"
SRC_URI="http://ftp.us.debian.org/debian/dists/stable/main/source/devel/${A}"
HOMEPAGE="http://www.rocklinux.de/projects/sparc/sparc.html"
LICENSE="GPL-2 LGPL-2"
SLOT="0"
KEYWORDS="sparc sparc64 -x86 -ppc"

#RDEPEND="virtual/glibc"
#MYCHOST=`echo $CHOST | sed 's/sparc-/sparc64-/'`
DEPEND="sys-devel/autoconf"

MYPREFIX=/usr
MYCHOST=sparc64-unknown-linux-gnu

# Reset CFLAGS, gcc doesn't want that stuff
CFLAGS=""
CXXFLAGS="$CFLAGS"
export CFLAGS CXXFLAGS

src_unpack() {
	unpack ${A}
	cat ${FILESDIR}/egcs64_${EGCSDATE}-4.diff | patch -p0 -l || die
	cat ${FILESDIR}/egcs64_${EGCSDATE}-4-gentoo.diff | patch -p0 -l || die
}

src_compile() {
	unset CHOST
	mkdir ${S}/build
	cd ${S}/build
	AR_FOR_TARGET=ar LIBGCC2_INCLUDES=-I/usr/include CC=gcc \
		../configure \
			--prefix=${MYPREFIX} --mandir=${MYPREFIX}/share/man \
			--infodir=${MYPREFIX}/share/info --enable-shared \
			--enable-threads --enable-languages=c \
			--enable-version-specific-runtime-libs $MYCHOST || die

			#--prefix=${MYPREFIX} --with-local-prefix=${MYPREFIX}/local \
	# Fix a weird problem where TARGET_CONFIGDIRS gets populated with the wrong
	# thing for a kernel crosscompiler. Need to investigate.
	mv Makefile Makefile.tmp
	sed -e 's/[ ]*TARGET_CONFIGDIRS[ ]*=.*/TARGET_CONFIGDIRS = /' Makefile.tmp \
		> Makefile

	# Now make
	make \
		CFLAGS="-DHOST_WIDE_INT=long\ long -DHOST_BITS_PER_WIDE_INT=64" \
		LANGUAGES=c TARGET_CONFIGDIRS="" \
		cross || die

}

src_install() {

	cd ${S}/build
	mkdir -p ${D}/${MYPREFIX}/lib ${D}/${MYPREFIX}/bin ${D}/${MYPREFIX}/local \
				${D}/${MYPREFIX}/doc/egcs64-${EGCSDATE}/gcc

	cd gcc && make install \
		prefix=${D}/${MYPREFIX} local_prefix=${D}/${MYPREFIX}/local \
		includedir=${D}/${MYPREFIX}/local/include \
		CFLAGS='-DHOST_WIDE_INT=long\ long -DHOST_BITS_PER_WIDE_INT=64' \
		LANGUAGES=c || die

	cd ${D}/${MYPREFIX}/bin
	rm gcc gcj

	cd ${S}
	cp -a COPYING COPYING.LIB ChangeLog README MAINTAINERS \
		${D}/${MYPREFIX}/doc/egcs64-${EGCSDATE}
	cd gcc
	cp -a BUGS INSTALL LANGUAGES LITERATURE NEWS PROBLEMS PROJECTS \
		README* SERVICE TESTS.FLUNK \
		${D}/${MYPREFIX}/doc/egcs64-${EGCSDATE}/gcc

	# remove the stuff we don't need

	cd ${D}/${MYPREFIX}
	rm -rf info man
	cd ${D}/${MYPREFIX}/bin
	mv sparc64-unknown-linux-gnu-gcc egcs-${EGCSVER}
	ln -s egcs-${EGCSVER} sparc64-unknown-linux-gnu-gcc
	ln -s egcs-${EGCSVER} sparc64-unknown-linux-gcc
	ln -s egcs-${EGCSVER} sparc64-linux-gcc
	ln -s egcs-${EGCSVER} gcc64
	ln -s egcs-${EGCSVER} egcs64
	ln -s egcs-${EGCSVER} cc64
}