201cab84e8
There are a few reasons that this is a desirable move to take: 1. Proof of concept that a third party event loop is possible 2. Clear separation of responsibility between rt::io and the uv-backend 3. Enforce in the future that the event loop is "pluggable" and replacable Here's a quick summary of the points of this pull request which make this possible: * Two new lang items were introduced: event_loop, and event_loop_factory. The idea of a "factory" is to define a function which can be called with no arguments and will return the new event loop as a trait object. This factory is emitted to the crate map when building an executable. The factory doesn't have to exist, and when it doesn't then an empty slot is in the crate map and a basic event loop with no I/O support is provided to the runtime. * When building an executable, then the rustuv crate will be linked by default (providing a default implementation of the event loop) via a similar method to injecting a dependency on libstd. This is currently the only location where the rustuv crate is ever linked. * There is a new #[no_uv] attribute (implied by #[no_std]) which denies implicitly linking to rustuv by default Closes #5019
168 lines
6.3 KiB
Makefile
168 lines
6.3 KiB
Makefile
# Copyright 2012 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.
|
|
|
|
# CP_HOST_STAGE_N template: arg 1 is the N we're promoting *from*, arg
|
|
# 2 is N+1. Must be invoked to promote target artifacts to host
|
|
# artifacts for stage 1-3 (stage0 host artifacts come from the
|
|
# snapshot). Arg 3 is the triple we're copying FROM and arg 4 is the
|
|
# triple we're copying TO.
|
|
#
|
|
# The easiest way to read this template is to assume we're promoting
|
|
# stage1 to stage2 and mentally gloss $(1) as 1, $(2) as 2.
|
|
|
|
define CP_HOST_STAGE_N
|
|
|
|
# Host libraries and executables (stage$(2)/bin/rustc and its runtime needs)
|
|
|
|
# Note: $(3) and $(4) are both the same!
|
|
|
|
$$(HBIN$(2)_H_$(4))/rustc$$(X_$(4)): \
|
|
$$(TBIN$(1)_T_$(4)_H_$(3))/rustc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B_$(4)),$$(notdir $$@))
|
|
|
|
$$(HLIB$(2)_H_$(4))/$(CFG_LIBSYNTAX_$(4)): \
|
|
$$(TLIB$(1)_T_$(4)_H_$(3))/$(CFG_LIBSYNTAX_$(4)) \
|
|
$$(HLIB$(2)_H_$(4))/$(CFG_RUNTIME_$(4)) \
|
|
$$(HLIB$(2)_H_$(4))/$(CFG_RUSTLLVM_$(4)) \
|
|
$$(HSTDLIB_DEFAULT$(2)_H_$(4)) \
|
|
$$(HEXTRALIB_DEFAULT$(2)_H_$(4)) \
|
|
$$(HLIBRUSTUV_DEFAULT$(2)_H_$(4)) \
|
|
| $$(HLIB$(2)_H_$(4))/
|
|
@$$(call E, cp: $$@)
|
|
$$(call REMOVE_ALL_OLD_GLOB_MATCHES_EXCEPT,$$(dir $$@),$(LIBSYNTAX_GLOB_$(4)),$$(notdir $$@))
|
|
$$(Q)cp $$< $$@
|
|
$$(Q)cp -R $$(TLIB$(1)_T_$(4)_H_$(3))/$(LIBSYNTAX_GLOB_$(4)) \
|
|
$$(wildcard $$(TLIB$(1)_T_$(4)_H_$(3))/$(LIBSYNTAX_DSYM_GLOB_$(4))) \
|
|
$$(HLIB$(2)_H_$(4))
|
|
$$(call LIST_ALL_OLD_GLOB_MATCHES_EXCEPT,$$(dir $$@),$(LIBSYNTAX_GLOB_$(4)),$$(notdir $$@))
|
|
|
|
$$(HLIB$(2)_H_$(4))/$(CFG_RUNTIME_$(4)): \
|
|
$$(TLIB$(1)_T_$(4)_H_$(3))/$(CFG_RUNTIME_$(4)) \
|
|
| $$(HLIB$(2)_H_$(4))/
|
|
@$$(call E, cp: $$@)
|
|
$$(Q)cp $$< $$@
|
|
|
|
$$(HLIB$(2)_H_$(4))/$(CFG_STDLIB_$(4)): \
|
|
$$(TLIB$(1)_T_$(4)_H_$(3))/$(CFG_STDLIB_$(4)) \
|
|
$$(HLIB$(2)_H_$(4))/$(CFG_RUNTIME_$(4)) \
|
|
| $$(HLIB$(2)_H_$(4))/
|
|
@$$(call E, cp: $$@)
|
|
$$(call REMOVE_ALL_OLD_GLOB_MATCHES_EXCEPT,$$(dir $$@),$(STDLIB_GLOB_$(4)),$$(notdir $$@))
|
|
$$(Q)cp $$< $$@
|
|
# Subtle: We do not let the shell expand $$(STDLIB_DSYM_GLOB) directly rather
|
|
# we use Make's $$(wildcard) facility. The reason is that, on mac, when using
|
|
# USE_SNAPSHOT_STDLIB, we copy the std.dylib file out of the snapshot.
|
|
# In that case, there is no .dSYM file. Annoyingly, bash then refuses to expand
|
|
# glob, and cp reports an error because libstd-*.dylib.dsym does not exist.
|
|
# Make instead expands the glob to nothing, which gives us the correct behavior.
|
|
# (Copy .dsym file if it exists, but do nothing otherwise)
|
|
$$(Q)cp -R $$(TLIB$(1)_T_$(4)_H_$(3))/$(STDLIB_GLOB_$(4)) \
|
|
$$(wildcard $$(TLIB$(1)_T_$(4)_H_$(3))/$(STDLIB_DSYM_GLOB_$(4))) \
|
|
$$(HLIB$(2)_H_$(4))
|
|
$$(call LIST_ALL_OLD_GLOB_MATCHES_EXCEPT,$$(dir $$@),$(STDLIB_GLOB_$(4)),$$(notdir $$@))
|
|
|
|
$$(HLIB$(2)_H_$(4))/$(CFG_EXTRALIB_$(4)): \
|
|
$$(TLIB$(1)_T_$(4)_H_$(3))/$(CFG_EXTRALIB_$(4)) \
|
|
$$(HLIB$(2)_H_$(4))/$(CFG_STDLIB_$(4)) \
|
|
$$(HLIB$(2)_H_$(4))/$(CFG_RUNTIME_$(4)) \
|
|
| $$(HLIB$(2)_H_$(4))/
|
|
@$$(call E, cp: $$@)
|
|
$$(call REMOVE_ALL_OLD_GLOB_MATCHES_EXCEPT,$$(dir $$@),$(EXTRALIB_GLOB_$(4)),$$(notdir $$@))
|
|
$$(Q)cp $$< $$@
|
|
$$(Q)cp -R $$(TLIB$(1)_T_$(4)_H_$(3))/$(EXTRALIB_GLOB_$(4)) \
|
|
$$(wildcard $$(TLIB$(1)_T_$(4)_H_$(3))/$(EXTRALIB_DSYM_GLOB_$(4))) \
|
|
$$(HLIB$(2)_H_$(4))
|
|
$$(call LIST_ALL_OLD_GLOB_MATCHES_EXCEPT,$$(dir $$@),$(EXTRALIB_GLOB_$(4)),$$(notdir $$@))
|
|
|
|
$$(HLIB$(2)_H_$(4))/$(CFG_LIBRUSTUV_$(4)): \
|
|
$$(TLIB$(1)_T_$(4)_H_$(3))/$(CFG_LIBRUSTUV_$(4)) \
|
|
$$(HLIB$(2)_H_$(4))/$(CFG_STDLIB_$(4)) \
|
|
$$(HLIB$(2)_H_$(4))/$(CFG_RUNTIME_$(4)) \
|
|
| $$(HLIB$(2)_H_$(4))/
|
|
@$$(call E, cp: $$@)
|
|
$$(call REMOVE_ALL_OLD_GLOB_MATCHES_EXCEPT,$$(dir $$@),$(LIBRUSTUV_GLOB_$(4)),$$(notdir $$@))
|
|
$$(Q)cp $$< $$@
|
|
$$(Q)cp -R $$(TLIB$(1)_T_$(4)_H_$(3))/$(LIBRUSTUV_GLOB_$(4)) \
|
|
$$(wildcard $$(TLIB$(1)_T_$(4)_H_$(3))/$(LIBRUSTUV_DSYM_GLOB_$(4))) \
|
|
$$(HLIB$(2)_H_$(4))
|
|
$$(call LIST_ALL_OLD_GLOB_MATCHES_EXCEPT,$$(dir $$@),$(LIBRUSTUV_GLOB_$(4)),$$(notdir $$@))
|
|
|
|
$$(HLIB$(2)_H_$(4))/libstd.rlib: \
|
|
$$(TLIB$(1)_T_$(4)_H_$(3))/libstd.rlib \
|
|
$$(HLIB$(2)_H_$(4))/$$(CFG_RUNTIME_$(4)) \
|
|
| $$(HLIB$(2)_H_$(4))/
|
|
@$$(call E, cp: $$@)
|
|
$$(Q)cp $$< $$@
|
|
|
|
$$(HLIB$(2)_H_$(4))/libextra.rlib: \
|
|
$$(TLIB$(1)_T_$(4)_H_$(3))/libextra.rlib \
|
|
$$(HLIB$(2)_H_$(4))/libstd.rlib \
|
|
$$(HLIB$(2)_H_$(4))/$$(CFG_RUNTIME_$(4)) \
|
|
| $$(HLIB$(2)_H_$(4))/
|
|
@$$(call E, cp: $$@)
|
|
$$(Q)cp $$< $$@
|
|
|
|
$$(HLIB$(2)_H_$(4))/librustc.rlib: \
|
|
$$(TLIB$(1)_T_$(4)_H_$(3))/librustc.rlib \
|
|
$$(HLIB$(2)_H_$(4))/libstd.rlib \
|
|
$$(HLIB$(2)_H_$(4))/libextra.rlib \
|
|
$$(HLIB$(2)_H_$(4))/$$(CFG_RUNTIME_$(4)) \
|
|
| $$(HLIB$(2)_H_$(4))/
|
|
@$$(call E, cp: $$@)
|
|
$$(Q)cp $$< $$@
|
|
|
|
$$(HLIB$(2)_H_$(4))/$(CFG_RUSTLLVM_$(4)): \
|
|
$$(TLIB$(1)_T_$(4)_H_$(3))/$(CFG_RUSTLLVM_$(4)) \
|
|
| $$(HLIB$(2)_H_$(4))/
|
|
@$$(call E, cp: $$@)
|
|
$$(Q)cp $$< $$@
|
|
|
|
$$(HBIN$(2)_H_$(4))/:
|
|
mkdir -p $$@
|
|
|
|
ifneq ($(CFG_LIBDIR),bin)
|
|
$$(HLIB$(2)_H_$(4))/:
|
|
mkdir -p $$@
|
|
endif
|
|
|
|
endef
|
|
|
|
$(foreach t,$(CFG_HOST_TRIPLES), \
|
|
$(eval $(call CP_HOST_STAGE_N,0,1,$(t),$(t))) \
|
|
$(eval $(call CP_HOST_STAGE_N,1,2,$(t),$(t))) \
|
|
$(eval $(call CP_HOST_STAGE_N,2,3,$(t),$(t))))
|