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

Add new target 'make dist-osx' to create a .pkg installer for OS X #12546

Closed
wants to merge 2 commits into from
Closed
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
36 changes: 34 additions & 2 deletions mk/dist.mk
Original file line number Diff line number Diff line change
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 @@ -103,7 +107,7 @@ distcheck: dist

else

dist: $(PKG_TAR)
dist: $(PKG_TAR) $(PKG_OSX)

distcheck: $(PKG_TAR)
$(Q)rm -Rf dist
Expand All @@ -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=tmp/dist/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 tmp/dist/pkgroot rust.pkg
$(Q)productbuild --distribution Distribution.xml --resources . $(PKG_OSX)
$(Q)rm -rf tmp 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
Original file line number Diff line number Diff line change
@@ -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>