From 54337f17fd0de57808ddb5ca4e95c05575f35b3c Mon Sep 17 00:00:00 2001 From: IntegratedQuantum Date: Tue, 26 Sep 2023 22:06:35 +0200 Subject: [PATCH] Add a `run.sh` file that automatically downloads or updates zig and runs the game. This is a step towards #103 --- .gitignore | 3 ++- README.md | 1 + run.sh | 20 ++++++++++++++++++++ 3 files changed, 23 insertions(+), 1 deletion(-) create mode 100755 run.sh diff --git a/.gitignore b/.gitignore index 93314186..058bd2f2 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +compiler/ logs/ saves/ zig-out/ @@ -6,4 +7,4 @@ serverAssets/ settings.json gui_layout.json -test.png \ No newline at end of file +test.png diff --git a/README.md b/README.md index 84d2d15d..4f143523 100644 --- a/README.md +++ b/README.md @@ -39,6 +39,7 @@ I also had to install a few `-dev` packages for the compilation to work: ``` sudo apt install libgl-dev libasound2-dev libx11-dev libxcursor-dev libxrandr-dev libxinerama-dev libxext-dev libxi-dev ``` +For Linux there is also a handy `run.sh` file that automatically downloads the correct zig version # Contributing ### Code diff --git a/run.sh b/run.sh new file mode 100755 index 00000000..1e0ff631 --- /dev/null +++ b/run.sh @@ -0,0 +1,20 @@ +#!/bin/bash + +version=zig-linux-x86_64-0.12.0-dev.596+2adb932ad + +mkdir -p compiler/zig +touch compiler/version.txt +if [[ $(< compiler/version.txt) != "$version" ]]; then + echo "Deleting old zig installation..." + rm -r compiler/zig + mkdir compiler/zig + echo "Downloading zig version $version..." + wget -O compiler/archive.tar.xz https://ziglang.org/builds/$version.tar.xz + echo "Extracting tar file..." + tar --xz -xf compiler/archive.tar.xz --directory compiler/zig --strip-components 1 + echo "Done." + rm compiler/version.txt + printf "$version" >> compiler/version.txt +fi + +./compiler/zig/zig build run $@ \ No newline at end of file