#!/bin/bash set -e mkdir -p isl mpfr gmp mpc tar -xf ../isl-*.tar.xz -C isl --strip-components=1 && tar -xf ../mpfr-*.tar.xz -C mpfr --strip-components=1 && tar -xf ../gmp-*.tar.xz -C gmp --strip-components=1 && tar -xf ../mpc-*.tar.gz -C mpc --strip-components=1 && case $(uname -m) in x86_64) sed -e '/m64=/s/lib64/lib/' -i.orig gcc/config/i386/t-linux64 ;; aarch64) sed -e '/mabi.lp64=/s/lib64/lib/' \ -i.orig gcc/config/aarch64/t-aarch64-linux ;; esac mkdir -v build cd build || exit 1 mkdir -pv "${LFS_TGT}"/libgcc && ln -s ../../../libgcc/gthr-posix.h "${LFS_TGT}"/libgcc/gthr-default.h && ../configure \ --build="$(../config.guess)" \ --host="${LFS_TGT}" \ --prefix=/usr \ CC_FOR_TARGET="${LFS_TGT}"-gcc \ --with-build-sysroot="${LFS}" \ --enable-initfini-array \ --disable-nls \ --disable-multilib \ --disable-decimal-float \ --disable-libatomic \ --disable-libgomp \ --disable-libquadmath \ --disable-libssp \ --disable-libvtv \ --disable-libstdcxx \ --enable-languages=c,c++ \ "$([ "$(uname -m)" = aarch64 ] && echo --with-arch=armv8-a)" \ "$([ "$(uname -m)" = aarch64 ] && echo --with-cpu=cortex-a73.cortex-a53)" \ "$([ "$(uname -m)" = aarch64 ] && echo --enable-fix-cortex-a53-835769)" \ "$([ "$(uname -m)" = aarch64 ] && echo --enable-fix-cortex-a53-843419)" && make && make DESTDIR="${LFS}" -j1 install && ln -sv gcc "${LFS}"/usr/bin/cc