#!/usr/bin/env bash # Slightly based on love-exporter at https://github.com/dmoa/love-export/blob/master/main.sh VISION_COMMIT=`git ls-remote https://git.biggetje.net/martijn/vision.git | grep "refs/heads/main" | cut -f 1 | head -c 8` LOVE_VERSION=11.4 LOVE_WIN64=https://github.com/love2d/love/releases/download/$LOVE_VERSION/love-$LOVE_VERSION-win64.zip LOVE_MACOS=https://github.com/love2d/love/releases/download/$LOVE_VERSION/love-$LOVE_VERSION-macos.zip build() { echo "Building release" cp -Rf {assets,bullet,captain,planet,scene,shaders,ship,vendor} build/game/ cp -f *.lua build/game/ find build/game -maxdepth 5 -type f -name '*.psd' -delete } downloadlove() { echo "Downloading binaries" cd build curl -L -O $LOVE_WIN64 unzip love-$LOVE_VERSION-win64.zip mv ./*win64 win rm love-$LOVE_VERSION-win64.zip cd win rm love.ico game.ico lovec.exe readme.txt changes.txt cd .. mkdir mac cd mac curl -L -O $LOVE_MACOS unzip love-$LOVE_VERSION-macos.zip rm love-$LOVE_VERSION-macos.zip cd .. # todo appimage cd .. } makelove() { cd build/game echo "Generating love file" zip -9 -r ../../release/vision-$VISION_COMMIT.love . cd ../.. } makewin64() { echo "Generating Win64 build" cat "build/win/love.exe" "release/vision-$VISION_COMMIT.love" > "build/win/vision.exe" rm "build/win/love.exe" cd build/win zip -9 -r ../../release/vision-$VISION_COMMIT-win64.zip . cd ../.. } makemac() { echo "Generating MacOS build" cp "release/vision-$VISION_COMMIT.love" "build/mac/love.app/Contents/Resources" mv "build/mac/love.app" "build/mac/vision.app" cd build/mac cp -f "../../tools/macos-info.plist" "vision.app/Contents/Info.plist" zip -9 -r ../../release/vision-$VISION_COMMIT-macos.zip . cd ../.. } echo "Building the game on LÖVE $LOVE_VERSION!" rm -Rf build/* release/* mkdir -p build/game mkdir -p release build downloadlove makelove makewin64 makemac