Add run_release script (#152)

* Add run_release script

* Update README to use the run_release scripts
This commit is contained in:
Samuel Meenzen 2023-10-24 15:43:17 +02:00 committed by GitHub
parent d2a6fc3c42
commit 8aaa9f585c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 20 additions and 10 deletions

1
.zig-version Normal file
View File

@ -0,0 +1 @@
0.12.0-dev.983+78f2ae7f2

View File

@ -31,8 +31,7 @@ Otherwise you can
### Compile Cubyz from source
1. Install git
2. Clone this repository `git clone https://github.com/pixelguys/Cubyz`
3. Run `run.sh` (Linux) or `run.bat` (Windows)
4. If the game is too slow, run it in release: `run.sh -Doptimize=ReleaseFast` (Linux) or `run.bar -Doptimize=ReleaseFast` (Windows)
3. Run `run_release.sh` (Linux) or `run_release.bat` (Windows)
#### Note for Linux Users:
I also had to install a few `-dev` packages for the compilation to work:
```

View File

@ -1,6 +1,7 @@
@echo off
set version=zig-windows-x86_64-0.12.0-dev.983+78f2ae7f2
set /p baseVersion=<".zig-version"
set version=zig-windows-x86_64-%baseVersion%
if not exist compiler mkdir compiler
if not exist compiler\version.txt copy NUL compiler\version.txt >NUL

17
run.sh
View File

@ -1,21 +1,24 @@
#!/bin/bash
version=zig-linux-x86_64-0.12.0-dev.983+78f2ae7f2
BASE_VERSION=$(< .zig-version)
VERSION=zig-linux-x86_64-$BASE_VERSION
mkdir -p compiler/zig
touch compiler/version.txt
if [[ $(< compiler/version.txt) != "$version" ]]; then
CURRENT_VERSION=$(< compiler/version.txt)
if [[ "$CURRENT_VERSION" != "$VERSION" ]]; then
echo "Deleting old zig installation..."
rm -r compiler/zig
mkdir compiler/zig
echo "Downloading $version..."
wget -O compiler/archive.tar.xz https://ziglang.org/builds/$version.tar.xz
echo "Downloading $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/archive.tar.xz
rm compiler/version.txt
printf "$version" >> compiler/version.txt
echo "$VERSION" > compiler/version.txt
fi
./compiler/zig/zig build run $@
./compiler/zig/zig build run "$@"

3
run_release.bat Normal file
View File

@ -0,0 +1,3 @@
@echo off
.\run.bat -Doptimize=ReleaseFast %*

3
run_release.sh Executable file
View File

@ -0,0 +1,3 @@
#!/bin/bash
./run.sh -Doptimize=ReleaseFast "$@"