Skip to content

Commit

Permalink
use the LIBXML2 variable if set directly instead of figuring out pack…
Browse files Browse the repository at this point in the history
…aging
  • Loading branch information
przygienda authored and dginev committed May 17, 2021
1 parent e483902 commit b85992f
Showing 1 changed file with 23 additions and 13 deletions.
36 changes: 23 additions & 13 deletions build.rs
Original file line number Diff line number Diff line change
@@ -1,19 +1,29 @@
fn main() {
#[cfg(any(target_family="unix", target_os="macos"))]
{
if pkg_config_dep::find() {
return;
}
}
if let Ok(ref s) = std::env::var("LIBXML2") {
// println!("{:?}", std::env::vars());
// panic!("set libxml2.");
let p = std::path::Path::new(s);
let fname = std::path::Path::new(p.file_name().expect("no file name in LIBXML2 env"));
assert!(p.is_file());
println!("cargo:rustc-link-lib={}", fname.file_stem().unwrap().to_string_lossy());
println!("cargo:rustc-link-search={}", p.parent().expect("no library path in LIBXML2 env").to_string_lossy());
} else {
#[cfg(any(target_family = "unix", target_os = "macos"))]
{
if pkg_config_dep::find() {
return;
}
}

#[cfg(windows)]
{
if vcpkg_dep::find() {
return;
}
}
#[cfg(windows)]
{
if vcpkg_dep::find() {
return;
}
}

panic!("Could not find libxml2.")
panic!("Could not find libxml2.")
}
}

#[cfg(any(target_family="unix", target_os="macos"))]
Expand Down

0 comments on commit b85992f

Please sign in to comment.