Do build-time bindgen

Majority of build_gecko.rs is just the straightforward conversion from
regen.py. There are two differences that:
1. Side in whitelist is changed to mozilla::Side
2. std::atomic__My_base is added to opaque types for Windows
This commit is contained in:
Xidorn Quan 2016-12-09 13:55:49 -10:00
parent 6dd4b4822f
commit 1cefd1bef0
8 changed files with 739 additions and 835 deletions

View file

@ -2,6 +2,12 @@
* 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/. */
#[macro_use]
extern crate lazy_static;
#[cfg(feature = "bindgen")]
extern crate libbindgen;
#[cfg(feature = "bindgen")]
extern crate regex;
extern crate walkdir;
extern crate phf_codegen;
@ -12,6 +18,14 @@ use std::path::Path;
use std::process::{Command, exit};
use walkdir::WalkDir;
#[cfg(feature = "gecko")]
mod build_gecko;
#[cfg(not(feature = "gecko"))]
mod build_gecko {
pub fn generate() {}
}
#[cfg(windows)]
fn find_python() -> String {
if Command::new("python2.7.exe").arg("--version").output().is_ok() {
@ -39,8 +53,7 @@ fn find_python() -> String {
}.to_owned()
}
fn main() {
println!("cargo:rerun-if-changed=build.rs");
fn generate_properties() {
for entry in WalkDir::new("properties") {
let entry = entry.unwrap();
match entry.path().extension().and_then(|e| e.to_str()) {
@ -82,3 +95,9 @@ fn main() {
map.build(&mut file).unwrap();
write!(&mut file, ";\n").unwrap();
}
fn main() {
println!("cargo:rerun-if-changed=build.rs");
generate_properties();
build_gecko::generate();
}