Bug 1322769 - Add a "servo" feature; r?Manishearth
MozReview-Commit-ID: A9dNTxNkl39
--- a/config/rules.mk
+++ b/config/rules.mk
@@ -914,16 +914,19 @@ cargo_target_flag := --target=$(RUST_TAR
# Permit users to pass flags to cargo from their mozconfigs (e.g. --color=always).
cargo_build_flags = $(CARGOFLAGS)
ifndef MOZ_DEBUG
cargo_build_flags = --release
endif
ifdef MOZ_CARGO_SUPPORTS_FROZEN
cargo_build_flags += --frozen
endif
+ifdef MOZ_STYLO
+cargo_build_flags += --features=servo
+endif
cargo_build_flags += --manifest-path $(CARGO_FILE)
ifdef BUILD_VERBOSE_LOG
cargo_build_flags += --verbose
endif
# Enable color output if original stdout was a TTY and color settings
# aren't already present. This essentially restores the default behavior
--- a/toolkit/library/gtest/rust/Cargo.toml
+++ b/toolkit/library/gtest/rust/Cargo.toml
@@ -2,16 +2,17 @@
name = "gkrust-gtest"
version = "0.1.0"
authors = ["nobody@mozilla.org"]
license = "MPL-2.0"
description = "Testing code for libgkrust"
[features]
bindgen = ["gkrust-shared/bindgen"]
+servo = ["gkrust-shared/servo"]
[dependencies]
mp4parse-gtest = { path = "../../../../dom/media/gtest" }
nsstring-gtest = { path = "../../../../xpcom/rust/nsstring/gtest" }
gkrust-shared = { path = "../../rust/shared" }
[lib]
path = "lib.rs"
--- a/toolkit/library/rust/Cargo.toml
+++ b/toolkit/library/rust/Cargo.toml
@@ -2,16 +2,17 @@
name = "gkrust"
version = "0.1.0"
authors = ["nobody@mozilla.org"]
license = "MPL-2.0"
description = "Rust code for libxul"
[features]
bindgen = ["gkrust-shared/bindgen"]
+servo = ["gkrust-shared/servo"]
[dependencies]
gkrust-shared = { path = "shared" }
[lib]
path = "lib.rs"
crate-type = ["staticlib"]
test = false
--- a/toolkit/library/rust/shared/Cargo.toml
+++ b/toolkit/library/rust/shared/Cargo.toml
@@ -1,24 +1,25 @@
[package]
name = "gkrust-shared"
version = "0.1.0"
authors = ["nobody@mozilla.org"]
license = "MPL-2.0"
description = "Shared Rust code for libxul"
[dependencies]
-geckoservo = { path = "../../../../servo/ports/geckolib" }
+geckoservo = { path = "../../../../servo/ports/geckolib", optional = true }
mp4parse_capi = { path = "../../../../media/libstagefright/binding/mp4parse_capi" }
nsstring = { path = "../../../../xpcom/rust/nsstring" }
rust_url_capi = { path = "../../../../netwerk/base/rust-url-capi" }
[features]
default = []
bindgen = ["geckoservo/bindgen"]
+servo = ["geckoservo"]
[lib]
path = "lib.rs"
test = false
doctest = false
bench = false
doc = false
plugin = false
--- a/toolkit/library/rust/shared/lib.rs
+++ b/toolkit/library/rust/shared/lib.rs
@@ -1,7 +1,10 @@
// This Source Code Form is subject to the terms of the Mozilla Public
// 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/.
+#[cfg(feature="servo")]
+extern crate geckoservo;
+
extern crate mp4parse_capi;
extern crate nsstring;
extern crate rust_url_capi;