From f2b0c454f03387137b42e2b6acdc7c8bcb220ad7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonin=20D=C3=A9cimo?= Date: Tue, 19 Aug 2014 21:14:20 +0200 Subject: [PATCH] Add Mac OS X module --- README.md | 9 +-- love-release.1 | 11 ++-- love-release.sh | 7 ++- scripts/macosx.sh | 141 ++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 158 insertions(+), 10 deletions(-) create mode 100644 scripts/macosx.sh diff --git a/README.md b/README.md index 3eb5529..8cfd829 100644 --- a/README.md +++ b/README.md @@ -66,17 +66,18 @@ the script will use it to set the game icon on Windows. `-r` Set the release directory. By default, a subdirectory called releases is created. -`-u` Set the company name. Provide it for MacOS CFBundleIdentifier. - `-v` Love version. Default is 0.9.1. Starting with Love 0.8.0, a release is specially available for Windows x64. Starting with Love 0.9.0, Love no longer supports old x86 Macintosh. +#### MAC OS X +`--maintainer-name` Set the maintainer’s name. Provide it for OS X CFBundleIdentifier. + #### DEBIAN `--description` Set the description of your project. `--homepage` Set the homepage of your project. `--maintainer-email` Set the maintainer’s email. -`--maintainer-name` Set the maintainer’s name. The company name is used by default. +`--maintainer-name` Set the maintainer’s name. `--package-name` Set the name of the package and the command that will be used to launch your game. By default, it is the name of your project converted to lowercase, with eventual spaces replaced by dashes. @@ -88,7 +89,7 @@ with eventual underscores (i.e. [a-zA-Z0-9\_]), otherwise you'll get errors. `--activity` The name of the class that extends GameActivity. By default it is the name of the project with ‘Activity’ appended, eventual spaces and dashes replaced by underscores. -`--maintainer-name` Set the maintainer’s name. The company name is used by default. +`--maintainer-name` Set the maintainer’s name. It must be only alphanumerical characters, with eventual underscores. `--package-name` Set the name of the package. By default, it is the name of your project, with eventual spaces replaced by underscores. diff --git a/love-release.1 b/love-release.1 index 27c8a22..75744b3 100644 --- a/love-release.1 +++ b/love-release.1 @@ -76,13 +76,14 @@ Set the projects name. By default, the name of the current directory is used. .B \-r \fIrelease-dir\fR Set the release directory. By default, a subdirectory called releases is created. .TP -.B \-u \fIcompany\fR -Set the company name. Provide it for MacOS CFBundleIdentifier. -.TP .B \-v \fIversion\fR Love version. Default is 0.9.1. Starting with Love 0.8.0, a release is specially available for Windows x64. Starting with Love 0.9.0, Love no longer supports old x86 Macintosh. +.SH MAC OS X +.TP +.B \-\-maintainer\-name \fIname\fR +Set the maintainer's name. Provide it for OS X CFBundleIdentifier. .SH DEBIAN .TP .B \-\-description \fIdescription\fR @@ -95,7 +96,7 @@ Set the homepage of your project. Set the maintainer's email. .TP .B \-\-maintainer\-name \fIname\fR -Set the maintainer's name. The company name is used by default. +Set the maintainer's name. .TP .B \-\-package-name \fIname\fR Set the name of the package and the command that will be use to launch your game. @@ -114,7 +115,7 @@ By default it is the name of the project with 'Activity' appended, eventual spaces and dashes replaced by underscores. .TP .B \-\-maintainer\-name \fIname\fR -Set the maintainer’s name. The company name is used by default. +Set the maintainer’s name. It must be only alphanumerical characters, with eventual underscores. .TP .B \-\-package\-name \fIname\fR diff --git a/love-release.sh b/love-release.sh index 2001174..d22d452 100755 --- a/love-release.sh +++ b/love-release.sh @@ -14,7 +14,7 @@ LOVE_VERSION=0.9.1 ## - a colon ":" if it requires an argument ## SCRIPT_ARGS="a; osname:" -SCRIPT_ARGS="l; d; g; w." +SCRIPT_ARGS="l; d; g; m; w." ## Windows SCRIPT_ARGS="icon: $SCRIPT_ARGS" @@ -22,6 +22,8 @@ SCRIPT_ARGS="icon: $SCRIPT_ARGS" SCRIPT_ARGS="package-version: maintainer-name: maintainer-email: homepage: description: package-name: $SCRIPT_ARGS" ## Android SCRIPT_ARGS="activity: package-version: maintainer-name: package-name: update-android; $SCRIPT_ARGS" +## Mac OS X +SCRIPT_ARGS="icon: maintainer-name: $SCRIPT_ARGS" ## Add a short summary of your platform script here @@ -30,6 +32,7 @@ SCRIPT_ARGS="activity: package-version: maintainer-name: package-name: update-an SHORT_HELP=" -l Create a plain Love file -d Create a Debian package -g Create an Android package + -m Create a Mac OS X application -w, Create a Windows application -w32 Create a Windows x86 application -w64 Create a Windows x64 application" @@ -196,6 +199,8 @@ do source "$PLATFORMS_DIR"/debian.sh elif [ "$OPTOPT" = "g" ]; then source "$PLATFORMS_DIR"/android.sh + elif [ "$OPTOPT" = "m" ]; then + source "$PLATFORMS_DIR"/macosx.sh elif [ "$OPTOPT" = "w" ]; then if [ "$OPTARG" = "32" ]; then RELEASE_WIN_32=true diff --git a/scripts/macosx.sh b/scripts/macosx.sh new file mode 100644 index 0000000..fafc4ff --- /dev/null +++ b/scripts/macosx.sh @@ -0,0 +1,141 @@ +# Mac OS X +init_module "Mac OS X" + + +# Options +while getoptex "$SCRIPT_ARGS" "$@" +do + if [ "$OPTOPT" = "icon" ]; then + PROJECT_ICNS=$OPTARG + elif [ "$OPTOPT" = "maintainer-name" ]; then + MAINTAINER_NAME=$OPTARG + fi +done +EXCLUDE_FILES="$EXCLUDE_FILES $PROJECT_ICNS" +PACKAGE_NAME=$(echo $PROJECT_NAME | sed -e 's/[^-a-zA-Z0-9_]/-/g') + + +create_love_file + + +# Info.plist +## TODO: Remove this and replace it by parsing the file instead of overwriting +INFO_PLIST=" + + + + 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 + ${PROJECT_ICNS##/*/} + CFBundleIdentifier + org.$MAINTAINER_NAME.$PACKAGE_NAME + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $PROJECT_NAME + CFBundlePackageType + APPL + CFBundleShortVersionString + $LOVE_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 + © 2006-2014 LÖVE Development Team + NSPrincipalClass + NSApplication + +" + + +## MacOS 64-bits ## +if [ "$LOVE_GT_090" = true ]; then + if [ -f "$CACHE_DIR/love-$LOVE_VERSION-macosx-x64.zip" ]; then + cp $CACHE_DIR/love-$LOVE_VERSION-macosx-x64.zip ./ + else + curl -L -C - -o $CACHE_DIR/love-$LOVE_VERSION-macosx-x64.zip https://bitbucket.org/rude/love/downloads/love-$LOVE_VERSION-macosx-x64.zip + cp $CACHE_DIR/love-$LOVE_VERSION-macosx-x64.zip ./ + fi + unzip -qq love-$LOVE_VERSION-macosx-x64.zip + rm -rf "$PROJECT_NAME"-macosx-x64.zip 2> /dev/null + mv love.app "$PROJECT_NAME".app + cp "$PROJECT_NAME".love "$PROJECT_NAME".app/Contents/Resources + cp "$PROJECT_ICNS" "$PROJECT_NAME".app/Contents/Resources 2> /dev/null + + echo "$INFO_PLIST" > "$PROJECT_NAME".app/Contents/Info.plist + + zip -9 -qr "$PROJECT_NAME"-macosx-x64.zip "$PROJECT_NAME".app + rm -rf love-$LOVE_VERSION-macosx-x64.zip "$PROJECT_NAME".app __MACOSX + + ## MacOS 32-bits ## +else + if [ -f "$CACHE_DIR/love-$LOVE_VERSION-macosx-ub.zip" ]; then + cp $CACHE_DIR/love-$LOVE_VERSION-macosx-ub.zip ./ + else + curl -L -C - -o $CACHE_DIR/love-$LOVE_VERSION-macosx-ub.zip https://bitbucket.org/rude/love/downloads/love-$LOVE_VERSION-macosx-ub.zip + cp $CACHE_DIR/love-$LOVE_VERSION-macosx-ub.zip ./ + fi + unzip -qq love-$LOVE_VERSION-macosx-ub.zip + rm -rf "$PROJECT_NAME"-macosx-ub.zip 2> /dev/null + mv love.app "$PROJECT_NAME".app + cp "$PROJECT_NAME".love "$PROJECT_NAME".app/Contents/Resources + cp "$PROJECT_ICNS" "$PROJECT_NAME".app/Contents/Resources 2> /dev/null + + echo "$INFO_PLIST" > "$PROJECT_NAME".app/Contents/Info.plist + + zip -9 -qr "$PROJECT_NAME"-macosx-ub.zip "$PROJECT_NAME".app + rm -rf love-$LOVE_VERSION-macosx-ub.zip "$PROJECT_NAME".app __MACOSX +fi + +remove_love_file +exit_module +