mirror of
https://github.com/PixelGuys/Cubyz.git
synced 2025-08-03 03:06:55 -04:00
* Rename run_release scripts to run_OS (#241) * Update README with new script names (#241) * Fix run_windows infinite loop * Make debug_linux more verbose. * Make windows script errors match linux * Automatically set working directory (#252) * Remote quotes from echo commands in run_windows * Replace zig run with zig build run * Replace spaces with tabs in run scripts. * Make 'Building Cubyz' message more accurate * Have run scripts check the machine architecture. * Add failsafe for unrecognized architecture; erase scratch work in debug_windows * Replace more spaces with tabs in debug_linux * Linux run script: don't pause if debug build or NO_PAUSE * Windows run script: do not pause in debug builds or if NO_PAUSE * Escape a paren * Fix x64 typo * Delete logs about failing to build * Use `call` to call the batch script on windows Without `call` windows won't execute the lines after calling the batch script. --------- Co-authored-by: IntegratedQuantum <43880493+IntegratedQuantum@users.noreply.github.com>
This commit is contained in:
parent
6ce09c52cd
commit
fd332139d7
@ -28,7 +28,7 @@ However, both of them lost interest at some point, and now Cubyz is maintained b
|
||||
## The Easy Way (no tools needed)
|
||||
1. Download the latest [source code](https://codeload.github.com/PixelGuys/Cubyz/zip/refs/heads/master)
|
||||
2. Extract the zip file
|
||||
3. Go into the extraced folder and double click the `run_release.sh` (Linux) or `run_release.bat` (Windows)
|
||||
3. Go into the extraced folder and double click the `run_linux.sh` or `run_windows.bat` depending on your operating system.
|
||||
4. Congratulations: You just compiled your first program!
|
||||
|
||||
### It doesn't work?
|
||||
@ -45,7 +45,7 @@ sudo apt install libgl-dev libasound2-dev libx11-dev libxcursor-dev libxrandr-de
|
||||
## The Better Way
|
||||
1. Install Git
|
||||
2. Clone this repository `git clone https://github.com/pixelguys/Cubyz`
|
||||
3. Run `run_release.sh` (Linux) or `run_release.bat` (Windows), if you already have Zig installed on your computer (it must be a compatible version) you can also just use `zig build run`
|
||||
3. Run `run_linux.sh` or `run_windows.bat`, if you already have Zig installed on your computer (it must be a compatible version) you can also just use `zig build run`
|
||||
4. When you want to update your local version you can use `git pull`. This keeps everything in one place, avoiding repeatedly downloading the compiler on every update.
|
||||
|
||||
# Contributing
|
||||
|
78
debug_linux.sh
Executable file
78
debug_linux.sh
Executable file
@ -0,0 +1,78 @@
|
||||
#!/bin/bash
|
||||
|
||||
cd "$(dirname "$0")"
|
||||
|
||||
fail () {
|
||||
exit 1
|
||||
}
|
||||
|
||||
echo "Detecting Zig compiler..."
|
||||
|
||||
BASE_VERSION=$(< .zig-version)
|
||||
|
||||
case "$(uname -s)" in
|
||||
"Darwin")
|
||||
OS=macos;;
|
||||
*)
|
||||
OS=linux;;
|
||||
esac
|
||||
|
||||
if [ -n $ARCH ]
|
||||
then
|
||||
case "$(uname -m)" in
|
||||
"arm64" | "aarch64")
|
||||
ARCH=aarch64;;
|
||||
"arm*")
|
||||
ARCH=armv7a;;
|
||||
"amd64" | "x86_64")
|
||||
ARCH=x86_64;;
|
||||
"x86*")
|
||||
ARCH=x86;;
|
||||
*)
|
||||
echo "Machine architecture could not be recognized ($(uname -m)). Report this bug with the result of \`uname -m\` and your preferred Zig release name."
|
||||
echo "Defaulting architecture to x86_64."
|
||||
ARCH=x86_64;;
|
||||
esac
|
||||
fi
|
||||
|
||||
VERSION=zig-$OS-$ARCH-$BASE_VERSION
|
||||
|
||||
mkdir -p compiler/zig
|
||||
touch compiler/version.txt
|
||||
|
||||
CURRENT_VERSION=$(< compiler/version.txt)
|
||||
|
||||
if [[ "$CURRENT_VERSION" != "$VERSION" ]]; then
|
||||
echo "Your Zig is the wrong version."
|
||||
echo "Deleting current 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
|
||||
if [ $? != 0 ]
|
||||
then
|
||||
echo "Failed to download the Zig compiler."
|
||||
fail
|
||||
fi
|
||||
echo "Extracting tar file..."
|
||||
tar --xz -xf compiler/archive.tar.xz --directory compiler/zig --strip-components 1
|
||||
rm compiler/archive.tar.xz
|
||||
echo "$VERSION" > compiler/version.txt
|
||||
echo "Done updating Zig."
|
||||
else
|
||||
echo "Zig compiler is valid."
|
||||
fi
|
||||
|
||||
echo "Building Zig Cubyz ($@) from source. This may take a few minutes..."
|
||||
|
||||
./compiler/zig/zig build "$@"
|
||||
|
||||
if [ $? != 0 ]
|
||||
then
|
||||
fail
|
||||
fi
|
||||
|
||||
echo "Cubyz successfully built!"
|
||||
echo "Launching Cubyz."
|
||||
|
||||
./compiler/zig/zig build run "$@"
|
58
debug_windows.bat
Normal file
58
debug_windows.bat
Normal file
@ -0,0 +1,58 @@
|
||||
@echo off
|
||||
|
||||
cd /D "%~dp0"
|
||||
|
||||
echo Detecting Zig compiler...
|
||||
|
||||
set /p baseVersion=<".zig-version"
|
||||
|
||||
IF "%PROCESSOR_ARCHITECTURE%"=="AMD64" (set arch=x86_64)
|
||||
IF "%PROCESSOR_ARCHITECTURE%"=="IA64" (set arch=x86_64)
|
||||
IF "%PROCESSOR_ARCHITECTURE%"=="x86" (set arch=x86)
|
||||
IF "%PROCESSOR_ARCHITECTURE%"=="ARM64" (set arch=aarch64)
|
||||
IF "%arch%"=="" (
|
||||
echo Machine architecture could not be recognized: %arch%. Please file a bug report.
|
||||
echo Defaulting architecture to x86_64.
|
||||
set arch=x86_64
|
||||
)
|
||||
|
||||
set version=zig-windows-%arch%-%baseVersion%
|
||||
|
||||
if not exist compiler mkdir compiler
|
||||
if not exist compiler\version.txt copy NUL compiler\version.txt >NUL
|
||||
|
||||
set currVersion=
|
||||
set /p currVersion=<"compiler\version.txt"
|
||||
|
||||
if not "%version%" == "%currVersion%" (
|
||||
echo Your Zig is the wrong version.
|
||||
echo Deleting current Zig installation ...
|
||||
if exist compiler\zig rmdir /s /q compiler\zig
|
||||
echo Downloading %version% ...
|
||||
powershell -Command $ProgressPreference = 'SilentlyContinue'; "Invoke-WebRequest -uri https://ziglang.org/builds/%version%.zip -OutFile compiler\archive.zip"
|
||||
if errorlevel 1 (
|
||||
echo Failed to download the Zig compiler.
|
||||
exit /b 1
|
||||
)
|
||||
echo Extracting zip file ...
|
||||
powershell $ProgressPreference = 'SilentlyContinue'; Expand-Archive compiler\archive.zip -DestinationPath compiler
|
||||
ren compiler\%version% zig
|
||||
del compiler\archive.zip
|
||||
echo %version%> compiler\version.txt
|
||||
echo Done updating Zig.
|
||||
) ELSE (
|
||||
echo Zig compiler is valid.
|
||||
)
|
||||
|
||||
echo Building Zig Cubyz (%*^) from source. This may take a few minutes...
|
||||
|
||||
compiler\zig\zig build %*
|
||||
|
||||
if errorlevel 1 (
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
echo Cubyz successfully built!
|
||||
echo Launching Cubyz.
|
||||
|
||||
compiler\zig\zig build run %*
|
25
run.bat
25
run.bat
@ -1,25 +0,0 @@
|
||||
@echo off
|
||||
|
||||
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
|
||||
|
||||
set currVersion=
|
||||
set /p currVersion=<"compiler\version.txt"
|
||||
|
||||
if not "%version%" == "%currVersion%" (
|
||||
echo Deleting old zig installation ...
|
||||
if exist compiler\zig rmdir /s /q compiler\zig
|
||||
echo Downloading zig version %version% ...
|
||||
powershell -Command $ProgressPreference = 'SilentlyContinue'; "Invoke-WebRequest -uri https://ziglang.org/builds/%version%.zip -OutFile compiler\archive.zip"
|
||||
echo Extracting zip file ...
|
||||
powershell $ProgressPreference = 'SilentlyContinue'; Expand-Archive compiler\archive.zip -DestinationPath compiler
|
||||
ren compiler\%version% zig
|
||||
echo Done downloading zig.
|
||||
del compiler\archive.zip
|
||||
echo %version%> compiler\version.txt
|
||||
)
|
||||
|
||||
compiler\zig\zig build run %*
|
24
run.sh
24
run.sh
@ -1,24 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
BASE_VERSION=$(< .zig-version)
|
||||
VERSION=zig-linux-x86_64-$BASE_VERSION
|
||||
|
||||
mkdir -p compiler/zig
|
||||
touch compiler/version.txt
|
||||
|
||||
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 "Extracting tar file..."
|
||||
tar --xz -xf compiler/archive.tar.xz --directory compiler/zig --strip-components 1
|
||||
echo "Done downloading zig."
|
||||
rm compiler/archive.tar.xz
|
||||
echo "$VERSION" > compiler/version.txt
|
||||
fi
|
||||
|
||||
./compiler/zig/zig build run "$@"
|
10
run_linux.sh
Executable file
10
run_linux.sh
Executable file
@ -0,0 +1,10 @@
|
||||
#!/bin/bash
|
||||
|
||||
cd "$(dirname "$0")"
|
||||
|
||||
./debug_linux.sh -Doptimize=ReleaseFast "$@"
|
||||
|
||||
if [ ! $NO_PAUSE ]; then
|
||||
echo "Press enter key to continue. (Or export NO_PAUSE=1 to skip this prompt.)"
|
||||
read
|
||||
fi
|
@ -1,3 +0,0 @@
|
||||
@echo off
|
||||
|
||||
.\run.bat -Doptimize=ReleaseFast %*
|
@ -1,3 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
./run.sh -Doptimize=ReleaseFast "$@"
|
10
run_windows.bat
Normal file
10
run_windows.bat
Normal file
@ -0,0 +1,10 @@
|
||||
@echo off
|
||||
|
||||
cd /D "%~dp0"
|
||||
|
||||
call debug_windows.bat -Doptimize=ReleaseFast %*
|
||||
|
||||
IF "%NO_PAUSE%" == "" (
|
||||
echo Press enter key to continue. (Or set NO_PAUSE=1 to skip this prompt.^)
|
||||
pause
|
||||
)
|
Loading…
x
Reference in New Issue
Block a user