aboutsummaryrefslogtreecommitdiffstats
path: root/main/binutils/APKBUILD
blob: bf21a6c6d97c8c7b86e131dde1490db8be50cb21 (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
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=binutils
pkgver=2.26
pkgrel=0
pkgdesc="Tools necessary to build programs"
url="http://www.gnu.org/software/binutils/"
depends=""
makedepends="bison flex texinfo zlib-dev"
arch="all"
license="GPL2 GPL3+ LGPL2 BSD"
subpackages="$pkgname-dev $pkgname-doc $pkgname-libs $pkgname-gold"

if [ "$CHOST" != "$CTARGET" ] && [ -n "$CHOST" -a -n "$CTARGET" ]; then
	pkgname="$pkgname-$CTARGET"
	subpackages=""
	somask="libbfd-$pkgver.so libopcodes-$pkgver.so"
fi

source="http://ftp.gnu.org/gnu/binutils/binutils-$pkgver.tar.bz2
	binutils-ld-fix-static-linking.patch
	hash-style-gnu.patch
	"

_builddir="$srcdir/binutils-$pkgver"
prepare() {
	local i
	cd "$_builddir"
	for i in $source; do
		case $i in
		*.patch|*.diff)
			msg "Applying $i..."
			patch -p1 -i "$srcdir"/$i || return 1
			;;
		esac
	done
}

build() {
	local _sysroot=/
	[ "$CHOST" != "$CTARGET" ] && _sysroot="$CBUILDROOT"
	cd "$_builddir"
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--target=$CTARGET \
		--with-build-sysroot="$CBUILDROOT" \
		--with-sysroot=$_sysroot \
		--prefix=/usr \
		--mandir=/usr/share/man \
		--infodir=/usr/share/info \
		--disable-multilib \
		--enable-shared \
		--enable-ld=default \
		--enable-gold=yes \
		--enable-64-bit-bfd \
		--enable-plugins \
		--enable-install-libiberty \
		--disable-werror \
		--disable-nls \
		|| return 1
	make || return 1
}

package() {
	cd "$_builddir"
	make install DESTDIR="$pkgdir" || return 1
	if [ -d "$pkgdir"/usr/lib64 ]; then
		mv "$pkgdir"/usr/lib64/* "$pkgdir"/usr/lib/
		rmdir "$pkgdir"/usr/lib64
	fi
	if [ "$CHOST" != "$CTARGET" ]; then
		# creating cross tools: remove any files that would conflict
		# with the native tools, or other cross tools
		rm -r "$pkgdir"/usr/share
		rm -f "$pkgdir"/usr/lib/libiberty.a
	fi
}

libs() {
	pkgdesc="Runtime libraries from binutils - libbfd and libopcodes"

	mkdir -p "$subpkgdir"/usr/lib
	mv "$pkgdir"/usr/lib/lib*.so "$subpkgdir"/usr/lib/ || return 1
}

gold() {
	pkgdesc="GNU binutils - gold linker"

	if [ -e "$pkgdir"/usr/bin/ld.gold ]; then
		mkdir -p "$subpkgdir"/usr/bin
		mv "$pkgdir"/usr/bin/ld.gold "$subpkgdir"/usr/bin
	fi
	mkdir -p "$subpkgdir"/usr/$CTARGET/bin
	mv "$pkgdir"/usr/$CTARGET/bin/ld.gold "$subpkgdir"/usr/$CTARGET/bin/ld.gold
}

md5sums="64146a0faa3b411ba774f47d41de239f  binutils-2.26.tar.bz2
c9f308494b87c243f121a56d58f2da87  binutils-ld-fix-static-linking.patch
686071a371b6d7aaad86c3a5c09ba6d3  hash-style-gnu.patch"
sha256sums="c2ace41809542f5237afc7e3b8f32bb92bc7bc53c6232a84463c423b0714ecd9  binutils-2.26.tar.bz2
d5c5581d0ba04ef2e3690f6fb57435bf7ce343f2376fe972a2a693c5429eec9c  binutils-ld-fix-static-linking.patch
d30633153c41f0a59956f4d49ad12c0b53dabfd9f48175d0db0a1a5f2263cdfc  hash-style-gnu.patch"
sha512sums="e77e1b8dbbcbaf9ac2fae95c4403615808af3be03b2e1d32448cd3a7d32c43273f8bcace3f2de84ec120a982879295673029da306e2885dbf5f990584932cfc7  binutils-2.26.tar.bz2
ecee33b0e435aa704af1c334e560f201638ff79e199aa11ed78a72f7c9b46f85fbb227af5748e735fd681d1965fcc42ac81b0c8824e540430ce0c706c81e8b49  binutils-ld-fix-static-linking.patch
24e853bf4b58621a77921087e599da2ace47ba3079e2d50fb5d08ae399be5f060c5fdd7f65257bcc0526aebc66e68b98aafd45d714c035da8ea2bdc3d8d4e375  hash-style-gnu.patch"