Skip to content

Commit 027a7c5

Browse files
committed
Carry over PR #134 enhancements for mingw64, thank you @netoffice-zz
1 parent eba2097 commit 027a7c5

3 files changed

Lines changed: 12 additions & 3 deletions

File tree

Cargo.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,12 @@ name = "libxml"
2020
[dependencies]
2121
libc = "0.2"
2222

23-
[target.'cfg(windows)'.build-dependencies]
23+
[target.'cfg(all(target_family = "windows", target_env = "msvc"))'.build-dependencies]
2424
vcpkg = "0.2"
2525

26+
[target.'cfg(all(target_family = "windows", target_env = "gnu"))'.build-dependencies]
27+
pkg-config = "0.3.2"
28+
2629
[target.'cfg(macos)'.build-dependencies]
2730
pkg-config = "0.3.2"
2831

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ $ pkg install libxml2 pkgconf
4444

4545
### Windows
4646

47+
#### msvc
48+
4749
[Community contributed](https://github.com/KWARC/rust-libxml/issues/81#issuecomment-760364976):
4850

4951
* manually install builds tools c++ and english language by visiting [BuildTools](https://visualstudio.microsoft.com/fr/thank-you-downloading-visual-studio/?sku=BuildTools&rel=16)
@@ -56,3 +58,7 @@ C:\> refreshenv
5658
C:\> vcpkg install libxml2:x64-windows
5759
C:\> vcpkg integrate install
5860
```
61+
62+
#### gnu
63+
64+
On mingw64 environment you could install libxml2 with `pacman -S mingw64/mingw-w64-x86_64-libxml2`.

build.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ fn find_libxml2() -> Option<ProbedLib> {
4040
);
4141
None
4242
} else {
43-
#[cfg(any(target_family = "unix", target_os = "macos"))]
43+
#[cfg(any(target_family = "unix", target_os = "macos", all(target_family="windows", target_env="gnu")))]
4444
{
4545
let lib = pkg_config::Config::new()
4646
.probe("libxml-2.0")
@@ -109,7 +109,7 @@ fn main() {
109109
}
110110
}
111111

112-
#[cfg(target_family = "windows")]
112+
#[cfg(all(target_family = "windows", target_env = "msvc"))]
113113
mod vcpkg_dep {
114114
use crate::ProbedLib;
115115
pub fn vcpkg_find_libxml2() -> Option<ProbedLib> {

0 commit comments

Comments
 (0)