|
| 1 | +# Tool Chain: GCC-8.2.0 PASS 1 of 2 |
| 2 | +# Build and install as mlfs |
| 3 | + |
| 4 | +export CC="${MLFS_TARGET}-gcc" |
| 5 | +export CXX="${MLFS_TARGET}-g++" |
| 6 | +export AR="${MLFS_TARGET}-ar" |
| 7 | +export AS="${MLFS_TARGET}-as" |
| 8 | +export RANLIB="${MLFS_TARGET}-ranlib" |
| 9 | +export LD="${MLFS_TARGET}-ld" |
| 10 | +export STRIP="${MLFS_TARGET}-strip" |
| 11 | + |
| 12 | +tar -xf ../mpfr-4.0.1.tar.xz |
| 13 | +mv -v mpfr-4.0.1 mpfr |
| 14 | +tar -xf ../gmp-6.1.2.tar.xz |
| 15 | +mv -v gmp-6.1.2 gmp |
| 16 | +tar -xf ../mpc-1.1.0.tar.gz |
| 17 | +mv -v mpc-1.1.0 mpc |
| 18 | + |
| 19 | +patch -Np0 -i ../gcc-8.2.0-void-0016-invalid_tls_model.diff |
| 20 | +patch -Np0 -i ../gcc-8.2.0-void-fix-cxxflags-passing.patch |
| 21 | +patch -Np0 -i ../gcc-8.2.0-void-fix-musl-execinfo.patch |
| 22 | +patch -Np0 -i ../gcc-8.2.0-void-no-stack_chk_fail_local.patch |
| 23 | + |
| 24 | + |
| 25 | +#change the location of GCC's default dynamic linker to use the one installed in /tools |
| 26 | +for file in gcc/config/{linux,i386/linux{,64}}.h |
| 27 | +do |
| 28 | + cp -uv $file{,.orig} |
| 29 | + sed -e 's@/lib\(64\)\?\(32\)\?/ld@/tools&@g' \ |
| 30 | + -e 's@/usr@/tools@g' $file.orig > $file |
| 31 | + echo ' |
| 32 | +#undef STANDARD_STARTFILE_PREFIX_1 |
| 33 | +#undef STANDARD_STARTFILE_PREFIX_2 |
| 34 | +#define STANDARD_STARTFILE_PREFIX_1 "/tools/lib/" |
| 35 | +#define STANDARD_STARTFILE_PREFIX_2 ""' >> $file |
| 36 | + touch $file.orig |
| 37 | +done |
| 38 | + |
| 39 | +case $(uname -m) in |
| 40 | + x86_64) |
| 41 | + sed -e '/m64=/s/lib64/lib/' \ |
| 42 | + -i.orig gcc/config/i386/t-linux64 |
| 43 | + ;; |
| 44 | +esac |
| 45 | + |
| 46 | +mkdir -v build && cd build |
| 47 | +../configure \ |
| 48 | + --target=${MLFS_TARGET} \ |
| 49 | + --build=${MLFS_HOST} \ |
| 50 | + --host=${MLFS_TARGET} \ |
| 51 | + --prefix=/tools \ |
| 52 | + --with-sysroot=$MLFS \ |
| 53 | + --with-newlib \ |
| 54 | + --without-headers \ |
| 55 | + --with-local-prefix=/tools \ |
| 56 | + --with-native-system-header-dir=/tools/include \ |
| 57 | + --disable-nls \ |
| 58 | + --disable-shared \ |
| 59 | + --disable-multilib \ |
| 60 | + --disable-threads \ |
| 61 | + --disable-libatomic \ |
| 62 | + --disable-libgomp \ |
| 63 | + --disable-libmpx \ |
| 64 | + --disable-libquadmath \ |
| 65 | + --disable-libssp \ |
| 66 | + --disable-libvtv \ |
| 67 | + --disable-libstdcxx \ |
| 68 | + --enable-languages=c,c++ \ |
| 69 | + --disable-libstdcxx-pch \ |
| 70 | + --disable-symvers \ |
| 71 | + --disable-libitm \ |
| 72 | + --disable-gnu-indirect-function \ |
| 73 | + --disable-libmudflap \ |
| 74 | + --disable-libsanitizer \ |
| 75 | + --disable-libcilkrts |
| 76 | +## Will not build unless $PATH is switched from /cross-tools/bin:/tools/bin:/bin:/usr/bin to |
| 77 | +## /bin:/usr/bin:/cross-tools/bin:/tools/bin |
| 78 | +export PATH=/bin:/usr/bin:/cross-tools/bin:/tools/bin |
| 79 | +make && make install |
| 80 | + |
| 81 | +export PATH=/cross-tools/bin:/tools/bin:/bin:/usr/bin |
0 commit comments