summaryrefslogtreecommitdiff
blob: 5654e779f70412d7b0f3eeaacf999f97506a2649 (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
# Copyright 1999-2004 Gentoo Technologies, Inc.
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/sys-devel/binutils-hppa64/binutils-hppa64-2.14.90.0.8.ebuild,v 1.1 2004/03/27 23:04:54 gmsoft Exp $

IUSE="nls bootstrap build"

# NOTE to Maintainer:  ChangeLog states that it no longer use perl to build
#                      the manpages, but seems this is incorrect ....

inherit eutils libtool flag-o-matic

# Generate borked binaries.  Bug #6730
filter-flags "-fomit-frame-pointer -fssa"

MY_P=${P/-hppa64/}
S="${WORKDIR}/${MY_P}"
DESCRIPTION="Tools necessary to build programs"
SRC_URI="mirror://kernel/linux/devel/binutils/${MY_P}.tar.bz2
	mirror://kernel/linux/devel/binutils/test/${MY_P}.tar.bz2"
HOMEPAGE="http://sources.redhat.com/binutils/"

SLOT="0"
LICENSE="GPL-2 | LGPL-2"
KEYWORDS="-* ~hppa"

DEPEND="virtual/glibc
	nls? ( sys-devel/gettext )
	!build? ( !bootstrap? ( dev-lang/perl ) )"

TARGET=hppa64-linux

src_unpack() {

	unpack ${A}
	
	cd ${S}
	#epatch ${FILESDIR}/hppa64-fptr-reloc.diff

	# Libtool is broken (Redhat).
	for x in ${S}/opcodes/Makefile.{am,in}
	do
		cp ${x} ${x}.orig
		gawk '
			{
				if ($0 ~ /LIBADD/)
					gsub("../bfd/libbfd.la", "-L../bfd/.libs ../bfd/libbfd.la")

					print
			}' ${x}.orig > ${x}
		rm -rf ${x}.orig
	done

}

src_compile() {
	local myconf=

	use nls && \
		myconf="${myconf} --without-included-gettext" || \
		myconf="${myconf} --disable-nls"


	# Fix /usr/lib/libbfd.la
	elibtoolize --portage

	./configure --enable-shared \
		--enable-64-bit-bfd \
		--prefix=/usr \
		--mandir=/usr/share/man \
		--infodir=/usr/share/info \
		--host=${CHOST} \
		--target=${TARGET} \
		${myconf} || die

	make configure-bfd || die
	make headers -C bfd || die
	emake tooldir="${ROOT}/usr/bin" \
		MAKEOVERRIDES="VERSION=${PV}-${TARGET/-linux/}" \
		all || die

}

src_install() {

	make MAKEOVERRIDES="VERSION=${PV}-${TARGET/-linux/}" \
		prefix=${D}/usr \
		mandir=${D}/usr/share/man \
		infodir=${D}/usr/share/info \
		install || die

	# Move shared libs to the standart path
	mv ${D}/usr/${CHOST}/${TARGET}/lib/lib*-*.so ${D}/usr/lib

	# Remove unused files
	for i in man info include share ${CHOST} lib/libiberty.a lib/ldscripts
	do
		rm -Rf ${D}/usr/${i}
	done

	# Remove /usr/bin/* to create symlinks
	rm ${D}/usr/bin/*

	# Create symlinks
	cd ${D}/usr/bin
	for i in ${D}/usr/${TARGET}/bin/*
	do
		BIN=`basename ${i}`
		dosym ../${TARGET}/bin/${BIN} /usr/bin/${TARGET}-${BIN}
	done
}