Skip to content

Commit

Permalink
Merge pull request #18522 from JuliaLang/sb/no-monotremes
Browse files Browse the repository at this point in the history
Update Mac packaging to work without platypus
  • Loading branch information
tkelman committed Sep 25, 2016
2 parents de0833f + aeadb11 commit e665592
Show file tree
Hide file tree
Showing 6 changed files with 66 additions and 71 deletions.
74 changes: 45 additions & 29 deletions contrib/mac/app/Makefile
Expand Up @@ -5,43 +5,59 @@
JULIAHOME := $(abspath ../../..)
include ../../../Make.inc

JULIA_PKGDIR:=$(shell echo $$JULIA_PKGDIR)
ifeq ($(JULIA_PKGDIR),)
JULIA_PKGDIR:=$(shell echo ~)/.julia
endif

# X.Y.Z or X.Y.Z-hash
DMG_VERSION_SUFFIX:=$(shell [ $$(git describe --tags --exact-match 2>/dev/null) ] && echo $(JULIA_VERSION) || echo $(JULIA_VERSION)-$(JULIA_COMMIT))
JULIA_VERSION_OPT_COMMIT:=$(shell [ $$(git describe --tags --exact-match 2>/dev/null) ] && echo $(JULIA_VERSION) || echo $(JULIA_VERSION)-$(JULIA_COMMIT))

# X.Y
APP_VERSION_SUFFIX:=$(shell echo $(JULIA_VERSION) | grep -o '^[0-9]\+.[0-9]\+')
JULIA_VERSION_MAJOR_MINOR:=$(shell echo $(JULIA_VERSION) | grep -o '^[0-9]\+.[0-9]\+')
JULIA_VERSION_MAJOR_MINOR_PATCH:=$(shell echo $(JULIA_VERSION) | grep -o '^[0-9]\+.[0-9]\+.[0-9]\+')

DMG_NAME:=Julia-$(DMG_VERSION_SUFFIX).dmg
APP_NAME:=Julia-$(APP_VERSION_SUFFIX).app
VOL_NAME:=Julia-$(DMG_VERSION_SUFFIX)
DMG_NAME:=Julia-$(JULIA_VERSION_OPT_COMMIT).dmg
APP_NAME:=Julia-$(JULIA_VERSION_MAJOR_MINOR).app
VOL_NAME:=Julia-$(JULIA_VERSION_OPT_COMMIT)

all: clean $(DMG_NAME)
APP_ID:=org.julialang.launcherapp
APP_COPYRIGHT:=© 2016 The Julia Project

$(DMG_NAME): dmg/$(APP_NAME)
-cp -f julia.icns dmg/.VolumeIcon.icns
-ln -fs /Applications ./dmg/Applications
-chmod 755 ./dmg/$(APP_NAME)/Contents/MacOS/Julia
@echo "We're going to chown the .app file to root:admin now, which requires sudo. You may be asked for your password:"
sudo chown -R root:admin ./dmg/$(APP_NAME)
sudo hdiutil create $(DMG_NAME) -size 500m -ov -volname "$(VOL_NAME)" -imagekey zlib-level=9 -srcfolder dmg

dmg/$(APP_NAME): julia.icns
make -C ../../.. binary-dist
tar zxf ../../../julia-*.tar.gz
mv julia-* julia
-mkdir -p ./julia/libexec ./julia/share
rm -f julia/lib/*.{a,la}
-mkdir dmg
platypus -a Julia -p /bin/bash -V $(JULIA_VERSION) -R -u "The Julia Project" -i julia.icns -Q julia.icns -o "None" -I org.julialang.julia -x -f julia script ./dmg/$(APP_NAME)
-codesign -s "AFB379C0B4CBD9DB9A762797FC2AB5460A2B0DBE" --deep ./dmg/$(APP_NAME)

all: clean $(DMG_NAME)

$(DMG_NAME): dmg/$(APP_NAME) dmg/.VolumeIcon.icns dmg/Applications
hdiutil create $@ -size 500m -ov -volname "$(VOL_NAME)" -imagekey zlib-level=9 -srcfolder dmg

dmg/.VolumeIcon.icns: julia.icns
-mkdir -p dmg
cp -f julia.icns $@

dmg/Applications:
-mkdir -p dmg
ln -fs /Applications $@

dmg/$(APP_NAME): startup.applescript julia.icns
-mkdir -p dmg
osacompile -o $@ startup.applescript
rm $@/Contents/Resources/applet.icns
cp julia.icns $@/Contents/Resources/
plutil -replace CFBundleDevelopmentRegion -string "en" $@/Contents/Info.plist
plutil -insert CFBundleDisplayName -string "Julia" $@/Contents/Info.plist
plutil -replace CFBundleIconFile -string "julia.icns" $@/Contents/Info.plist
plutil -insert CFBundleIdentifier -string "$(APP_ID)" $@/Contents/Info.plist
plutil -replace CFBundleName -string "Julia" $@/Contents/Info.plist
plutil -insert CFBundleShortVersionString -string "$(JULIA_VERSION_MAJOR_MINOR_PATCH)" $@/Contents/Info.plist
plutil -insert CFBundleVersion -string "$(JULIA_VERSION_OPT_COMMIT)" $@/Contents/Info.plist
plutil -insert NSHumanReadableCopyright -string "$(APP_COPYRIGHT)" $@/Contents/Info.plist
-mkdir -p $@/Contents/Resources/julia
make -C $(JULIAHOME) binary-dist
tar zxf $(JULIAHOME)/julia-*.tar.gz -C $@/Contents/Resources/julia --strip-components 1
-codesign -s "AFB379C0B4CBD9DB9A762797FC2AB5460A2B0DBE" --deep $@

ROOTFILES := $(shell ls -ld dmg/*.app *.dmg 2> /dev/null | awk '{print $$3}')
clean:
ifneq ($(filter root,$(ROOTFILES)),)
@echo "We have to use sudo here to clean out folders owned by root. You may be asked for your password"
sudo rm -fr julia dmg *.dmg
sudo rm -rf dmg *.dmg
else
rm -rf dmg *.dmg
endif

.PHONY: clean all
7 changes: 0 additions & 7 deletions contrib/mac/app/README

This file was deleted.

16 changes: 16 additions & 0 deletions contrib/mac/app/README.md
@@ -0,0 +1,16 @@
Julia OS X packaging
====================

This builds the Julia OS X application bundle (.app folder), and stores it in a disk image
(.dmg file).

The application bundle is actually just a bundled applet which opens Terminal.app and
executes the julia binary (which opens the REPL). All the Julia binary files and their
dependencies are bundled inside this.

Run `make` to build.

Other files in this directory

* `startup.applescript` is the script which is compiled to the applet.
* `julia.icns` is the Julia icon file.
26 changes: 0 additions & 26 deletions contrib/mac/app/run-install-name-tool-change.sh

This file was deleted.

9 changes: 0 additions & 9 deletions contrib/mac/app/script

This file was deleted.

5 changes: 5 additions & 0 deletions contrib/mac/app/startup.applescript
@@ -0,0 +1,5 @@
set RootPath to POSIX path of (path to me)
tell application id "com.apple.terminal"
do script ("exec '" & RootPath & "Contents/Resources/julia/bin/julia'")
activate
end tell

0 comments on commit e665592

Please sign in to comment.