Check for dependencies before building toolchain

This commit is contained in:
K. Lange 2018-07-19 09:29:16 +09:00
parent f292de0ab6
commit 9b3d7915e6
3 changed files with 87 additions and 0 deletions

View File

@ -1,6 +1,8 @@
#!/bin/bash #!/bin/bash
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
$DIR/check-reqs.sh
TARGET=i686-pc-toaru TARGET=i686-pc-toaru
PREFIX="$DIR/local" PREFIX="$DIR/local"
TOARU_SYSROOT="$DIR/../base" TOARU_SYSROOT="$DIR/../base"

79
util/check-reqs.sh Executable file
View File

@ -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

View File

@ -2,6 +2,12 @@
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" 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 echo -n "Toolchain has not been built. Would you like to build it now? (y/n) " >&2
read response read response
case $response in case $response in