From 9e33a154fd4800aac135639fc9396340a40b892d Mon Sep 17 00:00:00 2001 From: Mike Hommey Date: Mon, 22 May 2023 13:07:32 +0200 Subject: [PATCH] style: Setup bindgen flags for servo similarly to cranelift and neqo While the use of toml allows the flags to be separated, the split is done via some shell shenanigans anyways, and servo's build.rs can handle the same just fine. Differential Revision: https://phabricator.services.mozilla.com/D121042 --- components/style/build_gecko.rs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) 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