
Time to drink again from the firehose of knowledge...Vhati wrote:They do their best to make it mysterious, but it's conceptually not much cleverer than a batch in a folder.I've been googling for like 3 hours, but I still have no idea how to create the bundle for Mac on Windows :/
I'll write something up
I no longer have access to a mac to tease out the bare minimum, so what follows is what worked for me in an old project.
Code: Select all
ABC_v123/
|-ABC.app/
| |-Contents/
| |-MacOS/
| | |-runme
| |-Resources/
| | |-appIcon.icns
| | |-ABC.jar
| | |-some-lib.jar
| | |-another-lib.jar
| |
| |-Info.plist
| |-PkgInfo
|
|- readme.txt
I used IcoFX to create a 128x128 32bit color icon.
That's the only Windows editor I know of that can save Mac *.icns files. The link is to the last freeware version.
After sketching, I added alternate resolutions (Icon menu-New Image). IcoFX offers to fill them with scaled down copies, but you can make each different so they look good small.
An icon is probably required.32x32 32bit, 32x32 8bit, 32x32 1bit
16x16 32bit, 16x16 8bit, 16x16 1bit
PkgInfo
Code: Select all
APPL????
This file might be deprecated and unimportant by now.
Info.plist
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleExecutable</key>
<string>runme</string>
<key>CFBundleGetInfoString</key>
<string>ABC 1.2.3</string>
<key>CFBundleIconFile</key>
<string>appIcon.icns</string>
<key>CFBundleIdentifier</key>
<string>com.blah.ABC</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>My ABC Bundle</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.2.3</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1.2.3</string>
<key>LSHasLocalizedDisplayName</key>
<true/>
<key>NSHumanReadableCopyright</key>
<string>Copyright 2011 John Doe</string>
<key>LSEnvironment</key>
<dict>
<key>CUSTOM_ENVIRONMENT_VARIABLE</key>
<string>The var's value. runme can check these for...</string>
<key>ANOTHER_VARIABLE</key>
<string>... special behavior when launched via the bundle.</string>
<key>AND_SO_ON</key>
<string>LSEnvironment and its dict can be omitted.</string>
</dict>
</dict>
</plist>
runme
Code: Select all
#!/bin/sh
# You can run this script directly in a terminal, but only from a directory
# outside the bundle.
# Chop off a few dirs from the full path used to run the executable.
# Not necessarily an absolute path, but good enough to navigate.
CONTENTDIR="${0%/*/*}";
MAINDIR="${CONTENTDIR%/*/*}";
RESDIR="${CONTENTDIR}/Resources";
CLASSPATH="${RESDIR}/ABC.jar";
CLASSPATH="${CLASSPATH}:${RESDIR}/some-lib.jar";
CLASSPATH="${CLASSPATH}:${RESDIR}/another-lib.jar";
cd "${MAINDIR}";
java -classpath "${CLASSPATH}" -Xdock:icon="${RESDIR}/appIcon.icns" MainClass >log.txt 2>&1;
(see tar below)
To distribute, you'll need a tar command (attached) to set execute permissions (--mode), and by convention, gzip to shrink it.
Code: Select all
tar.exe --create --mode=777 -f "archive.tar" "ABC_v123"
gzip.exe archive.tar
OR
tar --create --mode=777 -f - "ABC_v123" | gzip.exe > archive.tar.gz
The first example's harmless, because they're acting on a filename instead of a stream. Tar writes the file, and gzip quirkily writes a new file with a similar name.
Following that guide you should yield a folder that OSX "helpfully" makes difficult to see inside,
but can be double-clicked to execute 'runme'.