Loading openssl-sys/Cargo.toml +1 −0 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ vendored = ['openssl-src'] libc = "0.2" [build-dependencies] bindgen = { version = "0.59", optional = true } cc = "1.0" openssl-src = { version = "300", optional = true } pkg-config = "0.3.9" Loading openssl-sys/build/main.rs +7 −1 Original line number Diff line number Diff line #![allow(clippy::inconsistent_digit_grouping, clippy::unusual_byte_groupings)] extern crate autocfg; #[cfg(feature = "bindgen")] extern crate bindgen; extern crate cc; #[cfg(feature = "vendored")] extern crate openssl_src; Loading @@ -12,12 +14,13 @@ use std::collections::HashSet; use std::env; use std::ffi::OsString; use std::path::{Path, PathBuf}; mod cfgs; mod find_normal; #[cfg(feature = "vendored")] mod find_vendored; #[cfg(feature = "bindgen")] mod run_bindgen; #[derive(PartialEq)] enum Version { Loading Loading @@ -64,6 +67,9 @@ fn main() { let (lib_dir, include_dir) = find_openssl(&target); #[cfg(feature = "bindgen")] run_bindgen::run(&include_dir); if !Path::new(&lib_dir).exists() { panic!( "OpenSSL library directory does not exist: {}", Loading openssl-sys/build/run_bindgen.rs 0 → 100644 +32 −0 Original line number Diff line number Diff line use bindgen::callbacks::{MacroParsingBehavior, ParseCallbacks}; use std::env; use std::path::{Path, PathBuf}; const INCLUDES: &str = " #include <openssl/stack.h> "; pub fn run(include_dir: &Path) { let out_dir = PathBuf::from(env::var_os("OUT_DIR").unwrap()); bindgen::builder() .parse_callbacks(Box::new(OpensslCallbacks)) .ctypes_prefix("::libc") .clang_arg("-I") .clang_arg(include_dir.display().to_string()) .header_contents("includes.h", INCLUDES) .generate() .unwrap() .write_to_file(out_dir.join("bindgen.rs")) .unwrap(); } #[derive(Debug)] struct OpensslCallbacks; impl ParseCallbacks for OpensslCallbacks { // for now we'll continue hand-writing constants fn will_parse_macro(&self, _name: &str) -> MacroParsingBehavior { MacroParsingBehavior::Ignore } } openssl-sys/src/lib.rs +5 −0 Original line number Diff line number Diff line Loading @@ -16,6 +16,9 @@ extern crate libc; use libc::*; #[cfg(feature = "bindgen")] include!(concat!(env!("OUT_DIR"), "/bindgen.rs")); pub use aes::*; pub use asn1::*; pub use bio::*; Loading Loading @@ -44,6 +47,7 @@ pub use sha::*; pub use srtp::*; pub use ssl::*; pub use ssl3::*; #[cfg(not(feature = "bindgen"))] pub use stack::*; pub use tls1::*; pub use types::*; Loading Loading @@ -82,6 +86,7 @@ mod sha; mod srtp; mod ssl; mod ssl3; #[cfg(not(feature = "bindgen"))] mod stack; mod tls1; mod types; Loading openssl/Cargo.toml +1 −0 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ v110 = [] v111 = [] vendored = ['ffi/vendored'] bindgen = ['ffi/bindgen'] [dependencies] bitflags = "1.0" Loading Loading
openssl-sys/Cargo.toml +1 −0 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ vendored = ['openssl-src'] libc = "0.2" [build-dependencies] bindgen = { version = "0.59", optional = true } cc = "1.0" openssl-src = { version = "300", optional = true } pkg-config = "0.3.9" Loading
openssl-sys/build/main.rs +7 −1 Original line number Diff line number Diff line #![allow(clippy::inconsistent_digit_grouping, clippy::unusual_byte_groupings)] extern crate autocfg; #[cfg(feature = "bindgen")] extern crate bindgen; extern crate cc; #[cfg(feature = "vendored")] extern crate openssl_src; Loading @@ -12,12 +14,13 @@ use std::collections::HashSet; use std::env; use std::ffi::OsString; use std::path::{Path, PathBuf}; mod cfgs; mod find_normal; #[cfg(feature = "vendored")] mod find_vendored; #[cfg(feature = "bindgen")] mod run_bindgen; #[derive(PartialEq)] enum Version { Loading Loading @@ -64,6 +67,9 @@ fn main() { let (lib_dir, include_dir) = find_openssl(&target); #[cfg(feature = "bindgen")] run_bindgen::run(&include_dir); if !Path::new(&lib_dir).exists() { panic!( "OpenSSL library directory does not exist: {}", Loading
openssl-sys/build/run_bindgen.rs 0 → 100644 +32 −0 Original line number Diff line number Diff line use bindgen::callbacks::{MacroParsingBehavior, ParseCallbacks}; use std::env; use std::path::{Path, PathBuf}; const INCLUDES: &str = " #include <openssl/stack.h> "; pub fn run(include_dir: &Path) { let out_dir = PathBuf::from(env::var_os("OUT_DIR").unwrap()); bindgen::builder() .parse_callbacks(Box::new(OpensslCallbacks)) .ctypes_prefix("::libc") .clang_arg("-I") .clang_arg(include_dir.display().to_string()) .header_contents("includes.h", INCLUDES) .generate() .unwrap() .write_to_file(out_dir.join("bindgen.rs")) .unwrap(); } #[derive(Debug)] struct OpensslCallbacks; impl ParseCallbacks for OpensslCallbacks { // for now we'll continue hand-writing constants fn will_parse_macro(&self, _name: &str) -> MacroParsingBehavior { MacroParsingBehavior::Ignore } }
openssl-sys/src/lib.rs +5 −0 Original line number Diff line number Diff line Loading @@ -16,6 +16,9 @@ extern crate libc; use libc::*; #[cfg(feature = "bindgen")] include!(concat!(env!("OUT_DIR"), "/bindgen.rs")); pub use aes::*; pub use asn1::*; pub use bio::*; Loading Loading @@ -44,6 +47,7 @@ pub use sha::*; pub use srtp::*; pub use ssl::*; pub use ssl3::*; #[cfg(not(feature = "bindgen"))] pub use stack::*; pub use tls1::*; pub use types::*; Loading Loading @@ -82,6 +86,7 @@ mod sha; mod srtp; mod ssl; mod ssl3; #[cfg(not(feature = "bindgen"))] mod stack; mod tls1; mod types; Loading
openssl/Cargo.toml +1 −0 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ v110 = [] v111 = [] vendored = ['ffi/vendored'] bindgen = ['ffi/bindgen'] [dependencies] bitflags = "1.0" Loading