#!/bin/sh # Tool to build tools to build final system set -e umask 022 command -v astronaut >/dev/null 2>&1 || { echo 'Can'\''t find astronaut in $PATH' 1>&2 exit 1 } if [ ! "$rocket" ]; then echo 'Please set the $rocket variable' 1>&2 exit 1 fi if [ "$(readlink /tools)" != "$(realpath "$rocket")/tools" ]; then echo "Please create a symlink from /tools to $(realpath "$rocket")/tools" 1>&2 exit 1 fi # Options for supported shells if [ "$(basename "$(readlink /bin/sh)")" = "bash" ]; then shellopts="+h" fi # Know where them satellites are satellite_dir="$(dirname "$(realpath "$0")")/satellites" envrun() { env -i \ HOME="$HOME" \ TERM="$TERM" \ LC_ALL=C \ PATH="/tools/bin:$PATH" \ MAKEFLAGS="$MAKEFLAGS" \ rocket="$rocket" \ target="$(uname -m)-rocket-linux-gnu" \ /bin/sh "$shellopts" "$@" } astrobuild() { envrun astronaut -i "$rocket" "$satellite_dir/$1.sat" } # List of packages to build mkdir -p "$rocket/tools" astrobuild "binutils-1" astrobuild "gcc-1" astrobuild "linux-api" astrobuild "glibc" astrobuild "libstdc" astrobuild "binutils-2" astrobuild "gcc-2" astrobuild "make" astrobuild "busybox" astrobuild "astronaut"