Skip to content

Commit

Permalink
Merge pull request #98 from lazareviczoran/add-feature-flags-for-nati…
Browse files Browse the repository at this point in the history
…ve-tls

Use native-tls/native-certs features of ureq crate
  • Loading branch information
termoshtt authored Jan 14, 2023
2 parents a5fbe97 + 654537a commit ca7234a
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 9 deletions.
17 changes: 9 additions & 8 deletions openblas-build/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,23 @@ name = "openblas-build"
version = "0.10.7"
license = "Apache-2.0/MIT"
edition = "2018"
authors = [
"Toshiki Teramura <toshiki.teramura@gmail.com>",
]
authors = ["Toshiki Teramura <toshiki.teramura@gmail.com>"]
description = "The package provides a build helper for OpenBLAS."
documentation = "https://docs.rs/openblas-build"
homepage = "https://github.com/blas-lapack-rs/openblas-src"
repository = "https://github.com/blas-lapack-rs/openblas-src"
readme = "../README.md"
exclude = [
"test_build/",
]
readme = "../README.md"
exclude = ["test_build/"]

[dependencies]
anyhow = "1.0.68"
flate2 = "1.0.25"
tar = "0.4.38"
thiserror = "1.0.22"
ureq = "2.5.0"
ureq = { version = "2.5.0", default-features = false, features = [
"native-certs",
"native-tls",
"gzip",
] }
native-tls = { version = "0.2.11" }
walkdir = "2.3.1"
13 changes: 12 additions & 1 deletion openblas-build/src/download.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,22 @@ pub fn openblas_source_url() -> String {
pub fn download(out_dir: &Path) -> Result<PathBuf> {
let dest = out_dir.join(format!("OpenBLAS-{}", OPENBLAS_VERSION));
if !dest.exists() {
let buf = ureq::get(&openblas_source_url()).call()?.into_reader();
let buf = get_agent()
.get(&openblas_source_url())
.call()?
.into_reader();
let gz_stream = flate2::read::GzDecoder::new(buf);
let mut ar = tar::Archive::new(gz_stream);
ar.unpack(out_dir)?;
assert!(dest.exists());
}
Ok(dest)
}

fn get_agent() -> ureq::Agent {
ureq::AgentBuilder::new()
.tls_connector(std::sync::Arc::new(
native_tls::TlsConnector::new().expect("failed to create TLS connector"),
))
.build()
}

0 comments on commit ca7234a

Please sign in to comment.