From 8b92d24ab96cd4aba8e4763a9f22367b03299dc6 Mon Sep 17 00:00:00 2001 From: BodgeMaster <> Date: Sun, 11 Sep 2022 10:11:17 +0200 Subject: [PATCH] setupenv: Add dependency check --- setupenv.bashrc | 68 ++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 67 insertions(+), 1 deletion(-) diff --git a/setupenv.bashrc b/setupenv.bashrc index c8a3117..8006b04 100644 --- a/setupenv.bashrc +++ b/setupenv.bashrc @@ -51,4 +51,70 @@ if [ -f "$PROJECT_BASE_DIR/.localenv.bashrc" ]; then echo "Loaded local environment customizations." fi -echo ">>> Done." +echo ">>> Checking for dependencies..." +MISSING_DEPS=0 + +if command -v wget > /dev/null 2>&1; then + true +else + if command -v curl > /dev/null 2>&1; then + true + else + echo "WARNING: `wget` or `curl` is needed to download some additional dependencies." + MISSING_DEPS=1 + fi +fi + +if command -v sha256sum > /dev/null 2>&1; then + true +else + if command -v sha256 > /dev/null 2>&1; then + true + else + echo "WARNING: Coreutils `sha256sum` or a `sha256` as found on NetBSD is needed to verify downloaded files." + MISSING_DEPS=1 + fi +fi + +if command -v gzip > /dev/null 2>&1; then + true +else + echo "WARNING: `gzip` is needed to decompress downloaded dependencies." + MISSING_DEPS=1 +fi + +if command -v tar > /dev/null 2>&1; then + true +else + echo "WARNING: `tar` is needed to unpack downloaded dependencies." + MISSING_DEPS=1 +fi + +if command -v cmake > /dev/null 2>&1; then + true +else + echo "WARNING: `cmake` is needed to build downloaded dependencies." + MISSING_DEPS=1 +fi + +if [ -z "$CXX" ]; then + if command -v c++ > /dev/null 2>&1; then + true + else + echo "WARNING: Your system does not appear to have a standard C++ compiler. If you have a C++ compiler installed, but not linked to `c++` on your PATH, set it manually using `CXX=/path/to/your/compiler`." + MISSING_DEPS=1 + fi +fi + +if command -v xxd > /dev/null 2>&1; then + true +else + echo "WARNING: `xxd` is needed for some tool scripts." + MISSING_DEPS=1 +fi + +if [ "$MISSING_DEPS" -eq 0 ]; then + echo "All set." +fi + +unset MISSING_DEPS