archrelease: copy trunk to extra-x86_64
[arch-packages.git] / binutils / repos / core-x86_64 / PKGBUILD
blobdc367e5e67b822079996db92b45b0c0ad49a615a
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
8 pkgname=binutils
9 pkgver=2.40
10 _commit=ded035f913e4d8c989880cf5928b6b5fca9466ae
11 pkgrel=5
12 pkgdesc='A set of programs to assemble and manipulate binary and object files'
13 arch=(x86_64)
14 url='https://www.gnu.org/software/binutils/'
15 license=('GPL3' 'GPL' 'FDL1.3' 'custom:FSFAP')
16 depends=(glibc jansson libelf zlib zstd)
17 makedepends=(git)
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)
26 sha256sums=('SKIP'
27             '2d430b66f84a19c154725ec535280c493be1d34f1a90f95208dce02fecd0e4e4')
28 validpgpkeys=(3A24BC1E8FB409FA9F14371813FCEF89DD9E3C4F)
30 prepare() {
31   [[ ! -d binutils-gdb ]] && ln -s binutils-${pkgver} binutils-gdb
32   mkdir -p binutils-build
34   cd binutils-gdb
36   # Turn off development mode (-Werror, gas run-time checks, date in sonames)
37   sed -i '/^development=/s/true/false/' bfd/development.sh
39   # Creds @Fedora
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
46 build() {
47   cd binutils-build
49   "${srcdir}"/binutils-gdb/configure \
50     --prefix=/usr \
51     --sysconfdir="${pkgdir}"/etc \
52     --with-lib-path=/usr/lib:/usr/local/lib \
53     --with-bugurl=https://bugs.archlinux.org/ \
54     --enable-cet \
55     --enable-colored-disassembly \
56     --enable-default-execstack=no \
57     --enable-deterministic-archives \
58     --enable-gold \
59     --enable-install-libiberty \
60     --enable-jansson \
61     --enable-ld=default \
62     --enable-new-dtags \
63     --enable-pgo-build=lto \
64     --enable-plugins \
65     --enable-relro \
66     --enable-shared \
67     --enable-targets=x86_64-pep,bpf-unknown-none \
68     --enable-threads \
69     --disable-gdb \
70     --disable-gdbserver \
71     --disable-libdecnumber \
72     --disable-readline \
73     --disable-sim \
74     --disable-werror \
75     --with-debuginfod \
76     --with-pic \
77     --with-system-zlib
79   make -O tooldir=/usr
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
87 check() {
88   cd binutils-build
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" \
96           LDFLAGS="" \
97           check || true
100 package() {
101   cd binutils-build
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
113 /* GNU ld script */
115 INPUT( /usr/lib/libbfd.a -lsframe -liberty -lz -lzstd -ldl )
118   tee "${pkgdir}"/usr/lib/libopcodes.so << EOS
119 /* GNU ld script */
121 INPUT( /usr/lib/libopcodes.a -lbfd )
124   # install FSF All Permissive License
125   install -Dm644 -t "${pkgdir}"/usr/share/licenses/${pkgname}/ FSFAP