Skip to content

Commit

Permalink
Merge #2225 Create and release CKAN.app for Mac OS X
Browse files Browse the repository at this point in the history
  • Loading branch information
politas committed Dec 21, 2017
2 parents 955d1de + a4774d8 commit d43f05b
Show file tree
Hide file tree
Showing 7 changed files with 116 additions and 0 deletions.
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ All notable changes to this project will be documented in this file.
- [GUI] Change icon on filter button to something filter-y (#2156 by: politas; reviewed: HebaruSan)
- [Core] Add include_only fields (#1577, #2170 by: Zane6888, Olympic1; reviewed: politas)
- [ConsoleUI] Create text UI inspired by Turbo Vision (#2177 by: HebaruSan; reviewed: dbent, Maxzhao, pjf, ProfFan, politas)
- [Build] Create and release CKAN.app for Mac OS X (#2225 by: HebaruSan; reviewed: politas)

### Bugfixes

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)

0 comments on commit d43f05b

Please sign in to comment.