auto merge of #12284 : brson/rust/install, r=alexcrichton
Work toward #9876. This adds `prepare.mk`, which is simply a more heavily-parameterized `install.mk`, then uses `prepare` to implement both `install` and the windows installer (`dist`). Smoke tested on both Linux and Windows.
This commit is contained in:
commit
57d273f65e
37
Makefile.in
37
Makefile.in
|
@ -198,16 +198,6 @@ include $(CFG_SRC_DIR)mk/llvm.mk
|
|||
# Secondary makefiles, conditionalized for speed
|
||||
######################################################################
|
||||
|
||||
# Source and binary distribution artifacts
|
||||
ifneq ($(strip $(findstring dist,$(MAKECMDGOALS)) \
|
||||
$(findstring check,$(MAKECMDGOALS)) \
|
||||
$(findstring test,$(MAKECMDGOALS)) \
|
||||
$(findstring tidy,$(MAKECMDGOALS)) \
|
||||
$(findstring clean,$(MAKECMDGOALS))),)
|
||||
CFG_INFO := $(info cfg: including dist rules)
|
||||
include $(CFG_SRC_DIR)mk/dist.mk
|
||||
endif
|
||||
|
||||
# Binary snapshots
|
||||
ifneq ($(strip $(findstring snap,$(MAKECMDGOALS)) \
|
||||
$(findstring clean,$(MAKECMDGOALS))),)
|
||||
|
@ -230,18 +220,33 @@ ifneq ($(findstring perf,$(MAKECMDGOALS)),)
|
|||
include $(CFG_SRC_DIR)mk/perf.mk
|
||||
endif
|
||||
|
||||
# Copy all the distributables to another directory for binary install
|
||||
ifneq ($(strip $(findstring prepare,$(MAKECMDGOALS)) \
|
||||
$(findstring dist,$(MAKECMDGOALS)) \
|
||||
$(findstring install,$(MAKECMDGOALS))),)
|
||||
CFG_INFO := $(info cfg: including prepare rules)
|
||||
include $(CFG_SRC_DIR)mk/prepare.mk
|
||||
endif
|
||||
|
||||
# (Unix) Installation from the build directory
|
||||
ifneq ($(findstring install,$(MAKECMDGOALS)),)
|
||||
CFG_INFO := $(info cfg: including install rules)
|
||||
include $(CFG_SRC_DIR)mk/install.mk
|
||||
endif
|
||||
|
||||
# Source and binary distribution artifacts
|
||||
ifneq ($(strip $(findstring dist,$(MAKECMDGOALS)) \
|
||||
$(findstring clean,$(MAKECMDGOALS))),)
|
||||
CFG_INFO := $(info cfg: including dist rules)
|
||||
include $(CFG_SRC_DIR)mk/dist.mk
|
||||
endif
|
||||
|
||||
# Cleaning
|
||||
ifneq ($(findstring clean,$(MAKECMDGOALS)),)
|
||||
CFG_INFO := $(info cfg: including clean rules)
|
||||
include $(CFG_SRC_DIR)mk/clean.mk
|
||||
endif
|
||||
|
||||
# Installation from the build directory
|
||||
ifneq ($(findstring install,$(MAKECMDGOALS)),)
|
||||
CFG_INFO := $(info cfg: including install rules)
|
||||
include $(CFG_SRC_DIR)mk/install.mk
|
||||
endif
|
||||
|
||||
# CTAGS building
|
||||
ifneq ($(strip $(findstring TAGS.emacs,$(MAKECMDGOALS)) \
|
||||
$(findstring TAGS.vi,$(MAKECMDGOALS))),)
|
||||
|
|
20
mk/dist.mk
20
mk/dist.mk
|
@ -24,10 +24,10 @@ PKG_FILES := \
|
|||
$(S)RELEASES.txt \
|
||||
$(S)configure $(S)Makefile.in \
|
||||
$(S)man \
|
||||
$(S)doc \
|
||||
$(addprefix $(S)src/, \
|
||||
README.md \
|
||||
compiletest \
|
||||
doc \
|
||||
driver \
|
||||
etc \
|
||||
$(foreach crate,$(CRATES),lib$(crate)) \
|
||||
|
@ -52,12 +52,24 @@ LICENSE.txt: $(S)COPYRIGHT $(S)LICENSE-APACHE $(S)LICENSE-MIT
|
|||
cp $< $@
|
||||
|
||||
$(PKG_EXE): rust.iss modpath.iss LICENSE.txt rust-logo.ico \
|
||||
$(PKG_FILES) $(CSREQ3_T_$(CFG_BUILD)_H_$(CFG_BUILD))
|
||||
$(CFG_PYTHON) $(S)src/etc/copy-runtime-deps.py i686-pc-mingw32/stage3/bin
|
||||
$(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)" $<
|
||||
endif
|
||||
|
||||
dist-prepare-win: PREPARE_HOST=$(CFG_BUILD)
|
||||
dist-prepare-win: PREPARE_TARGETS=$(CFG_BUILD)
|
||||
dist-prepare-win: PREPARE_DEST_DIR=tmp/dist/win
|
||||
# On windows we're using stage3, unlike Unix...
|
||||
dist-prepare-win: PREPARE_STAGE=3
|
||||
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-base
|
||||
|
||||
endif
|
||||
|
||||
$(PKG_TAR): $(PKG_FILES)
|
||||
@$(call E, making dist dir)
|
||||
|
|
161
mk/install.mk
161
mk/install.mk
|
@ -12,117 +12,33 @@
|
|||
# For consistency it might be desirable for stageN to be an exact
|
||||
# mirror of the installation directory structure.
|
||||
|
||||
# Installation macros.
|
||||
# For INSTALL,
|
||||
# $(1) is the source dirctory
|
||||
# $(2) is the destination directory
|
||||
# $(3) is the filename/libname-glob
|
||||
ifdef VERBOSE
|
||||
INSTALL = install -m755 $(1)/$(3) $(DESTDIR)$(2)/$(3)
|
||||
else
|
||||
INSTALL = $(Q)$(call E, install: $(DESTDIR)$(2)/$(3)) && install -m755 $(1)/$(3) $(DESTDIR)$(2)/$(3)
|
||||
endif
|
||||
|
||||
# For MK_INSTALL_DIR
|
||||
# $(1) is the directory to create
|
||||
MK_INSTALL_DIR = (umask 022 && mkdir -p $(DESTDIR)$(1))
|
||||
|
||||
# For INSTALL_LIB,
|
||||
# Target-specific $(LIB_SOURCE_DIR) is the source directory
|
||||
# Target-specific $(LIB_DESTIN_DIR) is the destination directory
|
||||
# $(1) is the filename/libname-glob
|
||||
ifdef VERBOSE
|
||||
DO_INSTALL_LIB = install -m644 `ls -drt1 $(LIB_SOURCE_DIR)/$(1) | tail -1` $(DESTDIR)$(LIB_DESTIN_DIR)/
|
||||
else
|
||||
DO_INSTALL_LIB = $(Q)$(call E, install_lib: $(DESTDIR)$(LIB_DESTIN_DIR)/$(1)) && \
|
||||
install -m644 `ls -drt1 $(LIB_SOURCE_DIR)/$(1) | tail -1` $(DESTDIR)$(LIB_DESTIN_DIR)/
|
||||
endif
|
||||
|
||||
# Target-specific $(LIB_SOURCE_DIR) is the source directory
|
||||
# Target-specific $(LIB_DESTIN_DIR) is the destination directory
|
||||
# $(1) is the filename/libname-glob
|
||||
define INSTALL_LIB
|
||||
$(if $(filter-out 1,$(words $(wildcard $(LIB_SOURCE_DIR)/$(1)))), \
|
||||
$(error Aborting install because more than one library matching \
|
||||
$(1) is present in build tree $(LIB_SOURCE_DIR): \
|
||||
$(wildcard $(LIB_SOURCE_DIR)/$(1))))
|
||||
$(Q)LIB_NAME="$(notdir $(lastword $(wildcard $(LIB_SOURCE_DIR)/$(1))))"; \
|
||||
MATCHES="$(filter-out %$(notdir $(lastword $(wildcard $(LIB_SOURCE_DIR)/$(1)))),\
|
||||
$(wildcard $(LIB_DESTIN_DIR)/$(1)))"; \
|
||||
if [ -n "$$MATCHES" ]; then \
|
||||
echo "warning: one or libraries matching Rust library '$(1)'" && \
|
||||
echo " (other than '$$LIB_NAME' itself) already present" && \
|
||||
echo " at destination $(LIB_DESTIN_DIR):" && \
|
||||
echo $$MATCHES ; \
|
||||
fi
|
||||
$(call DO_INSTALL_LIB,$(1))
|
||||
endef
|
||||
|
||||
# The stage we install from
|
||||
ISTAGE = 2
|
||||
|
||||
install: PREPARE_HOST=$(CFG_BUILD)
|
||||
install: PREPARE_TARGETS=$(CFG_TARGET)
|
||||
install: PREPARE_STAGE=$(ISTAGE)
|
||||
install: PREPARE_DIR_CMD=$(DEFAULT_PREPARE_DIR_CMD)
|
||||
install: PREPARE_BIN_CMD=$(DEFAULT_PREPARE_BIN_CMD)
|
||||
install: PREPARE_LIB_CMD=$(DEFAULT_PREPARE_LIB_CMD)
|
||||
install: PREPARE_MAN_CMD=$(DEFAULT_PREPARE_MAN_CMD)
|
||||
install: PREPARE_SOURCE_DIR=$(PREPARE_HOST)/stage$(PREPARE_STAGE)
|
||||
install: PREPARE_SOURCE_BIN_DIR=$(PREPARE_SOURCE_DIR)/bin
|
||||
install: PREPARE_SOURCE_LIB_DIR=$(PREPARE_SOURCE_DIR)/$(CFG_LIBDIR_RELATIVE)
|
||||
install: PREPARE_SOURCE_MAN_DIR=$(S)/man
|
||||
install: PREPARE_DEST_BIN_DIR=$(DESTDIR)$(CFG_PREFIX)/bin
|
||||
install: PREPARE_DEST_LIB_DIR=$(DESTDIR)$(CFG_LIBDIR)
|
||||
install: PREPARE_DEST_MAN_DIR=$(DESTDIR)$(CFG_MANDIR)/man1
|
||||
install: prepare-everything
|
||||
|
||||
|
||||
# Uninstall code
|
||||
|
||||
PREFIX_ROOT = $(CFG_PREFIX)
|
||||
PREFIX_BIN = $(PREFIX_ROOT)/bin
|
||||
PREFIX_LIB = $(CFG_LIBDIR)
|
||||
|
||||
INSTALL_TOOLS := $(filter-out compiletest, $(TOOLS))
|
||||
|
||||
define INSTALL_PREPARE_N
|
||||
# $(1) is the target triple
|
||||
# $(2) is the host triple
|
||||
|
||||
# T{B,L} == Target {Bin, Lib} for stage ${ISTAGE}
|
||||
TB$(1)$(2) = $$(TBIN$$(ISTAGE)_T_$(1)_H_$(2))
|
||||
TL$(1)$(2) = $$(TLIB$$(ISTAGE)_T_$(1)_H_$(2))
|
||||
|
||||
# PT{R,B,L} == Prefix Target {Root, Bin, Lib}
|
||||
PTR$(1)$(2) = $$(PREFIX_LIB)/$(CFG_RUSTLIBDIR)/$(1)
|
||||
PTB$(1)$(2) = $$(PTR$(1)$(2))/bin
|
||||
PTL$(1)$(2) = $$(PTR$(1)$(2))/lib
|
||||
|
||||
endef
|
||||
|
||||
$(foreach target,$(CFG_TARGET), \
|
||||
$(eval $(call INSTALL_PREPARE_N,$(target),$(CFG_BUILD))))
|
||||
|
||||
define INSTALL_TARGET_N
|
||||
install-target-$(1)-host-$(2): LIB_SOURCE_DIR=$$(TL$(1)$(2))
|
||||
install-target-$(1)-host-$(2): LIB_DESTIN_DIR=$$(PTL$(1)$(2))
|
||||
install-target-$(1)-host-$(2): \
|
||||
$$(TSREQ$$(ISTAGE)_T_$(1)_H_$(2)) \
|
||||
$$(SREQ$$(ISTAGE)_T_$(1)_H_$(2))
|
||||
$$(Q)$$(call MK_INSTALL_DIR,$$(PTL$(1)$(2)))
|
||||
$$(Q)$$(foreach crate,$$(TARGET_CRATES),\
|
||||
$$(call INSTALL_LIB,$$(call CFG_LIB_GLOB_$(1),$$(crate)));\
|
||||
$$(call INSTALL_LIB,$$(call CFG_RLIB_GLOB,$$(crate)));)
|
||||
$$(Q)$$(call INSTALL_LIB,libmorestack.a)
|
||||
$$(Q)$$(call INSTALL_LIB,libcompiler-rt.a)
|
||||
|
||||
endef
|
||||
|
||||
define INSTALL_HOST_N
|
||||
|
||||
install-target-$(1)-host-$(2): LIB_SOURCE_DIR=$$(TL$(1)$(2))
|
||||
install-target-$(1)-host-$(2): LIB_DESTIN_DIR=$$(PTL$(1)$(2))
|
||||
install-target-$(1)-host-$(2): $$(CSREQ$$(ISTAGE)_T_$(1)_H_$(2))
|
||||
$$(Q)$$(call MK_INSTALL_DIR,$$(PTL$(1)$(2)))
|
||||
$$(Q)$$(foreach crate,$$(CRATES),\
|
||||
$$(call INSTALL_LIB,$$(call CFG_LIB_GLOB_$(1),$$(crate)));)
|
||||
$$(Q)$$(foreach crate,$$(TARGET_CRATES),\
|
||||
$$(call INSTALL_LIB,$$(call CFG_RLIB_GLOB,$$(crate)));)
|
||||
$$(Q)$$(call INSTALL_LIB,libmorestack.a)
|
||||
$$(Q)$$(call INSTALL_LIB,libcompiler-rt.a)
|
||||
endef
|
||||
|
||||
$(foreach target,$(CFG_TARGET), \
|
||||
$(if $(findstring $(target), $(CFG_BUILD)), \
|
||||
$(eval $(call INSTALL_HOST_N,$(target),$(CFG_BUILD))), \
|
||||
$(eval $(call INSTALL_TARGET_N,$(target),$(CFG_BUILD)))))
|
||||
|
||||
INSTALL_TARGET_RULES = $(foreach target,$(CFG_TARGET), \
|
||||
install-target-$(target)-host-$(CFG_BUILD))
|
||||
|
||||
install: all install-host install-targets
|
||||
INSTALL_TOOLS := $(PREPARE_TOOLS)
|
||||
|
||||
# Shorthand for build/stageN/bin
|
||||
HB = $(HBIN$(ISTAGE)_H_$(CFG_BUILD))
|
||||
|
@ -134,39 +50,6 @@ PHB = $(PREFIX_BIN)
|
|||
# Shorthand for the prefix bin directory
|
||||
PHL = $(PREFIX_LIB)
|
||||
|
||||
install-host%: LIB_SOURCE_DIR=$(HL)
|
||||
install-host%: LIB_DESTIN_DIR=$(PHL)
|
||||
install-host: \
|
||||
install-host-prep \
|
||||
$(foreach tool,$(INSTALL_TOOLS),install-host-tool-$(tool))
|
||||
|
||||
install-host-prep: $(CSREQ$(ISTAGE)_T_$(CFG_BUILD)_H_$(CFG_BUILD))
|
||||
$(Q)$(call MK_INSTALL_DIR,$(PREFIX_BIN))
|
||||
$(Q)$(call MK_INSTALL_DIR,$(PREFIX_LIB))
|
||||
$(Q)$(call MK_INSTALL_DIR,$(CFG_MANDIR)/man1)
|
||||
|
||||
define INSTALL_HOST_TOOL
|
||||
install-host-tool-$(1): \
|
||||
$$(foreach dep,$$(TOOL_DEPS_$(1)),install-host-lib-$$(dep)) \
|
||||
$$(CSREQ$$(ISTAGE)_T_$$(CFG_BUILD)_H_$$(CFG_BUILD))
|
||||
$$(Q)$$(call INSTALL,$$(HB2),$$(PHB),$(1)$$(X_$$(CFG_BUILD)))
|
||||
$$(Q)$$(call INSTALL,$$(S)/man,$$(CFG_MANDIR)/man1,$(1).1)
|
||||
endef
|
||||
|
||||
$(foreach tool,$(INSTALL_TOOLS),$(eval $(call INSTALL_HOST_TOOL,$(tool))))
|
||||
|
||||
define INSTALL_HOST_LIB
|
||||
install-host-lib-$(1): \
|
||||
$$(foreach dep,$$(RUST_DEPS_$(1)),install-host-lib-$$(dep)) \
|
||||
$$(CSREQ$$(ISTAGE)_T_$$(CFG_BUILD)_H_$$(CFG_BUILD))
|
||||
$$(Q)$$(call INSTALL_LIB,$$(call CFG_LIB_GLOB_$$(CFG_BUILD),$(1)))
|
||||
endef
|
||||
|
||||
$(foreach lib,$(CRATES),$(eval $(call INSTALL_HOST_LIB,$(lib))))
|
||||
|
||||
install-targets: $(INSTALL_TARGET_RULES)
|
||||
|
||||
|
||||
HOST_LIB_FROM_HL_GLOB = \
|
||||
$(patsubst $(HL)/%,$(PHL)/%,$(wildcard $(HL)/$(1)))
|
||||
|
||||
|
@ -188,6 +71,10 @@ endef
|
|||
|
||||
$(foreach lib,$(CRATES),$(eval $(call UNINSTALL_LIB,$(lib))))
|
||||
|
||||
|
||||
# Android runtime setup
|
||||
# FIXME: This probably belongs somewhere else
|
||||
|
||||
# target platform specific variables
|
||||
# for arm-linux-androidabi
|
||||
define DEF_ADB_DEVICE_STATUS
|
||||
|
|
|
@ -0,0 +1,194 @@
|
|||
# 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.
|
||||
|
||||
# Basic support for producing installation images.
|
||||
#
|
||||
# The 'prepare' build target copies all release artifacts from the build
|
||||
# directory to some other location, placing all binaries, libraries, and
|
||||
# docs in their final locations relative to each other.
|
||||
#
|
||||
# It requires the following variables to be set:
|
||||
#
|
||||
# PREPARE_HOST - the host triple
|
||||
# PREPARE_TARGETS - the target triples, space separated
|
||||
# PREPARE_DEST_DIR - the directory to put the image
|
||||
|
||||
prepare: PREPARE_STAGE=2
|
||||
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)/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
|
||||
DEFAULT_PREPARE_MAN_CMD = install -m755
|
||||
|
||||
# On windows we install from stage3, but on unix only stage2
|
||||
# Because of the way these rules are organized, preparing from any
|
||||
# stage requires all these stages to be built
|
||||
ifdef CFG_WINDOWSY_$(CFG_BUILD)
|
||||
PREPARE_STAGES=3
|
||||
else
|
||||
PREPARE_STAGES=2
|
||||
endif
|
||||
|
||||
# Create a directory
|
||||
# $(1) is the directory
|
||||
define PREPARE_DIR
|
||||
@$(Q)$(call E, install: $(1))
|
||||
$(Q)$(PREPARE_DIR_CMD) $(1)
|
||||
endef
|
||||
|
||||
# Copy an executable
|
||||
# $(1) is the filename/libname-glob
|
||||
define PREPARE_BIN
|
||||
@$(call E, install: $(PREPARE_DEST_BIN_DIR)/$(1))
|
||||
$(Q)$(PREPARE_BIN_CMD) $(PREPARE_SOURCE_BIN_DIR)/$(1) $(PREPARE_DEST_BIN_DIR)/$(1)
|
||||
endef
|
||||
|
||||
# Copy a dylib or rlib
|
||||
# $(1) is the filename/libname-glob
|
||||
#
|
||||
# XXX: Don't remove the $(nop) command below!
|
||||
# Yeah, that's right, it's voodoo. Something in the way this macro is being expanded
|
||||
# causes it to parse incorrectly. Throwing in that empty command seems to fix the
|
||||
# problem. I'm sorry, just don't remove the $(nop), alright?
|
||||
define PREPARE_LIB
|
||||
$(nop)
|
||||
@$(call E, install: $(PREPARE_WORKING_DEST_LIB_DIR)/$(1))
|
||||
$(Q)LIB_NAME="$(notdir $(lastword $(wildcard $(PREPARE_WORKING_SOURCE_LIB_DIR)/$(1))))"; \
|
||||
MATCHES="$(filter-out %$(notdir $(lastword $(wildcard $(PREPARE_WORKING_SOURCE_LIB_DIR)/$(1)))),\
|
||||
$(wildcard $(PREPARE_WORKING_DEST_LIB_DIR)/$(1)))"; \
|
||||
if [ -n "$$MATCHES" ]; then \
|
||||
echo "warning: one or libraries matching Rust library '$(1)'" && \
|
||||
echo " (other than '$$LIB_NAME' itself) already present" && \
|
||||
echo " at destination $(PREPARE_WORKING_DEST_LIB_DIR):" && \
|
||||
echo $$MATCHES ; \
|
||||
fi
|
||||
$(Q)$(PREPARE_LIB_CMD) `ls -drt1 $(PREPARE_WORKING_SOURCE_LIB_DIR)/$(1) | tail -1` $(PREPARE_WORKING_DEST_LIB_DIR)/
|
||||
endef
|
||||
|
||||
# Copy a man page
|
||||
# $(1) - source dir
|
||||
define PREPARE_MAN
|
||||
@$(call E, install: $(PREPARE_DEST_MAN_DIR)/$(1))
|
||||
$(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 stage,$(PREPARE_STAGES),\
|
||||
$(foreach host,$(CFG_HOST),\
|
||||
prepare-host-tool-$(tool)-$(stage)-$(host))))
|
||||
|
||||
prepare-host-dirs:
|
||||
$(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
|
||||
define DEF_PREPARE_HOST_TOOL
|
||||
prepare-host-tool-$(1)-$(2)-$(3): $$(foreach dep,$$(TOOL_DEPS_$(1)),prepare-host-lib-$$(dep)-$(2)-$(3)) \
|
||||
$$(HBIN$(2)_H_$(3))/$(1)$$(X_$(3)) \
|
||||
prepare-host-dirs
|
||||
$$(if $$(findstring $(2), $$(PREPARE_STAGE)),\
|
||||
$$(if $$(findstring $(3), $$(PREPARE_HOST)),\
|
||||
$$(call PREPARE_BIN,$(1)$$(X_$$(PREPARE_HOST))),),)
|
||||
$$(if $$(findstring $(2), $$(PREPARE_STAGE)),\
|
||||
$$(if $$(findstring $(3), $$(PREPARE_HOST)),\
|
||||
$$(call PREPARE_MAN,$(1).1),),)
|
||||
endef
|
||||
|
||||
$(foreach tool,$(PREPARE_TOOLS),\
|
||||
$(foreach stage,$(PREPARE_STAGES),\
|
||||
$(foreach host,$(CFG_HOST),\
|
||||
$(eval $(call DEF_PREPARE_HOST_TOOL,$(tool),$(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
|
||||
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): $$(foreach dep,$$(RUST_DEPS_$(1)),prepare-host-lib-$$(dep)-$(2)-$(3))\
|
||||
$$(HLIB$(2)_H_$(3))/stamp.$(1) \
|
||||
prepare-host-dirs
|
||||
$$(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 stage,$(PREPARE_STAGES),\
|
||||
$(foreach host,$(CFG_HOST),\
|
||||
$(eval $(call DEF_PREPARE_HOST_LIB,$(lib),$(stage),$(host))))))
|
||||
|
||||
prepare-targets:\
|
||||
$(foreach host,$(CFG_HOST),\
|
||||
$(foreach target,$(CFG_TARGET),\
|
||||
$(foreach stage,$(PREPARE_STAGES),\
|
||||
prepare-target-$(target)-host-$(host)-$(stage))))
|
||||
|
||||
# $(1) is stage
|
||||
# $(2) is target
|
||||
# $(3) is host
|
||||
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): \
|
||||
$$(foreach crate,$$(TARGET_CRATES), \
|
||||
$$(TLIB$(1)_T_$(2)_H_$(3))/stamp.$$(crate)) \
|
||||
$$(if $$(findstring $(2),$$(CFG_HOST)), \
|
||||
$$(foreach crate,$$(HOST_CRATES), \
|
||||
$$(TLIB$(1)_T_$(2)_H_$(3))/stamp.$$(crate)),)
|
||||
# Only install if this host and target combo is being prepared
|
||||
$$(if $$(findstring $(1), $$(PREPARE_STAGE)),\
|
||||
$$(if $$(findstring $(2), $$(PREPARE_TARGETS)),\
|
||||
$$(if $$(findstring $(3), $$(PREPARE_HOST)),\
|
||||
$$(call PREPARE_DIR,$$(PREPARE_WORKING_DEST_LIB_DIR))\
|
||||
$$(foreach crate,$$(TARGET_CRATES),\
|
||||
$$(call PREPARE_LIB,$$(call CFG_LIB_GLOB_$(2),$$(crate)))\
|
||||
$$(call PREPARE_LIB,$$(call CFG_RLIB_GLOB,$$(crate))))\
|
||||
$$(if $$(findstring $(2),$$(CFG_HOST)),\
|
||||
$$(foreach crate,$$(HOST_CRATES),\
|
||||
$$(call PREPARE_LIB,$$(call CFG_LIB_GLOB_$(2),$$(crate)))\
|
||||
$$(call PREPARE_LIB,$$(call CFG_RLIB_GLOB,$$(crate)))),)\
|
||||
$$(call PREPARE_LIB,libmorestack.a) \
|
||||
$$(call PREPARE_LIB,libcompiler-rt.a),),),)
|
||||
endef
|
||||
|
||||
$(foreach host,$(CFG_HOST),\
|
||||
$(foreach target,$(CFG_TARGET), \
|
||||
$(foreach stage,$(PREPARE_STAGES),\
|
||||
$(eval $(call DEF_PREPARE_TARGET_N,$(stage),$(target),$(host))))))
|
|
@ -36,7 +36,7 @@ Uninstallable=yes
|
|||
Name: modifypath; Description: &Add {app}\bin to your PATH (recommended)
|
||||
|
||||
[Files]
|
||||
Source: "i686-pc-mingw32/stage3/*.*" ; DestDir: "{app}"; Flags: ignoreversion recursesubdirs
|
||||
Source: "tmp/dist/win/*.*" ; DestDir: "{app}"; Flags: ignoreversion recursesubdirs
|
||||
|
||||
[Code]
|
||||
const
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
#[desc = "rustdoc, the Rust documentation extractor"];
|
||||
#[license = "MIT/ASL2"];
|
||||
#[crate_type = "dylib"];
|
||||
#[crate_type = "rlib"];
|
||||
|
||||
#[feature(globs, struct_variant, managed_boxes)];
|
||||
|
||||
|
|
Loading…
Reference in New Issue