#!/bin/sh # set -e : ${MACHINE:=mips-elf} b_prefix="--prefix=${INSTALL}" machine="--target ${MACHINE}" # build dependencies gmp="--with-gmp=${INSTALL}" mfr="--with-mpfr=${INSTALL}" mpc="--with-mpc=${INSTALL}" # gcc # newlib="--with-newlib --without-headers" extra="--disable-lto --disable-nls --disable-libgomp --disable-libquadmath --disable-decimal-float --disable-libitm --without-isl --disable-plugin" sde="--with-arm=mips32r2" sde_extra="--with-mips-plt --with-llsc --with-synci" binutils="${mpc} ${gmp} ${mpfr} --with-gnu-as --with-gnu-ld" hier_dirs () { cd ${BUILDDIR} mkdir -p "${1}" cd "${1}" } prebuild() { cd "${BUILDDIR}" hier_dirs gmp ${START}/${GMP}/configure ${b_prefix} -q --disable-shared make && make install hier_dirs mpfr ${START}/${MPFR}/configure ${b_prefix} -q --disable-shared --disable-lto --disable-decimal-float make && make install hier_dirs mpc ${START}/${MPC}/configure ${b_prefix} -q --disable-shared make && make install } binutils() { hier_dirs binutils ${START}/${BINUTILS}/configure -q ${b_prefix} ${machine} ${mpc} ${gmp} ${mpfr} \ --disable-debug --disable-lto --disable-nls --disable-multilib \ --disable-gdb --disable-gdb-server --disable-libdecnumber \ --disable-readline --disable-sim --disable-gold make && make install } phase_1() { hier_dirs gcc0 ${START}/${GCC}/configure -q ${b_prefix} ${machine} --enable-languages=c ${binutils} \ ${sde} ${newlib} ${sde_extra} make all-gcc && make install-gcc make all-target-libgcc && make install-target-libgcc } newlib() { hier_dirs newlib ${START}/${NEWLIB}/configure -q ${b_prefix} ${machine} --disable-newlib-supplied-syscalls make && make install } phase_2() { hier_dirs gcc1 ${START}/${GCC}/configure -q ${b_prefix} ${machine} --enable-languages=c ${binutils} ${sde} ${newlib} ${sde_extra} } test -z "${BUILDDIR}" -o -z "${PREFIX}" -o -z "${START}" -o -z "${MACHINE}" && 2>& echo "Environment not set." && exit test -r "./versions.env" && . "./versions.env" prebuild binutils phase_1 newlib phase_2