summaryrefslogtreecommitdiff
blob: beb5053112871be6131f06042862a45b7ccea8da (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
116
117
118
119
120
121
122
123
124
# Copyright 1999-2006 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/sys-devel/binutils-hppa64/binutils-hppa64-2.16.1.ebuild,v 1.2 2006/01/16 18:29:58 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/"

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

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

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

}

pkg_setup() {
	# glibc or uclibc?
	if use elibc_glibc; then
		MYUSERLAND="gnu"
	elif use elibc_uclibc; then
		MYUSERLAND="uclibc"
	fi

	MYARCH=hppa64
	MYTARGET=${MYARCH}-unknown-linux-${MYUSERLAND}
}

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=${MYTARGET} \
		${myconf} || die

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

}

src_install() {

	make MAKEOVERRIDES="VERSION=${PV}-${MYARCH}" \
		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}/${MYTARGET}/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/${MYTARGET}/bin/*
	do
		BIN=`basename ${i}`
		dosym ../${MYTARGET}/bin/${BIN} /usr/bin/${MYTARGET}-${BIN}
		dosym ../${MYTARGET}/bin/${BIN} /usr/bin/${MYARCH}-${BIN}

		# The hppa kernel needs that one
		dosym ../${MYTARGET}/bin/${BIN} /usr/bin/${MYARCH}-linux-${BIN}
	done
}