Skip to content

Commit

Permalink
Configure --openssldir to its default location (#141)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
alexcrichton authored May 19, 2022
1 parent 9f28b4c commit 7039235
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down

0 comments on commit 7039235

Please sign in to comment.