From cb3071b2736244db03f800102f123f437fabc9c1 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Wed, 13 May 2015 10:03:00 -0700 Subject: [PATCH] mk: Update `make dist` for MSVC targets This commit updates the `dist` target for MSVC to not build the mingw components and to also ensure that the `llvm-ar.exe` binary is ferried along into the right location for installs. --- mk/cfg/x86_64-pc-windows-msvc.mk | 1 + mk/dist.mk | 11 ++++++++++- mk/prepare.mk | 11 ++++++++++- 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/mk/cfg/x86_64-pc-windows-msvc.mk b/mk/cfg/x86_64-pc-windows-msvc.mk index 1a1f059945a..bd1088b7cd1 100644 --- a/mk/cfg/x86_64-pc-windows-msvc.mk +++ b/mk/cfg/x86_64-pc-windows-msvc.mk @@ -45,6 +45,7 @@ endif # instead of `lib.exe` for assembling archives, so we need to inject this custom # dependency here. NATIVE_TOOL_DEPS_core_T_x86_64-pc-windows-msvc += llvm-ar.exe +INSTALLED_BINS_x86_64-pc-windows-msvc += llvm-ar.exe # When working with MSVC on windows, each DLL needs to explicitly declare its # interface to the outside world through some means. The options for doing so diff --git a/mk/dist.mk b/mk/dist.mk index 75c6219c5f0..9aab51daba9 100644 --- a/mk/dist.mk +++ b/mk/dist.mk @@ -144,9 +144,11 @@ dist/$$(PKG_NAME)-$(1).tar.gz: dist-install-dir-$(1) prepare-overlay-$(1) @$(call E, build: $$@) # Copy essential gcc components into installer ifdef CFG_WINDOWSY_$(1) +ifeq ($$(findstring gnu,$(1)),gnu) $$(Q)rm -Rf tmp/dist/win-rust-gcc-$(1) $$(Q)$$(CFG_PYTHON) $$(S)src/etc/make-win-dist.py tmp/dist/$$(PKG_NAME)-$(1)-image tmp/dist/win-rust-gcc-$(1) $(1) $$(Q)cp -r $$(S)src/etc/third-party tmp/dist/$$(PKG_NAME)-$(1)-image/share/doc/ +endif endif $$(Q)$$(S)src/rust-installer/gen-installer.sh \ --product-name=Rust \ @@ -213,7 +215,14 @@ endif dist-install-dirs: $(foreach host,$(CFG_HOST),dist-install-dir-$(host)) ifdef CFG_WINDOWSY_$(CFG_BUILD) -MAYBE_MINGW_TARBALLS=$(foreach host,$(CFG_HOST),dist/$(MINGW_PKG_NAME)-$(host).tar.gz) +define BUILD_MINGW_TARBALL +ifeq ($$(findstring gnu,$(1)),gnu) +MAYBE_MINGW_TARBALLS += dist/$(MINGW_PKG_NAME)-$(1).tar.gz +endif +endef + +$(foreach host,$(CFG_HOST),\ + $(eval $(call BUILD_MINGW_TARBALL,$(host)))) endif ifeq ($(CFG_DISABLE_DOCS),) diff --git a/mk/prepare.mk b/mk/prepare.mk index a7f5a489dc5..573b7ac79fd 100644 --- a/mk/prepare.mk +++ b/mk/prepare.mk @@ -36,7 +36,10 @@ endef # Copy an executable # $(1) is the filename/libname-glob +# +# Gee, what's up with that $(nop)? See comment below. define PREPARE_BIN + $(nop) @$(call E, prepare: $(PREPARE_DEST_BIN_DIR)/$(1)) $(Q)$(PREPARE_BIN_CMD) $(PREPARE_SOURCE_BIN_DIR)/$(1) $(PREPARE_DEST_BIN_DIR)/$(1) endef @@ -119,6 +122,8 @@ 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)-$(4): PREPARE_WORKING_SOURCE_LIB_DIR=$$(PREPARE_SOURCE_LIB_DIR)/rustlib/$(2)/lib prepare-target-$(2)-host-$(3)-$(1)-$(4): PREPARE_WORKING_DEST_LIB_DIR=$$(PREPARE_DEST_LIB_DIR)/rustlib/$(2)/lib +prepare-target-$(2)-host-$(3)-$(1)-$(4): PREPARE_SOURCE_BIN_DIR=$$(PREPARE_SOURCE_LIB_DIR)/rustlib/$(3)/bin +prepare-target-$(2)-host-$(3)-$(1)-$(4): PREPARE_DEST_BIN_DIR=$$(PREPARE_DEST_LIB_DIR)/rustlib/$(3)/bin prepare-target-$(2)-host-$(3)-$(1)-$(4): prepare-maybe-clean-$(4) \ $$(foreach crate,$$(TARGET_CRATES), \ $$(TLIB$(1)_T_$(2)_H_$(3))/stamp.$$(crate)) \ @@ -133,6 +138,7 @@ prepare-target-$(2)-host-$(3)-$(1)-$(4): prepare-maybe-clean-$(4) \ $$(if $$(findstring $(2), $$(PREPARE_TARGETS)), \ $$(if $$(findstring $(3), $$(PREPARE_HOST)), \ $$(call PREPARE_DIR,$$(PREPARE_WORKING_DEST_LIB_DIR)) \ + $$(call PREPARE_DIR,$$(PREPARE_DEST_BIN_DIR)) \ $$(foreach crate,$$(TARGET_CRATES), \ $$(if $$(or $$(findstring 1, $$(ONLY_RLIB_$$(crate))),$$(findstring 1,$$(CFG_INSTALL_ONLY_RLIB_$(2)))),, \ $$(call PREPARE_LIB,$$(call CFG_LIB_GLOB_$(2),$$(crate)))) \ @@ -141,7 +147,10 @@ prepare-target-$(2)-host-$(3)-$(1)-$(4): prepare-maybe-clean-$(4) \ $$(foreach crate,$$(HOST_CRATES), \ $$(call PREPARE_LIB,$$(call CFG_LIB_GLOB_$(2),$$(crate)))),) \ $$(foreach object,$$(INSTALLED_OBJECTS_$(2)),\ - $$(call PREPARE_LIB,$$(object))),),),) + $$(call PREPARE_LIB,$$(object))) \ + $$(foreach bin,$$(INSTALLED_BINS_$(3)),\ + $$(call PREPARE_BIN,$$(bin))) \ + ,),),) endef define INSTALL_GDB_DEBUGGER_SCRIPTS_COMMANDS -- 2.44.0