Added build script

main
Victor Hans-Georg Waitz 2024-10-04 17:17:46 +02:00
commit 281863a9be
1 changed files with 36 additions and 0 deletions

36
build.sh 100644
View File

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