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=ded035f913e4d8c989880cf5928b6b5fca9466ae
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')
16 depends=(glibc jansson libelf zlib zstd)
18 checkdepends=(dejagnu debuginfod bc)
19 optdepends=('debuginfod: for debuginfod server/client functionality')
20 conflicts=(binutils-multilib)
21 replaces=(binutils-multilib)
22 backup=('etc/gprofng.rc')
23 options=(staticlibs !distcc !ccache)
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 --sysconfdir="${pkgdir}"/etc \
52 --with-lib-path=/usr/lib:/usr/local/lib \
53 --with-bugurl=https://bugs.archlinux.org/ \
55 --enable-colored-disassembly \
56 --enable-default-execstack=no \
57 --enable-deterministic-archives \
59 --enable-install-libiberty \
63 --enable-pgo-build=lto \
67 --enable-targets=x86_64-pep,bpf-unknown-none \
71 --disable-libdecnumber \
81 # Extract the FSF All Permissive License
82 # <https://www.gnu.org/prep/maintain/html_node/License-Notices-for-Other-Files.html>
83 # used for some linker scripts.
84 tail -n 5 "${srcdir}"/binutils-gdb/ld/scripttempl/README > FSFAP
90 # Use minimal flags for testsuite
91 # ld testsuite uses CFLAGS_FOR_TARGET and requires -g
92 # gold testsuite requires CXXFLAGS/CFLAGS with default PIE/PIC disabled
93 make -O CFLAGS_FOR_TARGET="-O2 -g" \
94 CXXFLAGS="-O2 -no-pie -fno-PIC" \
95 CFLAGS="-O2 -no-pie" \
102 make prefix="${pkgdir}"/usr tooldir="${pkgdir}"/usr install
104 # install PIC version of libiberty
105 install -m644 libiberty/pic/libiberty.a "${pkgdir}"/usr/lib
107 # Remove unwanted files
108 rm -f "${pkgdir}"/usr/share/man/man1/{dlltool,windres,windmc}*
110 # No shared linking to these files outside binutils
111 rm -f "${pkgdir}"/usr/lib/lib{bfd,opcodes}.so
112 tee "${pkgdir}"/usr/lib/libbfd.so << EOS
115 INPUT( /usr/lib/libbfd.a -lsframe -liberty -lz -lzstd -ldl )
118 tee "${pkgdir}"/usr/lib/libopcodes.so << EOS
121 INPUT( /usr/lib/libopcodes.a -lbfd )
124 # install FSF All Permissive License
125 install -Dm644 -t "${pkgdir}"/usr/share/licenses/${pkgname}/ FSFAP