From 7ed0cec1b03a454ae4ea9f583f2f9a89b3553e1d Mon Sep 17 00:00:00 2001 From: jahway603 Date: Thu, 8 Dec 2022 23:52:56 -0500 Subject: [PATCH] build script to check build dependencies --- Makefile | 2 +- util/build.sh | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 51 insertions(+), 1 deletion(-) create mode 100755 util/build.sh diff --git a/Makefile b/Makefile index f790ab1..081cfd3 100644 --- a/Makefile +++ b/Makefile @@ -14,7 +14,7 @@ about: ## Display release info printf "Hush Silentdragonlite-cli Makefile by jahway603\n" build: ## Build the release - cargo build --release + ./util/build.sh cp `pwd`/target/release/$(PROJECT_NAME) . printf "Hush silentdragonlite-cli is ready for you\n" diff --git a/util/build.sh b/util/build.sh new file mode 100755 index 0000000..9f1290f --- /dev/null +++ b/util/build.sh @@ -0,0 +1,50 @@ +#!/usr/bin/env bash +# Copyright 2021-2022 The Hush Developers +# Distributed under the GPLv3 software license, see the accompanying +# file LICENSE or https://www.gnu.org/licenses/gpl-3.0.en.html + +# Purpose: Script to build Hush silentdragonlite on x86 64-bit arch +## Usage: ./util/build.sh + +# Check if rustc is installed on system and exits if it is not +if ! [ -x "$(command -v rustc)" ]; then + echo 'Error: rustc is not installed. Install it and try again.' >&2 + exit 1 +fi +# Check if cargo is installed on system and exits if it is not +if ! [ -x "$(command -v cargo)" ]; then + echo 'Error: cargo is not installed. Install it and try again.' >&2 + exit 1 +fi +# Check if rustfmt is installed on system and exits if it is not +if ! [ -x "$(command -v rustfmt)" ]; then + echo 'Error: rustfmt is not installed. Install it and try again.' >&2 + exit 1 +fi + +echo "" +echo "Welcome to the Hush magic folks..." +echo "" +echo " #### ##### # #### # # ##### # # # # ##### ##### # # # ###### " +echo "# # # # # # # # # # # # # # # # # # ## ## # " +echo " #### # # # ##### # # # ##### # # # # # # # # # ## # ##### " +echo " # # # # # # # # # # # # # # # # # # # # " +echo "# # # # # # # # # # # # # # # # # # # # # # " +echo " #### ##### ###### #### ###### # ##### #### # ###### ##### # # # # ###### " + +# now to compiling... +echo "" +echo "You have the requirements installed, so let's build!" + +cargo build --release + +# check if compile was success +if [ $? -ne 0 ]; then + echo "" + echo 'Error: Something went wrong and it did not build successfully... Please reach out if you need support.' >&2 + exit 1 +fi + +echo "" +echo "Hush silentdragonlite-cli is now compiled for you. Enjoy and reach out if you need support." +echo "For options, run ./silentdragonlite --help"