Skip to content

Commit f18e3d4

Browse files
committed
Always use bindgen crate
1 parent 0bc40e4 commit f18e3d4

File tree

3 files changed

+7
-58
lines changed

3 files changed

+7
-58
lines changed

Cargo.toml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@ wasi = ["ffi/wasi"]
1818
std = []
1919
use-32bit-slots = ["ffi/use-32bit-slots"]
2020

21-
build-bindgen = ["ffi/build-bindgen"]
22-
2321
[dependencies]
2422
cty = "0.2"
2523

wasm3-sys/Cargo.toml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,14 @@ include = ["wasm3/source/**/*", "src/**/*", "Cargo.toml", "build.rs"]
1515
[features]
1616
wasi = []
1717
use-32bit-slots = []
18-
build-bindgen = ["bindgen"]
1918

2019
[dependencies]
2120
cty = "0.2"
2221

2322
[build-dependencies]
2423
cc = "1"
2524
shlex = "0.1.1"
26-
27-
[build-dependencies.bindgen]
28-
version = "0.54"
29-
optional = true
25+
bindgen = "0.58.1"
3026

3127
[package.metadata.docs.rs]
3228
all-features = true

wasm3-sys/build.rs

Lines changed: 6 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -35,53 +35,6 @@ fn gen_wrapper(out_path: &Path) -> PathBuf {
3535
wrapper_file
3636
}
3737

38-
#[cfg(not(feature = "build-bindgen"))]
39-
fn gen_bindings() {
40-
let out_path = PathBuf::from(&env::var("OUT_DIR").unwrap());
41-
42-
let wrapper_file = gen_wrapper(&out_path);
43-
44-
let mut bindgen = std::process::Command::new("bindgen");
45-
bindgen
46-
.arg(wrapper_file)
47-
.arg("--use-core")
48-
.arg("--ctypes-prefix")
49-
.arg("cty")
50-
.arg("--no-layout-tests")
51-
.arg("--default-enum-style=moduleconsts")
52-
.arg("--no-doc-comments")
53-
.arg("--whitelist-function")
54-
.arg(WHITELIST_REGEX_FUNCTION)
55-
.arg("--whitelist-type")
56-
.arg(WHITELIST_REGEX_TYPE)
57-
.arg("--whitelist-var")
58-
.arg(WHITELIST_REGEX_VAR)
59-
.arg("--no-derive-debug");
60-
for &ty in PRIMITIVES.iter() {
61-
bindgen.arg("--blacklist-type").arg(ty);
62-
}
63-
bindgen
64-
.arg("-o")
65-
.arg(out_path.join("bindings.rs").to_str().unwrap());
66-
bindgen
67-
.arg("--")
68-
.arg(format!(
69-
"-Dd_m3Use32BitSlots={}",
70-
if cfg!(feature = "use-32bit-slots") {
71-
1
72-
} else {
73-
0
74-
}
75-
))
76-
.arg("-Dd_m3LogOutput=0")
77-
.arg("-Iwasm3/source");
78-
let status = bindgen.status().expect("Unable to generate bindings");
79-
if !status.success() {
80-
panic!("Failed to run bindgen: {:?}", status);
81-
}
82-
}
83-
84-
#[cfg(feature = "build-bindgen")]
8538
fn gen_bindings() {
8639
let out_path = PathBuf::from(env::var("OUT_DIR").unwrap());
8740

@@ -94,13 +47,15 @@ fn gen_bindings() {
9447
.layout_tests(false)
9548
.default_enum_style(bindgen::EnumVariation::ModuleConsts)
9649
.generate_comments(false)
97-
.whitelist_function(WHITELIST_REGEX_FUNCTION)
98-
.whitelist_type(WHITELIST_REGEX_TYPE)
99-
.whitelist_var(WHITELIST_REGEX_VAR)
50+
.allowlist_function(WHITELIST_REGEX_FUNCTION)
51+
.allowlist_type(WHITELIST_REGEX_TYPE)
52+
.allowlist_var(WHITELIST_REGEX_VAR)
10053
.derive_debug(false);
54+
10155
bindgen = PRIMITIVES
10256
.iter()
103-
.fold(bindgen, |bindgen, ty| bindgen.blacklist_type(ty));
57+
.fold(bindgen, |bindgen, ty| bindgen.blocklist_type(ty));
58+
10459
bindgen
10560
.clang_args(
10661
[

0 commit comments

Comments
 (0)