|
|
|
#!/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 -M -i "$rocket" "$satellite_dir/$1.sat"
|
|
|
|
}
|
|
|
|
|
|
|
|
mkdir -p "$rocket/tools/lib"
|
|
|
|
ln -sf lib "$rocket/tools/lib64"
|
|
|
|
|
|
|
|
# List of packages to build
|
|
|
|
|
|
|
|
# Toolchain
|
|
|
|
astrobuild "binutils-1"
|
|
|
|
astrobuild "gcc-1"
|
|
|
|
astrobuild "linux-api"
|
|
|
|
astrobuild "glibc"
|
|
|
|
astrobuild "libstdc"
|
|
|
|
astrobuild "binutils-2"
|
|
|
|
astrobuild "gcc-2"
|
|
|
|
|
|
|
|
# Utilities
|
|
|
|
astrobuild "busybox"
|
|
|
|
astrobuild "bash"
|
|
|
|
astrobuild "gawk"
|
|
|
|
astrobuild "make"
|
|
|
|
astrobuild "m4"
|
|
|
|
|
|
|
|
astrobuild "perl"
|
|
|
|
astrobuild "openssl"
|
|
|
|
astrobuild "ca-certificates"
|
|
|
|
astrobuild "curl"
|
|
|
|
astrobuild "stow"
|
|
|
|
astrobuild "astronaut"
|