Skip to content

Commit ec21897

Browse files
allow building local install
1 parent e91a766 commit ec21897

File tree

2 files changed

+30
-4
lines changed

2 files changed

+30
-4
lines changed

hts-sys/Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,5 @@ static = []
3535
fs-utils = "1.1"
3636
bindgen = { version = "0.53.2", default-features = false, features = ["runtime"] }
3737
cc = "1.0"
38-
glob = "0.3.0"
38+
glob = "0.3.0"
39+
dirs = "1.0.2"

hts-sys/build.rs

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
use fs_utils::copy::copy_directory;
77
use glob::glob;
88

9+
use ::dirs::home_dir;
10+
911
use std::env;
1012
use std::fs;
1113
use std::path::PathBuf;
@@ -86,7 +88,21 @@ fn main() {
8688
.current_dir(out.join("htslib"))
8789
.arg("clean")
8890
.status().unwrap().success()
89-
91+
92+
&&
93+
94+
!Command::new("autoconf")
95+
.current_dir(out.join("htslib"))
96+
.status().unwrap().success()
97+
98+
&&
99+
100+
!Command::new("./configure")
101+
.current_dir(out.join("htslib"))
102+
.env("CFLAGS", &cc_cflags)
103+
.arg(format!("--host={}", &host))
104+
.status().unwrap().success()
105+
90106
&&
91107

92108
!Command::new("autoreconf")
@@ -98,8 +114,7 @@ fn main() {
98114

99115
!Command::new("./configure")
100116
.current_dir(out.join("htslib"))
101-
.env("CFLAGS", &cc_cflags)
102-
.arg(format!("--host={}", &host))
117+
.arg(format!("--prefix={}/local", home_dir().unwrap().into_os_string().into_string().unwrap()))
103118
.status().unwrap().success()
104119
{
105120
panic!("could not configure htslib nor any of its plugins")
@@ -117,6 +132,16 @@ fn main() {
117132
panic!("failed to build htslib");
118133
}
119134

135+
if !Command::new("make")
136+
.current_dir(out.join("htslib"))
137+
.arg("install")
138+
.status()
139+
.unwrap()
140+
.success()
141+
{
142+
panic!("failed to build htslib");
143+
}
144+
120145
cfg.file("wrapper.c").compile("wrapper");
121146

122147
bindgen::Builder::default()

0 commit comments

Comments
 (0)