I wanted to make a game run on Android, so I've got two batch files for compiling the APKs, as well as one for making a .love -and- another that spins up an EXE w/the required DLLs so I can make a release package - a total of 4 batch files (plus another that runs the game without a .love for quick testing). Here they are:
The simplest - a simple run batch (aptly named run.bat):
Code: Select all
@ECHO OFF
..\love-0.9.1-win32\love.exe --console "%CD%"
The next simplest - makes a .love file (adapted from the first post):
Code: Select all
"C:\PATH\TO\7z.exe" a -tzip builds/game.love * -xr!*.love -xr!*.bat -xr!*.apk -xr!*.ini -xr!*.exe -xr!*.7z
pause
Moving on - compiling an EXE:
Code: Select all
SET wd=%CD%
SET lovedir=C:\PATH\TO\love-0.9.1-win32
CD %lovedir%
copy /Y %wd%\builds\game.love %lovedir%
rmdir /s /q make
mkdir make
copy /b love.exe+%wd%\builds\game.love .\make\game.exe
copy *.dll .\make\*.dll
copy make %wd%\builds\exe\
pause
Up next is compiling a debug APK with love-android-sdl2:
Code: Select all
SET wd=%CD%
for %%* in (.) do SET pkg=%%~n*
SET love=%wd%\builds\game.love
SET builddir=D:\PATH\TO\love-android-sdl2
SET assets=D:\PATH\TO\love-android-sdl2\assets\game.love
SET dbg=D:\PATH\TO\\love-android-sdl2\bin\love_android_sdl2-debug.apk
copy /Y %love% %assets%
cd %builddir%
call ant debug
copy /Y %dbg% %wd%\builds\debug.apk
pause
Lastly, the most unpretty of them all - compiling a release mode APK (this one could be less ugly, but it was 3AM and I was in the zone):
Code: Select all
@ECHO OFF
SET wd=%CD%
for %%* in (.) do SET pkg=%%~n*
SET love=%wd%\game.love
SET builddir=D:\PATH\TO\love-android-sdl2
SET assets=D:\PATH\TO\love-android-sdl2\assets\game.love
SET dbg=D:\PATH\TO\love-android-sdl2\bin\love_android_sdl2-release-unsigned.apk
SET jdk=C:\PATH\TO\jdk1.7.0_60\bin
SET unsigned=%wd%\builds\release-unsigned.apk
SET signed=%wd%\builds\release.apk
del builds\release.apk
copy /Y %love% %assets%
cd %builddir%
call ant release
copy /Y %dbg% %unsigned%
cd /D %jdk%
call jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore D:\PATH\TO\your.keystore %unsigned% KEYSTOREALIAS
call jarsigner -verify %unsigned%
call zipalign -v 4 %unsigned% %signed%
pause
I've got these all sitting in the root directory of my game folder. When they run, a subfolder is made called "builds", which all up will have these files:
- debug.apk
- release.apk
- game.love
- release-unsigned.apk (by the end of the process I think this one actually is signed, but not aligned
- directory: /exe (contains game.exe and the love dll's, ready for packaging)
As for why I have them: convenience, mostly. I'm an enterprise developer by trade, so having the ability to compile and go without screwing around fits neatly into my development practices. I plan to make another batch file to rename the EXE/APKs and package them for release as well.