]> git.lizzy.rs Git - dragonblocks_alpha.git/blobdiff - snapshot.sh
Properly deinitialize player inventories
[dragonblocks_alpha.git] / snapshot.sh
index 05e9bd74d3a1b992151be3d4d025b9b6420ce3f1..290617fbb22409ca9ff3968757d47f1a8770bd93 100755 (executable)
@@ -1,48 +1,49 @@
 #!/bin/bash
 set -e
 
-VERSION=`git tag --points-at HEAD`
-if [[ $VERSION = "" ]]; then
-       VERSION=`git rev-parse --short HEAD`
-fi
+version="$(git describe --tags)"
+
+mkdir -p "snapshot"
+cd "snapshot"
+
+build="build"
+snapshot="dragonblocks_alpha-$version"
+toolchain=""
+dotexe=""
+dotsh=".sh"
+flags="-O2"
 
-BUILD=build-release
-SNAPSHOT=dragonblocks_alpha-$VERSION
-TOOLCHAIN=
-DOTEXE=
-DOTSH=".sh"
-FLAGS="-Ofast"
 if [[ "$1" != "" ]]; then
-       BUILD=build-$1
-       SNAPSHOT=dragonblocks_alpha-$1-$VERSION
-       TOOLCHAIN=$1.cmake
-       DOTEXE=".exe"
-       DOTSH=".bat"
-       FLAGS="$FLAGS -static"
+       build="$build-$1"
+       snapshot="$snapshot-$1"
+       toolchain="$1.cmake"
+       dotexe=".exe"
+       dotsh=".bat"
+       flags="$flags -static"
 fi
 
-mkdir -p $BUILD
+mkdir -p "$build"
 
-cmake -B $BUILD -S src \
+cmake -B "$build" -S ../src \
        -DCMAKE_BUILD_TYPE="Release" \
        -DASSET_PATH="assets/" \
-       -DCMAKE_C_FLAGS="$FLAGS" \
-       -DCMAKE_CXX_FLAGS="$FLAGS" \
-       -DCMAKE_TOOLCHAIN_FILE="$TOOLCHAIN"
+       -DCMAKE_C_FLAGS="$flags" \
+       -DCMAKE_CXX_FLAGS="$flags" \
+       -DCMAKE_TOOLCHAIN_FILE="$toolchain"
 
-make --no-print-directory -C $BUILD -j$(nproc)
+make --no-print-directory -C "$build" -j"$(nproc)"
 
-rm -rf $SNAPSHOT
-mkdir $SNAPSHOT
+rm -rf "$snapshot"
+mkdir "$snapshot"
 
 cp -r \
-       assets \
-       $BUILD/dragonblocks_client$DOTEXE \
-       $BUILD/dragonblocks_server$DOTEXE \
-       singleplayer$DOTSH \
-       LICENSE \
-       README.md \
-       $SNAPSHOT
-
-rm -f $SNAPSHOT.zip
-zip -r $SNAPSHOT.zip $SNAPSHOT/*
+       "../assets" \
+       "$build/dragonblocks_client$dotexe" \
+       "$build/dragonblocks_server$dotexe" \
+       "../singleplayer$dotsh" \
+       "../LICENSE" \
+       "../README.md" \
+       "$snapshot"
+
+rm -f "$snapshot.zip"
+zip -r "$snapshot.zip" "$snapshot"/*