build: bump bindgen to 0.72 and migrate to the allowlist API

bindgen 0.59, relied on the now-deprecated whitelist_* builder methods
and the bare CargoCallbacks unit struct. Move to 0.72 and its current
API.
merge-requests/17/head
Alaric Senat 2026-07-17 23:34:13 +02:00
parent 9be21665c8
commit 656aa597fa
2 changed files with 7 additions and 7 deletions

View File

@ -22,7 +22,7 @@ crate-type = ["rlib"]
libc = "0.2" libc = "0.2"
[build-dependencies] [build-dependencies]
bindgen = {version = "0.59", optional = true } bindgen = { version = "0.72", optional = true }
pkg-config = "0.3" pkg-config = "0.3"
[target.'cfg(target_os = "windows")'.build-dependencies] [target.'cfg(target_os = "windows")'.build-dependencies]

View File

@ -12,12 +12,12 @@ fn generate_bindings() {
.use_core() .use_core()
// Use libc // Use libc
.ctypes_prefix("libc") .ctypes_prefix("libc")
// Whitelist // Allowlist every (lib)vlc symbol.
.whitelist_type(".*vlc.*") .allowlist_item("(lib|LIB)?(vlc|VLC)_.*")
.whitelist_function(".*vlc.*") // Required by the Windows `legacy_stdio_definitions` link workaround
.whitelist_var(".*vlc.*") // (see `windows::link_vlc`).
.whitelist_function("vsnprintf") .allowlist_function("vsnprintf")
.parse_callbacks(Box::new(bindgen::CargoCallbacks)); .parse_callbacks(Box::new(bindgen::CargoCallbacks::new()));
// Set header include paths // Set header include paths
let pkg_config_library = pkg_config::Config::new().probe("libvlc").unwrap(); let pkg_config_library = pkg_config::Config::new().probe("libvlc").unwrap();