MacOS .app Bundle

* Add a shell script to generate a MacOS .app bundle for proper
  distribution.
physics
Noah 2019-07-17 18:10:13 -07:00
parent 65a811db0d
commit 32db95ea85
5 changed files with 74 additions and 1 deletions

View File

@ -121,7 +121,7 @@ dist-free: doodads bindata build-free __dist-common
__dist-common:
mkdir -p dist/doodle-$(VERSION)
cp bin/* dist/doodle-$(VERSION)/
cp -r README.md "Open Source Licenses.md" dist/doodle-$(VERSION)/
cp -r README.md Changes.md "Open Source Licenses.md" dist/doodle-$(VERSION)/
cd dist && tar -czvf doodle-$(VERSION).tar.gz doodle-$(VERSION)
cd dist && zip -r doodle-$(VERSION).zip doodle-$(VERSION)

View File

@ -0,0 +1,28 @@
<?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>CFBundleGetInfoString</key>
<string>Project: Doodle</string>
<key>CFBundleExecutable</key>
<string>doodle</string>
<key>CFBundleIdentifier</key>
<string>net.kirsle.ProjectDoodle</string>
<key>CFBundleName</key>
<string>Doodle</string>
<key>CFBundleIconFile</key>
<string>icon.icns</string>
<key>CFBundleShortVersionString</key>
<string>0.01</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>IFMajorVersion</key>
<integer>0</integer>
<key>IFMinorVersion</key>
<integer>1</integer>
<key>NSHighResolutionCapable</key><true/>
<key>NSSupportsAutomaticGraphicsSwitching</key><true/>
</dict>
</plist>

13
etc/macos/README.md Normal file
View File

@ -0,0 +1,13 @@
# Mac OS Configuration
This directory contains a template `.app` folder for Mac OS.
## Creating the ICNS Icon
On Fedora: `dnf install libicns-utils`, Ubuntu `apt install icnsutils`
Command: `png2icns icon.icns 16.png 32.png 128.png 256.png`
Note, 48x48 is also a valid icon size but I didn't make one that size yet.
https://dentrassi.de/2014/02/25/creating-mac-os-x-icons-icns-on-linux/

32
scripts/mac-app.sh Executable file
View File

@ -0,0 +1,32 @@
#!/bin/bash
# mac-app: create Mac OS .app distribution. Run this script from the directory
# containing the doodad binaries (subdirectory of /dist from git repo root)
VERSION=`grep -e 'Version =' ../../pkg/branding/branding.go | head -n 1 | cut -d '"' -f 2`
INSTALL_ROOT="/opt/project-doodle"
APP_NAME="Project Doodle.app"
APP_FOLDER="../../etc/macos/$APP_NAME"
APP_CONTENTS="$APP_NAME/Contents"
if [[ ! -f "./doodle" ]]; then
echo Run this script from the directory containing the Doodle binary.
echo This is usually at /dist/doodle-VERSION/ relative to the git root.
exit 1
fi
if [[ ! -d "$APP_FOLDER" ]]; then
echo "Didn't find Mac .app template relative to current folder."
echo "I looked at $APP_FOLDER."
exit 1
fi
# Copy the Mac app template in to current folder.
echo Copying template app: $APP_FOLDER
cp -r "$APP_FOLDER" ./
mkdir -p "$APP_CONTENTS/MacOS"
mkdir -p "$APP_CONTENTS/Resources"
# Copy binaries to /MacOS
cp doodle doodad "$APP_CONTENTS/MacOS/"
cp *.* "$APP_CONTENTS/Resources/"