From 281863a9bed45b9a5df034f7b5cdeff36ee6377c Mon Sep 17 00:00:00 2001 From: Victor Hans-Georg Waitz <3013050@stud.hs-mannheim.de> Date: Fri, 4 Oct 2024 17:17:46 +0200 Subject: [PATCH] Added build script --- build.sh | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 build.sh diff --git a/build.sh b/build.sh new file mode 100644 index 0000000..e1a056b --- /dev/null +++ b/build.sh @@ -0,0 +1,36 @@ +#!/bin/bash + + +input_string="$1" + +if [ -z "$input_string" ]; then + echo "Error: No zig script name provided. Exiting." + exit 1 +fi + +INPUT_NAME=$input_string + +FOLDER_NAME="output" + +SCRIPT_DIR="$(dirname "$0")" + +FOLDER_PATH="$SCRIPT_DIR/$FOLDER_NAME" + + +if [ ! -d "$FOLDER_PATH" ]; then + mkdir "$FOLDER_PATH" +fi + +cd output + +zig build-exe "../$INPUT_NAME" + +executable_name="${INPUT_NAME%.zig}" + +if [ -f "$executable_name" ]; then + + ./"$executable_name" +else + echo "Error: Executable '$executable_name' not found. Build might have failed. Exiting." + exit 1 +fi