auto merge of #13063 : brson/rust/dist, r=alexcrichton

Several things here:

* Cleanup
* Fix build targets for building .pkg so that it works and works for all hosts
* Adds support for nightly artifacts
* Put docs in a location suitable for upload to s3 during 'make dist'
* Add coverage of unix binary installers to 'distcheck'
* Fix 'distcheck'
* Change 'dist' to build source tarballs, binary tarballs and OS X packages
This commit is contained in:
bors 2014-03-25 00:01:52 -07:00
commit b1091c3141
6 changed files with 312 additions and 180 deletions

View File

@ -43,7 +43,8 @@ clean-misc:
$(Q)rm -f $(RUSTLLVM_LIB_OBJS) $(RUSTLLVM_OBJS_OBJS) $(RUSTLLVM_DEF)
$(Q)rm -Rf $(GENERATED)
$(Q)rm -Rf tmp/*
$(Q)rm -Rf rust-stage0-*.tar.bz2 $(PKG_NAME)-*.tar.gz $(PKG_NAME)-*.exe dist
$(Q)rm -Rf rust-stage0-*.tar.bz2 $(PKG_NAME)-*.tar.gz $(PKG_NAME)-*.exe
$(Q)rm -Rf dist/*
$(Q)rm -Rf doc
define CLEAN_GENERIC

View File

@ -1,23 +1,41 @@
# Copyright 2014 The Rust Project Developers. See the COPYRIGHT
# file at the top-level directory of this distribution and at
# http://rust-lang.org/COPYRIGHT.
#
# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
# option. This file may not be copied, modified, or distributed
# except according to those terms.
######################################################################
# Distribution
######################################################################
PKG_NAME := rust
PKG_DIR = $(PKG_NAME)-$(CFG_RELEASE)
PKG_TAR = dist/$(PKG_DIR).tar.gz
# Primary targets:
#
# * dist - make all distribution artifacts
# * distcheck - sanity check dist artifacts
# * dist-tar-src - source tarballs
# * dist-win - Windows exe installers
# * dist-osx - OS X .pkg installers
# * dist-tar-bins - Ad-hoc Unix binary installers
# * dist-docs - Stage docs for upload
ifdef CFG_ISCC
PKG_ISS = $(wildcard $(S)src/etc/pkg/*.iss)
PKG_ICO = $(S)src/etc/pkg/rust-logo.ico
PKG_EXE = dist/$(PKG_DIR)-install.exe
endif
PKG_NAME = $(CFG_PACKAGE_NAME)
ifeq ($(CFG_OSTYPE), apple-darwin)
PKG_OSX = dist/$(PKG_DIR).pkg
endif
# License suitable for displaying in a popup
LICENSE.txt: $(S)COPYRIGHT $(S)LICENSE-APACHE $(S)LICENSE-MIT
cat $^ > $@
######################################################################
# Source tarball
######################################################################
PKG_TAR = dist/$(PKG_NAME).tar.gz
PKG_GITMODULES := $(S)src/libuv $(S)src/llvm $(S)src/gyp $(S)src/compiler-rt
PKG_FILES := \
$(S)COPYRIGHT \
$(S)LICENSE-APACHE \
@ -40,44 +58,15 @@ PKG_FILES := \
snapshots.txt \
test) \
$(PKG_GITMODULES) \
$(filter-out Makefile config.stamp config.mk, \
$(MKFILE_DEPS))
$(filter-out config.stamp, \
$(MKFILES_FOR_TARBALL))
UNROOTED_PKG_FILES := $(patsubst $(S)%,./%,$(PKG_FILES))
LICENSE.txt: $(S)COPYRIGHT $(S)LICENSE-APACHE $(S)LICENSE-MIT
cat $^ > $@
ifdef CFG_ISCC
%.iss: $(S)src/etc/pkg/%.iss
cp $< $@
%.ico: $(S)src/etc/pkg/%.ico
cp $< $@
$(PKG_EXE): rust.iss modpath.iss LICENSE.txt rust-logo.ico \
$(PKG_FILES) $(CSREQ3_T_$(CFG_BUILD)_H_$(CFG_BUILD)) \
dist-prepare-win
$(CFG_PYTHON) $(S)src/etc/copy-runtime-deps.py tmp/dist/win/bin
@$(call E, ISCC: $@)
$(Q)"$(CFG_ISCC)" $<
dist-prepare-win: PREPARE_HOST=$(CFG_BUILD)
dist-prepare-win: PREPARE_TARGETS=$(CFG_BUILD)
dist-prepare-win: PREPARE_DEST_DIR=tmp/dist/win
dist-prepare-win: PREPARE_DIR_CMD=$(DEFAULT_PREPARE_DIR_CMD)
dist-prepare-win: PREPARE_BIN_CMD=$(DEFAULT_PREPARE_BIN_CMD)
dist-prepare-win: PREPARE_LIB_CMD=$(DEFAULT_PREPARE_LIB_CMD)
dist-prepare-win: PREPARE_MAN_CMD=$(DEFAULT_PREPARE_MAN_CMD)
dist-prepare-win: PREPARE_CLEAN=true
dist-prepare-win: prepare-base
endif
$(PKG_TAR): $(PKG_FILES)
@$(call E, making dist dir)
$(Q)rm -Rf tmp/dist/$(PKG_DIR)
$(Q)mkdir -p tmp/dist/$(PKG_DIR)
$(Q)rm -Rf tmp/dist/$(PKG_NAME)
$(Q)mkdir -p tmp/dist/$(PKG_NAME)
$(Q)tar \
-C $(S) \
--exclude-vcs \
@ -88,87 +77,128 @@ $(PKG_TAR): $(PKG_FILES)
--exclude=*/llvm/test/*/*/*.ll \
--exclude=*/llvm/test/*/*/*.td \
--exclude=*/llvm/test/*/*/*.s \
-c $(UNROOTED_PKG_FILES) | tar -x -C tmp/dist/$(PKG_DIR)
$(Q)tar -czf $(PKG_TAR) -C tmp/dist $(PKG_DIR)
$(Q)rm -Rf tmp/dist/$(PKG_DIR)
-c $(UNROOTED_PKG_FILES) | tar -x -C tmp/dist/$(PKG_NAME)
$(Q)tar -czf $(PKG_TAR) -C tmp/dist $(PKG_NAME)
$(Q)rm -Rf tmp/dist/$(PKG_NAME)
.PHONY: dist distcheck
dist-tar-src: $(PKG_TAR)
ifdef CFG_WINDOWSY_$(CFG_BUILD)
distcheck-tar-src: dist-tar-src
$(Q)rm -Rf tmp/distcheck/$(PKG_NAME)
$(Q)rm -Rf tmp/distcheck/srccheck
$(Q)mkdir -p tmp/distcheck
@$(call E, unpacking $(PKG_TAR) in tmp/distcheck/$(PKG_NAME))
$(Q)cd tmp/distcheck && tar -xzf ../../$(PKG_TAR)
@$(call E, configuring in tmp/distcheck/srccheck)
$(Q)mkdir -p tmp/distcheck/srccheck
$(Q)cd tmp/distcheck/srccheck && ../$(PKG_NAME)/configure
@$(call E, making 'check' in tmp/distcheck/srccheck)
$(Q)+make -C tmp/distcheck/srccheck check
@$(call E, making 'clean' in tmp/distcheck/srccheck)
$(Q)+make -C tmp/distcheck/srccheck clean
$(Q)rm -Rf tmp/distcheck/$(PKG_NAME)
$(Q)rm -Rf tmp/distcheck/srccheck
dist: $(PKG_EXE)
distcheck: dist
@echo
@echo -----------------------------------------------
@echo $(PKG_EXE) ready for distribution
@echo -----------------------------------------------
######################################################################
# Windows .exe installer
######################################################################
else
# FIXME Needs to support all hosts, but making rust.iss compatible looks like a chore
dist: $(PKG_TAR) $(PKG_OSX)
ifdef CFG_ISCC
distcheck: $(PKG_TAR)
$(Q)rm -Rf dist
$(Q)mkdir -p dist
@$(call E, unpacking $(PKG_TAR) in dist/$(PKG_DIR))
$(Q)cd dist && tar -xzf ../$(PKG_TAR)
@$(call E, configuring in dist/$(PKG_DIR)-build)
$(Q)mkdir -p dist/$(PKG_DIR)-build
$(Q)cd dist/$(PKG_DIR)-build && ../$(PKG_DIR)/configure
@$(call E, making 'check' in dist/$(PKG_DIR)-build)
$(Q)+make -C dist/$(PKG_DIR)-build check
@$(call E, making 'clean' in dist/$(PKG_DIR)-build)
$(Q)+make -C dist/$(PKG_DIR)-build clean
$(Q)rm -Rf dist
@echo
@echo -----------------------------------------------
@echo $(PKG_TAR) ready for distribution
@echo -----------------------------------------------
PKG_EXE = dist/$(PKG_NAME)-install.exe
%.iss: $(S)src/etc/pkg/%.iss
cp $< $@
%.ico: $(S)src/etc/pkg/%.ico
cp $< $@
$(PKG_EXE): rust.iss modpath.iss LICENSE.txt rust-logo.ico \
$(CSREQ3_T_$(CFG_BUILD)_H_$(CFG_BUILD)) \
dist-prepare-win
$(CFG_PYTHON) $(S)src/etc/copy-runtime-deps.py tmp/dist/win/bin
@$(call E, ISCC: $@)
$(Q)"$(CFG_ISCC)" $<
$(eval $(call DEF_PREPARE,win))
dist-prepare-win: PREPARE_HOST=$(CFG_BUILD)
dist-prepare-win: PREPARE_TARGETS=$(CFG_BUILD)
dist-prepare-win: PREPARE_DEST_DIR=tmp/dist/win
dist-prepare-win: PREPARE_DIR_CMD=$(DEFAULT_PREPARE_DIR_CMD)
dist-prepare-win: PREPARE_BIN_CMD=$(DEFAULT_PREPARE_BIN_CMD)
dist-prepare-win: PREPARE_LIB_CMD=$(DEFAULT_PREPARE_LIB_CMD)
dist-prepare-win: PREPARE_MAN_CMD=$(DEFAULT_PREPARE_MAN_CMD)
dist-prepare-win: PREPARE_CLEAN=true
dist-prepare-win: prepare-base-win
endif
dist-win: $(PKG_EXE)
distcheck-win: dist-win
######################################################################
# OS X .pkg installer
######################################################################
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_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
define DEF_OSX_PKG
$(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)
$$(eval $$(call DEF_PREPARE,osx-$(1)))
dist-prepare-osx-$(1): PREPARE_HOST=$(1)
dist-prepare-osx-$(1): PREPARE_TARGETS=$(1)
dist-prepare-osx-$(1): PREPARE_DEST_DIR=tmp/dist/pkgroot-$(1)
dist-prepare-osx-$(1): PREPARE_DIR_CMD=$(DEFAULT_PREPARE_DIR_CMD)
dist-prepare-osx-$(1): PREPARE_BIN_CMD=$(DEFAULT_PREPARE_BIN_CMD)
dist-prepare-osx-$(1): PREPARE_LIB_CMD=$(DEFAULT_PREPARE_LIB_CMD)
dist-prepare-osx-$(1): PREPARE_MAN_CMD=$(DEFAULT_PREPARE_MAN_CMD)
dist-prepare-osx-$(1): prepare-base-osx-$(1)
dist/$(PKG_NAME)-$(1).pkg: $(S)src/etc/pkg/Distribution.xml LICENSE.txt dist-prepare-osx-$(1)
@$$(call E, making OS X pkg)
$(Q)pkgbuild --identifier org.rust-lang.rust --root tmp/dist/pkgroot-$(1) rust.pkg
$(Q)productbuild --distribution $(S)src/etc/pkg/Distribution.xml --resources . dist/$(PKG_NAME)-$(1).pkg
$(Q)rm -rf tmp rust.pkg
dist-osx: $(PKG_OSX)
endef
distcheck-osx: $(PKG_OSX)
@echo
@echo -----------------------------------------------
@echo $(PKG_OSX) ready for distribution
@echo -----------------------------------------------
$(foreach host,$(CFG_HOST),$(eval $(call DEF_OSX_PKG,$(host))))
dist-osx: $(foreach host,$(CFG_HOST),dist/$(PKG_NAME)-$(host).pkg)
else
dist-osx:
endif
dist-install-dir: $(foreach host,$(CFG_HOST),dist-install-dir-$(host))
# FIXME should do something
distcheck-osx: dist-osx
dist-tar-bins: $(foreach host,$(CFG_HOST),dist/$(PKG_DIR)-$(host).tar.gz)
######################################################################
# Unix binary installer tarballs
######################################################################
define DEF_INSTALLER
$$(eval $$(call DEF_PREPARE,dir-$(1)))
dist-install-dir-$(1): PREPARE_HOST=$(1)
dist-install-dir-$(1): PREPARE_TARGETS=$(1)
dist-install-dir-$(1): PREPARE_DEST_DIR=tmp/dist/$$(PKG_DIR)-$(1)
dist-install-dir-$(1): PREPARE_DEST_DIR=tmp/dist/$$(PKG_NAME)-$(1)
dist-install-dir-$(1): PREPARE_DIR_CMD=$(DEFAULT_PREPARE_DIR_CMD)
dist-install-dir-$(1): PREPARE_BIN_CMD=$(DEFAULT_PREPARE_BIN_CMD)
dist-install-dir-$(1): PREPARE_LIB_CMD=$(DEFAULT_PREPARE_LIB_CMD)
dist-install-dir-$(1): PREPARE_MAN_CMD=$(DEFAULT_PREPARE_MAN_CMD)
dist-install-dir-$(1): PREPARE_CLEAN=true
dist-install-dir-$(1): prepare-base
dist-install-dir-$(1): prepare-base-dir-$(1)
$$(Q)(cd $$(PREPARE_DEST_DIR)/ && find -type f) \
> $$(PREPARE_DEST_DIR)/$$(CFG_LIBDIR_RELATIVE)/$$(CFG_RUSTLIBDIR)/manifest
$$(Q)$$(PREPARE_MAN_CMD) $$(S)COPYRIGHT $$(PREPARE_DEST_DIR)
@ -177,11 +207,71 @@ dist-install-dir-$(1): prepare-base
$$(Q)$$(PREPARE_MAN_CMD) $$(S)README.md $$(PREPARE_DEST_DIR)
$$(Q)$$(PREPARE_BIN_CMD) $$(S)src/etc/install.sh $$(PREPARE_DEST_DIR)
dist/$$(PKG_DIR)-$(1).tar.gz: dist-install-dir-$(1)
dist/$$(PKG_NAME)-$(1).tar.gz: dist-install-dir-$(1)
@$(call E, build: $$@)
$$(Q)tar -czf dist/$$(PKG_DIR)-$(1).tar.gz -C tmp/dist $$(PKG_DIR)-$(1)
$$(Q)tar -czf dist/$$(PKG_NAME)-$(1).tar.gz -C tmp/dist $$(PKG_NAME)-$(1)
endef
$(foreach host,$(CFG_HOST),\
$(eval $(call DEF_INSTALLER,$(host))))
dist-install-dirs: $(foreach host,$(CFG_HOST),dist-install-dir-$(host))
dist-tar-bins: $(foreach host,$(CFG_HOST),dist/$(PKG_NAME)-$(host).tar.gz)
# Just try to run the compiler for the build host
distcheck-tar-bins: dist-tar-bins
@$(call E, checking binary tarball)
$(Q)rm -Rf tmp/distcheck/$(PKG_NAME)-$(CFG_BUILD)
$(Q)rm -Rf tmp/distcheck/tarbininstall
$(Q)mkdir -p tmp/distcheck
$(Q)cd tmp/distcheck && tar -xzf ../../dist/$(PKG_NAME)-$(CFG_BUILD).tar.gz
$(Q)mkdir -p tmp/distcheck/tarbininstall
$(Q)sh tmp/distcheck/$(PKG_NAME)-$(CFG_BUILD)/install.sh --prefix=tmp/distcheck/tarbininstall
$(Q)tmp/distcheck/tarbininstall/bin/rustc --version
$(Q)rm -Rf tmp/distcheck/$(PKG_NAME)-$(CFG_BUILD)
$(Q)rm -Rf tmp/distcheck/tarbininstall
######################################################################
# Docs
######################################################################
# Just copy the docs to a folder under dist with the appropriate name
# for uploading to S3
dist-docs: docs compiler-docs
$(Q) rm -Rf dist/doc
$(Q) mkdir -p dist/doc/
$(Q) cp -r doc dist/doc/$(CFG_PACKAGE_VERS)
distcheck-docs: dist-docs
######################################################################
# Primary targets (dist, distcheck)
######################################################################
ifdef CFG_WINDOWSY_$(CFG_BUILD)
dist: dist-win
distcheck: distcheck-win
$(Q)rm -Rf tmp/distcheck
@echo
@echo -----------------------------------------------
@echo "Rust ready for distribution (see ./dist)"
@echo -----------------------------------------------
else
dist: dist-tar-src dist-osx dist-tar-bins dist-docs
distcheck: distcheck-tar-src distcheck-osx distcheck-tar-bins distcheck-docs
$(Q)rm -Rf tmp/distcheck
@echo
@echo -----------------------------------------------
@echo "Rust ready for distribution (see ./dist)"
@echo -----------------------------------------------
endif
.PHONY: dist distcheck

