const LIB_NAME: &str = "blkid";
const BLKID_MIN_REQ_VERSION: &str = "2.21.0";
const BLKID_CHANGED_MIN_VERSIONS: &[usize] = &[23, 24, 25, 30, 31, 36, 37];
fn main() {
let libblkid = pkg_config::Config::new()
.atleast_version(BLKID_MIN_REQ_VERSION)
.probe(LIB_NAME)
.expect("Failed to find minimal required version of library");
let min_num = libblkid
.version
.split_terminator('.')
.nth(1)
.expect("Failed to find MIN number of version");
let min_num: usize = min_num
.parse()
.expect("Failed to parse MIN number of version");
let idx = BLKID_CHANGED_MIN_VERSIONS.iter().position(|v| v > &min_num);
if let Some(idx) = idx {
for min_num in &BLKID_CHANGED_MIN_VERSIONS[..idx] {
println!("cargo:rustc-cfg={}=\"2.{}\"", LIB_NAME, min_num);
}
} else {
for min_num in BLKID_CHANGED_MIN_VERSIONS {
println!("cargo:rustc-cfg={}=\"2.{}\"", LIB_NAME, min_num);
}
}
}