2121# * dist-docs - Stage docs for upload
2222
2323PKG_NAME := $(CFG_PACKAGE_NAME )
24+ STD_PKG_NAME := rust-std-$(CFG_PACKAGE_VERS )
2425DOC_PKG_NAME := rust-docs-$(CFG_PACKAGE_VERS )
2526MINGW_PKG_NAME := rust-mingw-$(CFG_PACKAGE_VERS )
2627
@@ -112,19 +113,25 @@ distcheck-tar-src: dist-tar-src
112113# Unix binary installer tarballs
113114# #####################################################################
114115
115- define DEF_INSTALLER
116+ define DEF_START_INSTALLER
117+ dist-install-dir-$(1 ) -%: PREPARE_DIR_CMD=$(DEFAULT_PREPARE_DIR_CMD )
118+ dist-install-dir-$(1 ) -%: PREPARE_BIN_CMD=$(DEFAULT_PREPARE_BIN_CMD )
119+ dist-install-dir-$(1 ) -%: PREPARE_LIB_CMD=$(DEFAULT_PREPARE_LIB_CMD )
120+ dist-install-dir-$(1 ) -%: PREPARE_MAN_CMD=$(DEFAULT_PREPARE_MAN_CMD )
121+ dist-install-dir-$(1 ) -%: PREPARE_CLEAN=true
116122
117123$$(eval $$(call DEF_PREPARE,dir-$(1 ) ) )
124+ endef
125+
126+ $(foreach target,$(CFG_TARGET),\
127+ $(eval $(call DEF_START_INSTALLER,$(target))))
118128
119- dist-install-dir-$(1 ) : PREPARE_HOST=$(1 )
120- dist-install-dir-$(1 ) : PREPARE_TARGETS=$(2 )
121- dist-install-dir-$(1 ) : PREPARE_DEST_DIR=tmp/dist/$$(PKG_NAME ) -$(1 ) -image
122- dist-install-dir-$(1 ) : PREPARE_DIR_CMD=$(DEFAULT_PREPARE_DIR_CMD )
123- dist-install-dir-$(1 ) : PREPARE_BIN_CMD=$(DEFAULT_PREPARE_BIN_CMD )
124- dist-install-dir-$(1 ) : PREPARE_LIB_CMD=$(DEFAULT_PREPARE_LIB_CMD )
125- dist-install-dir-$(1 ) : PREPARE_MAN_CMD=$(DEFAULT_PREPARE_MAN_CMD )
126- dist-install-dir-$(1 ) : PREPARE_CLEAN=true
127- dist-install-dir-$(1 ) : prepare-base-dir-$(1 ) docs
129+ define DEF_INSTALLER
130+
131+ dist-install-dir-$(1 ) -host: PREPARE_HOST=$(1 )
132+ dist-install-dir-$(1 ) -host: PREPARE_TARGETS=$(2 )
133+ dist-install-dir-$(1 ) -host: PREPARE_DEST_DIR=tmp/dist/$$(PKG_NAME ) -$(1 ) -image
134+ dist-install-dir-$(1 ) -host: prepare-base-dir-$(1 ) -host docs
128135 $$(Q ) mkdir -p $$(PREPARE_DEST_DIR ) /share/doc/rust
129136 $$(Q )$$(PREPARE_MAN_CMD ) $$(S ) COPYRIGHT $$(PREPARE_DEST_DIR ) /share/doc/rust
130137 $$(Q )$$(PREPARE_MAN_CMD ) $$(S ) LICENSE-APACHE $$(PREPARE_DEST_DIR ) /share/doc/rust
@@ -141,14 +148,27 @@ prepare-overlay-$(1):
141148# This tiny morsel of metadata is used by rust-packaging
142149 $$(Q ) echo "$(CFG_VERSION ) " > tmp/dist/$$(PKG_NAME ) -$(1 ) -overlay/version
143150
144- dist/$$(PKG_NAME ) -$(1 ) .tar.gz: dist-install-dir-$(1 ) prepare-overlay-$(1 )
151+ dist/$$(PKG_NAME ) -$(1 ) .tar.gz: dist-install-dir-$(1 ) -host prepare-overlay-$(1 )
145152 @$(call E, build: $$@ )
146- # Copy essential gcc components into installer
147- ifdef CFG_WINDOWSY_$(1)
148- ifeq ($$(findstring gnu,$(1 ) ) ,gnu)
149- $$(Q)rm -Rf tmp/dist/win-rust-gcc-$(1)
150- $$(Q)$$(CFG_PYTHON) $$(S)src/etc/make-win-dist.py tmp/dist/$$(PKG_NAME)-$(1)-image tmp/dist/win-rust-gcc-$(1) $(1)
151- $$(Q)cp -r $$(S)src/etc/third-party tmp/dist/$$(PKG_NAME)-$(1)-image/share/doc/
153+ # On a 32-bit MinGW target we've got a few runtime DLL dependencies that we need
154+ # to include. THe first argument to `make-win-dist` is where to put these DLLs
155+ # (the image we're creating) and the second argument is a junk directory to
156+ # ignore all the other MinGW stuff the script creates.
157+ ifeq ($(2 ) ,i686-pc-windows-gnu)
158+ $$(Q)rm -Rf tmp/dist/win-rust-gcc-$(2)
159+ $$(Q)$$(CFG_PYTHON) $$(S)src/etc/make-win-dist.py \
160+ tmp/dist/$$(STD_PKG_NAME)-$(2)-image \
161+ tmp/dist/win-rust-gcc-$(2) $(2)
162+ endif
163+ # On 32-bit MinGW we're always including a DLL which needs some extra licenses
164+ # to distribute. On 64-bit MinGW we don't actually distribute anything requiring
165+ # us to distribute a license but it's likely that the install will *also*
166+ # include the rust-mingw package down below, which also need licenses, so to be
167+ # safe we just inlude it here in all MinGW packages.
168+ ifdef CFG_WINDOWSY_$(2)
169+ ifeq ($$(findstring $(2 ) ,gnu) ,gnu)
170+ $$(Q)cp -r $$(S)src/etc/third-party \
171+ tmp/dist/$$(STD_PKG_NAME)-$(2)-image/share/doc/
152172endif
153173endif
154174 $$(Q )$$(S ) src/rust-installer/gen-installer.sh \
@@ -183,11 +203,16 @@ dist/$$(DOC_PKG_NAME)-$(1).tar.gz: dist-doc-install-dir-$(1)
183203 --bulk-dirs=share/doc/rust/html
184204 $$(Q ) rm -R tmp/dist/$$(DOC_PKG_NAME ) -$(1 ) -image
185205
206+ # Creates the rust-mingw package, and the first argument to make-win-dist is a
207+ # "temporary directory" which is just thrown away (this contains the runtime
208+ # DLLs included in the rustc package above) and the second argument is where to
209+ # place all the MinGW components (which is what we want).
186210dist-mingw-install-dir-$(1 ) :
187211 $$(Q ) mkdir -p tmp/dist/rust-mingw-tmp-$(1 ) -image
188212 $$(Q ) rm -Rf tmp/dist/$$(MINGW_PKG_NAME ) -$(1 ) -image
189213 $$(Q )$$(CFG_PYTHON ) $$(S ) src/etc/make-win-dist.py \
190- tmp/dist/rust-mingw-tmp-$(1 ) -image tmp/dist/$$(MINGW_PKG_NAME ) -$(1 ) -image $(1 )
214+ tmp/dist/rust-mingw-tmp-$(1 ) -image \
215+ tmp/dist/$$(MINGW_PKG_NAME ) -$(1 ) -image $(1 )
191216
192217dist/$$(MINGW_PKG_NAME ) -$(1 ) .tar.gz: dist-mingw-install-dir-$(1 )
193218 @$(call E, build: $$@ )
@@ -205,15 +230,34 @@ dist/$$(MINGW_PKG_NAME)-$(1).tar.gz: dist-mingw-install-dir-$(1)
205230
206231endef
207232
208- ifneq ($(CFG_ENABLE_DIST_HOST_ONLY ) ,)
209- $(foreach host,$(CFG_HOST),\
210- $(eval $(call DEF_INSTALLER,$(host),$(host))))
211- else
212- $(foreach host,$(CFG_HOST),\
213- $(eval $(call DEF_INSTALLER,$(host),$(CFG_TARGET))))
214- endif
233+ # $(1) - host
234+ # $(2) - target
235+ define DEF_INSTALLER_TARGETS
236+
237+ dist-install-dir-$(2 ) -target: PREPARE_HOST=$(1 )
238+ dist-install-dir-$(2 ) -target: PREPARE_TARGETS=$(2 )
239+ dist-install-dir-$(2 ) -target: PREPARE_DEST_DIR=tmp/dist/$$(STD_PKG_NAME ) -$(2 ) -image
240+ dist-install-dir-$(2 ) -target: prepare-base-dir-$(2 ) -target
215241
216- dist-install-dirs : $(foreach host,$(CFG_HOST ) ,dist-install-dir-$(host ) )
242+ dist/$$(STD_PKG_NAME ) -$(2 ) .tar.gz: dist-install-dir-$(2 ) -target
243+ @$$(call E, build: $$@ )
244+ $$(Q )$$(S ) src/rust-installer/gen-installer.sh \
245+ --product-name=Rust \
246+ --rel-manifest-dir=rustlib \
247+ --success-message=std-is-standing-at-the-ready. \
248+ --image-dir=tmp/dist/$$(STD_PKG_NAME ) -$(2 ) -image \
249+ --work-dir=tmp/dist \
250+ --output-dir=dist \
251+ --package-name=$$(STD_PKG_NAME ) -$(2 ) \
252+ --component-name=rust-std-$(2 ) \
253+ --legacy-manifest-dirs=rustlib,cargo
254+ $$(Q ) rm -R tmp/dist/$$(STD_PKG_NAME ) -$(2 ) -image
255+ endef
256+
257+ $(foreach host,$(CFG_HOST),\
258+ $(eval $(call DEF_INSTALLER,$(host))))
259+ $(foreach target,$(CFG_TARGET),\
260+ $(eval $(call DEF_INSTALLER_TARGETS,$(CFG_BUILD),$(target))))
217261
218262ifdef CFG_WINDOWSY_$(CFG_BUILD)
219263define BUILD_MINGW_TARBALL
@@ -230,7 +274,9 @@ ifeq ($(CFG_DISABLE_DOCS),)
230274MAYBE_DOC_TARBALLS =$(foreach host,$(CFG_HOST ) ,dist/$(DOC_PKG_NAME ) -$(host ) .tar.gz)
231275endif
232276
233- dist-tar-bins : $(foreach host,$(CFG_HOST ) ,dist/$(PKG_NAME ) -$(host ) .tar.gz) \
277+ dist-tar-bins : \
278+ $(foreach host,$(CFG_HOST ) ,dist/$(PKG_NAME ) -$(host ) .tar.gz) \
279+ $(foreach target,$(CFG_TARGET ) ,dist/$(STD_PKG_NAME ) -$(target ) .tar.gz) \
234280 $(MAYBE_DOC_TARBALLS ) $(MAYBE_MINGW_TARBALLS )
235281
236282# Just try to run the compiler for the build host
0 commit comments