1 # Maintainer: Giancarlo Razzolini <grazzolini@archlinux.org>
2 # Maintainer: Frederik Schwan <freswa at archlinux dot org>
3 # Contributor: Bartłomiej Piotrowski <bpiotrowski@archlinux.org>
4 # Contributor: Allan McRae <allan@archlinux.org>
6 # toolchain build order: linux-api-headers->glibc->binutils->gcc->glibc->binutils->gcc
10 _commit=b51c2fec1da205ea3e7354cbb3e253018d64873c
12 pkgdesc='A set of programs to assemble and manipulate binary and object files'
14 url='https://www.gnu.org/software/binutils/'
15 license=('GPL3' 'GPL' 'FDL1.3' 'custom:FSFAP')
17 depends=(glibc zlib libelf jansson)
19 checkdepends=(dejagnu debuginfod bc)
20 optdepends=('debuginfod: for debuginfod server/client functionality')
21 conflicts=(binutils-multilib)
22 replaces=(binutils-multilib)
23 options=(staticlibs !distcc !ccache debug)
24 source=(git+https://sourceware.org/git/binutils-gdb.git#commit=${_commit}
25 gold-warn-unsupported.patch)
27 '2d430b66f84a19c154725ec535280c493be1d34f1a90f95208dce02fecd0e4e4')
28 validpgpkeys=(3A24BC1E8FB409FA9F14371813FCEF89DD9E3C4F)
31 [[ ! -d binutils-gdb ]] && ln -s binutils-$pkgver binutils-gdb
32 mkdir -p binutils-build
36 # Turn off development mode (-Werror, gas run-time checks, date in sonames)
37 sed -i '/^development=/s/true/false/' bfd/development.sh
40 # Change the gold configuration script to only warn about
41 # unsupported targets. This allows the binutils to be built with
42 # BPF support enabled.
43 patch -Np1 -i "${srcdir}"/gold-warn-unsupported.patch
49 "$srcdir/binutils-gdb/configure" \
51 --with-lib-path=/usr/lib:/usr/local/lib \
52 --with-bugurl=https://bugs.archlinux.org/ \
54 --enable-deterministic-archives \
56 --enable-install-libiberty \
59 --enable-pgo-build=lto \
63 --enable-targets=x86_64-pep,bpf-unknown-none \
67 --disable-libdecnumber \
77 # Extract the FSF All Permissive License
78 # <https://www.gnu.org/prep/maintain/html_node/License-Notices-for-Other-Files.html>
79 # used for some linker scripts.
80 tail -n 5 "${srcdir}"/binutils-gdb/ld/scripttempl/README > FSFAP
86 # Use minimal flags for testsuite
87 # ld testsuite uses CFLAGS_FOR_TARGET and requires -g
88 # gold testsuite requires CXXFLAGS/CFLAGS with default PIE/PIC disabled
89 make -O CFLAGS_FOR_TARGET="-O2 -g" \
90 CXXFLAGS="-O2 -no-pie -fno-PIC" \
91 CFLAGS="-O2 -no-pie" \
98 make prefix="$pkgdir/usr" tooldir="$pkgdir/usr" install
100 # install PIC version of libiberty
101 install -m644 libiberty/pic/libiberty.a "$pkgdir/usr/lib"
103 # Remove unwanted files
104 rm -f "$pkgdir"/usr/share/man/man1/{dlltool,windres,windmc}*
106 # No shared linking to these files outside binutils
107 rm -f "$pkgdir"/usr/lib/lib{bfd,opcodes}.so
108 echo 'INPUT( /usr/lib/libbfd.a -liberty -lz -ldl )' > "$pkgdir/usr/lib/libbfd.so"
109 echo 'INPUT( /usr/lib/libopcodes.a -lbfd )' > "$pkgdir/usr/lib/libopcodes.so"
111 # install FSF All Permissive License
112 install -Dm644 -t "${pkgdir}"/usr/share/licenses/${pkgname}/ FSFAP