2323# * dist-docs - Stage docs for upload
2424
2525PKG_NAME := $(CFG_PACKAGE_NAME )
26+ DOC_PKG_NAME := rust-docs-$(CFG_PACKAGE_VERS )
2627
2728# License suitable for displaying in a popup
2829LICENSE.txt : $(S ) COPYRIGHT $(S ) LICENSE-APACHE $(S ) LICENSE-MIT
@@ -229,7 +230,11 @@ dist-install-dir-$(1): prepare-base-dir-$(1) docs compiler-docs
229230 $$(Q )$$(PREPARE_MAN_CMD ) $$(S ) LICENSE-APACHE $$(PREPARE_DEST_DIR )
230231 $$(Q )$$(PREPARE_MAN_CMD ) $$(S ) LICENSE-MIT $$(PREPARE_DEST_DIR )
231232 $$(Q )$$(PREPARE_MAN_CMD ) $$(S ) README.md $$(PREPARE_DEST_DIR )
232- $$(Q ) [ ! -d doc ] || cp -r doc $$(PREPARE_DEST_DIR )
233+ $$(Q ) mkdir -p $$(PREPARE_DEST_DIR ) /share/doc/rust
234+ $$(Q )$$(PREPARE_MAN_CMD ) $$(S ) COPYRIGHT $$(PREPARE_DEST_DIR ) /share/doc/rust
235+ $$(Q )$$(PREPARE_MAN_CMD ) $$(S ) LICENSE-APACHE $$(PREPARE_DEST_DIR ) /share/doc/rust
236+ $$(Q )$$(PREPARE_MAN_CMD ) $$(S ) LICENSE-MIT $$(PREPARE_DEST_DIR ) /share/doc/rust
237+ $$(Q )$$(PREPARE_MAN_CMD ) $$(S ) README.md $$(PREPARE_DEST_DIR ) /share/doc/rust
233238
234239dist/$$(PKG_NAME ) -$(1 ) .tar.gz: dist-install-dir-$(1 )
235240 @$(call E, build: $$@ )
@@ -247,6 +252,26 @@ dist/$$(PKG_NAME)-$(1).tar.gz: dist-install-dir-$(1)
247252 --legacy-manifest-dirs=rustlib,cargo
248253 $$(Q ) rm -R tmp/dist/$$(PKG_NAME ) -$(1 ) -image
249254
255+ dist-doc-install-dir-$(1 ) : docs compiler-docs
256+ $$(Q ) mkdir -p tmp/dist/$$(DOC_PKG_NAME ) -$(1 ) -image/share/doc/rust
257+ $$(Q ) cp -r doc tmp/dist/$$(DOC_PKG_NAME ) -$(1 ) -image/share/doc/rust/html
258+
259+ dist/$$(DOC_PKG_NAME ) -$(1 ) .tar.gz: dist-doc-install-dir-$(1 )
260+ @$(call E, build: $$@ )
261+ $$(Q )$$(S ) src/rust-installer/gen-installer.sh \
262+ --product-name=Rust-Documentation \
263+ --rel-manifest-dir=rustlib \
264+ --success-message=Rust-documentation-is-installed. \
265+ --image-dir=tmp/dist/$$(DOC_PKG_NAME ) -$(1 ) -image \
266+ --work-dir=tmp/dist \
267+ --output-dir=dist \
268+ --package-name=$$(DOC_PKG_NAME ) -$(1 ) \
269+ --component-name=rust-docs \
270+ --legacy-manifest-dirs=rustlib,cargo \
271+ --bulk-dirs=share/doc/rust/html
272+ $$(Q ) rm -R tmp/dist/$$(DOC_PKG_NAME ) -$(1 ) -image
273+
274+
250275endef
251276
252277ifneq ($(CFG_ENABLE_DIST_HOST_ONLY ) ,)
@@ -259,7 +284,12 @@ endif
259284
260285dist-install-dirs : $(foreach host,$(CFG_HOST ) ,dist-install-dir-$(host ) )
261286
287+ ifneq ($(CFG_DISABLE_DOCS ) ,)
262288dist-tar-bins : $(foreach host,$(CFG_HOST ) ,dist/$(PKG_NAME ) -$(host ) .tar.gz)
289+ else
290+ dist-tar-bins : $(foreach host,$(CFG_HOST ) ,dist/$(PKG_NAME ) -$(host ) .tar.gz) \
291+ $(foreach host,$(CFG_HOST),dist/$(DOC_PKG_NAME)-$(host).tar.gz)
292+ endif
263293
264294# Just try to run the compiler for the build host
265295distcheck-tar-bins : dist-tar-bins
0 commit comments