Skip to content

Commit

Permalink
Build infra and minor build-enabling bugfixes for cargo.
Browse files Browse the repository at this point in the history
  • Loading branch information
graydon committed Dec 1, 2011
1 parent fa9e3e8 commit d1fd7d4
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 9 deletions.
3 changes: 2 additions & 1 deletion Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
1 change: 1 addition & 0 deletions mk/clean.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 2 additions & 0 deletions mk/dist.mk
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ PKG_FILES = \
$(FUZZER_INPUTS) \
$(COMPILETEST_CRATE) \
$(COMPILETEST_INPUTS) \
$(CARGO_CRATE) \
$(CARGO_INPUTS) \
$(PKG_PP_EXAMPLES) \
$(MKFILE_DEPS)

Expand Down
5 changes: 3 additions & 2 deletions mk/pp.mk
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ ifdef PPFILES
else
PP_INPUTS = $(wildcard $(addprefix $(S)src/lib/,*.rs */*.rs)) \
$(wildcard $(addprefix $(S)src/comp/,*.rs */*.rs */*/*.rs)) \
$(wildcard $(S)src/test/*/*.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")
Expand Down
18 changes: 18 additions & 0 deletions mk/tools.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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), \
Expand Down
14 changes: 14 additions & 0 deletions src/cargo/cargo.rc
Original file line number Diff line number Diff line change
@@ -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:
8 changes: 2 additions & 6 deletions src/cargo.rs → src/cargo/cargo.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
// cargo.rs - Rust package manager

use rustc;
use std;

import rustc::syntax::{ast, codemap, visit};
import rustc::syntax::parse::parser;

Expand Down Expand Up @@ -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;
}
Expand All @@ -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 {
Expand All @@ -132,4 +129,3 @@ fn main(argv: [str]) {
_ { cmd_usage(); }
}
}

0 comments on commit d1fd7d4

Please sign in to comment.