diff --git a/components/style/build_gecko.rs b/components/style/build_gecko.rs index 094b44a7087..ddf4a8b71ef 100644 --- a/components/style/build_gecko.rs +++ b/components/style/build_gecko.rs @@ -46,11 +46,15 @@ lazy_static! { .join("layout/style/ServoBindings.toml"); read_config(&path) }; - static ref BUILD_CONFIG: Table = { + static ref BINDGEN_FLAGS: Vec = { // Load build-specific config overrides. let path = PathBuf::from(env::var_os("MOZ_TOPOBJDIR").unwrap()) - .join("layout/style/bindgen.toml"); - read_config(&path) + .join("layout/style/extra-bindgen-flags"); + println!("cargo:rerun-if-changed={}", path.to_str().unwrap()); + fs::read_to_string(path).expect("Failed to read extra-bindgen-flags file") + .split_whitespace() + .map(std::borrow::ToOwned::to_owned) + .collect() }; static ref INCLUDE_RE: Regex = Regex::new(r#"#include\s*"(.+?)""#).unwrap(); static ref DISTDIR_PATH: PathBuf = { @@ -159,12 +163,8 @@ impl BuilderExt for Builder { builder = builder.clang_arg("-DDEBUG=1").clang_arg("-DJS_DEBUG=1"); } - let build_config = BUILD_CONFIG["build"] - .as_table() - .expect("Malformed config file"); - let extra_bindgen_flags = build_config["args"].as_array().unwrap().as_slice(); - for item in extra_bindgen_flags.iter() { - builder = builder.clang_arg(item.as_str().expect("Expect string in list")); + for item in &*BINDGEN_FLAGS { + builder = builder.clang_arg(item); } builder