aboutsummaryrefslogtreecommitdiff
path: root/testing/libgccjit/build
blob: 3d2dc7c1557f6f6e27a2ed09980bafa4fe780420 (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
#!/bin/sh -e

# TODO Cleanup non-libgccjit items.

sys_arch=${3:-$(uname -m)}

sed_i() {
    for file; do :; done
    sed "$@" > _
    cat _ > "$file"; rm -f _
}

if [ "${sys_arch#i*86}" ]; then
    # Do not create lib64 directories
    sed_i '/m64=/s/lib64/lib/' gcc/gcc/config/i386/t-linux64
    sed_i 's/lib64/lib/'       gcc/gcc/config/i386/linux64.h
fi

# FIXME: there is an offset on the diff, causing 'busybox patch' to fail.
(cd gcc; patch -p1 < ../gccjit-musl-fix.patch)

case "$sys_arch" in
    i*86)   archopts="--build=i686-pc-linux-musl" ;;
    x86_64) archopts="--build=x86_64-pc-linux-musl"
esac

# Build must happen outside of gcc source.
mkdir -p gcc-build
cd gcc-build

export libat_cv_have_ifunc=no

../gcc/configure \
    --prefix=/usr \
    "$archopts" \
    --disable-bootstrap \
    --disable-fixed-point \
    --disable-libada \
    --disable-libquadmath \
    --disable-libsanitizer \
    --disable-libssp \
    --disable-libvtv \
    --disable-lto \
    --disable-multilib \
    --disable-nls \
    --disable-symvers \
    --disable-werror \
    --enable-__cxa_atexit \
    --enable-checking=release \
    --enable-default-pie \
    --enable-default-ssp \
    --enable-host-shared \
    --enable-languages=jit \
    --enable-shared \
    --enable-threads \
    --enable-tls \
    --infodir=/usr/share/info \
    --mandir=/usr/share/man \
    --with-system-zlib \
    --without-included-gettext

make
make DESTDIR="$1" -C gcc install

# Remove unnecessary gcc files.
rm -rf "$1/usr/bin" \
       "$1/usr/lib/gcc" \
       "$1/usr/libexec" \
       "$1/usr/share/man"

# Remove info pages other than libgccjit
find "$1/usr/share/info" -type f ! -name libgccjit.info -exec rm -f {} +