Skip to content

Commit 958118b

Browse files
committed
Add new target 'make dist-osx' to create a .pkg installer for OS X
1 parent 4bc7672 commit 958118b

File tree

2 files changed

+55
-1
lines changed

2 files changed

+55
-1
lines changed

mk/dist.mk

+33-1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ PKG_ICO = $(S)src/etc/pkg/rust-logo.ico
1212
PKG_EXE = $(PKG_DIR)-install.exe
1313
endif
1414

15+
ifeq ($(CFG_OSTYPE), apple-darwin)
16+
PKG_OSX = $(PKG_DIR).pkg
17+
endif
18+
1519
PKG_GITMODULES := $(S)src/libuv $(S)src/llvm $(S)src/gyp $(S)src/compiler-rt
1620

1721
PKG_FILES := \
@@ -41,10 +45,10 @@ PKG_FILES := \
4145

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

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

51+
ifdef CFG_ISCC
4852
%.iss: $(S)src/etc/pkg/%.iss
4953
cp $< $@
5054

@@ -124,3 +128,31 @@ distcheck: $(PKG_TAR)
124128
@echo -----------------------------------------------
125129

126130
endif
131+
132+
ifeq ($(CFG_OSTYPE), apple-darwin)
133+
134+
dist-prepare-osx: PREPARE_HOST=$(CFG_BUILD)
135+
dist-prepare-osx: PREPARE_TARGETS=$(CFG_BUILD)
136+
dist-prepare-osx: PREPARE_DEST_DIR=pkgroot
137+
dist-prepare-osx: PREPARE_STAGE=2
138+
dist-prepare-osx: PREPARE_DIR_CMD=$(DEFAULT_PREPARE_DIR_CMD)
139+
dist-prepare-osx: PREPARE_BIN_CMD=$(DEFAULT_PREPARE_BIN_CMD)
140+
dist-prepare-osx: PREPARE_LIB_CMD=$(DEFAULT_PREPARE_LIB_CMD)
141+
dist-prepare-osx: PREPARE_MAN_CMD=$(DEFAULT_PREPARE_MAN_CMD)
142+
dist-prepare-osx: prepare-base
143+
144+
$(PKG_OSX): Distribution.xml LICENSE.txt dist-prepare-osx
145+
@$(call E, making OS X pkg)
146+
$(Q)pkgbuild --identifier org.rust-lang.rust --root pkgroot rust.pkg
147+
$(Q)productbuild --distribution Distribution.xml --resources . $(PKG_OSX)
148+
$(Q)rm -rf pkgroot rust.pkg
149+
150+
dist-osx: $(PKG_OSX)
151+
152+
distcheck-osx: $(PKG_OSX)
153+
@echo
154+
@echo -----------------------------------------------
155+
@echo $(PKG_OSX) ready for distribution
156+
@echo -----------------------------------------------
157+
158+
endif

src/etc/pkg/Distribution.xml

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?xml version="1.0" encoding="utf-8" standalone="no"?>
2+
<installer-gui-script minSpecVersion="2">
3+
<title>Rust</title>
4+
<license file="LICENSE.txt" mime-type="text/plain"/>
5+
<pkg-ref id="org.rust-lang.rust"/>
6+
<options customize="never" require-scripts="false" hostArchitectures="i386,x86_64"/>
7+
<volume-check>
8+
<allowed-os-versions>
9+
<os-version min="10.7"/>
10+
</allowed-os-versions>
11+
</volume-check>
12+
<choices-outline>
13+
<line choice="default">
14+
<line choice="org.rust-lang.rust"/>
15+
</line>
16+
</choices-outline>
17+
<choice id="default"/>
18+
<choice id="org.rust-lang.rust" visible="false">
19+
<pkg-ref id="org.rust-lang.rust"/>
20+
</choice>
21+
<pkg-ref id="org.rust-lang.rust" version="0" onConclusion="none">rust.pkg</pkg-ref>
22+
</installer-gui-script>

0 commit comments

Comments
 (0)