mirror of
https://github.com/TangentFoxy/LovePackaging.git
synced 2024-11-09 09:34:22 +00:00
123 lines
4.4 KiB
Bash
123 lines
4.4 KiB
Bash
#!/bin/bash
|
|
|
|
# keep unset variables from breaking everything
|
|
set -o nounset
|
|
# exit on error instead of continuing
|
|
set -o errexit
|
|
|
|
# get config
|
|
#if $1 ; then
|
|
# has a command-line option
|
|
#fi
|
|
source ./config.sh
|
|
|
|
# remove old versions of package?
|
|
if [ $removeOld = true ]; then
|
|
rm -f "$outputDir/$packageName*"
|
|
fi
|
|
|
|
# move to source dir
|
|
originalDir=$(pwd)
|
|
cd "$sourceDir"
|
|
|
|
# build .love file
|
|
echo "Building $packageName (version $version)... (.love file)"
|
|
zip -r -X -q "$outputDir/$packageName-$version.love" ./*
|
|
echo " Done."
|
|
|
|
# check if executables exist, if not, download them
|
|
# assumes if the exe exists, everything else does too
|
|
if [ ! -r "$win32Dir/love-0.9.1-win32/love.exe" ]; then
|
|
mkdir -p "$win32Dir"
|
|
echo "Downloading win32src..."
|
|
$download "$win32Dir/love32.zip" https://bitbucket.org/rude/love/downloads/love-0.9.1-win32.zip
|
|
echo " Done."
|
|
echo "Extracting win32src..."
|
|
unzip -q "$win32Dir/love32.zip" -d "$win32Dir"
|
|
echo " Done."
|
|
fi
|
|
|
|
if [ ! -r "$win64Dir/love-0.9.1-win64/love.exe" ]; then
|
|
mkdir -p "$win64Dir"
|
|
echo "Downloading win64src..."
|
|
$download "$win64Dir/love64.zip" https://bitbucket.org/rude/love/downloads/love-0.9.1-win64.zip
|
|
echo " Done."
|
|
echo "Extracting win64src..."
|
|
unzip -q "$win64Dir/love64.zip" -d "$win64Dir"
|
|
echo " Done."
|
|
fi
|
|
|
|
if [ ! -d "$osx10Dir/love.app" ]; then
|
|
mkdir -p "$osx10Dir"
|
|
echo "Downloading osx10src..."
|
|
$download "$osx10Dir/loveOSX.zip" https://bitbucket.org/rude/love/downloads/love-0.9.1-macosx-x64.zip
|
|
echo " Done."
|
|
echo "Extracting osx10src..."
|
|
unzip -q "$osx10Dir/loveOSX.zip" -d "$osx10Dir"
|
|
# delete Mac crao (for some reason can't not unzip it *shrugs*)
|
|
rm -rf "$osx10Dir/__MACOSX"
|
|
# the Info.plist is overwritten each time the app is built, so it is not fixed here.
|
|
echo " Done."
|
|
fi
|
|
|
|
# build executables and zip files for them
|
|
|
|
echo "Building $packageName (version $version)... (win32 zip)"
|
|
cat "$win32Dir/love-0.9.1-win32/love.exe" "$outputDir/$packageName-$version.love" > "$win32Dir/$packageName.exe"
|
|
cd "$win32Dir"
|
|
zip -r -X -q "$outputDir/$packageName-${version}_win32.zip" "./$packageName.exe"
|
|
cd ./love-0.9.1-win32
|
|
zip -r -X -q "$outputDir/$packageName-${version}_win32.zip" ./*.dll
|
|
cp ./license.txt ./LOVE-license.txt
|
|
zip -r -X -q "$outputDir/$packageName-${version}_win32.zip" ./LOVE-license.txt
|
|
cd "$includes"
|
|
zip -r -X -q "$outputDir/$packageName-${version}_win32.zip" ./*
|
|
echo " Done."
|
|
|
|
echo "Building $packageName (version $version)... (win64 zip)"
|
|
cat "$win64Dir/love-0.9.1-win64/love.exe" "$outputDir/$packageName-$version.love" > "$win64Dir/$packageName.exe"
|
|
cd "$win64Dir"
|
|
zip -r -X -q "$outputDir/$packageName-${version}_win64.zip" "./$packageName.exe"
|
|
cd ./love-0.9.1-win64
|
|
zip -r -X -q "$outputDir/$packageName-${version}_win64.zip" ./*.dll
|
|
cp ./license.txt ./LOVE-license.txt
|
|
zip -r -X -q "$outputDir/$packageName-${version}_win64.zip" ./LOVE-license.txt
|
|
cd "$includes"
|
|
zip -r -X -q "$outputDir/$packageName-${version}_win64.zip" ./*
|
|
echo " Done."
|
|
|
|
if [ $macInfoPlistFixed = true ]; then
|
|
echo "Building $packageName (version $version)... (OS X zip)"
|
|
# WHY IS THIS CHECK NEEDED? IT IS REDUNDANT
|
|
if [ -f "$osx10Dir" ]; then
|
|
rm -f "$osx10Dir/love.app/Contents/Resources/$packageName.love"
|
|
fi
|
|
cp "$outputDir/$packageName-$version.love" "$osx10Dir/love.app/Contents/Resources/$packageName.love"
|
|
cp "$originalDir/Info.plist" "$osx10Dir/love.app/Contents/Info.plist"
|
|
cd "$osx10Dir"
|
|
# the copy is so multiple things can be built in the same place without interfering
|
|
#make this copy happen at the beginning of mac crap, so the mac stuff is completely separate for each project
|
|
#make the Info.plist location configurable! (for multiple configs to be possible, this must be done)
|
|
cp ./love.app "./$packageName.app"
|
|
zip -r -X -q "$outputDir/$packageName-${version}_osx.zip" "./$packageName.app"
|
|
cd "$includes"
|
|
zip -r -X -q "$outputDir/$packageName-${version}_osx.zip" ./*
|
|
echo " Done."
|
|
else
|
|
echo "WARN: Mac packaging disabled."
|
|
echo " See README.md for information."
|
|
fi
|
|
|
|
echo "Building $packageName (version $version)... (Linux zip)"
|
|
cd "$outputDir"
|
|
zip -r -X -q "./$packageName-${version}_linux.zip" "./$packageName-$version.love"
|
|
cp "$win64Dir/love-0.9.1-win64/LOVE-license.txt" ./LOVE-license.txt
|
|
zip -r -X -q "./$packageName-${version}_linux.zip" ./LOVE-license.txt
|
|
cd "$includes"
|
|
zip -r -X -q "$outputDir/$packageName-${version}_linux.zip" ./*
|
|
echo " Done."
|
|
|
|
echo "Builds complete. Unless there are errors above. Double check your files."
|
|
echo
|
|
if which fortune > /dev/null 2>&1; then fortune; fi
|