74 lines
1.1 KiB
Bash
Executable File
74 lines
1.1 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
if [[ -v DEBUG ]]; then
|
|
set -euox pipefail
|
|
else
|
|
set -euo pipefail
|
|
fi
|
|
|
|
umask 022
|
|
|
|
. version.bash
|
|
. flags.bash
|
|
. utilities.bash
|
|
|
|
create_sysroot
|
|
|
|
bootstrap_builds() {
|
|
for build in binutils gcc linux glibc libstdc++; do
|
|
. "stage/bootstrap/${build}.bash"
|
|
cd "$PROJDIR"
|
|
done
|
|
}
|
|
|
|
toolchain_builds() {
|
|
for build in m4 ncurses bash coreutils diffutils file findutils gawk grep gzip make patch sed tar xz binutils gcc; do
|
|
. "stage/toolchain/${build}.bash"
|
|
cd "$PROJDIR"
|
|
done
|
|
}
|
|
|
|
prechroot_builds() {
|
|
for build in setup bison perl python util_linux cleanup; do
|
|
. "stage/prechroot/${build}.bash"
|
|
cd "$PROJDIR"
|
|
done
|
|
}
|
|
|
|
usage() {
|
|
echo "usage: build.bash <stage> <package>"
|
|
exit 1
|
|
}
|
|
|
|
|
|
check_in_run() {
|
|
if [[ $# -ge 1 && $# -le 2 ]]; then
|
|
case $1 in
|
|
bootstap|toolchain)
|
|
if [ $# -eq 1 ]; then
|
|
"${1}_builds"
|
|
else
|
|
. "stage/$1/$2.bash"
|
|
fi
|
|
;;
|
|
prechroot|hroot)
|
|
if [ $# -eq 1 ]; then
|
|
do_mount
|
|
"${1}_builds"
|
|
do_unmount
|
|
else
|
|
do_mount
|
|
. "stage/$1/$2.bash"
|
|
do_unmount
|
|
fi
|
|
;;
|
|
*)
|
|
usage
|
|
;;
|
|
esac
|
|
else
|
|
usage
|
|
fi
|
|
}
|
|
|
|
check_in_run "$@" |