proxmox-backup-qemu/build.rs
Fabian Grünbichler b68750a609 update to current PBS and cbindgen
cbindgen still requires syn 1.x unfortunately, the new version picks up
wakeup_callback which we don't actually need in our interface, so exclude it at
least until the next bump happens for other reasons.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2023-10-03 12:00:41 +02:00

30 lines
912 B
Rust

// build.rs
extern crate cbindgen;
use std::env;
fn main() {
let crate_dir = env::var("CARGO_MANIFEST_DIR").unwrap();
let header = std::fs::read_to_string("header-preamble.c").unwrap();
let crate_ver = env!("CARGO_PKG_VERSION");
let git_ver = match option_env!("GITVERSION") {
Some(ver) if !ver.is_empty() => ver,
_ => "UNKNOWN",
};
let version_string = format!("{} ({})", crate_ver, git_ver,);
cbindgen::Builder::new()
.with_language(cbindgen::Language::C)
.with_crate(&crate_dir)
.with_header(header)
.with_include_guard("PROXMOX_BACKUP_QEMU_H")
.exclude_item("wakeup_callback")
.generate()
.unwrap()
.write_to_file("proxmox-backup-qemu.h");
println!("cargo:rustc-cdylib-link-arg=-Wl,-soname,libproxmox_backup_qemu.so.0");
println!("cargo:rustc-env=PBS_LIB_VERSION={}", version_string);
}