Unverified Commit daaca3fe authored by Jack Rickard's avatar Jack Rickard Committed by GitHub
Browse files

Merge pull request #2122 from DanielSidhion/propagate-openssl-dir-vendored

Configure OpenSSL data dir on vendored builds.
parents a7c7bf0a 734d2c55
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -25,7 +25,7 @@ bssl-sys = { version = "0.1.0", optional = true }
[build-dependencies]
bindgen = { version = "0.65.0", optional = true, features = ["experimental"] }
cc = "1.0.61"
openssl-src = { version = "300.1.2", optional = true, features = ["legacy"] }
openssl-src = { version = "300.2.0", optional = true, features = ["legacy"] }
pkg-config = "0.3.9"
vcpkg = "0.2.8"

+10 −1
Original line number Diff line number Diff line
use openssl_src;
use std::path::PathBuf;

use super::env;

pub fn get_openssl(_target: &str) -> (Vec<PathBuf>, PathBuf) {
    let artifacts = openssl_src::Build::new().build();
    let openssl_config_dir = env("OPENSSL_CONFIG_DIR");

    let mut openssl_src_build = openssl_src::Build::new();
    if let Some(value) = openssl_config_dir {
        openssl_src_build.openssl_dir(PathBuf::from(value));
    }

    let artifacts = openssl_src_build.build();
    println!("cargo:vendored=1");
    println!(
        "cargo:root={}",
+9 −2
Original line number Diff line number Diff line
@@ -19,8 +19,9 @@
//! openssl = { version = "0.10", features = ["vendored"] }
//! ```
//!
//! The vendored copy will not be configured to automatically find the system's root certificates, but the
//! `openssl-probe` crate can be used to do that instead.
//! The vendored copy will be configured to automatically find a configuration and root certificates at `/usr/local/ssl`.
//! This path can be overridden with an environment variable (see the manual section below).
//! Alternatively, the `openssl-probe` crate can be used to find root certificates at runtime.
//!
//! ## Automatic
//!
@@ -67,6 +68,12 @@
//!     if nonstandard library names were used for whatever reason.
//! * `OPENSSL_NO_VENDOR` - If set, always find OpenSSL in the system, even if the `vendored` feature is enabled.
//!
//! If the `vendored` Cargo feature is enabled, the following environment variable can also be used to further configure
//! the OpenSSL build.
//!
//! * `OPENSSL_CONFIG_DIR` - If set, the copy of OpenSSL built by the `openssl-src` crate will be configured to look for
//!     configuration files and root certificates in this directory.
//!
//! Additionally, these variables can be prefixed with the upper-cased target architecture (e.g.
//!     `X86_64_UNKNOWN_LINUX_GNU_OPENSSL_DIR`), which can be useful when cross compiling.
//!