Switch task_info to use modern Cargo tools.

This commit is contained in:
Jack Moffitt 2015-05-29 17:38:48 -06:00
parent bf4fc6f388
commit 29fcdce5e0
9 changed files with 22 additions and 64 deletions

View file

@ -10,9 +10,6 @@ path = "lib.rs"
[dependencies.profile_traits] [dependencies.profile_traits]
path = "../profile_traits" path = "../profile_traits"
[dependencies.task_info]
path = "../../support/rust-task_info"
[dependencies.util] [dependencies.util]
path = "../util" path = "../util"
@ -20,3 +17,9 @@ path = "../util"
libc = "*" libc = "*"
regex = "0.1.14" regex = "0.1.14"
time = "0.1.12" time = "0.1.12"
[target.x86_64-apple-darwin.dependencies.task_info]
path = "../../support/rust-task_info"
[target.i686-apple-darwin.dependencies.task_info]
path = "../../support/rust-task_info"

View file

@ -1178,6 +1178,9 @@ dependencies = [
[[package]] [[package]]
name = "task_info" name = "task_info"
version = "0.0.1" version = "0.0.1"
dependencies = [
"gcc 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]] [[package]]
name = "tempdir" name = "tempdir"

3
ports/cef/Cargo.lock generated
View file

@ -1171,6 +1171,9 @@ dependencies = [
[[package]] [[package]]
name = "task_info" name = "task_info"
version = "0.0.1" version = "0.0.1"
dependencies = [
"gcc 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]] [[package]]
name = "tempdir" name = "tempdir"

3
ports/gonk/Cargo.lock generated
View file

@ -1042,6 +1042,9 @@ dependencies = [
[[package]] [[package]]
name = "task_info" name = "task_info"
version = "0.0.1" version = "0.0.1"
dependencies = [
"gcc 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]] [[package]]
name = "tempdir" name = "tempdir"

View file

@ -5,3 +5,6 @@ version = "0.0.1"
authors = ["The Servo Project Developers"] authors = ["The Servo Project Developers"]
build = "build.rs" build = "build.rs"
[build-dependencies]
gcc = "0.3.4"

View file

@ -1,32 +0,0 @@
VPATH=%VPATH%
CC ?= gcc
RUSTC ?= rustc
AR ?= ar
RUSTFLAGS ?=
CFLAGS += -Wall
RUST_SRC = $(shell find $(VPATH)/. -type f -name '*.rs')
.PHONY: all
all: libtask_info-servo.dummy
libtask_info-servo.dummy: task_info.rc $(RUST_SRC) libtask_info.a
$(RUSTC) $(RUSTFLAGS) $< --out-dir . -C extra-filename=-servo
touch $@
task_info-test: task_info.rc $(RUST_SRC) libtask_info.a
$(RUSTC) $(RUSTFLAGS) $< -o $@ --test
libtask_info.a: task_info.o
$(AR) rcs libtask_info.a task_info.o
task_info.o: task_info.c
$(CC) $(CFLAGS) $< -o $@ -c
check: task_info-test
./task_info-test
.PHONY: clean
clean:
rm -f task_info-test *.a *.o *.so *.dylib *.rlib *.dll *.dummy task_info-test

View file

@ -2,14 +2,10 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use std::process::Command; extern crate gcc;
use std::env;
fn main() { fn main() {
assert!(Command::new("make") let mut cfg = gcc::Config::new();
.args(&["-f", "makefile.cargo"]) cfg.file("src/task_info.c");
.status() cfg.compile("libtask_info.a");
.unwrap()
.success());
println!("cargo:rustc-flags=-L native={}", env::var("OUT_DIR").unwrap());
} }

View file

@ -1,20 +0,0 @@
CC ?= gcc
AR ?= ar
CFLAGS += -Wall
.PHONY: all
ifeq (darwin,$(findstring darwin,$(TARGET)))
all: $(OUT_DIR)/libtask_info.a
$(OUT_DIR)/libtask_info.a: $(OUT_DIR)/task_info.o
$(AR) rcs $@ $^
$(OUT_DIR)/task_info.o: src/task_info.c
$(CC) $(CFLAGS) $< -o $@ -c
else
all:
endif

View file

@ -14,6 +14,5 @@
extern crate libc; extern crate libc;
#[cfg(target_os="macos")]
pub mod task_basic_info; pub mod task_basic_info;