Commit 0854632f authored by Steven Fackler's avatar Steven Fackler
Browse files

Make c_helpers optional

parent 2f46c793
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -26,6 +26,10 @@ rfc5114 = ["openssl-sys/rfc5114"]
ecdh_auto = ["openssl-sys/ecdh_auto"]
pkcs5_pbkdf2_hmac = ["openssl-sys/pkcs5_pbkdf2_hmac"]

c_helpers = ["gcc"]
x509_clone = ["c_helpers"]
ssl_context_clone = ["c_helpers"]

[dependencies]
bitflags = ">= 0.5.0, < 0.8.0"
lazy_static = "0.2"
@@ -34,7 +38,7 @@ openssl-sys = { version = "0.7.14", path = "../openssl-sys" }
openssl-sys-extras = { version = "0.7.14", path = "../openssl-sys-extras" }

[build-dependencies]
gcc = "0.3"
gcc = { version = "0.3", optional = true }

[dev-dependencies]
rustc-serialize = "0.3"
+21 −9
Original line number Diff line number Diff line
#[cfg(feature = "c_helpers")]
mod imp {
    extern crate gcc;

    use std::env;
    use std::path::PathBuf;

fn main() {
    pub fn main() {
        let mut config = gcc::Config::new();

        if let Some(paths) = env::var_os("DEP_OPENSSL_INCLUDE") {
@@ -14,3 +16,13 @@ fn main() {

        config.file("src/c_helpers.c").compile("libc_helpers.a");
    }
}

#[cfg(not(feature = "c_helpers"))]
mod imp {
    pub fn main() {}
}

fn main() {
    imp::main()
}
+7 −0
Original line number Diff line number Diff line
use ffi;

#[allow(dead_code)]
extern "C" {
    pub fn rust_SSL_CTX_clone(cxt: *mut ffi::SSL_CTX);
    pub fn rust_X509_clone(x509: *mut ffi::X509);
}
+2 −2
Original line number Diff line number Diff line
@@ -101,7 +101,7 @@ mod tests {
                                      5FBD3")
                    .unwrap();
        let dh = DH::from_params(p, g, q).unwrap();
        ctx.set_tmp_dh(dh).unwrap();
        ctx.set_tmp_dh(&dh).unwrap();
    }

    #[test]
@@ -109,6 +109,6 @@ mod tests {
        let mut ctx = SslContext::new(Sslv23).unwrap();
        let params = include_bytes!("../../test/dhparams.pem");
        let dh = DH::from_pem(params).ok().expect("Failed to load PEM");
        ctx.set_tmp_dh(dh).unwrap();
        ctx.set_tmp_dh(&dh).unwrap();
    }
}
+2 −0
Original line number Diff line number Diff line
@@ -24,6 +24,8 @@ mod macros;
pub mod asn1;
mod bio;
pub mod bn;
#[cfg(feature = "c_helpers")]
mod c_helpers;
pub mod crypto;
pub mod dh;
pub mod error;
Loading