summaryrefslogtreecommitdiffstats
path: root/main/binutils/APKBUILD
blob: 492adb13486e956b509a75ed13a936662bdb1344 (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
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=binutils
pkgver=2.23.2
pkgrel=3
pkgdesc="Tools necessary to build programs"
url="http://www.gnu.org/software/binutils/"
depends=
makedepends="bison flex texinfo zlib-dev"
arch="all"
license="GPL"
subpackages="$pkgname-doc $pkgname-libs"
_builddir="$srcdir/$pkgname-$pkgver"

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"

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

	update_config_sub || return 1
}

build() {
	local _cross_configure=
	[ "$CHOST" != "$CTARGET" ] && _cross_configure="--with-sysroot=$CBUILDROOT"

	cd "$_builddir"
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--target=$CTARGET \
		--with-build-sysroot="$CBUILDROOT" \
		$_cross_configure \
		--prefix=/usr \
		--mandir=/usr/share/man \
		--infodir=/usr/share/info \
		--disable-multilib \
		--enable-shared \
		--enable-64-bit-bfd \
		--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
	rm "$pkgdir"/usr/lib/libiberty.a
	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
	fi
	find "$pkgdir" -name "*.la" -delete
}

libs() {
       pkgdesc="Runtime libraries from binutils - libbfd and libopcodes"
       replaces="binutils"
       mkdir -p "$subpkgdir"/usr/lib
       mv "$pkgdir"/usr/lib/lib*.so "$subpkgdir"/usr/lib/ || return 1
}

md5sums="4f8fa651e35ef262edc01d60fb45702e  binutils-2.23.2.tar.bz2
6b744d0574338cc69d3096a890a7b609  binutils-ld-fix-static-linking.patch"
sha256sums="fe914e56fed7a9ec2eb45274b1f2e14b0d8b4f41906a5194eac6883cfe5c1097  binutils-2.23.2.tar.bz2
a3ebf58f95fc6c1bfe05377d222d876593f692fa9098d1ccce43874ecbb0501d  binutils-ld-fix-static-linking.patch"
sha512sums="dec753bbba008f1526b89cf1bd85feba78f362f5333ffdf93953fd131eb755976dec82a0a4ba38c43d2434da007137780cfe674de5414be5cf7ce7fbc6af6d16  binutils-2.23.2.tar.bz2
d013566655041eee1e484d6f8b7168a2817839e88d370f064be3917c9c6be11d1b13e90fd9e769f5f095e6709520b6308d3cfca69c2956ada311c07ff697bab4  binutils-ld-fix-static-linking.patch"