From 259822493f86998b2ba488e54257afe9e9184a86 Mon Sep 17 00:00:00 2001 From: Gunnar Beutner Date: Sun, 30 May 2021 10:48:47 +0200 Subject: [PATCH] Toolchain: Check whether required tools and libraries are available Rather than having the toolchain build fail half-way through we should check whether the user has installed all the required tools and libraries early on. --- Toolchain/BuildIt.sh | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/Toolchain/BuildIt.sh b/Toolchain/BuildIt.sh index 376bafca21..47eac0705d 100755 --- a/Toolchain/BuildIt.sh +++ b/Toolchain/BuildIt.sh @@ -91,6 +91,48 @@ buildstep() { "$@" 2>&1 | sed $'s|^|\x1b[34m['"${NAME}"$']\x1b[39m |' } +# === DEPENDENCIES === +buildstep dependencies echo "Checking whether 'make' is available..." +if ! command -v ${MAKE:-make} >/dev/null; then + buildstep dependencies echo "Please make sure to install GNU Make (for the '${MAKE:-make}' tool)." + exit 1 +fi + +buildstep dependencies echo "Checking whether 'patch' is available..." +if ! command -v patch >/dev/null; then + buildstep dependencies echo "Please make sure to install GNU patch (for the 'patch' tool)." + exit 1 +fi + +buildstep dependencies echo "Checking whether 'makeinfo' is available..." +if ! command -v makeinfo >/dev/null; then + buildstep dependencies echo "Please make sure to install GNU Texinfo (for the 'makeinfo' tool)." + exit 1 +fi + +buildstep dependencies echo "Checking whether your C compiler works..." +if ! ${CC:-cc} -o /dev/null -xc - >/dev/null <<'PROGRAM' +int main() {} +PROGRAM +then + buildstep dependencies echo "Please make sure to install a working C compiler." + exit 1 +fi + +if [ "$SYSTEM_NAME" != "Darwin" ]; then + for lib in gmp mpc mpfr; do + buildstep dependencies echo "Checking whether the $lib library and headers are available..." + if ! ${CC:-cc} -I /usr/local/include -L /usr/local/lib -l$lib -o /dev/null -xc - >/dev/null < +int main() {} +PROGRAM + then + echo "Please make sure to install the $lib library and headers." + exit 1 + fi + done +fi + # === CHECK CACHE AND REUSE === pushd "$DIR"