Merge pull request #470 from sfackler/confs
Support OpenSSL conditional compilation
This commit is contained in:
commit
3ea2a9cb5f
|
|
@ -283,6 +283,7 @@ The build is now aborting due to this version mismatch.
|
||||||
|
|
||||||
// Look for `#define OPENSSL_FOO`, print out everything as our own
|
// Look for `#define OPENSSL_FOO`, print out everything as our own
|
||||||
// #[cfg] flag.
|
// #[cfg] flag.
|
||||||
|
let mut vars = vec![];
|
||||||
for line in conf_header.lines() {
|
for line in conf_header.lines() {
|
||||||
let i = match line.find("define ") {
|
let i = match line.find("define ") {
|
||||||
Some(i) => i,
|
Some(i) => i,
|
||||||
|
|
@ -291,8 +292,10 @@ The build is now aborting due to this version mismatch.
|
||||||
let var = line[i + "define ".len()..].trim();
|
let var = line[i + "define ".len()..].trim();
|
||||||
if var.starts_with("OPENSSL") && !var.contains(" ") {
|
if var.starts_with("OPENSSL") && !var.contains(" ") {
|
||||||
println!("cargo:rustc-cfg=osslconf=\"{}\"", var);
|
println!("cargo:rustc-cfg=osslconf=\"{}\"", var);
|
||||||
|
vars.push(var);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
println!("cargo:osslconf={}", vars.join(","));
|
||||||
}
|
}
|
||||||
|
|
||||||
return version_text.to_string()
|
return version_text.to_string()
|
||||||
|
|
|
||||||
|
|
@ -549,6 +549,7 @@ extern {
|
||||||
pub fn OPENSSL_add_all_algorithms_noconf();
|
pub fn OPENSSL_add_all_algorithms_noconf();
|
||||||
pub fn HMAC_CTX_init(ctx: *mut ::HMAC_CTX);
|
pub fn HMAC_CTX_init(ctx: *mut ::HMAC_CTX);
|
||||||
pub fn HMAC_CTX_cleanup(ctx: *mut ::HMAC_CTX);
|
pub fn HMAC_CTX_cleanup(ctx: *mut ::HMAC_CTX);
|
||||||
|
#[cfg(not(osslconf = "OPENSSL_NO_SSL3_METHOD"))]
|
||||||
pub fn SSLv3_method() -> *const ::SSL_METHOD;
|
pub fn SSLv3_method() -> *const ::SSL_METHOD;
|
||||||
pub fn TLSv1_method() -> *const ::SSL_METHOD;
|
pub fn TLSv1_method() -> *const ::SSL_METHOD;
|
||||||
pub fn SSLv23_method() -> *const ::SSL_METHOD;
|
pub fn SSLv23_method() -> *const ::SSL_METHOD;
|
||||||
|
|
|
||||||
|
|
@ -31,6 +31,11 @@ fn main() {
|
||||||
if env::var("DEP_OPENSSL_IS_110").is_ok() {
|
if env::var("DEP_OPENSSL_IS_110").is_ok() {
|
||||||
cfg.cfg("ossl110", None);
|
cfg.cfg("ossl110", None);
|
||||||
}
|
}
|
||||||
|
if let Ok(vars) = env::var("DEP_OPENSSL_OSSLCONF") {
|
||||||
|
for var in vars.split(",") {
|
||||||
|
cfg.cfg("osslconf", Some(var));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
cfg.header("openssl/comp.h")
|
cfg.header("openssl/comp.h")
|
||||||
.header("openssl/dh.h")
|
.header("openssl/dh.h")
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue