From 4cebfd7ded69e0115e2ac93d6fd80ad337c2bfce Mon Sep 17 00:00:00 2001 From: Meralis40 Date: Wed, 15 Jun 2016 13:46:27 +0200 Subject: [PATCH 1/2] Make it build on Windows --- libuv-sys/Cargo.toml | 1 + libuv-sys/Readme.md | 8 ++++++++ libuv-sys/build.rs | 2 +- libuv-sys/src/lib.rs | 2 +- 4 files changed, 11 insertions(+), 2 deletions(-) create mode 100644 libuv-sys/Readme.md diff --git a/libuv-sys/Cargo.toml b/libuv-sys/Cargo.toml index 3c71410..6efe5ee 100644 --- a/libuv-sys/Cargo.toml +++ b/libuv-sys/Cargo.toml @@ -14,6 +14,7 @@ pkg-config = "0.3.6" [dependencies] libc = "0.1.10" +winapi = "0.2.7" # [lib] # crate-type = ["dylib"] diff --git a/libuv-sys/Readme.md b/libuv-sys/Readme.md new file mode 100644 index 0000000..bbd1ca0 --- /dev/null +++ b/libuv-sys/Readme.md @@ -0,0 +1,8 @@ +# libuv-sys + + + +# Building on Windows +In order to build libuv-sys on Windows, you must have : +* Python 2.7 (not 3.x) installed, and on PATH +* Rust MSVC toolchain (currently, GNU toolchains don't work) diff --git a/libuv-sys/build.rs b/libuv-sys/build.rs index 72e41b3..73c2225 100644 --- a/libuv-sys/build.rs +++ b/libuv-sys/build.rs @@ -154,7 +154,7 @@ fn main() { pkg_config::find_library("libuv").unwrap(); } else { get_libuv(); - println!("cargo:rustc-link-lib=static=uv"); + println!("cargo:rustc-link-lib=uv"); println!("cargo:rustc-link-search=native={}", env::current_dir().unwrap().join(libuv_lib().parent().unwrap()).to_str().unwrap()); if target.contains("linux") { diff --git a/libuv-sys/src/lib.rs b/libuv-sys/src/lib.rs index be6fe75..7f21bfd 100644 --- a/libuv-sys/src/lib.rs +++ b/libuv-sys/src/lib.rs @@ -9,7 +9,7 @@ use winapi::{OVERLAPPED, HANDLE}; #[cfg(windows)] mod variable_types { - use libc::c_uchar; + use libc::{c_uchar, c_char}; use winapi::{ULONG, SOCKET, HANDLE}; // undocumented pub type uv_uid_t = c_uchar; From 46466438c4a3149e06139bfe15fe912a4af19a0f Mon Sep 17 00:00:00 2001 From: Quentin Laveau Date: Thu, 22 Jun 2017 13:05:55 +0200 Subject: [PATCH 2/2] Correct building on Windows --- libuv-sys/build.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/libuv-sys/build.rs b/libuv-sys/build.rs index 73c2225..e6a46da 100644 --- a/libuv-sys/build.rs +++ b/libuv-sys/build.rs @@ -154,7 +154,11 @@ fn main() { pkg_config::find_library("libuv").unwrap(); } else { get_libuv(); - println!("cargo:rustc-link-lib=uv"); + if target.contains("windows") { + println!("cargo:rustc-link-lib=libuv"); + } else { + println!("cargo:rustc-link-lib=static=uv"); + } println!("cargo:rustc-link-search=native={}", env::current_dir().unwrap().join(libuv_lib().parent().unwrap()).to_str().unwrap()); if target.contains("linux") {