about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2014-03-25 00:01:52 -0700
committerbors <bors@rust-lang.org>2014-03-25 00:01:52 -0700
commitb1091c3141f2285fa9620c9e4df3fb86d911c5f6 (patch)
treef2a0eeb3d73c7e4ae1be180e668d9108ce5c4db1
parent1e6e98c0c2bd6b736fc6bef9bc1fb8e34d24e488 (diff)
parent39b48fb8836b130fa6bec09b4864b5a8eee0cd42 (diff)
downloadrust-b1091c3141f2285fa9620c9e4df3fb86d911c5f6.tar.gz
rust-b1091c3141f2285fa9620c9e4df3fb86d911c5f6.zip
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
-rw-r--r--mk/clean.mk3
-rw-r--r--mk/dist.mk272
-rw-r--r--mk/main.mk29
-rw-r--r--mk/prepare.mk124
-rw-r--r--src/etc/install.sh43
-rw-r--r--src/etc/pkg/rust.iss5
6 files changed, 304 insertions, 172 deletions
diff --git a/mk/clean.mk b/mk/clean.mk
index 34fd4d06fe5..725f80ac8b5 100644
--- a/mk/clean.mk
+++ b/mk/clean.mk
@@ -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
diff --git a/mk/dist.mk b/mk/dist.mk
index 7ac3582f821..4990ae12f5e 100644
--- a/mk/dist.mk
+++ b/mk/dist.mk
@@ -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 $^ > $@
 
-PKG_GITMODULES := $(S)src/libuv $(S)src/llvm $(S)src/gyp $(S)src/compiler-rt
 
+######################################################################
+# 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,15 +58,58 @@ 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 $^ > $@
+$(PKG_TAR): $(PKG_FILES)
+	@$(call E, making dist dir)
+	$(Q)rm -Rf tmp/dist/$(PKG_NAME)
+	$(Q)mkdir -p tmp/dist/$(PKG_NAME)
+	$(Q)tar \
+         -C $(S) \
+         --exclude-vcs \
+         --exclude=*~ \
+         --exclude=*/llvm/test/*/*.ll \
+         --exclude=*/llvm/test/*/*.td \
+         --exclude=*/llvm/test/*/*.s \
+         --exclude=*/llvm/test/*/*/*.ll \
+         --exclude=*/llvm/test/*/*/*.td \
+         --exclude=*/llvm/test/*/*/*.s \
+         -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)
+
+dist-tar-src: $(PKG_TAR)
+
+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
+
+
+######################################################################
+# Windows .exe installer
+######################################################################
+
+# FIXME Needs to support all hosts, but making rust.iss compatible looks like a chore
 
 ifdef CFG_ISCC
+
+PKG_EXE = dist/$(PKG_NAME)-install.exe
+
 %.iss: $(S)src/etc/pkg/%.iss
 	cp $< $@
 
@@ -56,12 +117,14 @@ ifdef CFG_ISCC
 	cp $< $@
 
 $(PKG_EXE): rust.iss modpath.iss LICENSE.txt rust-logo.ico \
-            $(PKG_FILES) $(CSREQ3_T_$(CFG_BUILD)_H_$(CFG_BUILD)) \
+            $(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
@@ -70,105 +133,72 @@ 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
+dist-prepare-win: prepare-base-win
 
 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)tar \
-         -C $(S) \
-         --exclude-vcs \
-         --exclude=*~ \
-         --exclude=*/llvm/test/*/*.ll \
-         --exclude=*/llvm/test/*/*.td \
-         --exclude=*/llvm/test/*/*.s \
-         --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)
+dist-win: $(PKG_EXE)
 
-.PHONY: dist distcheck
+distcheck-win: dist-win
 
-ifdef CFG_WINDOWSY_$(CFG_BUILD)
+######################################################################
+# OS X .pkg installer
+######################################################################
 
-dist: $(PKG_EXE)
+ifeq ($(CFG_OSTYPE), apple-darwin)
 
-distcheck: dist
-	@echo
-	@echo -----------------------------------------------
-	@echo $(PKG_EXE) ready for distribution
-	@echo -----------------------------------------------
+define DEF_OSX_PKG
 
-else
+$$(eval $$(call DEF_PREPARE,osx-$(1)))
 
-dist: $(PKG_TAR) $(PKG_OSX)
-
-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 -----------------------------------------------
+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)
 
-endif
+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
 
-ifeq ($(CFG_OSTYPE), apple-darwin)
+endef
 
-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
-
-$(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
+$(foreach host,$(CFG_HOST),$(eval $(call DEF_OSX_PKG,$(host))))
 
-dist-osx: $(PKG_OSX)
+dist-osx: $(foreach host,$(CFG_HOST),dist/$(PKG_NAME)-$(host).pkg)
 
-distcheck-osx: $(PKG_OSX)
-	@echo
-	@echo -----------------------------------------------
-	@echo $(PKG_OSX) ready for distribution
-	@echo -----------------------------------------------
+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
diff --git a/mk/main.mk b/mk/main.mk
index 5f5f596b1b7..ccbdf30a1ff 100644
--- a/mk/main.mk
+++ b/mk/main.mk
@@ -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
diff --git a/mk/prepare.mk b/mk/prepare.mk
index bfc5c8785d0..a4197fdb045 100644
--- a/mk/prepare.mk
+++ b/mk/prepare.mk
@@ -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),)
diff --git a/src/etc/install.sh b/src/etc/install.sh
index 9e718a61d88..8dfc1903094 100644
--- a/src/etc/install.sh
+++ b/src/etc/install.sh
@@ -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)"
diff --git a/src/etc/pkg/rust.iss b/src/etc/pkg/rust.iss
index 559ed0e860f..66bb71527fe 100644
--- a/src/etc/pkg/rust.iss
+++ b/src/etc/pkg/rust.iss
@@ -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