View File

@ -13,9 +13,25 @@
######################################################################
# The version number
CFG_RELEASE = 0.10-pre
CFG_RELEASE_NUM=0.10
CFG_RELEASE_LABEL=-pre
# The version string plus commit information
ifndef CFG_NIGHTLY
# This is the normal version string
CFG_RELEASE=$(CFG_RELEASE_NUM)$(CFG_RELEASE_LABEL)
CFG_PACKAGE_VERS=$(CFG_RELEASE)
else
# Modify the version label for nightly builds
CFG_RELEASE=$(CFG_RELEASE_NUM)$(CFG_RELEASE_LABEL)-nightly
# When building nightly distributables just reuse the same "rust-nightly" name
# so when we upload we'll always override the previous nighly. This doesn't actually
# impact the version reported by rustc - it's just for file naming.
CFG_PACKAGE_VERS=nightly
endif
# The name of the package to use for creating tarballs, installers etc.
CFG_PACKAGE_NAME=rust-$(CFG_PACKAGE_VERS)
# The version string plus commit information - this is what rustc reports
CFG_VERSION = $(CFG_RELEASE)
CFG_GIT_DIR := $(CFG_SRC_DIR).git
# since $(CFG_GIT) may contain spaces (especially on Windows),
@ -32,9 +48,9 @@ ifneq ($(wildcard $(subst $(SPACE),\$(SPACE),$(CFG_GIT_DIR))),)
endif
endif
# windows exe's need numeric versions - don't use anything but
# Windows exe's need numeric versions - don't use anything but
# numbers and dots here
CFG_VERSION_WIN = $(subst -pre,,$(CFG_RELEASE))
CFG_VERSION_WIN = $(CFG_RELEASE_NUM)
######################################################################
@ -45,10 +61,10 @@ CFG_VERSION_WIN = $(subst -pre,,$(CFG_RELEASE))
# and include all of the .d files in one fell swoop.
ALL_OBJ_FILES :=
MKFILE_DEPS := config.stamp $(call rwildcard,$(CFG_SRC_DIR)mk/,*)
MKFILES_FOR_TARBALL:=$(MKFILE_DEPS)
ifneq ($(NO_MKFILE_DEPS),)
MKFILE_DEPS :=
else
MKFILE_DEPS := config.stamp $(call rwildcard,$(CFG_SRC_DIR)mk/,*)
endif
NON_BUILD_HOST = $(filter-out $(CFG_BUILD),$(CFG_HOST))
NON_BUILD_TARGET = $(filter-out $(CFG_BUILD),$(CFG_TARGET))
@ -259,6 +275,7 @@ export CFG_BUILD_DIR
export CFG_VERSION
export CFG_VERSION_WIN
export CFG_RELEASE
export CFG_PACKAGE_NAME
export CFG_BUILD
export CFG_LLVM_ROOT
export CFG_ENABLE_MINGW_CROSS

