summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 1799897e37be70dcb3529e670c1a54658b916560 (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
# Maintainer: Gökçe Aydos <aur_2023_01@aydos.de>
# Adapted from ABS:
# Contributor: Filipe Laíns (FFY00) <lains@archlinux.org>
# Contributor: Anatol Pomozov <anatol.pomozov@gmail.com>
#
# My modifications:
# - gdb and binutils are packaged together (https://stackoverflow.com/a/34045476), `--disable-gdb`.

_target=riscv64-elf
pkgname=$_target-binutils-git
pkgver=gdb.13.branchpoint.r1831.gd466f7492ec
pkgrel=1
pkgdesc='A set of programs to assemble and manipulate binary and object files for the RISCV64 (bare-metal) target'
arch=(x86_64)
url='https://www.gnu.org/software/binutils/'
license=(GPL)
depends=(zlib)
makedepends=(git)
source=("git+https://sourceware.org/git/binutils-gdb.git"
)
sha512sums=(SKIP)
conflicts=(riscv64-elf-binutils)
provides=(riscv64-elf-binutils)

pkgver() {
  cd binutils-gdb
  git describe --long | sed 's/\([^-]*-g\)/r\1/;s/-/./g'
}

prepare() {
  cd binutils-gdb
  sed -i '/ac_cpp=/s/\$CPPFLAGS/\$CPPFLAGS -O2/' libiberty/configure
}

build() {
  cd binutils-gdb
  ./configure --target=$_target \
              --with-sysroot=/usr/$_target \
              --prefix=/usr \
              --enable-multilib \
              --enable-interwork \
              --with-gnu-as \
              --with-gnu-ld \
              --disable-nls --disable-gdb \
              --enable-ld=default \
              --enable-gold \
              --enable-plugins \
              --enable-deterministic-archives

  make
}

check() {
  cd binutils-gdb

  # unset LDFLAGS as testsuite makes assumptions about which ones are active
  # do not abort on errors - manually check log files
  make LDFLAGS="" -k check || true
}

package() {
  cd binutils-gdb

  make DESTDIR="$pkgdir" install

  # Remove file conflicting with host binutils and manpages for MS Windows tools
  rm "$pkgdir"/usr/share/man/man1/$_target-{dlltool,windres,windmc}*
  rm "$pkgdir"/usr/lib/bfd-plugins/libdep.so

  # Remove info documents that conflict with host version
  rm -r "$pkgdir"/usr/share/info
}