Add a run.sh file that automatically downloads or updates zig and runs the game.

This is a step towards #103
This commit is contained in:
IntegratedQuantum 2023-09-26 22:06:35 +02:00
parent 6c896e2e93
commit 54337f17fd
3 changed files with 23 additions and 1 deletions

3
.gitignore vendored
View File

@ -1,3 +1,4 @@
compiler/
logs/
saves/
zig-out/
@ -6,4 +7,4 @@ serverAssets/
settings.json
gui_layout.json
test.png
test.png

View File

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

20
run.sh Executable file
View File

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