From ccf7b48d07ad52798e2dcb2cd0e6101aa6274847 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Thu, 19 May 2022 07:28:22 -0700 Subject: [PATCH] Configure `--openssldir` to its default location As pointed out in #140 otherwise certificates and configure is by default looked up in the directory of the build machine itself which is often a writable path. Instead switch the configuration option back to the default recommended in openssl's `INSTALL.md` Closes #140 --- src/lib.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/lib.rs b/src/lib.rs index cfd61550..1818abb6 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -134,12 +134,23 @@ impl Build { env::var("OPENSSL_SRC_PERL").unwrap_or(env::var("PERL").unwrap_or("perl".to_string())); let mut configure = Command::new(perl_program); configure.arg("./Configure"); + + // Change the install directory to happen inside of the build directory. if host.contains("pc-windows-gnu") { configure.arg(&format!("--prefix={}", sanitize_sh(&install_dir))); } else { configure.arg(&format!("--prefix={}", install_dir.display())); } + // Specify that openssl directory where things are loaded at runtime is + // not inside our build directory. Instead this should be located in the + // default locations of the OpenSSL build scripts. + if target.contains("windows") { + configure.arg("--openssldir=SYS$MANAGER:[OPENSSL]"); + } else { + configure.arg("--openssldir=/usr/local/ssl"); + } + configure // No shared objects, we just want static libraries .arg("no-dso")