Build infra and minor build-enabling bugfixes for cargo.

This commit is contained in:
Graydon Hoare 2011-12-01 11:31:29 -08:00
parent fa9e3e8d9a
commit d1fd7d49a7
7 changed files with 42 additions and 9 deletions

View File

@ -343,9 +343,10 @@ TSREQS := \
$(foreach target,$(CFG_TARGET_TRIPLES), \
$(SREQ3_T_$(target)_H_$(CFG_HOST_TRIPLE)))
FUZZ := $(HBIN3_H_$(CFG_HOST_TRIPLE))/fuzzer$(X)
CARGO := $(HBIN3_H_$(CFG_HOST_TRIPLE))/cargo$(X)
#all: $(SREQ3$(CFG_HOST_TRIPLE)) $(GENERATED) $(DOCS) $(FUZZ)
all: $(TSREQS) $(GENERATED) $(DOCS) $(FUZZ)
all: $(TSREQS) $(GENERATED) $(DOCS) $(FUZZ) $(CARGO)
endif

View File

@ -54,6 +54,7 @@ define CLEAN_HOST_STAGE_N
clean$(1)_H_$(2):
$(Q)rm -f $$(HBIN$(1)_H_$(2))/rustc$(X)
$(Q)rm -f $$(HBIN$(1)_H_$(2))/fuzzer$(X)
$(Q)rm -f $$(HBIN$(1)_H_$(2))/cargo$(X)
$(Q)rm -f $$(HLIB$(1)_H_$(2))/$(CFG_RUNTIME)
$(Q)rm -f $$(HLIB$(1)_H_$(2))/$(CFG_STDLIB)
$(Q)rm -f $$(HLIB$(1)_H_$(2))/$(CFG_RUSTLLVM)

View File

@ -52,6 +52,8 @@ PKG_FILES = \
$(FUZZER_INPUTS) \
$(COMPILETEST_CRATE) \
$(COMPILETEST_INPUTS) \
$(CARGO_CRATE) \
$(CARGO_INPUTS) \
$(PKG_PP_EXAMPLES) \
$(MKFILE_DEPS)

View File

@ -6,7 +6,8 @@ else
$(wildcard $(addprefix $(S)src/comp/,*.rs */*.rs */*/*.rs)) \
$(wildcard $(S)src/test/*/*.rs \
$(S)src/test/*/*/*.rs) \
$(wildcard $(S)src/fuzzer/*.rs)
$(wildcard $(S)src/fuzzer/*.rs) \
$(wildcard $(S)src/cargo/*.rs)
PP_INPUTS_FILTERED = $(shell echo $(PP_INPUTS) | xargs grep -L \
"no-reformat\|xfail-pretty\|xfail-test")

View File

@ -8,6 +8,10 @@ FUZZER_INPUTS := $(wildcard $(addprefix $(S)src/fuzzer/, *.rs))
COMPILETEST_CRATE := $(S)src/compiletest/compiletest.rc
COMPILETEST_INPUTS := $(wildcard $(S)src/compiletest/*rs)
# Cargo, the package manager
CARGO_CRATE := $(S)src/cargo/cargo.rc
CARGO_INPUTS := $(wildcard $(S)src/cargo/*rs)
# FIXME: These are only built for the host arch. Eventually we'll
# have tools that need to built for other targets.
define TOOLS_STAGE_N
@ -43,6 +47,20 @@ $$(HBIN$(2)_H_$(4))/compiletest$$(X): \
@$$(call E, cp: $$@)
$$(Q)cp $$< $$@
$$(TBIN$(1)_T_$(4)_H_$(3))/cargo$$(X): \
$$(CARGO_CRATE) $$(CARGO_INPUTS) \
$$(TSREQ$(1)_T_$(4)_H_$(3)) \
$$(TLIB$(1)_T_$(4)_H_$(3))/$$(CFG_STDLIB) \
$$(TLIB$(1)_T_$(4)_H_$(3))/$$(CFG_LIBRUSTC)
@$$(call E, compile_and_link: $$@)
$$(STAGE$(1)_T_$(4)_H_$(3)) -o $$@ $$<
$$(HBIN$(2)_H_$(4))/cargo$$(X): \
$$(TBIN$(1)_T_$(4)_H_$(3))/cargo$$(X) \
$$(HSREQ$(2)_$(4))
@$$(call E, cp: $$@)
$$(Q)cp $$< $$@
endef
$(foreach host,$(CFG_TARGET_TRIPLES), \

14
src/cargo/cargo.rc Normal file
View File

@ -0,0 +1,14 @@
// -*- rust -*-
// cargo.rs - Rust package manager
use std;
use rustc;
// Local Variables:
// fill-column: 78;
// indent-tabs-mode: nil
// c-basic-offset: 4
// buffer-file-coding-system: utf-8-unix
// compile-command: "make -k -C $RBUILD 2>&1 | sed -e 's/\\/x\\//x:\\//g'";
// End:

View File

@ -1,8 +1,5 @@
// cargo.rs - Rust package manager
use rustc;
use std;
import rustc::syntax::{ast, codemap, visit};
import rustc::syntax::parse::parser;
@ -98,7 +95,7 @@ fn rest(s: str, start: uint) -> str {
}
}
fn install_file(path: str) -> option::t<str> {
fn install_file(_path: str) -> option::t<str> {
let wd = tempfile::mkdtemp("/tmp/cargo-work-", "");
ret wd;
}
@ -110,7 +107,7 @@ fn cmd_install(argv: [str]) {
ret;
}
let wd = if str::starts_with(argv[2], "file:") {
let _wd = if str::starts_with(argv[2], "file:") {
let path = rest(argv[2], 5u);
install_file(path)
} else {
@ -132,4 +129,3 @@ fn main(argv: [str]) {
_ { cmd_usage(); }
}
}