From 459296d0e21fbbfd77a60a8341194e5c39a66d6f Mon Sep 17 00:00:00 2001 From: Mike Harris Date: Tue, 2 Feb 2021 03:58:47 +1100 Subject: Expose libssh2_trace function (#209) * Expose libssh2_trace function and associated constants, to allow enabling libssh2 trace output. * set LIBSSH2_WIN32 on windows build so that gettimeofday replacement will be compiled. * libssh2_trace actually returns int, even though the documentation says it returns void. This was causing systest to fail. Changed the FFI to match the C function. Co-authored-by: eharmic --- libssh2-sys/build.rs | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'libssh2-sys/build.rs') diff --git a/libssh2-sys/build.rs b/libssh2-sys/build.rs index 2150148..0ec2073 100644 --- a/libssh2-sys/build.rs +++ b/libssh2-sys/build.rs @@ -39,6 +39,7 @@ fn main() { } let target = env::var("TARGET").unwrap(); + let profile = env::var("PROFILE").unwrap(); let dst = PathBuf::from(env::var_os("OUT_DIR").unwrap()); let mut cfg = cc::Build::new(); @@ -91,6 +92,7 @@ fn main() { if target.contains("windows") { cfg.include("libssh2/win32"); cfg.define("LIBSSH2_WINCNG", None); + cfg.define("LIBSSH2_WIN32", None); cfg.file("libssh2/src/wincng.c"); } else { cfg.flag("-fvisibility=hidden"); @@ -108,6 +110,7 @@ fn main() { cfg.define("HAVE_LIBCRYPT32", None); cfg.define("HAVE_EVP_AES_128_CTR", None); cfg.define("HAVE_POLL", None); + cfg.define("HAVE_GETTIMEOFDAY", None); cfg.file("libssh2/src/openssl.c"); @@ -126,6 +129,11 @@ fn main() { cfg.define("LIBSSH2_DH_GEX_NEW", None); cfg.define("LIBSSH2_HAVE_ZLIB", None); + + if profile.contains("debug") { + cfg.define("LIBSSH2DEBUG", None); + } + println!("cargo:rerun-if-env-changed=DEP_Z_INCLUDE"); if let Some(path) = env::var_os("DEP_Z_INCLUDE") { cfg.include(path); -- cgit v1.2.3