Add Mac OS X module

This commit is contained in:
Antonin Décimo
2014-08-19 21:14:20 +02:00
parent 530ee0f3de
commit f2b0c454f0
4 changed files with 158 additions and 10 deletions

View File

@@ -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. `-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. `-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.8.0, a release is specially available for Windows x64.
Starting with Love 0.9.0, Love no longer supports old x86 Macintosh. Starting with Love 0.9.0, Love no longer supports old x86 Macintosh.
#### MAC OS X
`--maintainer-name` Set the maintainers name. Provide it for OS X CFBundleIdentifier.
#### DEBIAN #### DEBIAN
`--description` Set the description of your project. `--description` Set the description of your project.
`--homepage` Set the homepage of your project. `--homepage` Set the homepage of your project.
`--maintainer-email` Set the maintainers email. `--maintainer-email` Set the maintainers email.
`--maintainer-name` Set the maintainers name. The company name is used by default. `--maintainer-name` Set the maintainers name.
`--package-name` Set the name of the package and the command that will be used to launch your game. `--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, By default, it is the name of your project converted to lowercase,
with eventual spaces replaced by dashes. 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. `--activity` The name of the class that extends GameActivity.
By default it is the name of the project with Activity appended, By default it is the name of the project with Activity appended,
eventual spaces and dashes replaced by underscores. eventual spaces and dashes replaced by underscores.
`--maintainer-name` Set the maintainers name. The company name is used by default. `--maintainer-name` Set the maintainers name.
It must be only alphanumerical characters, with eventual underscores. It must be only alphanumerical characters, with eventual underscores.
`--package-name` Set the name of the package. `--package-name` Set the name of the package.
By default, it is the name of your project, with eventual spaces replaced by underscores. By default, it is the name of your project, with eventual spaces replaced by underscores.

View File

@@ -76,13 +76,14 @@ Set the projects name. By default, the name of the current directory is used.
.B \-r \fIrelease-dir\fR .B \-r \fIrelease-dir\fR
Set the release directory. By default, a subdirectory called releases is created. Set the release directory. By default, a subdirectory called releases is created.
.TP .TP
.B \-u \fIcompany\fR
Set the company name. Provide it for MacOS CFBundleIdentifier.
.TP
.B \-v \fIversion\fR .B \-v \fIversion\fR
Love version. Default is 0.9.1. 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.8.0, a release is specially available for Windows x64.
Starting with Love 0.9.0, Love no longer supports old x86 Macintosh. 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 .SH DEBIAN
.TP .TP
.B \-\-description \fIdescription\fR .B \-\-description \fIdescription\fR
@@ -95,7 +96,7 @@ Set the homepage of your project.
Set the maintainer's email. Set the maintainer's email.
.TP .TP
.B \-\-maintainer\-name \fIname\fR .B \-\-maintainer\-name \fIname\fR
Set the maintainer's name. The company name is used by default. Set the maintainer's name.
.TP .TP
.B \-\-package-name \fIname\fR .B \-\-package-name \fIname\fR
Set the name of the package and the command that will be use to launch your game. 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. eventual spaces and dashes replaced by underscores.
.TP .TP
.B \-\-maintainer\-name \fIname\fR .B \-\-maintainer\-name \fIname\fR
Set the maintainers name. The company name is used by default. Set the maintainers name.
It must be only alphanumerical characters, with eventual underscores. It must be only alphanumerical characters, with eventual underscores.
.TP .TP
.B \-\-package\-name \fIname\fR .B \-\-package\-name \fIname\fR

View File

@@ -14,7 +14,7 @@ LOVE_VERSION=0.9.1
## - a colon ":" if it requires an argument ## - a colon ":" if it requires an argument
## SCRIPT_ARGS="a; osname:" ## SCRIPT_ARGS="a; osname:"
SCRIPT_ARGS="l; d; g; w." SCRIPT_ARGS="l; d; g; m; w."
## Windows ## Windows
SCRIPT_ARGS="icon: $SCRIPT_ARGS" 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" SCRIPT_ARGS="package-version: maintainer-name: maintainer-email: homepage: description: package-name: $SCRIPT_ARGS"
## Android ## Android
SCRIPT_ARGS="activity: package-version: maintainer-name: package-name: update-android; $SCRIPT_ARGS" 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 ## 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 SHORT_HELP=" -l Create a plain Love file
-d Create a Debian package -d Create a Debian package
-g Create an Android package -g Create an Android package
-m Create a Mac OS X application
-w, Create a Windows application -w, Create a Windows application
-w32 Create a Windows x86 application -w32 Create a Windows x86 application
-w64 Create a Windows x64 application" -w64 Create a Windows x64 application"
@@ -196,6 +199,8 @@ do
source "$PLATFORMS_DIR"/debian.sh source "$PLATFORMS_DIR"/debian.sh
elif [ "$OPTOPT" = "g" ]; then elif [ "$OPTOPT" = "g" ]; then
source "$PLATFORMS_DIR"/android.sh source "$PLATFORMS_DIR"/android.sh
elif [ "$OPTOPT" = "m" ]; then
source "$PLATFORMS_DIR"/macosx.sh
elif [ "$OPTOPT" = "w" ]; then elif [ "$OPTOPT" = "w" ]; then
if [ "$OPTARG" = "32" ]; then if [ "$OPTARG" = "32" ]; then
RELEASE_WIN_32=true RELEASE_WIN_32=true

141
scripts/macosx.sh Normal file
View File

@@ -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="<?xml version=\"1.0\" encoding=\"UTF-8\"?>
<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">
<plist version=\"1.0\">
<dict>
<key>BuildMachineOSBuild</key>
<string>13D65</string>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleDocumentTypes</key>
<array>
<dict>
<key>CFBundleTypeIconFile</key>
<string>LoveDocument.icns</string>
<key>CFBundleTypeName</key>
<string>LÖVE Project</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
<key>LSHandlerRank</key>
<string>Owner</string>
<key>LSItemContentTypes</key>
<array>
<string>org.love2d.love-game</string>
</array>
</dict>
<dict>
<key>CFBundleTypeName</key>
<string>Folder</string>
<key>CFBundleTypeOSTypes</key>
<array>
<string>fold</string>
</array>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
<key>LSHandlerRank</key>
<string>None</string>
</dict>
</array>
<key>CFBundleExecutable</key>
<string>love</string>
<key>CFBundleIconFile</key>
<string>${PROJECT_ICNS##/*/}</string>
<key>CFBundleIdentifier</key>
<string>org.$MAINTAINER_NAME.$PACKAGE_NAME</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$PROJECT_NAME</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>$LOVE_VERSION</string>
<key>CFBundleSignature</key>
<string>LoVe</string>
<key>DTCompiler</key>
<string>com.apple.compilers.llvm.clang.1_0</string>
<key>DTPlatformBuild</key>
<string>5B1008</string>
<key>DTPlatformVersion</key>
<string>GM</string>
<key>DTSDKBuild</key>
<string>13C64</string>
<key>DTSDKName</key>
<string>macosx10.9</string>
<key>DTXcode</key>
<string>0511</string>
<key>DTXcodeBuild</key>
<string>5B1008</string>
<key>LSApplicationCategoryType</key>
<string>public.app-category.games</string>
<key>NSHumanReadableCopyright</key>
<string>© 2006-2014 LÖVE Development Team</string>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
</dict>
</plist>"
## 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