From ec218971a2366d768bd9b994994ad830f02a253b Mon Sep 17 00:00:00 2001 From: TomKellyGenetics Date: Fri, 5 Jun 2020 12:20:28 +0900 Subject: [PATCH 1/3] allow building local install --- hts-sys/Cargo.toml | 3 ++- hts-sys/build.rs | 31 ++++++++++++++++++++++++++++--- 2 files changed, 30 insertions(+), 4 deletions(-) diff --git a/hts-sys/Cargo.toml b/hts-sys/Cargo.toml index 296a916df..3e561d1f5 100644 --- a/hts-sys/Cargo.toml +++ b/hts-sys/Cargo.toml @@ -35,4 +35,5 @@ static = [] fs-utils = "1.1" bindgen = { version = "0.53.2", default-features = false, features = ["runtime"] } cc = "1.0" -glob = "0.3.0" \ No newline at end of file +glob = "0.3.0" +dirs = "1.0.2" diff --git a/hts-sys/build.rs b/hts-sys/build.rs index 66f745c6c..87982f64c 100644 --- a/hts-sys/build.rs +++ b/hts-sys/build.rs @@ -6,6 +6,8 @@ use fs_utils::copy::copy_directory; use glob::glob; +use ::dirs::home_dir; + use std::env; use std::fs; use std::path::PathBuf; @@ -86,7 +88,21 @@ fn main() { .current_dir(out.join("htslib")) .arg("clean") .status().unwrap().success() - + + && + + !Command::new("autoconf") + .current_dir(out.join("htslib")) + .status().unwrap().success() + + && + + !Command::new("./configure") + .current_dir(out.join("htslib")) + .env("CFLAGS", &cc_cflags) + .arg(format!("--host={}", &host)) + .status().unwrap().success() + && !Command::new("autoreconf") @@ -98,8 +114,7 @@ fn main() { !Command::new("./configure") .current_dir(out.join("htslib")) - .env("CFLAGS", &cc_cflags) - .arg(format!("--host={}", &host)) + .arg(format!("--prefix={}/local", home_dir().unwrap().into_os_string().into_string().unwrap())) .status().unwrap().success() { panic!("could not configure htslib nor any of its plugins") @@ -117,6 +132,16 @@ fn main() { panic!("failed to build htslib"); } + if !Command::new("make") + .current_dir(out.join("htslib")) + .arg("install") + .status() + .unwrap() + .success() + { + panic!("failed to build htslib"); + } + cfg.file("wrapper.c").compile("wrapper"); bindgen::Builder::default() From b5f99d57124ba8532191fec21eea893d9ea4d194 Mon Sep 17 00:00:00 2001 From: TomKellyGenetics Date: Fri, 5 Jun 2020 12:28:34 +0900 Subject: [PATCH 2/3] remove make install call --- hts-sys/build.rs | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/hts-sys/build.rs b/hts-sys/build.rs index 87982f64c..d467eaa85 100644 --- a/hts-sys/build.rs +++ b/hts-sys/build.rs @@ -132,16 +132,6 @@ fn main() { panic!("failed to build htslib"); } - if !Command::new("make") - .current_dir(out.join("htslib")) - .arg("install") - .status() - .unwrap() - .success() - { - panic!("failed to build htslib"); - } - cfg.file("wrapper.c").compile("wrapper"); bindgen::Builder::default() From 9842e1197ba79583b52efb653d3b58fe609d0c1b Mon Sep 17 00:00:00 2001 From: TomKellyGenetics Date: Mon, 8 Jun 2020 14:11:52 +0900 Subject: [PATCH 3/3] simplify install steps --- hts-sys/build.rs | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/hts-sys/build.rs b/hts-sys/build.rs index d467eaa85..4b4df7ade 100644 --- a/hts-sys/build.rs +++ b/hts-sys/build.rs @@ -91,20 +91,6 @@ fn main() { && - !Command::new("autoconf") - .current_dir(out.join("htslib")) - .status().unwrap().success() - - && - - !Command::new("./configure") - .current_dir(out.join("htslib")) - .env("CFLAGS", &cc_cflags) - .arg(format!("--host={}", &host)) - .status().unwrap().success() - - && - !Command::new("autoreconf") .current_dir(out.join("htslib")) .env("CFLAGS", &cc_cflags) @@ -114,6 +100,8 @@ fn main() { !Command::new("./configure") .current_dir(out.join("htslib")) + .env("CFLAGS", &cc_cflags) + .arg(format!("--host={}", &host)) .arg(format!("--prefix={}/local", home_dir().unwrap().into_os_string().into_string().unwrap())) .status().unwrap().success() {