diff --git a/Cargo.toml b/Cargo.toml index 418de9c6..d2d75707 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -16,11 +16,11 @@ links = "mkl_intel_lp64" exclude = ["mkl_lib/mkl.tar.xz"] [build-dependencies] -pkg-config = "0.3" -failure = "0.1" -reqwest = "0.9" -xz2 = "0.1" -tar = "0.4" +pkg-config = "0.3.16" +failure = "0.1.6" +xz2 = "0.1.6" +tar = "0.4.26" +curl = "0.4.25" [dev-dependencies] -libc = "0.2" +libc = "0.2.65" diff --git a/build.rs b/build.rs index 2e2b2c02..2f5fd077 100644 --- a/build.rs +++ b/build.rs @@ -20,8 +20,13 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. +use curl::easy::Easy; use failure::*; -use std::{env, fs, io, path::*}; +use std::{ + env, fs, + io::{self, Write}, + path::*, +}; const S3_ADDR: &'static str = "https://s3-ap-northeast-1.amazonaws.com/rust-intel-mkl"; @@ -57,13 +62,12 @@ fn main() -> Fallible<()> { let archive = out_dir.join(mkl::ARCHIVE); if !archive.exists() { eprintln!("Download archive from AWS S3: {}/{}", S3_ADDR, mkl::ARCHIVE); - let mut res = reqwest::get(&format!("{}/{}", S3_ADDR, mkl::ARCHIVE))?; - if !res.status().is_success() { - bail!("HTTP access failed: {}", res.status()); - } let f = fs::File::create(&archive)?; let mut buf = io::BufWriter::new(f); - res.copy_to(&mut buf)?; + let mut easy = Easy::new(); + easy.url(&format!("{}/{}", S3_ADDR, mkl::ARCHIVE))?; + easy.write_function(move |data| Ok(buf.write(data).unwrap()))?; + easy.perform()?; assert!(archive.exists()); } else { eprintln!("Use existing archive");