You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
62 lines
1.3 KiB
62 lines
1.3 KiB
#!/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"
|
|
|
|
# Toolchain
|
|
astrobuild "binutils-1"
|
|
astrobuild "gcc-1"
|
|
astrobuild "linux-api"
|
|
astrobuild "glibc"
|
|
astrobuild "libstdc"
|
|
astrobuild "binutils-2"
|
|
astrobuild "gcc-2"
|
|
|
|
# Utilities
|
|
astrobuild "busybox"
|
|
astrobuild "make"
|
|
astrobuild "perl"
|
|
astrobuild "stow"
|
|
astrobuild "astronaut"
|
|
|