Revert "gcc upgraded to version 8-20190222"
[dragora.git] / stages / 0 / 03-gcc-static
blobb90a93d49b5c04771ccd6a984789de1383caec70
1 # Build script for gcc.
3 # Copyright (c) 2016-2019 Matias Fonzo, <selk@dragora.org>.
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
9 #    http://www.apache.org/licenses/LICENSE-2.0
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
17 version=8-20190201
19 # Prerequisites
20 gmp_version=6.1.2
21 mpfr_version=4.0.2
22 mpc_version=1.1.0
23 isl_version=0.20
25 cd -- "$TMPDIR"
27 rm -rf gcc-${version} gmp-${gmp_version} \
28        mpfr-${mpfr_version} mpc-${mpc_version} isl-${isl_version}
29 unpack "${worktree}/sources/gcc-${version}.tar.xz" \
30        "${worktree}/sources/gmp-${gmp_version}.tar.lz" \
31        "${worktree}/sources/mpfr-${mpfr_version}.tar.bz2" \
32        "${worktree}/sources/mpc-${mpc_version}.tar.gz" \
33        "${worktree}/sources/isl-${isl_version}.tar.bz2"
35 # Build instructions
36 cd gcc-${version}
38 # Make symlinks for requisites
39 ln -s ../gmp-${gmp_version} gmp
40 ln -s ../mpfr-${mpfr_version} mpfr
41 ln -s ../mpc-${mpc_version} mpc
42 ln -s ../isl-${isl_version} isl
44 # Apply patches for MPFR
46     cd mpfr || exit 1
48     for file in "${worktree}"/patches/mpfr/*
49     do
50         if test -f "$file"
51         then
52             rm -f PATCHES
53             patch -p1 < "$file"
54         fi
55     done
58 # Apply specific patches for the support in musl.
59 # http://port70.net/~nsz/musl/gcc-8.2.0
61 patch -Np1 -i "${worktree}/patches/gcc/0001-ssp_nonshared.patch"
62 patch -Np1 -i "${worktree}/patches/gcc/0002-posix_memalign.patch"
63 patch -Np1 -i "${worktree}/patches/gcc/0003-libatomic-test-fix.patch"
64 patch -Np1 -i "${worktree}/patches/gcc/0004-libgomp-test-fix.patch"
65 patch -Np1 -i "${worktree}/patches/gcc/0005-libitm-test-fix.patch"
66 patch -Np1 -i "${worktree}/patches/gcc/0006-libvtv-test-fix.patch"
67 patch -Np1 -i "${worktree}/patches/gcc/0007-j2.patch"
68 patch -Np1 -i "${worktree}/patches/gcc/0008-s390x-muslldso.patch"
69 patch -Np1 -i "${worktree}/patches/gcc/0009-microblaze-pr65649.patch"
70 patch -Np1 -i "${worktree}/patches/gcc/0010-ldbl128-config.patch"
71 patch -Np1 -i "${worktree}/patches/gcc/0011-m68k.patch"
72 patch -Np1 -i "${worktree}/patches/gcc/0012-static-pie.patch"
74 # Build in a separate directory
75 rm -rf ../gcc-build
76 mkdir ../gcc-build
77 cd ../gcc-build
79 ../gcc-${version}/configure \
80 AR="ar" CC="$BTCC" CXX="$BTCXX" \
81 CFLAGS="$BTCFLAGS" CXXFLAGS="$BTCXXFLAGS" LDFLAGS="$BTLDFLAGS" \
82  --prefix="$crossdir" \
83  --libdir="${crossdir}/lib${libSuffix}" \
84  --build=$host \
85  --host=$host \
86  --target=$target \
87  --enable-languages=c \
88  --enable-clocale=generic \
89  --disable-shared \
90  --disable-threads \
91  --disable-decimal-float \
92  --disable-libgomp \
93  --disable-libssp \
94  --disable-libatomic \
95  --disable-libitm \
96  --disable-libquadmath \
97  --disable-libvtv \
98  --disable-libcilkrts \
99  --disable-libstdcxx \
100  --disable-gnu-indirect-function \
101  --disable-libmudflap \
102  --disable-libsanitizer \
103  --disable-libmpx \
104  --disable-nls \
105  --with-sysroot="${crossdir}/$target" \
106  --with-newlib \
107  --without-headers \
108  --without-ppl \
109  --without-cloog \
110  $multilib_options \
111  $gcc_options
113 make -j${jobs} all-gcc all-target-libgcc
114 make -j${jobs} install-gcc install-target-libgcc
116 cleanup()
118     cd -- "$TMPDIR" && rm -rf gcc-${version} \
119      gmp-${gmp_version} mpfr-${mpfr_version} \
120      mpc-${mpc_version} isl-${isl_version}