2014-11-20 07:59:19 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
2014-11-20 20:07:17 +00:00
|
|
|
# keep unset variables from breaking everything
|
|
|
|
set -o nounset
|
|
|
|
# exit on error instead of continuing
|
|
|
|
set -o errexit
|
|
|
|
|
2014-11-20 07:59:19 +00:00
|
|
|
# get config
|
2014-11-20 20:21:14 +00:00
|
|
|
#if $1 ; then
|
|
|
|
# has a command-line option
|
|
|
|
#fi
|
|
|
|
source ./config.sh
|
2014-11-20 07:59:19 +00:00
|
|
|
|
|
|
|
# remove old versions of package?
|
|
|
|
if [ $removeOld = true ]; then
|
2014-11-20 20:21:14 +00:00
|
|
|
rm -f "$outputDir/$packageName*"
|
2014-11-20 07:59:19 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
# move to source dir
|
|
|
|
originalDir=$(pwd)
|
2014-11-20 20:21:14 +00:00
|
|
|
cd "$sourceDir"
|
2014-11-20 07:59:19 +00:00
|
|
|
|
|
|
|
# build .love file
|
|
|
|
echo "Building $packageName (version $version)... (.love file)"
|
2014-11-20 20:33:01 +00:00
|
|
|
zip -r -X -q "$outputDir/$packageName-$version.love" ./*
|
2014-11-20 20:48:33 +00:00
|
|
|
echo " Done."
|
2014-11-20 07:59:19 +00:00
|
|
|
|
2014-11-20 20:07:17 +00:00
|
|
|
# check if executables exist, if not, download them
|
|
|
|
# assumes if the exe exists, everything else does too
|
2014-11-20 20:21:14 +00:00
|
|
|
if [ ! -r "$win32Dir/love-0.9.1-win32/love.exe" ]; then
|
|
|
|
mkdir -p "$win32Dir"
|
2014-11-20 07:59:19 +00:00
|
|
|
echo "Downloading win32src..."
|
2014-11-20 21:06:38 +00:00
|
|
|
$download "$win32Dir/love32.zip" https://bitbucket.org/rude/love/downloads/love-0.9.1-win32.zip
|
2014-11-20 21:12:35 +00:00
|
|
|
echo " Done."
|
|
|
|
echo "Extracting win32src..."
|
2014-11-20 20:33:01 +00:00
|
|
|
unzip -q "$win32Dir/love32.zip" -d "$win32Dir"
|
2014-11-20 21:12:35 +00:00
|
|
|
echo " Done."
|
2014-11-20 07:59:19 +00:00
|
|
|
fi
|
|
|
|
|
2014-11-20 20:21:14 +00:00
|
|
|
if [ ! -r "$win64Dir/love-0.9.1-win64/love.exe" ]; then
|
|
|
|
mkdir -p "$win64Dir"
|
2014-11-20 07:59:19 +00:00
|
|
|
echo "Downloading win64src..."
|
2014-11-20 21:06:38 +00:00
|
|
|
$download "$win64Dir/love64.zip" https://bitbucket.org/rude/love/downloads/love-0.9.1-win64.zip
|
2014-11-20 21:12:35 +00:00
|
|
|
echo " Done."
|
|
|
|
echo "Extracting win64src..."
|
2014-11-20 20:33:01 +00:00
|
|
|
unzip -q "$win64Dir/love64.zip" -d "$win64Dir"
|
2014-11-20 21:12:35 +00:00
|
|
|
echo " Done."
|
2014-11-20 07:59:19 +00:00
|
|
|
fi
|
|
|
|
|
2014-11-20 20:21:14 +00:00
|
|
|
if [ ! -d "$osx10Dir/love.app" ]; then
|
|
|
|
mkdir -p "$osx10Dir"
|
2014-11-20 07:59:19 +00:00
|
|
|
echo "Downloading osx10src..."
|
2014-11-20 21:06:38 +00:00
|
|
|
$download "$osx10Dir/loveOSX.zip" https://bitbucket.org/rude/love/downloads/love-0.9.1-macosx-x64.zip
|
2014-11-20 21:12:35 +00:00
|
|
|
echo " Done."
|
|
|
|
echo "Extracting osx10src..."
|
2014-11-20 20:41:00 +00:00
|
|
|
unzip -q "$osx10Dir/loveOSX.zip" -d "$osx10Dir"
|
|
|
|
# delete Mac crao (for some reason can't not unzip it *shrugs*)
|
|
|
|
rm -rf "$osx10Dir/__MACOSX"
|
2014-11-20 20:07:17 +00:00
|
|
|
# the Info.plist is overwritten each time the app is built, so it is not fixed here.
|
2014-11-20 21:12:35 +00:00
|
|
|
echo " Done."
|
2014-11-20 07:59:19 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
# build executables and zip files for them
|
|
|
|
|
|
|
|
echo "Building $packageName (version $version)... (win32 zip)"
|
2014-11-20 20:21:14 +00:00
|
|
|
cat "$win32Dir/love-0.9.1-win32/love.exe" "$outputDir/$packageName-$version.love" > "$win32Dir/$packageName.exe"
|
|
|
|
cd "$win32Dir"
|
2014-11-20 20:33:01 +00:00
|
|
|
zip -r -X -q "$outputDir/$packageName-${version}_win32.zip" "./$packageName.exe"
|
2014-11-20 08:23:56 +00:00
|
|
|
cd ./love-0.9.1-win32
|
2014-11-20 20:33:01 +00:00
|
|
|
zip -r -X -q "$outputDir/$packageName-${version}_win32.zip" ./*.dll
|
2014-11-20 08:33:34 +00:00
|
|
|
cp ./license.txt ./LOVE-license.txt
|
2014-11-20 20:33:01 +00:00
|
|
|
zip -r -X -q "$outputDir/$packageName-${version}_win32.zip" ./LOVE-license.txt
|
2014-11-20 20:21:14 +00:00
|
|
|
cd "$includes"
|
2014-11-20 20:33:01 +00:00
|
|
|
zip -r -X -q "$outputDir/$packageName-${version}_win32.zip" ./*
|
2014-11-20 20:48:33 +00:00
|
|
|
echo " Done."
|
2014-11-20 07:59:19 +00:00
|
|
|
|
|
|
|
echo "Building $packageName (version $version)... (win64 zip)"
|
2014-11-20 20:21:14 +00:00
|
|
|
cat "$win64Dir/love-0.9.1-win64/love.exe" "$outputDir/$packageName-$version.love" > "$win64Dir/$packageName.exe"
|
|
|
|
cd "$win64Dir"
|
2014-11-20 20:33:01 +00:00
|
|
|
zip -r -X -q "$outputDir/$packageName-${version}_win64.zip" "./$packageName.exe"
|
2014-11-20 08:23:56 +00:00
|
|
|
cd ./love-0.9.1-win64
|
2014-11-20 20:33:01 +00:00
|
|
|
zip -r -X -q "$outputDir/$packageName-${version}_win64.zip" ./*.dll
|
2014-11-20 08:33:34 +00:00
|
|
|
cp ./license.txt ./LOVE-license.txt
|
2014-11-20 20:33:01 +00:00
|
|
|
zip -r -X -q "$outputDir/$packageName-${version}_win64.zip" ./LOVE-license.txt
|
2014-11-20 20:21:14 +00:00
|
|
|
cd "$includes"
|
2014-11-20 20:33:01 +00:00
|
|
|
zip -r -X -q "$outputDir/$packageName-${version}_win64.zip" ./*
|
2014-11-20 20:48:33 +00:00
|
|
|
echo " Done."
|
2014-11-20 07:59:19 +00:00
|
|
|
|
|
|
|
if [ $macInfoPlistFixed = true ]; then
|
|
|
|
echo "Building $packageName (version $version)... (OS X zip)"
|
2014-11-20 20:21:14 +00:00
|
|
|
# WHY IS THIS CHECK NEEDED? IT IS REDUNDANT
|
|
|
|
if [ -f "$osx10Dir" ]; then
|
|
|
|
rm -f "$osx10Dir/love.app/Contents/Resources/$packageName.love"
|
2014-11-20 07:59:19 +00:00
|
|
|
fi
|
2014-11-20 20:21:14 +00:00
|
|
|
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"
|
2014-11-20 20:33:01 +00:00
|
|
|
zip -r -X -q "$outputDir/$packageName-${version}_osx.zip" "./$packageName.app"
|
2014-11-20 20:21:14 +00:00
|
|
|
cd "$includes"
|
2014-11-20 20:33:01 +00:00
|
|
|
zip -r -X -q "$outputDir/$packageName-${version}_osx.zip" ./*
|
2014-11-20 20:48:33 +00:00
|
|
|
echo " Done."
|
2014-11-20 07:59:19 +00:00
|
|
|
else
|
|
|
|
echo "WARN: Mac packaging disabled."
|
2014-11-20 08:54:02 +00:00
|
|
|
echo " See README.md for information."
|
2014-11-20 07:59:19 +00:00
|
|
|
fi
|
|
|
|
|
2014-11-20 08:54:02 +00:00
|
|
|
echo "Building $packageName (version $version)... (Linux zip)"
|
2014-11-20 20:21:14 +00:00
|
|
|
cd "$outputDir"
|
2014-11-20 20:33:01 +00:00
|
|
|
zip -r -X -q "./$packageName-${version}_linux.zip" "./$packageName-$version.love"
|
2014-11-20 20:21:14 +00:00
|
|
|
cp "$win64Dir/love-0.9.1-win64/LOVE-license.txt" ./LOVE-license.txt
|
2014-11-20 20:33:01 +00:00
|
|
|
zip -r -X -q "./$packageName-${version}_linux.zip" ./LOVE-license.txt
|
2014-11-20 20:21:14 +00:00
|
|
|
cd "$includes"
|
2014-11-20 20:33:01 +00:00
|
|
|
zip -r -X -q "$outputDir/$packageName-${version}_linux.zip" ./*
|
2014-11-20 20:48:33 +00:00
|
|
|
echo " Done."
|
2014-11-20 08:54:02 +00:00
|
|
|
|
2014-11-20 20:48:33 +00:00
|
|
|
echo "Builds complete. Unless there are errors above. Double check your files."
|
2014-11-26 03:44:33 +00:00
|
|
|
echo
|
|
|
|
if which fortune > /dev/null 2>&1; then fortune; fi
|