Skip to content

Commit

Permalink
Add new target 'make dist-osx' to create a .pkg installer for OS X
Browse files Browse the repository at this point in the history
  • Loading branch information
bleibig authored and alexcrichton committed Feb 28, 2014
1 parent 700fd35 commit bbec2c5
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 1 deletion.
34 changes: 33 additions & 1 deletion mk/dist.mk
Expand Up @@ -12,6 +12,10 @@ PKG_ICO = $(S)src/etc/pkg/rust-logo.ico
PKG_EXE = $(PKG_DIR)-install.exe
endif

ifeq ($(CFG_OSTYPE), apple-darwin)
PKG_OSX = $(PKG_DIR).pkg
endif

PKG_GITMODULES := $(S)src/libuv $(S)src/llvm $(S)src/gyp $(S)src/compiler-rt

PKG_FILES := \
Expand Down Expand Up @@ -41,10 +45,10 @@ PKG_FILES := \

UNROOTED_PKG_FILES := $(patsubst $(S)%,./%,$(PKG_FILES))

ifdef CFG_ISCC
LICENSE.txt: $(S)COPYRIGHT $(S)LICENSE-APACHE $(S)LICENSE-MIT
cat $^ > $@

ifdef CFG_ISCC
%.iss: $(S)src/etc/pkg/%.iss
cp $< $@

Expand Down Expand Up @@ -124,3 +128,31 @@ distcheck: $(PKG_TAR)
@echo -----------------------------------------------

endif

ifeq ($(CFG_OSTYPE), apple-darwin)

dist-prepare-osx: PREPARE_HOST=$(CFG_BUILD)
dist-prepare-osx: PREPARE_TARGETS=$(CFG_BUILD)
dist-prepare-osx: PREPARE_DEST_DIR=pkgroot
dist-prepare-osx: PREPARE_STAGE=2
dist-prepare-osx: PREPARE_DIR_CMD=$(DEFAULT_PREPARE_DIR_CMD)
dist-prepare-osx: PREPARE_BIN_CMD=$(DEFAULT_PREPARE_BIN_CMD)
dist-prepare-osx: PREPARE_LIB_CMD=$(DEFAULT_PREPARE_LIB_CMD)
dist-prepare-osx: PREPARE_MAN_CMD=$(DEFAULT_PREPARE_MAN_CMD)
dist-prepare-osx: prepare-base

$(PKG_OSX): Distribution.xml LICENSE.txt dist-prepare-osx
@$(call E, making OS X pkg)
$(Q)pkgbuild --identifier org.rust-lang.rust --root pkgroot rust.pkg
$(Q)productbuild --distribution Distribution.xml --resources . $(PKG_OSX)
$(Q)rm -rf pkgroot rust.pkg

dist-osx: $(PKG_OSX)

distcheck-osx: $(PKG_OSX)
@echo
@echo -----------------------------------------------
@echo $(PKG_OSX) ready for distribution
@echo -----------------------------------------------

endif
22 changes: 22 additions & 0 deletions src/etc/pkg/Distribution.xml
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<installer-gui-script minSpecVersion="2">
<title>Rust</title>
<license file="LICENSE.txt" mime-type="text/plain"/>
<pkg-ref id="org.rust-lang.rust"/>
<options customize="never" require-scripts="false" hostArchitectures="i386,x86_64"/>
<volume-check>
<allowed-os-versions>
<os-version min="10.7"/>
</allowed-os-versions>
</volume-check>
<choices-outline>
<line choice="default">
<line choice="org.rust-lang.rust"/>
</line>
</choices-outline>
<choice id="default"/>
<choice id="org.rust-lang.rust" visible="false">
<pkg-ref id="org.rust-lang.rust"/>
</choice>
<pkg-ref id="org.rust-lang.rust" version="0" onConclusion="none">rust.pkg</pkg-ref>
</installer-gui-script>

0 comments on commit bbec2c5

Please sign in to comment.