Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create and release CKAN.app for Mac OS X #2225

Merged
merged 1 commit into from
Dec 21, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ addons:
- git
- mono-devel
- ca-certificates
# Stuff for building OSX DMGs
- make
- sed
- libplist-utils
- genisoimage

# These commands simulate having a graphical display, which is needed
# for our GUI tests.
Expand All @@ -34,6 +39,9 @@ script:
- ./build --configuration=$BUILD_CONFIGURATION
- ./build test+only --configuration=$BUILD_CONFIGURATION --where="cat!=FlakyNetwork"

before_deploy:
- ./build osx

deploy:
# Releases (which are tagged) go to github
- provider: releases
Expand All @@ -42,6 +50,7 @@ deploy:
secure: AjwbRLStNJZb9hAOLfRLK85KlFo2q2Dr1NKCoDS4elek1nqSiOjL1hH0kDgUMx/PJqQVnFU8tbJPL30t9Pj7jcJhp0LhbbPipQE3TCSpafTneSEbdz5HT+OdghWCZhUhfs07wGNTFUwcAO4WBZ7wv1AnfdfogHdA5RMdykiIl38=
file:
- _build/repack/$BUILD_CONFIGURATION/ckan.exe
- _build/osx/CKAN.dmg
on:
repo: KSP-CKAN/CKAN
tags: true
Expand Down
Binary file modified assets/ckan.icns
Binary file not shown.
9 changes: 9 additions & 0 deletions build.cake
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,15 @@ Task("Ckan")
Task("Netkan")
.IsDependentOn("Repack-Netkan");

Task("osx")
.IsDependentOn("Ckan")
.Does(() => StartProcess("make",
new ProcessSettings { WorkingDirectory = "macosx" }));

Task("osx-clean")
.Does(() => StartProcess("make",
new ProcessSettings { Arguments = "clean", WorkingDirectory = "macosx" }));

Task("Restore-Nuget")
.Does(() =>
{
Expand Down
23 changes: 23 additions & 0 deletions macosx/CKAN
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/sh

# Check El Capitan's mono install location
PATH="$PATH":/usr/local/bin
export PATH

MONO=$(which mono)

if [ -z "$MONO" -o ! -x "$MONO" ]
then
# We could not find mono. The wiki explains how to install.
open 'https://github.com/KSP-CKAN/CKAN/wiki/Installing-CKAN-on-OSX'
else
# Mono found, so we can run CKAN.
# Fetch the path relative to the launch point where this shell script exists. (taken from Tasque & macpack)
APP_PATH=$(echo $0 | awk '{split($0,patharr,"/"); idx=1; while(patharr[idx+3] != "") { if (patharr[idx] != "/") {printf("%s/", patharr[idx]); idx++ }} }')
ASSEMBLY=ckan.exe
MONO_FRAMEWORK_PATH=/Library/Frameworks/Mono.framework/Versions/Current
export DYLD_FALLBACK_LIBRARY_PATH=$APP_PATH/Contents/MacOS:$MONO_FRAMEWORK_PATH/lib:/lib:/usr/lib

cd "$APP_PATH/Contents/MacOS"
exec -a "CKAN" "$MONO" --debug $ASSEMBLY $@
fi
28 changes: 28 additions & 0 deletions macosx/Info.plist.in
Original file line number Diff line number Diff line change
@@ -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>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleExecutable</key>
<string>CKAN</string>
<key>CFBundleIconFile</key>
<string>CKAN.icns</string>
<key>CFBundleIdentifier</key>
<string>org.ksp-ckan.ckan</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>1.0</string>
<key>CFBundleName</key>
<string>CKAN</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>@VERSION@</string>
<key>CFBundleSignature</key>
<string>xmmd</string>
<key>CFBundleVersion</key>
<string>@VERSION@</string>
<key>NSAppleScriptEnabled</key>
<string>NO</string>
</dict>
</plist>
46 changes: 46 additions & 0 deletions macosx/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
.PHONY: clean

NAME:=CKAN
APPNAME:=$(NAME).app
OUTDIR:=../_build/osx
DMGROOT:=$(OUTDIR)/dmg
APPROOT=$(DMGROOT)/$(APPNAME)
DMG:=$(OUTDIR)/$(NAME).dmg
SCRIPTSRC:=CKAN
SCRIPTDEST:=$(APPROOT)/Contents/MacOS/CKAN
EXESRC:=../_build/repack/Release/ckan.exe
EXEDEST:=$(APPROOT)/Contents/MacOS/ckan.exe
ICNSSRC:=../assets/ckan.icns
ICNSDEST:=$(APPROOT)/Contents/Resources/CKAN.icns
PLISTSRC:=Info.plist.in
PLISTTMP:=$(OUTDIR)/Info.plist
PLISTDEST:=$(APPROOT)/Contents/Info.plist
CHANGELOGSRC:=../CHANGELOG.md
VERSION:=$(shell egrep '^\s*\#\#\s+v.*$$' $(CHANGELOGSRC) | head -1 | sed -e 's/^\s*\#\#\s\+v//' )

$(DMG): $(EXEDEST) $(SCRIPTDEST) $(ICNSDEST) $(PLISTDEST)
mkdir -p $(OUTDIR)
genisoimage -V $(NAME) -D -R -apple -no-pad -o $@ $(DMGROOT)

$(EXEDEST): $(EXESRC)
mkdir -p $(shell dirname $@)
cp -l $< $@

$(EXESRC):
cd .. && ./build --configuration=Release

$(SCRIPTDEST): $(SCRIPTSRC)
mkdir -p $(shell dirname $@)
cp -l $< $@

$(ICNSDEST): $(ICNSSRC)
mkdir -p $(shell dirname $@)
cp -l $< $@

$(PLISTDEST): $(PLISTSRC)
mkdir -p $(shell dirname $@)
sed -e 's/@VERSION@/$(VERSION)/' $< > $(PLISTTMP)
plistutil -i $(PLISTTMP) -o $@

clean:
rm -rf $(OUTDIR)