From 94a78756f42685fa5396e4a362013fe9f1dd4d39 Mon Sep 17 00:00:00 2001 From: Guard13007 Date: Tue, 11 Nov 2014 00:12:52 -0800 Subject: [PATCH] should be working, needs testing --- .gitignore | 1 + Info.plist | 75 +++++++++++++++++++++++++++++++++++ README.md | 80 ++++++++++++++++++++++++++++++++++++++ build.bat | 4 ++ build.sh | 67 +++++++++++++++++++++++++++++++ config.txt | 25 ++++++++++++ includes/LovePackaging.txt | 2 + 7 files changed, 254 insertions(+) create mode 100644 .gitignore create mode 100644 Info.plist create mode 100644 build.bat create mode 100644 build.sh create mode 100644 config.txt create mode 100644 includes/LovePackaging.txt diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..a007fea --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +build/* diff --git a/Info.plist b/Info.plist new file mode 100644 index 0000000..5b4aeee --- /dev/null +++ b/Info.plist @@ -0,0 +1,75 @@ + + + + + BuildMachineOSBuild + 13D65 + CFBundleDevelopmentRegion + English + CFBundleDocumentTypes + + + CFBundleTypeIconFile + LoveDocument.icns + CFBundleTypeName + LÖVE Project + CFBundleTypeRole + Viewer + LSHandlerRank + Owner + LSItemContentTypes + + org.love2d.love-game + + + + CFBundleTypeName + Folder + CFBundleTypeOSTypes + + fold + + CFBundleTypeRole + Viewer + LSHandlerRank + None + + + CFBundleExecutable + love + CFBundleIconFile + Love.icns + CFBundleIdentifier + YOUR.OWN.UNIQUE.IDENTIFIER + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + YOUR PROGRAM NAME + CFBundlePackageType + APPL + CFBundleShortVersionString + YOUR.CURRENT.VERSION + CFBundleSignature + LoVe + DTCompiler + com.apple.compilers.llvm.clang.1_0 + DTPlatformBuild + 5B1008 + DTPlatformVersion + GM + DTSDKBuild + 13C64 + DTSDKName + macosx10.9 + DTXcode + 0511 + DTXcodeBuild + 5B1008 + LSApplicationCategoryType + public.app-category.games + NSHumanReadableCopyright + © YEAR You + NSPrincipalClass + NSApplication + + diff --git a/README.md b/README.md index 45fa5df..3735433 100644 --- a/README.md +++ b/README.md @@ -2,3 +2,83 @@ LovePackaging ============= Scripts to create Love2d packages. + +Should be working for Linux but is untested as I am too tired right now. +Dunno if the shell script is compatible with Mac OS X at all. +The Windows batch file hasn't been made at all really, not yet. + +Installation +------------ + +ToDo: Explain how install and use. + +Troubleshooting +--------------- + +Screenshots are great if you're reporting a problem. But in any case, common +problems listed below, all one of them! + + +#### What does "WARN: Mac packaging disabled." mean? + +It means you have not edited the config file to specify that you have fixed the +Info.plist for your program. To fix this, first open the Info.plist file in the +same directory as this README file and edit the values on lines 43, 47, and 51. +They look like this by default: + +```xml + YOUR.OWN.UNIQUE.IDENTIFIER + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + YOUR PROGRAM NAME + CFBundlePackageType + APPL + CFBundleShortVersionString + YOUR.CURRENT.VERSION +``` + +An example of what they should look like: + +```xml + com.example.package + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + Example Program by You + CFBundlePackageType + APPL + CFBundleShortVersionString + 0.1.0 +``` + +Also line 71: + +```xml + NSHumanReadableCopyright + © YEAR You +``` + +Something like: + +```xml + NSHumanReadableCopyright + © 2013-2014 Guard13007 +``` + +Once you have fixed that, open config.txt and change the line: + +```bash +# Only change this if you know what you're doing (Read the README.md file). +macInfoPlistFixed=false +``` + +To this: + +```bash +# Only change this if you know what you're doing (Read the README.md file). +macInfoPlistFixed=true +``` + +This will get rid of that error and start building Mac OS X packages. Sorry +this part isn't more streamlined (yet). I am a bit of a noob. diff --git a/build.bat b/build.bat new file mode 100644 index 0000000..bb52514 --- /dev/null +++ b/build.bat @@ -0,0 +1,4 @@ +@ECHO OFF +FOR /F "eol=# tokens=1,2 delims==" %%i,%%j in (config.txt) DO ( + rem stuff +) diff --git a/build.sh b/build.sh new file mode 100644 index 0000000..43d5b5d --- /dev/null +++ b/build.sh @@ -0,0 +1,67 @@ +#!/bin/bash + +# get config +source ./config.txt + +# 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 $outputDir/$packageName-$version.love ./* + +# check if executables (their directories) exist, if not, download them +if [ ! -d $wind32Dir ]; then + mkdir -p $wind32Dir + echo "Downloading wind32src..." + wget -nv -O $wind32Dir/love32.zip https://bitbucket.org/rude/love/downloads/love-0.9.1-win32.zip + unzip $wind32Dir/love32.zip -d $wind32Dir +fi + +if [ ! -d $win64Dir ]; then + mkdir -p $win64Dir + echo "Downloading win64src..." + wget -nv -O $win64Dir/love64.zip https://bitbucket.org/rude/love/downloads/love-0.9.1-win64.zip + unzip $win64Dir/love64.zip -d $win64Dir +fi + +if [ ! -d $osx10Dir ]; then + mkdir -p $osx10Dir + echo "Downloading osx10src..." + wget -nv -O $osx10Dir/loveOSX.zip https://bitbucket.org/rude/love/downloads/love-0.9.1-macosx-x64.zip + unzip $osx10Dir/loveOSX.zip -d $osx10Dir + #delete Mac crap + rm -rf $osx10Dir/__MACOSX + #the Info.plist is overwritten each time the app is built, so it is not fixed here. +fi + +# build executables and zip files for them + +echo "Building $packageName (version $version)... (win32 zip)" +cat $wind32Dir/love-0.9.1-win32/love.exe $outputDir/$packageName-$version.love > $wind32Dir/$packageName.exe +zip -r $outputDir/$packageName-$version_win32.zip $wind32Dir/$packageName.exe $wind32Dir/love-0.9.1-win32/*.dll $wind32Dir/love-0.9.1-win32/license.txt $includes + +echo "Building $packageName (version $version)... (win64 zip)" +cat $win64Dir/love-0.9.1-win64/love.exe $outputDir/$packageName-$version.love > $win64Dir/$packageName.exe +zip -r $outputDir/$packageName-$version_win64.zip $win64Dir/$packageName.exe $win64Dir/love-0.9.1-win64/*.dll $win64Dir/love-0.9.1-win64/license.txt $includes + + +if [ $macInfoPlistFixed = true ]; then + echo "Building $packageName (version $version)... (OS X zip)" + 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 + zip -r $outputDir/$packageName-$version_osx.zip $osx10Dir/love.app $includes +else + echo "WARN: Mac packaging disabled." +fi + +echo "Build complete. Unless there are errors above. Check your files." diff --git a/config.txt b/config.txt new file mode 100644 index 0000000..3c512fe --- /dev/null +++ b/config.txt @@ -0,0 +1,25 @@ +# The name of the resulting executable. +packageName="LovePackagingExample" +# Where to place the resulting executable. +outputDir="$(pwd)/build" +# Where the source code is. (This should be where your main.lua file is.) +sourceDir="$(pwd)/src" +# Files to include in ZIP packages. (ReadMe's, licenses, etc.) +# Do not include a "license.txt" file. Name your license something else. +includes="$(pwd)/includes" + +# Who made this? (Yes, change this to your name.) +author="Guard13007" +# Current version (of your program) +version="0.1" + +# Remove old packages? +removeOld=true + +# Where unzipped executables to make packages out of will be kept +win32Dir="$build/win32src" +win64Dir="$build/win64src" +osx10Dir="$build/osx10src" + +# Only change this if you know what you're doing (Read the README.md file). +macInfoPlistFixed=false diff --git a/includes/LovePackaging.txt b/includes/LovePackaging.txt new file mode 100644 index 0000000..2aa8971 --- /dev/null +++ b/includes/LovePackaging.txt @@ -0,0 +1,2 @@ +This package created with LovePackaging! +http://www.github.com/Guard13007/LovePackaging