View File

@ -28,23 +28,6 @@ else
PREPARE_STAGE=2
endif
prepare: PREPARE_DIR_CMD=$(DEFAULT_PREPARE_DIR_CMD)
prepare: PREPARE_BIN_CMD=$(DEFAULT_PREPARE_BIN_CMD)
prepare: PREPARE_LIB_CMD=$(DEFAULT_PREPARE_LIB_CMD)
prepare: PREPARE_MAN_CMD=$(DEFAULT_PREPARE_MAN_CMD)
prepare: prepare-base
prepare-base: PREPARE_SOURCE_DIR=$(PREPARE_HOST)/stage$(PREPARE_STAGE)
prepare-base: PREPARE_SOURCE_BIN_DIR=$(PREPARE_SOURCE_DIR)/bin
prepare-base: PREPARE_SOURCE_LIB_DIR=$(PREPARE_SOURCE_DIR)/$(CFG_LIBDIR_RELATIVE)
prepare-base: PREPARE_SOURCE_MAN_DIR=$(S)/man
prepare-base: PREPARE_DEST_BIN_DIR=$(PREPARE_DEST_DIR)/bin
prepare-base: PREPARE_DEST_LIB_DIR=$(PREPARE_DEST_DIR)/$(CFG_LIBDIR_RELATIVE)
prepare-base: PREPARE_DEST_MAN_DIR=$(PREPARE_DEST_DIR)/man/man1
prepare-base: prepare-host prepare-targets
prepare-everything: prepare-host prepare-targets
DEFAULT_PREPARE_DIR_CMD = umask 022 && mkdir -p
DEFAULT_PREPARE_BIN_CMD = install -m755
DEFAULT_PREPARE_LIB_CMD = install -m644
@ -93,29 +76,17 @@ define PREPARE_MAN
$(Q)$(PREPARE_MAN_CMD) $(PREPARE_SOURCE_MAN_DIR)/$(1) $(PREPARE_DEST_MAN_DIR)/$(1)
endef
PREPARE_TOOLS = $(filter-out compiletest, $(TOOLS))
prepare-host: prepare-host-tools
prepare-host-tools: \
$(foreach tool, $(PREPARE_TOOLS),\
$(foreach host,$(CFG_HOST),\
prepare-host-tool-$(tool)-$(PREPARE_STAGE)-$(host)))
prepare-host-dirs: prepare-maybe-clean
$(call PREPARE_DIR,$(PREPARE_DEST_BIN_DIR))
$(call PREPARE_DIR,$(PREPARE_DEST_LIB_DIR))
$(call PREPARE_DIR,$(PREPARE_DEST_MAN_DIR))
# $(1) is tool
# $(2) is stage
# $(3) is host
# $(4) tag
define DEF_PREPARE_HOST_TOOL
prepare-host-tool-$(1)-$(2)-$(3): prepare-maybe-clean \
$$(foreach dep,$$(TOOL_DEPS_$(1)),prepare-host-lib-$$(dep)-$(2)-$(3)) \
$$(HBIN$(2)_H_$(3))/$(1)$$(X_$(3)) \
prepare-host-dirs
prepare-host-tool-$(1)-$(2)-$(3)-$(4): prepare-maybe-clean-$(4) \
$$(foreach dep,$$(TOOL_DEPS_$(1)),prepare-host-lib-$$(dep)-$(2)-$(3)-$(4)) \
prepare-host-dirs-$(4)
$$(if $$(findstring $(2), $$(PREPARE_STAGE)),\
$$(if $$(findstring $(3), $$(PREPARE_HOST)),\
$$(call PREPARE_BIN,$(1)$$(X_$$(PREPARE_HOST))),),)
@ -124,45 +95,35 @@ prepare-host-tool-$(1)-$(2)-$(3): prepare-maybe-clean \
$$(call PREPARE_MAN,$(1).1),),)
endef
$(foreach tool,$(PREPARE_TOOLS),\
$(foreach host,$(CFG_HOST),\
$(eval $(call DEF_PREPARE_HOST_TOOL,$(tool),$(PREPARE_STAGE),$(host)))))
# For host libraries only install dylibs, not rlibs since the host libs are only
# used to support rustc and rustc uses dynamic linking
#
# $(1) is tool
# $(2) is stage
# $(3) is host
# $(4) tag
define DEF_PREPARE_HOST_LIB
prepare-host-lib-$(1)-$(2)-$(3): PREPARE_WORKING_SOURCE_LIB_DIR=$$(PREPARE_SOURCE_LIB_DIR)
prepare-host-lib-$(1)-$(2)-$(3): PREPARE_WORKING_DEST_LIB_DIR=$$(PREPARE_DEST_LIB_DIR)
prepare-host-lib-$(1)-$(2)-$(3): prepare-maybe-clean \
$$(foreach dep,$$(RUST_DEPS_$(1)),prepare-host-lib-$$(dep)-$(2)-$(3))\
prepare-host-lib-$(1)-$(2)-$(3)-$(4): PREPARE_WORKING_SOURCE_LIB_DIR=$$(PREPARE_SOURCE_LIB_DIR)
prepare-host-lib-$(1)-$(2)-$(3)-$(4): PREPARE_WORKING_DEST_LIB_DIR=$$(PREPARE_DEST_LIB_DIR)
prepare-host-lib-$(1)-$(2)-$(3)-$(4): prepare-maybe-clean-$(4) \
$$(foreach dep,$$(RUST_DEPS_$(1)),prepare-host-lib-$$(dep)-$(2)-$(3)-$(4))\
$$(HLIB$(2)_H_$(3))/stamp.$(1) \
prepare-host-dirs
prepare-host-dirs-$(4)
$$(if $$(findstring $(2), $$(PREPARE_STAGE)),\
$$(if $$(findstring $(3), $$(PREPARE_HOST)),\
$$(call PREPARE_LIB,$$(call CFG_LIB_GLOB_$$(PREPARE_HOST),$(1))),),)
endef
$(foreach lib,$(CRATES),\
$(foreach host,$(CFG_HOST),\
$(eval $(call DEF_PREPARE_HOST_LIB,$(lib),$(PREPARE_STAGE),$(host)))))
prepare-targets:\
$(foreach host,$(CFG_HOST),\
$(foreach target,$(CFG_TARGET),\
prepare-target-$(target)-host-$(host)-$(PREPARE_STAGE)))
# $(1) is stage
# $(2) is target
# $(3) is host
# $(4) tag
define DEF_PREPARE_TARGET_N
# Rebind PREPARE_*_LIB_DIR to point to rustlib, then install the libs for the targets
prepare-target-$(2)-host-$(3)-$(1): PREPARE_WORKING_SOURCE_LIB_DIR=$$(PREPARE_SOURCE_LIB_DIR)/$$(CFG_RUSTLIBDIR)/$(2)/lib
prepare-target-$(2)-host-$(3)-$(1): PREPARE_WORKING_DEST_LIB_DIR=$$(PREPARE_DEST_LIB_DIR)/$$(CFG_RUSTLIBDIR)/$(2)/lib
prepare-target-$(2)-host-$(3)-$(1): prepare-maybe-clean \
prepare-target-$(2)-host-$(3)-$(1)-$(4): PREPARE_WORKING_SOURCE_LIB_DIR=$$(PREPARE_SOURCE_LIB_DIR)/$$(CFG_RUSTLIBDIR)/$(2)/lib
prepare-target-$(2)-host-$(3)-$(1)-$(4): PREPARE_WORKING_DEST_LIB_DIR=$$(PREPARE_DEST_LIB_DIR)/$$(CFG_RUSTLIBDIR)/$(2)/lib
prepare-target-$(2)-host-$(3)-$(1)-$(4): prepare-maybe-clean-$(4) \
$$(foreach crate,$$(TARGET_CRATES), \
$$(TLIB$(1)_T_$(2)_H_$(3))/stamp.$$(crate)) \
$$(if $$(findstring $(2),$$(CFG_HOST)), \
@ -186,12 +147,53 @@ prepare-target-$(2)-host-$(3)-$(1): prepare-maybe-clean \
$$(call PREPARE_LIB,libcompiler-rt.a),),),)
endef
$(foreach host,$(CFG_HOST),\
$(foreach target,$(CFG_TARGET), \
$(eval $(call DEF_PREPARE_TARGET_N,$(PREPARE_STAGE),$(target),$(host)))))
define DEF_PREPARE
prepare-base-$(1): PREPARE_SOURCE_DIR=$$(PREPARE_HOST)/stage$$(PREPARE_STAGE)
prepare-base-$(1): PREPARE_SOURCE_BIN_DIR=$$(PREPARE_SOURCE_DIR)/bin
prepare-base-$(1): PREPARE_SOURCE_LIB_DIR=$$(PREPARE_SOURCE_DIR)/$$(CFG_LIBDIR_RELATIVE)
prepare-base-$(1): PREPARE_SOURCE_MAN_DIR=$$(S)/man
prepare-base-$(1): PREPARE_DEST_BIN_DIR=$$(PREPARE_DEST_DIR)/bin
prepare-base-$(1): PREPARE_DEST_LIB_DIR=$$(PREPARE_DEST_DIR)/$$(CFG_LIBDIR_RELATIVE)
prepare-base-$(1): PREPARE_DEST_MAN_DIR=$$(PREPARE_DEST_DIR)/share/man/man1
prepare-base-$(1): prepare-host-$(1) prepare-targets-$(1)
prepare-host-$(1): prepare-host-tools-$(1)
prepare-host-tools-$(1): \
$$(foreach tool, $$(PREPARE_TOOLS),\
$$(foreach host,$$(CFG_HOST),\
prepare-host-tool-$$(tool)-$$(PREPARE_STAGE)-$$(host)-$(1)))
prepare-host-dirs-$(1): prepare-maybe-clean-$(1)
$$(call PREPARE_DIR,$$(PREPARE_DEST_BIN_DIR))
$$(call PREPARE_DIR,$$(PREPARE_DEST_LIB_DIR))
$$(call PREPARE_DIR,$$(PREPARE_DEST_MAN_DIR))
$$(foreach tool,$$(PREPARE_TOOLS),\
$$(foreach host,$$(CFG_HOST),\
$$(eval $$(call DEF_PREPARE_HOST_TOOL,$$(tool),$$(PREPARE_STAGE),$$(host),$(1)))))
$$(foreach lib,$$(CRATES),\
$$(foreach host,$$(CFG_HOST),\
$$(eval $$(call DEF_PREPARE_HOST_LIB,$$(lib),$$(PREPARE_STAGE),$$(host),$(1)))))
prepare-targets-$(1):\
$$(foreach host,$$(CFG_HOST),\
$$(foreach target,$$(CFG_TARGET),\
prepare-target-$$(target)-host-$$(host)-$$(PREPARE_STAGE)-$(1)))
$$(foreach host,$$(CFG_HOST),\
$$(foreach target,$$(CFG_TARGET), \
$$(eval $$(call DEF_PREPARE_TARGET_N,$$(PREPARE_STAGE),$$(target),$$(host),$(1)))))
prepare-maybe-clean-$(1):
$$(if $$(findstring true,$$(PREPARE_CLEAN)),\
@$$(call E, cleaning destination $$(PREPARE_DEST_DIR)),)
$$(if $$(findstring true,$$(PREPARE_CLEAN)),\
$$(Q)rm -rf $$(PREPARE_DEST_DIR),)
endef
prepare-maybe-clean:
$(if $(findstring true,$(PREPARE_CLEAN)),\
@$(call E, cleaning destination $@),)
$(if $(findstring true,$(PREPARE_CLEAN)),\
$(Q)rm -rf $(PREPARE_DEST_DIR),)

