This comit implements a new flag, --extern, which is used to specify where a crate is located. The purpose of this flag is to bypass the normal crate loading/matching of the compiler to point it directly at the right file. This flag takes the form `--extern foo=bar` where `foo` is the name of a crate and `bar` is the location at which to find the crate. Multiple `--extern` directives are allowed with the same crate name to specify the rlib/dylib pair for a crate. It is invalid to specify more than one rlib or more than one dylib, and it's required that the crates are valid rust crates. I have also added some extensive documentation to metadata::loader about how crate loading should work. RFC: 0035-remove-crate-id
16 lines
554 B
Makefile
16 lines
554 B
Makefile
-include ../tools.mk
|
|
|
|
all:
|
|
$(RUSTC) bar.rs --crate-type=rlib
|
|
$(RUSTC) bar.rs --crate-type=rlib -C extra-filename=-a
|
|
$(RUSTC) foo.rs --extern hello && exit 1 || exit 0
|
|
$(RUSTC) foo.rs --extern bar=no-exist && exit 1 || exit 0
|
|
$(RUSTC) foo.rs --extern bar=foo.rs && exit 1 || exit 0
|
|
$(RUSTC) foo.rs \
|
|
--extern bar=$(TMPDIR)/libbar.rlib \
|
|
--extern bar=$(TMPDIR)/libbar-a.rlib \
|
|
&& exit 1 || exit 0
|
|
$(RUSTC) foo.rs \
|
|
--extern bar=$(TMPDIR)/libbar.rlib \
|
|
--extern bar=$(TMPDIR)/libbar.rlib
|
|
$(RUSTC) foo.rs --extern bar=$(TMPDIR)/libbar.rlib
|