style: Use the mozbuild crate in servo

Differential Revision: https://phabricator.services.mozilla.com/D136562
This commit is contained in:
Mike Hommey 2023-06-06 23:48:37 +02:00 committed by Oriol Brufau
parent d32c5ed85f
commit d3aeba6bd3
2 changed files with 5 additions and 12 deletions

View file

@ -42,14 +42,12 @@ fn read_config(path: &PathBuf) -> Table {
lazy_static! {
static ref CONFIG: Table = {
// Load Gecko's binding generator config from the source tree.
let path = PathBuf::from(env::var_os("MOZ_SRC").unwrap())
.join("layout/style/ServoBindings.toml");
let path = mozbuild::TOPSRCDIR.join("layout/style/ServoBindings.toml");
read_config(&path)
};
static ref BINDGEN_FLAGS: Vec<String> = {
// Load build-specific config overrides.
let path = PathBuf::from(env::var_os("MOZ_TOPOBJDIR").unwrap())
.join("layout/style/extra-bindgen-flags");
let path = mozbuild::TOPOBJDIR.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()
@ -57,13 +55,7 @@ lazy_static! {
.collect()
};
static ref INCLUDE_RE: Regex = Regex::new(r#"#include\s*"(.+?)""#).unwrap();
static ref DISTDIR_PATH: PathBuf = {
let path = PathBuf::from(env::var_os("MOZ_TOPOBJDIR").unwrap());
if !path.is_absolute() || !path.is_dir() {
panic!("MOZ_TOPOBJDIR must be an absolute directory, was: {}", path.display());
}
path.join("dist")
};
static ref DISTDIR_PATH: PathBuf = mozbuild::TOPOBJDIR.join("dist");
static ref SEARCH_PATHS: Vec<PathBuf> = vec![
DISTDIR_PATH.join("include"),
DISTDIR_PATH.join("include/nspr"),