diff options
Diffstat (limited to 'openssl-sys/src')
| -rw-r--r-- | openssl-sys/src/build.rs | 13 | ||||
| -rw-r--r-- | openssl-sys/src/lib.rs | 4 |
2 files changed, 17 insertions, 0 deletions
diff --git a/openssl-sys/src/build.rs b/openssl-sys/src/build.rs index f32ced0e..53c047b2 100644 --- a/openssl-sys/src/build.rs +++ b/openssl-sys/src/build.rs @@ -3,6 +3,11 @@ extern crate "pkg-config" as pkg_config; use std::os; fn main() { + // Without hackory, pkg-config will only look for host libraries. + // So, abandon ship if we're cross compiling. + if !pkg_config::target_supported() { return; } + + if pkg_config::find_library("openssl").is_err() { let mut flags = " -l crypto -l ssl".to_string(); @@ -17,6 +22,14 @@ fn main() { if win_pos.is_some() { flags.push_str(" -l gdi32 -l wsock32"); } + + if target.find_str("android").is_some() { + let path = os::getenv("OPENSSL_PATH").expect("Android does not provide openssl libraries, please \ + build them yourselves (instructions in the README) \ + and provide their location through $OPENSSL_PATH."); + flags.push_str(format!(" -L {}", path).as_slice()); + } + println!("cargo:rustc-flags={}", flags); } } diff --git a/openssl-sys/src/lib.rs b/openssl-sys/src/lib.rs index 931920a9..03a5a567 100644 --- a/openssl-sys/src/lib.rs +++ b/openssl-sys/src/lib.rs @@ -4,6 +4,9 @@ extern crate libc; extern crate rustrt; +#[cfg(feature = "libressl-pnacl-sys")] +extern crate "libressl-pnacl-sys" as _for_linkage; + use libc::{c_void, c_int, c_char, c_ulong, c_long, c_uint, c_uchar, size_t}; use std::mem; use std::ptr; @@ -359,6 +362,7 @@ extern "C" { pub fn HMAC_Init_ex(ctx: *mut HMAC_CTX, key: *const u8, keylen: c_int, md: *const EVP_MD, imple: *const ENGINE); pub fn HMAC_Final(ctx: *mut HMAC_CTX, output: *mut u8, len: *mut c_uint); pub fn HMAC_Update(ctx: *mut HMAC_CTX, input: *const u8, len: c_uint); + pub fn HMAC_CTX_cleanup(ctx: *mut HMAC_CTX); pub fn PEM_read_bio_X509(bio: *mut BIO, out: *mut *mut X509, callback: Option<PasswordCallback>, |