-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.sh
executable file
·73 lines (60 loc) · 2.25 KB
/
build.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#!/bin/bash
# https://github.com/TomK32/kollum/blob/master/build.sh
# based on https://github.com/josefnpat/LD24/blob/master/build.sh
# Configure this, and also ensure you have the build/osx.patch ready.
NAME="Rogue Beach, CA"
# Version is {last tag}-{commits since last tag}.
# e.g: 0.1.2-3
GAME_VERSION=`git tag|tail -1`
REVISION=`git log ${GAME_VERSION}..HEAD --oneline | wc -l | sed -e 's/ //g'`
FILENAME="$NAME-$GAME_VERSION-$REVISION"
VERSION=0.8.0
BUILD="`pwd`/build"
mkdir -p "${BUILD}"
# download love files
for ARCH in "win-x86" "win-x64" "macosx-ub"
do
if [ ! -f "$BUILD/love-${VERSION}-${ARCH}.zip" ];
then
wget "https://bitbucket.org/rude/love/downloads/love-${VERSION}-${ARCH}.zip" -P "${BUILD}"
fi
done
# Take HEAD make an archive of it
git archive HEAD -o "$BUILD/$FILENAME.zip"
echo "game = {}; game.version = '${GAME_VERSION}-${REVISION}'" > "version.lua"
# Add the version file
zip -q "$BUILD/$FILENAME.zip" "version.lua"
mv "$BUILD/$FILENAME.zip" "$BUILD/$FILENAME.love"
GAME="$BUILD/$FILENAME.love"
echo "Building $FILENAME"
# For windows, just append our love file and zip it
for arch in 'win-x86' 'win-x64'
do
A="$BUILD/love-$VERSION-$arch"
if [ -f "$BUILD/$A" ]; then rm "$BUILD/$A"; fi
unzip -q -d "$BUILD" "$A.zip"
cat "$GAME" >> "$A/love.exe"
mv "$A" "$BUILD/${FILENAME}_$arch"
R_PWD=`pwd`
cd "$BUILD/${FILENAME}_$arch"
echo "$BUILD/${FILENAME}_$arch.zip"
if [ -f "$BUILD/${FILENAME}_$arch.zip" ]; then rm "$BUILD/${FILENAME}_$arch.zip"; fi
zip -q -r "$BUILD/${FILENAME}_$arch.zip" .
rm -R "$BUILD/${FILENAME}_$arch"
cd "$R_PWD"
done
# OS X needs more work, unzip, copy love file into it, apply the patch
# and zip it up again
echo "$BUILD/${FILENAME}.app.zip"
if [ -d "$BUILD/love.app" ]; then rm -R "$BUILD/love.app"; fi
unzip -q -d "$BUILD" "$BUILD/love-$VERSION-macosx-ub.zip"
mv "$BUILD/love.app" "$BUILD/${FILENAME}.app"
cp "$BUILD/$FILENAME.love" "$BUILD/$FILENAME.app/Contents/Resources/"
patch "$BUILD/${FILENAME}.app/Contents/Info.plist" -i "$BUILD/osx.patch"
cp "images/Rogue Beach.icns" "$BUILD/$FILENAME.app/Contents/Resources"
R_PWD=`pwd`
cd "$BUILD"
if [ -f "${FILENAME}_macosx.zip" ]; then rm "${FILENAME}_macosx.zip"; fi
zip -q -r "${FILENAME}_macosx.zip" "${FILENAME}.app"
cd "$R_PWD"
rm -rf "$BUILD/$FILENAME.app"