Skip to content
This repository has been archived by the owner on Nov 8, 2023. It is now read-only.

Fixed windows msvc download_and_install_libsodium in build.rs #79

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ cc = "1.0.70"

[target.'cfg(target_os = "windows")'.build-dependencies]
libflate = "1.1.1"
reqwest = { version = "0.11.4", default-features = false, features = ["rustls-tls"] }
reqwest = { version = "0.11.4", default-features = false, features = ["rustls-tls", "blocking"] }
tar = "0.4.37"
tempfile = "3.2.0"
zip = "0.5.13"
6 changes: 3 additions & 3 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -214,18 +214,18 @@ fn download_and_install_libsodium() {
let sodium_lib_file_path = sodium_lib_dir.join("libsodium.lib");
if !sodium_lib_file_path.exists() {
let mut tmpfile = tempfile::tempfile().unwrap();
reqwest::get(LIBSODIUM_ZIP)
reqwest::blocking::get(LIBSODIUM_ZIP)
.unwrap()
.copy_to(&mut tmpfile)
.unwrap();
let mut zip = zip::ZipArchive::new(tmpfile).unwrap();
#[cfg(target_arch = "x86_64")]
let mut lib = zip
.by_name("x64/Release/v142/static/libsodium.lib")
.by_name("libsodium/x64/Release/v142/static/libsodium.lib")
.unwrap();
#[cfg(target_arch = "x86")]
let mut lib = zip
.by_name("Win32/Release/v142/static/libsodium.lib")
.by_name("libsodium/Win32/Release/v142/static/libsodium.lib")
.unwrap();
#[cfg(not(any(target_arch = "x86_64", target_arch = "x86")))]
compile_error!("Bundled libsodium is only supported on x86 or x86_64 target architecture.");
Expand Down