summaryrefslogtreecommitdiff
path: root/system/binutils/APKBUILD
blob: 57eb9688c705a599dbc63177fec929d43df3f024 (plain) (blame)
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
# Maintainer: Adelie Platform Group <adelie-devel@lists.adelielinux.org>
pkgname=binutils
pkgver=2.30
pkgrel=2
pkgdesc="Tools necessary to build programs"
url="http://www.gnu.org/software/binutils/"
depends=""
makedepends_build="bison flex texinfo"
makedepends_host="zlib-dev"
makedepends="$makedepends_build $makedepends_host"
checkdepends="dejagnu"
arch="all"
license="GPL-2.0+ AND GPL-3.0+ AND LGPL-2.0+ AND LGPL-2.1+ AND LGPL-3.0+ AND BSD-3-Clause"
subpackages="$pkgname-dev $pkgname-doc $pkgname-lang $pkgname-libs"
# non-PIC is unsupported by musl/ppc
[ "${CARCH}" != "ppc" ] || options='!check'
source="http://ftp.gnu.org/gnu/$pkgname/$pkgname-$pkgver.tar.xz
	binutils-ld-fix-static-linking.patch
	disable-gnu-mbind.patch
	disable-ifunc-tests.patch
	disable-preinit-array-tests.patch
	mips-illegal-memcpy.patch
	remove-no-static-plt-test.patch
	remove-pr2404-tests.patch
	remove-pr19719-test.patch
	remove-pr19553c-test.patch
	"

if [ "$CHOST" != "$CTARGET" ]; then
	pkgname="$pkgname-$CTARGET_ARCH"
	subpackages=""
	options="!check"
	sonameprefix="$pkgname:"
	builddir="$srcdir"/binutils-$pkgver
fi

# secfixes:
#   2.28-r1:
#   - CVE-2017-7614

build() {
	local _sysroot=/
	local _cross_configure="--enable-install-libiberty"
	local _arch_configure=""

	if [ "$CHOST" != "$CTARGET" ]; then
		_sysroot="$CBUILDROOT"
		_cross_configure="--disable-install-libiberty"
	fi

	if [ "$CTARGET_ARCH" = "x86_64" ]; then
		_arch_configure="--enable-targets=x86_64-pep"
	fi

	case "$CTARGET_ARCH" in
	mips*)  _hash_style_configure="--enable-default-hash-style=sysv" ;;
	*)      _hash_style_configure="--enable-default-hash-style=gnu"	;;
	esac

	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-64-bit-bfd \
		--enable-plugins \
		--enable-relro \
		--disable-gold \
		--enable-deterministic-archives \
		$_cross_configure \
		$_arch_configure \
		$_hash_style_configure \
		--disable-werror \
		--with-system-zlib
	make
}

package() {
	cd "$builddir"
	make install DESTDIR="$pkgdir"
	if [ -d "$pkgdir"/usr/lib64 ]; then
		die "Something really bad happened."
		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
}

check() {
	cd "$builddir"
	make check
}

libs() {
	pkgdesc="Runtime libraries from binutils"

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

sha512sums="e747ea20d8d79fcd21b9d9f6695059caa7189d60f19256da398e34b789fea9a133c32b192e9693b5828d27683739b0198431bf8b3e39fb3b04884cf89d9aa839  binutils-2.30.tar.xz
ecee33b0e435aa704af1c334e560f201638ff79e199aa11ed78a72f7c9b46f85fbb227af5748e735fd681d1965fcc42ac81b0c8824e540430ce0c706c81e8b49  binutils-ld-fix-static-linking.patch
d378fdf1964f8f2bd0b1e62827ac5884bdf943aa435ec89c29fc84bb045d406b733fffaff8fdd8bd1cba8ddea7701c4cf6ccf3ed76a8a3df9c72b447737575a6  disable-gnu-mbind.patch
ba2b5c8cdfa95db7a1f05da8a2c1ffc3bcb35300abf7061e52249d9b29037e3fdef1aed830686bca2df74b9f5d48684e9c8e2f49715455bf90dca6e3bfc077eb  disable-ifunc-tests.patch
3537752e63cef0b5ef136d003ff7e814ba66b12624d817430112d0f291a792e8960fa69a78036f526af835441b3ee483d6a53d55c7b3dd8ee96f0399682dbcbe  disable-preinit-array-tests.patch
06422157349abf02e79a5ef8bd9f51100e7e996aab65250d518e0cf0d7ac8ed922d3bf1603c4f5b4fd8fb179266b7b4c41db32dcb241d60a7f1c21d1df0c36dd  mips-illegal-memcpy.patch
b40f9a3841a7af8fc12e8a4044cd672df5614bfda8461b0ca45efa57a42c3bc8490e491ea490c6c05d319a52d69993c4fca33a0aeb044090e7b7f4e4e30c6517  remove-no-static-plt-test.patch
32ab4215669c728648179c124632467573a3d4675e79f0f0d221c22eb2ec1ca5488b79910bd09142f90a1e0d0b81d99ca4846297f4f9561f158db63745facb66  remove-pr2404-tests.patch
a193d1fa7f42d91915960460a15e4d24e0df529d81e23014bcf45d283fae76bb7b300fdcb0d0a9d521cdb9137322efa1dc357112596d6ae7a7fd05988ac359b9  remove-pr19719-test.patch
39ef9c76dd5db6b15f11ffa8061f7ca844fb79c3fb9879c3b1466eef332a28b833597c87003ab9f260b1b85023fae264659088aee27cad7e5aa77b2d58b9a3f6  remove-pr19553c-test.patch"