View File

@ -224,41 +224,62 @@ step_msg "validating $CFG_SELF args"
validate_opt
# Sanity check: can we can write to the destination?
umask 022 && mkdir -p "${CFG_PREFIX}/lib"
need_ok "directory creation failed"
touch "${CFG_PREFIX}/lib/rust-install-probe" 2> /dev/null
if [ $? -ne 0 ]
then
err "can't write to destination. try again with 'sudo'."
fi
rm -r "${CFG_PREFIX}/lib/rust-install-probe"
rm "${CFG_PREFIX}/lib/rust-install-probe"
need_ok "failed to remove install probe"
# Sanity check: can we run these binaries?
"${CFG_SRC_DIR}/bin/rustc" --version > /dev/null
need_ok "can't run these binaries on this platform"
# First, uninstall from the installation prefix
# First, uninstall from the installation prefix.
# Errors are warnings - try to rm everything in the manifest even if some fail.
# FIXME: Hardcoded 'rustlib' ignores CFG_RUSTLIBDIR
if [ -f "${CFG_PREFIX}/lib/rustlib/manifest" ]
then
# Iterate through installed manifest and remove files
while read p; do
msg "uninstall ${CFG_PREFIX}/$p"
rm "${CFG_PREFIX}/$p"
need_ok "failed to remove file"
msg "removing ${CFG_PREFIX}/$p"
if [ -f "${CFG_PREFIX}/$p" ]
then
rm "${CFG_PREFIX}/$p"
if [ $? -ne 0 ]
then
warn "failed to remove ${CFG_PREFIX}/$p"
fi
else
warn "supposedly installed file ${CFG_PREFIX}/$p does not exist!"
fi
done < "${CFG_PREFIX}/lib/rustlib/manifest"
# Remove 'rustlib' directory
msg "uninstall ${CFG_PREFIX}/lib/rustlib"
msg "removing ${CFG_PREFIX}/lib/rustlib"
rm -r "${CFG_PREFIX}/lib/rustlib"
need_ok "failed to remove rustlib"
if [ $? -ne 0 ]
then
warn "failed to remove rustlib"
fi
else
if [ -n "${CFG_UNINSTALL}" ]
then
err "unable to find installation manifest at ${CFG_PREFIX}/lib/rustlib"
fi
fi
# If we're only uninstalling then exit
if [ -n "${CFG_UNINSTALL}" ]
then
echo
echo " Rust is uninstalled. Have a nice day."
echo
exit 0
fi
# Iterate through the new manifest and install files
# Now install, iterate through the new manifest and copy files
while read p; do
umask 022 && mkdir -p "${CFG_PREFIX}/$(dirname $p)"

View File

@ -1,5 +1,6 @@
#define CFG_VERSION_WIN GetEnv("CFG_VERSION_WIN")
#define CFG_RELEASE GetEnv("CFG_RELEASE")
#define CFG_PACKAGE_NAME GetEnv("CFG_PACKAGE_NAME")
[Setup]
@ -17,9 +18,9 @@ DisableProgramGroupPage=true
DisableReadyPage=true
DisableStartupPrompt=true
OutputDir=.\
OutputDir=.\dist\
SourceDir=.\
OutputBaseFilename=rust-{#CFG_RELEASE}-install
OutputBaseFilename={#CFG_PACKAGE_NAME}-install
DefaultDirName={pf32}\Rust
Compression=lzma2/ultra