vision/tools/build.sh

103 lines
2.6 KiB
Bash
Raw Normal View History

2022-10-29 15:22:41 +02:00
#!/usr/bin/env bash
# Slightly based on love-exporter at https://github.com/dmoa/love-export/blob/master/main.sh
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
2022-10-29 16:19:51 +02:00
LOVE_LINUX=https://github.com/love2d/love/releases/download/$LOVE_VERSION/love-$LOVE_VERSION-x86_64.AppImage
APPIMAGETOOL=https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage
2022-10-29 15:22:41 +02:00
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 ..
2022-10-29 16:19:51 +02:00
mkdir linux
cd linux
curl -L -O $LOVE_LINUX
curl -L -O $APPIMAGETOOL
2022-10-29 16:25:18 +02:00
chmod +x appimagetool-x86_64.AppImage
chmod +x love-$LOVE_VERSION-x86_64.AppImage
2022-10-29 16:19:51 +02:00
./appimagetool-x86_64.AppImage --appimage-extract
mv squashfs-root appimage
2022-10-29 16:25:18 +02:00
chmod +x appimage/AppRun
2022-10-29 16:19:51 +02:00
./love-$LOVE_VERSION-x86_64.AppImage --appimage-extract
2022-10-29 16:25:18 +02:00
chmod +x squashfs-root/AppRun
2022-10-29 16:19:51 +02:00
cd ..
2022-10-29 15:22:41 +02:00
cd ..
}
makelove() {
cd build/game
echo "Generating love file"
2022-10-29 16:19:51 +02:00
zip -9 -r ../../release/vision.love .
2022-10-29 15:22:41 +02:00
cd ../..
}
makewin64() {
echo "Generating Win64 build"
2022-10-29 16:19:51 +02:00
cat "build/win/love.exe" "release/vision.love" > "build/win/vision.exe"
2022-10-29 15:22:41 +02:00
rm "build/win/love.exe"
cd build/win
2022-10-29 16:19:51 +02:00
zip -9 -r ../../release/vision-win64.zip .
2022-10-29 15:22:41 +02:00
cd ../..
}
makemac() {
echo "Generating MacOS build"
2022-10-29 16:19:51 +02:00
cp "release/vision.love" "build/mac/love.app/Contents/Resources"
2022-10-29 15:22:41 +02:00
mv "build/mac/love.app" "build/mac/vision.app"
cd build/mac
cp -f "../../tools/macos-info.plist" "vision.app/Contents/Info.plist"
2022-10-29 16:19:51 +02:00
zip -9 -r ../../release/vision-macos.zip .
cd ../..
}
makelinux() {
cd "build/linux/"
cat "squashfs-root/bin/love" "../../release/vision.love" > "squashfs-root/bin/vision"
chmod +x "squashfs-root/bin/vision"
cp -f "../../tools/vision.desktop" "squashfs-root/vision.desktop"
rm "squashfs-root/love.desktop"
cd "squashfs-root"
tar zcvf ../../../release/vision-linux-appdir.tar.gz *
cd ..
./appimage/AppRun squashfs-root ../../release/vision-linux.AppImage
2022-10-29 15:22:41 +02:00
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
2022-10-29 16:19:51 +02:00
makelinux