summaryrefslogtreecommitdiff
path: root/repo/system/binutils.xibuild
blob: 8a18c937129a5bebc781ac5c11332c48b91ad884 (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
#!/bin/bash

DEPS=(glib zlib elfutils)

PKG_VER=2.37
SOURCE=https://ftp.gnu.org/gnu/binutils/binutils-$PKG_VER.tar.xz
DESC="tools for handling object files"

prepare () {
    curl -sSL https://www.linuxfromscratch.org/patches/lfs/development/binutils-$PKG_VER-upstream_fix-1.patch > binutils-$PKG_VER-upstream_fix-1.patch
    /usr/bin/patch -Np1 -i binutils-$PKG_VER-upstream_fix-1.patch

    # An error in the building system causes the shipped man pages to be empty. Workaround the issue and remove the shipped man pages, so the man pages will be regenerated correctly:

    sed -i '63d' etc/texi2pod.pl
    find -name \*.1 -delete
}

build () {
    mkdir -v build
    cd       build
    ../configure --prefix=/usr       \
             --enable-gold       \
             --enable-ld=default \
             --enable-install-libiberty \
             --enable-plugins    \
             --enable-shared     \
             --disable-werror    \
             --enable-64-bit-bfd \
             --with-system-zlib

    make tooldir=/usr
}

check () {
    make -k check || true
}

package() {
    make -j1 DESTDIR=$PKG_DEST -j1 install
    cp ../include/libiberty.h $PKG_DEST/usr/include
    rm -fv $PKG_DEST/usr/lib/lib{bfd,ctf,ctf-nobfd,opcodes}.a
    [ -e $PKG_DEST/usr/bin/ld ] && ln -sv ld.gold $PKG_DEST/usr/bin/ld 

}