diff --git a/util/build-gcc.sh b/util/build-gcc.sh index 96fc266c..e8253796 100644 --- a/util/build-gcc.sh +++ b/util/build-gcc.sh @@ -1,6 +1,8 @@ #!/bin/bash DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +$DIR/check-reqs.sh + TARGET=i686-pc-toaru PREFIX="$DIR/local" TOARU_SYSROOT="$DIR/../base" diff --git a/util/check-reqs.sh b/util/check-reqs.sh new file mode 100755 index 00000000..3d9e750e --- /dev/null +++ b/util/check-reqs.sh @@ -0,0 +1,79 @@ +#!/bin/bash + +RET=0 + +if ! which python3.6 >/dev/null; then + echo "python3.6 is required to run build tools (and eventually cross-compile python3.6)" + RET=1 +fi + +if ! which genext2fs >/dev/null; then + echo "genext2fs is needed to build ramdisk images" + RET=1 +else + if [ -z "$(genext2fs --help 2>&1 | grep -- "block-size")" ]; then + echo "genext2fs must support the -B (--block-size) argument; try building with Debian patches" + RET=1 + fi +fi + +if ! which mcopy >/dev/null; then + echo "mtools is required to build FAT images for EFI / hybrid ISOs" + RET=1 +fi + +if ! which xorriso >/dev/null; then + echo "xorriso is required to build ISO CD images" + RET=1 +fi + +if ! which yasm >/dev/null; then + echo "yasm is required to build some assembly sources" + RET=1 +fi + +if ! which autoconf >/dev/null; then + echo "autoconf is required to build GCC cross-compiler" + RET=1 +fi + +if ! which automake >/dev/null; then + echo "automake is required to build GCC cross-compiler" + RET=1 +fi + +if ! which wget >/dev/null; then + echo "wget is required to build GCC cross-compiler" + RET=1 +fi + +if [ ! -e /usr/lib32/crt0-efi-ia32.o ]; then + echo "gnu-efi is required to build EFI loaders" + RET=1 +fi + +if ! cpp <(echo "#include \"gmp.h\"") >/dev/null 2>/dev/null; then + echo "GMP headers are required to build GCC cross-compiler" + RET=1 +fi + +if ! cpp <(echo "#include \"mpfr.h\"") >/dev/null 2>/dev/null; then + echo "MPFR headers are required to build GCC cross-compiler" + RET=1 +fi + +if ! cpp <(echo "#include \"mpfr.h\"") >/dev/null 2>/dev/null; then + echo "MPFR headers are required to build GCC cross-compiler" + RET=1 +fi + +if ! cpp <(echo "#include \"mpc.h\"") >/dev/null 2>/dev/null; then + echo "MPC headers are required to build GCC cross-compiler" + RET=1 +fi + +echo "butts" +RET=1 + +exit $RET + diff --git a/util/prompt.sh b/util/prompt.sh index c80921f2..04143f21 100755 --- a/util/prompt.sh +++ b/util/prompt.sh @@ -2,6 +2,12 @@ DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +if ! $DIR/check-reqs.sh; then + echo "A toolchain is not available and the above issues were found." >&2 + echo "Resolve the problems above and run \`make\` again." >&2 + echo -n "n" && exit 1 +fi + echo -n "Toolchain has not been built. Would you like to build it now? (y/n) " >&2 read response case $response in