summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: fed09509f10dc8f0b70cfd69e0fd2820b7cee047 (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
# Contributor: Alexander 'hatred' Drozdov <adrozdoff@gmail.com>
# Contributor: toha257 <toha257@gmail.com>
# Contributor: Allan McRae <allan@archlinux.org>
# Contributor: Bartłomiej Piotrowski <bpiotrowski@archlinux.org>
# Contributor: Kevin Mihelich <kevin@archlinuxarm.org>
# Contributor: Felipe Balbi <felipe@balbi.sh>
# Contributor: Tavian Barnes <tavianator@tavianator.com>
# Contributor: Vyacheslav Razykov <v.razykov@gmail.com>
# Maintainer: Wilken Gottwalt <wilken dot gottwalt at posteo dot net>

_target="arm-linux-gnueabihf"
pkgname="${_target}-binutils"
pkgver=2.43.1
pkgrel=2
pkgdesc="A set of programs to assemble and manipulate binary and object files"
arch=(x86_64)
url='https://www.gnu.org/software/binutils/'
license=(GPL)
depends=(glibc libelf zlib zstd)
makedepends=(gcc glibc libelf zlib zstd)
options=(!emptydirs !distcc !strip)
source=(https://ftp.gnu.org/gnu/binutils/binutils-${pkgver}.tar.xz{,.sig})
sha256sums=('13f74202a3c4c51118b797a39ea4200d3f6cfbe224da6d1d95bb938480132dfd'
            'SKIP')
validpgpkeys=('3A24BC1E8FB409FA9F14371813FCEF89DD9E3C4F') # Nick Clifton (Chief Binutils Maintainer) <nickc@redhat.com>

prepare() {
  mkdir -p binutils-build

  cd binutils-${pkgver}
  sed -i "/ac_cpp=/s/\$CPPFLAGS/\$CPPFLAGS -O2/" libiberty/configure

  cd ../binutils-build
}

build() {
  cd binutils-build

  ../binutils-${pkgver}/configure \
    --build=$CHOST \
    --host=$CHOST \
    --target=$_target \
    --prefix=/usr \
    --with-sysroot=/usr/${_target} \
    --with-debuginfod \
    --with-pic \
    --with-system-zlib \
    --with-gnu-as \
    --with-gnu-ld \
    --enable-cet \
    --enable-deterministic-archives \
    --enable-gold \
    --enable-ld=default \
    --enable-lto \
    --enable-plugins \
    --enable-relro \
    --enable-threads \
    --enable-multilib \
    --disable-gdb \
    --disable-werror

  make
}

check() {
  cd binutils-build

  # unset LDFLAGS as testsuite makes assumptions about which ones are active
  # ignore failures in gold testsuite...
  make -k LDFLAGS="" check || true
}

package() {
  cd binutils-build

  make DESTDIR="${pkgdir}" install

  # elfedit does not support ARM and gprof makes no sense as a cross tool
  rm -rf "${pkgdir}"/usr/bin/*-{elfedit,gprof}
  # collides with system installation of binutils
  rm -rf "${pkgdir}"/usr/{lib,share}

  # strip it manually
  find "${pkgdir}"/ -type f -and \( -executable \) -exec strip '{}' \;
}