Skip to content

Commit cb3071b

Browse files
committed
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.
1 parent 74f4f39 commit cb3071b

File tree

3 files changed

+21
-2
lines changed

3 files changed

+21
-2
lines changed

Diff for: mk/cfg/x86_64-pc-windows-msvc.mk

+1
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ endif
4545
# instead of `lib.exe` for assembling archives, so we need to inject this custom
4646
# dependency here.
4747
NATIVE_TOOL_DEPS_core_T_x86_64-pc-windows-msvc += llvm-ar.exe
48+
INSTALLED_BINS_x86_64-pc-windows-msvc += llvm-ar.exe
4849

4950
# When working with MSVC on windows, each DLL needs to explicitly declare its
5051
# interface to the outside world through some means. The options for doing so

Diff for: mk/dist.mk

+10-1
Original file line numberDiff line numberDiff line change
@@ -144,9 +144,11 @@ dist/$$(PKG_NAME)-$(1).tar.gz: dist-install-dir-$(1) prepare-overlay-$(1)
144144
@$(call E, build: $$@)
145145
# Copy essential gcc components into installer
146146
ifdef CFG_WINDOWSY_$(1)
147+
ifeq ($$(findstring gnu,$(1)),gnu)
147148
$$(Q)rm -Rf tmp/dist/win-rust-gcc-$(1)
148149
$$(Q)$$(CFG_PYTHON) $$(S)src/etc/make-win-dist.py tmp/dist/$$(PKG_NAME)-$(1)-image tmp/dist/win-rust-gcc-$(1) $(1)
149150
$$(Q)cp -r $$(S)src/etc/third-party tmp/dist/$$(PKG_NAME)-$(1)-image/share/doc/
151+
endif
150152
endif
151153
$$(Q)$$(S)src/rust-installer/gen-installer.sh \
152154
--product-name=Rust \
@@ -213,7 +215,14 @@ endif
213215
dist-install-dirs: $(foreach host,$(CFG_HOST),dist-install-dir-$(host))
214216

215217
ifdef CFG_WINDOWSY_$(CFG_BUILD)
216-
MAYBE_MINGW_TARBALLS=$(foreach host,$(CFG_HOST),dist/$(MINGW_PKG_NAME)-$(host).tar.gz)
218+
define BUILD_MINGW_TARBALL
219+
ifeq ($$(findstring gnu,$(1)),gnu)
220+
MAYBE_MINGW_TARBALLS += dist/$(MINGW_PKG_NAME)-$(1).tar.gz
221+
endif
222+
endef
223+
224+
$(foreach host,$(CFG_HOST),\
225+
$(eval $(call BUILD_MINGW_TARBALL,$(host))))
217226
endif
218227

219228
ifeq ($(CFG_DISABLE_DOCS),)

Diff for: mk/prepare.mk

+10-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,10 @@ endef
3636

3737
# Copy an executable
3838
# $(1) is the filename/libname-glob
39+
#
40+
# Gee, what's up with that $(nop)? See comment below.
3941
define PREPARE_BIN
42+
$(nop)
4043
@$(call E, prepare: $(PREPARE_DEST_BIN_DIR)/$(1))
4144
$(Q)$(PREPARE_BIN_CMD) $(PREPARE_SOURCE_BIN_DIR)/$(1) $(PREPARE_DEST_BIN_DIR)/$(1)
4245
endef
@@ -119,6 +122,8 @@ define DEF_PREPARE_TARGET_N
119122
# Rebind PREPARE_*_LIB_DIR to point to rustlib, then install the libs for the targets
120123
prepare-target-$(2)-host-$(3)-$(1)-$(4): PREPARE_WORKING_SOURCE_LIB_DIR=$$(PREPARE_SOURCE_LIB_DIR)/rustlib/$(2)/lib
121124
prepare-target-$(2)-host-$(3)-$(1)-$(4): PREPARE_WORKING_DEST_LIB_DIR=$$(PREPARE_DEST_LIB_DIR)/rustlib/$(2)/lib
125+
prepare-target-$(2)-host-$(3)-$(1)-$(4): PREPARE_SOURCE_BIN_DIR=$$(PREPARE_SOURCE_LIB_DIR)/rustlib/$(3)/bin
126+
prepare-target-$(2)-host-$(3)-$(1)-$(4): PREPARE_DEST_BIN_DIR=$$(PREPARE_DEST_LIB_DIR)/rustlib/$(3)/bin
122127
prepare-target-$(2)-host-$(3)-$(1)-$(4): prepare-maybe-clean-$(4) \
123128
$$(foreach crate,$$(TARGET_CRATES), \
124129
$$(TLIB$(1)_T_$(2)_H_$(3))/stamp.$$(crate)) \
@@ -133,6 +138,7 @@ prepare-target-$(2)-host-$(3)-$(1)-$(4): prepare-maybe-clean-$(4) \
133138
$$(if $$(findstring $(2), $$(PREPARE_TARGETS)), \
134139
$$(if $$(findstring $(3), $$(PREPARE_HOST)), \
135140
$$(call PREPARE_DIR,$$(PREPARE_WORKING_DEST_LIB_DIR)) \
141+
$$(call PREPARE_DIR,$$(PREPARE_DEST_BIN_DIR)) \
136142
$$(foreach crate,$$(TARGET_CRATES), \
137143
$$(if $$(or $$(findstring 1, $$(ONLY_RLIB_$$(crate))),$$(findstring 1,$$(CFG_INSTALL_ONLY_RLIB_$(2)))),, \
138144
$$(call PREPARE_LIB,$$(call CFG_LIB_GLOB_$(2),$$(crate)))) \
@@ -141,7 +147,10 @@ prepare-target-$(2)-host-$(3)-$(1)-$(4): prepare-maybe-clean-$(4) \
141147
$$(foreach crate,$$(HOST_CRATES), \
142148
$$(call PREPARE_LIB,$$(call CFG_LIB_GLOB_$(2),$$(crate)))),) \
143149
$$(foreach object,$$(INSTALLED_OBJECTS_$(2)),\
144-
$$(call PREPARE_LIB,$$(object))),),),)
150+
$$(call PREPARE_LIB,$$(object))) \
151+
$$(foreach bin,$$(INSTALLED_BINS_$(3)),\
152+
$$(call PREPARE_BIN,$$(bin))) \
153+
,),),)
145154
endef
146155

147156
define INSTALL_GDB_DEBUGGER_SCRIPTS_COMMANDS

0 commit comments

Comments
 (0)