#!/bin/sh set -eu eval "$(args freshen-build-uberbaum ubersrc uberbuild gccsrc gccbuild -- "$@")" cmd () { echo echo "freshen-build-uberbaum: $1" >&2 eval "$1" || { status="$?" echo "exit status: $status" return $status } } # Always start with empty build trees. cmd "wipe-build-tree '$uberbuild'" cmd "wipe-build-tree '$gccbuild'" # First, we build and install gas, ld, and binutils from uberbaum. cmd "cd '$uberbuild'" cmd "CFLAGS=-g3 CXXFLAGS=-g3 $(compiler $uberbuild) '$ubersrc/configure' $(config-flags $uberbuild)" cmd "$(compiler $uberbuild) make all-{gas,ld,binutils}" cmd "$(compiler $uberbuild) make install-{gas,ld,binutils}" uberbin="$(prefix $uberbuild/config.status)/bin" setpath="with-path '$uberbin' $(compiler $gccbuild)" # Then, we build and install GCC from its own repository, which, if # it's a cross-compiler, depends on the target 'ar' we just built. cmd "cd '$gccbuild'" cmd "CFLAGS=-g3 CXXFLAGS=-g3 ${setpath} '$gccsrc/configure' $(config-flags $gccbuild)" cmd "${setpath} make" cmd "${setpath} make install" # And finally, we rebuild the entire uberbaum tree from sources. # We really do have to rebuild the whole thing, because the top-level # configure script chose, for example, CC_FOR_TARGET before we # installed GCC. So the whole thing needs to be re-configured. setpath="with-path '$uberbin' $(compiler $uberbuild)" cmd "wipe-build-tree '$uberbuild'" cmd "cd '$uberbuild'" cmd "CFLAGS=-g3 CXXFLAGS=-g3 ${setpath} '$ubersrc/configure' $(config-flags $uberbuild)" cmd "${setpath} make" cmd "${setpath} make install"