From 80e7a8410c646c9cac53338d7be4e142cf999363 Mon Sep 17 00:00:00 2001 From: Paul Liverman III Date: Fri, 6 Feb 2015 23:09:59 -0800 Subject: [PATCH] polished and built for release --- .gitignore | 4 + build | 165 ++++++++++++++++++++++++++++++++++++ builds/build.number | 1 + config.sh | 44 ++++++++++ LICENSE => includes/LICENSE | 0 scripts/Info.plist-maker.sh | 85 +++++++++++++++++++ src/conf.lua | 4 +- src/game.lua | 2 - src/main.lua | 3 + 9 files changed, 304 insertions(+), 4 deletions(-) create mode 100644 .gitignore create mode 100755 build create mode 100644 builds/build.number create mode 100644 config.sh rename LICENSE => includes/LICENSE (100%) create mode 100644 scripts/Info.plist-maker.sh diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b8be4da --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +!builds/ +builds/* +!builds/build.number +tmp/ diff --git a/build b/build new file mode 100755 index 0000000..87f94ef --- /dev/null +++ b/build @@ -0,0 +1,165 @@ +#!/bin/bash + +# keep unset variables from breaking everything +set -o nounset +# exit on error instead of continuing +set -o errexit + +# get config +#if [ ! -z "$1" ]; then +# # has a command-line option, which should be the config file to load from +# source "$1" +#else + source ./config.sh +#fi + +# make $outputDir if it doesn't exist +if [ ! -d "$outputDir" ]; then mkdir -p "$outputDir"; fi + +# append -buildN build numbers +# (build.number file stored in $outputDir) +if [ $autoNumberBuilds = true ]; then + # get the number if file exists, else use 1 + if [ -r "$outputDir/build.number" ]; then + source "$outputDir/build.number" + ((build++)) + else + build=1 + fi + # store the current build number + echo "build=$build" > "$outputDir/build.number" + # set version to use new build number + version=$version-build$build +fi + +# check that zip and unzip are accessible +# not sure if this is the best way to do this or not +if ! which zip > /dev/null 2>&1; then + echo "zip not installed" + exit 2; +fi +if ! which unzip > /dev/null 2>&1; then + echo "unzip not installed" + exit 3; +fi + +# remove old versions of package? +if [ $removeOld = true ]; then + rm -f "$outputDir/$packageName*" +fi + +# move to source dir and store original for later use +# (this is to make a zip command work) +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 generated each time a package is built, we don't need a copy here + rm -f "$osx10Dir/love.app/Contents/Info.plist" + echo " Done." +fi + +# build executables and zip files for them + +echo "Building $packageName (version $version)... (win32 zip)" +# EXE with ZIP at end +cat "$win32Dir/love-0.9.1-win32/love.exe" "$outputDir/$packageName-$version.love" > "$win32Dir/$packageName.exe" +cd "$win32Dir" +# ZIP up the EXE +zip -r -X -q "$outputDir/$packageName-${version}_win32.zip" "./$packageName.exe" +cd ./love-0.9.1-win32 +# ZIP up the required DLLs +zip -r -X -q "$outputDir/$packageName-${version}_win32.zip" ./*.dll +cp ./license.txt ./LOVE-license.txt +# ZIP up the LOVE license +zip -r -X -q "$outputDir/$packageName-${version}_win32.zip" ./LOVE-license.txt +cd "$includes" +# ZIP up extra included files +zip -r -X -q "$outputDir/$packageName-${version}_win32.zip" ./* +echo " Done." + +echo "Building $packageName (version $version)... (win64 zip)" +# EXE with ZIP at end +cat "$win64Dir/love-0.9.1-win64/love.exe" "$outputDir/$packageName-$version.love" > "$win64Dir/$packageName.exe" +cd "$win64Dir" +# ZIP up the EXE +zip -r -X -q "$outputDir/$packageName-${version}_win64.zip" "./$packageName.exe" +cd ./love-0.9.1-win64 +# ZIP up the required DLLs +zip -r -X -q "$outputDir/$packageName-${version}_win64.zip" ./*.dll +cp ./license.txt ./LOVE-license.txt +# ZIP up the LOVE license +zip -r -X -q "$outputDir/$packageName-${version}_win64.zip" ./LOVE-license.txt +cd "$includes" +# ZIP up extra included files +zip -r -X -q "$outputDir/$packageName-${version}_win64.zip" ./* +echo " Done." + +echo "Building $packageName (version $version)... (OS X zip)" +cd "$osx10Dir" +# Make a fresh copy of the .app directory +cp -r ./love.app "./$packageName.app" +# Copy in our .love file +cp "$outputDir/$packageName-$version.love" "$osx10Dir/$packageName.app/Contents/Resources/$packageName.love" +# Create an Info.plist and copy it in +cd "$originalDir" +source "$originalDir/scripts/Info.plist-maker.sh" +cd "$osx10Dir" +cp "$originalDir/tmp/Info.plist" "$osx10Dir/$packageName.app/Contents/Info.plist" +# ZIP up the .app directory +zip -r -X -q "$outputDir/$packageName-${version}_osx.zip" "./$packageName.app" +cd "$includes" +# ZIP up the extra included files +zip -r -X -q "$outputDir/$packageName-${version}_osx.zip" ./* +echo " Done." + +echo "Building $packageName (version $version)... (Linux zip)" +cd "$outputDir" +# ZIP up the .love file +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 up the LOVE license +zip -r -X -q "./$packageName-${version}_linux.zip" ./LOVE-license.txt +cd "$includes" +# ZIP up the extra included files +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 diff --git a/builds/build.number b/builds/build.number new file mode 100644 index 0000000..0ec13b9 --- /dev/null +++ b/builds/build.number @@ -0,0 +1 @@ +build=2 diff --git a/config.sh b/config.sh new file mode 100644 index 0000000..7c2d0ba --- /dev/null +++ b/config.sh @@ -0,0 +1,44 @@ +# The name of the resulting executables. +packageName="rgb" +# User-friendly package name. +friendlyPackageName="RGB - The Color Chooser" +# Who made this? (Yes, change this to your name.) +author="Guard13007" +# Copyright year (ex 2014-2015 or 2015) +copyrightYear="2015" +# A unique identifier for your package. +# (It should be fine to leave this as its default.) +identifier="com.$author.$packageName" +# Current version (of your program) +version="1.0" + +###### Important! ONLY USE ABSOLUATE PATHS ###### +# Where to place the resulting executables. +outputDir="$(pwd)/builds" +# 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.) +includes="$(pwd)/includes" + +# Where unzipped executables to make packages out of will be kept +# (This is also where LOVE executables will be kept before modifications to make your packages) +win32Dir="$outputDir/win32src" +win64Dir="$outputDir/win64src" +osx10Dir="$outputDir/osx10src" + +# Remove old packages? +removeOld=false + +# Allow overwrite? NOT IMPLEMENTED +# If this is false, LovePackaging will quit if you try to build with the same version number twice. +allowOverwrite=false + +# Auto-number builds? +# An "-buildN" will be added to the end of ZIP package names, with N being the Nth time this project was built. +# (To do this, a build.number file is stored in $outputDir, so watch out for that.) +autoNumberBuilds=true + +# Use curl or wget? +# (One of these lines should be commented out, the other not) +#download="curl -o" +download="wget --progress=bar:force -O" diff --git a/LICENSE b/includes/LICENSE similarity index 100% rename from LICENSE rename to includes/LICENSE diff --git a/scripts/Info.plist-maker.sh b/scripts/Info.plist-maker.sh new file mode 100644 index 0000000..a1ebcd3 --- /dev/null +++ b/scripts/Info.plist-maker.sh @@ -0,0 +1,85 @@ +#!/bin/bash + +mkdir -p ./tmp + +echo " + + + + 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" > ./tmp/Info.plist + +echo " $identifier + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName" >> ./tmp/Info.plist + +echo " $friendlyPackageName + CFBundlePackageType + APPL + CFBundleShortVersionString" >> ./tmp/Info.plist + +echo " $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" >> ./tmp/Info.plist + +echo " © $copyrightYear $author + NSPrincipalClass + NSApplication + +" >> ./tmp/Info.plist + +echo " Info.plist generated." diff --git a/src/conf.lua b/src/conf.lua index 4d5aff3..e4fef69 100644 --- a/src/conf.lua +++ b/src/conf.lua @@ -1,8 +1,8 @@ function love.conf(t) - t.identity = "RGB" + t.identity = "rgb" t.version = "0.9.1" --t.author = "Guard13007" - t.console = true + --t.console = true t.window = {} t.window.title = "RGB - The Color Chooser" diff --git a/src/game.lua b/src/game.lua index f575d1f..df03d62 100644 --- a/src/game.lua +++ b/src/game.lua @@ -49,7 +49,6 @@ local function copyColor(A) end function game:update(dt) - print(os.time()) -- check if level complete local coloredBoxes = {} for i=0,#boxes do @@ -111,7 +110,6 @@ function game:draw() end function game:mousepressed(x, y, button) - print(button) --debug local nx = math.floor(x / boxSize) local ny = math.floor((y - boxSize * 2) / boxSize) if boxes[nx][ny] then diff --git a/src/main.lua b/src/main.lua index 9012167..0730a15 100644 --- a/src/main.lua +++ b/src/main.lua @@ -2,6 +2,9 @@ local Gamestate = require "lib.gamestate" local menu = require "menu" function love.load() + local icon = love.image.newImageData("icon.png") + love.window.setIcon(icon) + Gamestate.registerEvents() Gamestate.switch(menu) end