Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to htslib 1.10.2 #184

Merged
merged 81 commits into from
Mar 17, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
81 commits
Select commit Hold shift + click to select a range
d3db4fd
Pull 1.10.2 submodule. Initial pass on i32->i64 type conversion, will…
brainstorm Feb 3, 2020
bb34638
Fixes issue #109 while I'm at it, long hanging fruit fix
brainstorm Feb 3, 2020
1636ef5
Fix compression levels
juliangehring Feb 3, 2020
18e8e57
Merge pull request #1 from juliangehring/fix-compression
brainstorm Feb 3, 2020
9c2a6d6
Going through https://github.com/samtools/htslib/blob/develop/README.…
brainstorm Feb 4, 2020
115c634
Repoint submodule to upstream release tag
brainstorm Feb 4, 2020
6bf1760
brainstorm Feb 4, 2020
83c0656
Try to amend submodule
brainstorm Feb 4, 2020
2173a9e
Handle submodules manually on TravisCI, since it is failing now: http…
brainstorm Feb 4, 2020
d7c5355
Odd balls that would need review marked with XXX. New htslib seems to…
brainstorm Feb 4, 2020
dac8565
Add curl-sys crate for hplugin_curl, aws s3 et al
brainstorm Feb 4, 2020
5678f70
Add conditional libcurl compilation flags
brainstorm Feb 4, 2020
bad400b
Be nice with cargo fmt [ci skip]
brainstorm Feb 4, 2020
9e1a315
Try installing libcurl meta-package instead of the openssl dependent …
brainstorm Feb 4, 2020
4c9fddf
Does not work with libcurl-dev metapackage: https://travis-ci.org/rus…
brainstorm Feb 4, 2020
417b672
Add matrix compile support for TravisCI, I would like to know why it …
brainstorm Feb 4, 2020
22fae28
PPA source no longer needed for ubuntu bionic? [ci skip]
brainstorm Feb 4, 2020
1a19c69
Bionic packages htslib with gnutls instead of openssl: https://packag…
brainstorm Feb 4, 2020
6eb623a
sed is not gsed on OSX... not entirely sure this substitution is 100%…
brainstorm Feb 4, 2020
5c31eb8
Add libssl-dev to the mix for the openssl-sys: https://travis-ci.org/…
brainstorm Feb 4, 2020
d3eba71
Add build-essential in hopes to fix libcurl issue, incorporate https:…
brainstorm Feb 4, 2020
eb2ae94
Add curl on default features for hts-sys
brainstorm Feb 4, 2020
92df799
Point to the right htslib upstream repo, thanks @dlaehnemann [skip ci]
brainstorm Feb 5, 2020
4389e3f
Appease OSX musl-cross toolchain requirements: https://travis-ci.org/…
brainstorm Feb 8, 2020
4f64d69
TravisCI timesout installing brew deps: https://travis-ci.org/rust-bi…
brainstorm Feb 8, 2020
39010b1
Try workaround for https://twitter.com/braincode/status/1226103002550…
brainstorm Feb 8, 2020
9fe358b
Do not update homebrew (time intensive), switch from travis_wait to v…
brainstorm Feb 8, 2020
9d2f381
brew install --verbose is not verbose enough for travis, reverting tr…
brainstorm Feb 8, 2020
949499f
Explicitly install system libcurl on linux and osx
brainstorm Feb 8, 2020
850011e
This .cargo/config makes it test right locally: https://github.com/ru…
brainstorm Feb 8, 2020
db42104
Cargo.toml missing quote misshap
brainstorm Feb 8, 2020
89608c6
Same linker flags should apply for Linux builds? build-essential not …
brainstorm Feb 8, 2020
e534df6
tid is i64 now, CRAM vs BAM test l_data is off by 3 and m_data is off…
brainstorm Feb 9, 2020
bbe490f
There should be no need for travis_wait with -v
brainstorm Feb 10, 2020
a741700
Debugging htslib structs with @jkbonfield guidance...
brainstorm Feb 20, 2020
29747e5
Disable osx and musl-cross homebrew on the TravisCI matrix since it t…
brainstorm Feb 21, 2020
77d4765
Mystery solved for test_read_cram, testing some of the struct fields,…
brainstorm Feb 24, 2020
4f2c90c
Extract selective CRAM/BAM field comparison to test helper function
brainstorm Feb 24, 2020
6bd85e0
Formatting
brainstorm Feb 24, 2020
de35991
Temporarily commenting the hfile format category detection makes .bed…
brainstorm Feb 24, 2020
d89c216
Format detection seems to be broken upstream on htslib, see https://g…
brainstorm Feb 25, 2020
f5dd07f
Merge branch 'master' into htslib-1.10.2
brainstorm Feb 25, 2020
f6d3679
Revert to libcurl4-openssl-dev instead of gnutls. All TravisCI script…
brainstorm Feb 25, 2020
4ffb8fe
Merge github.com:brainstorm/rust-htslib into htslib-1.10.2
brainstorm Feb 25, 2020
6e92156
Bump up curl-sys version
brainstorm Feb 26, 2020
6c9454b
Experimenting musl cross-compilation with rustembedded cross. Ideally…
brainstorm Feb 26, 2020
642ceba
Remove assert_ne since cannot guarantee that l_data is different on a…
brainstorm Feb 26, 2020
7cf834f
Add minimum deps needed for rustembedded cross docker container
brainstorm Feb 26, 2020
e6d0131
Run docker in TravisCI, even if it is only supported on linux jobs :/
brainstorm Feb 26, 2020
c0dde9a
Add CFLAGS suggested by @nlhepler
brainstorm Feb 26, 2020
571b457
Separate musl from GNU toolchains on Rust cross
brainstorm Feb 27, 2020
b10c48f
Bump up bindgen, vendorize openssl, further experimentation with comp…
brainstorm Feb 27, 2020
81ab53c
Deprecate the mixed GNU/MUSL container
brainstorm Feb 27, 2020
7f87d97
Add minimal explanation on how to use the new docker files [ci skip]
brainstorm Feb 27, 2020
20f6fb1
cross 0.2.0 with openssl vendored. Progress but more htslib compile t…
brainstorm Feb 27, 2020
77d06f9
Make sure libzma is present in both containers [ci skip]
brainstorm Feb 27, 2020
47fee89
Focusing on LLVMv8 GNU cross build first, musl will come later on (if…
brainstorm Feb 28, 2020
78c41d2
Two more usize that should be u64
brainstorm Feb 28, 2020
6b79b72
Amend and settle BED header debate
brainstorm Feb 28, 2020
116c3dd
Rename test name accordingly
brainstorm Feb 28, 2020
f6f2f64
Transition to cross instead of cargo for builds and tests
brainstorm Feb 28, 2020
8127679
All GNU/clang/llvm8 builds and tests seem to succeed, transitioning t…
brainstorm Feb 28, 2020
2f14727
Remove stray (repeated) musl build
brainstorm Feb 28, 2020
0ca9400
Remove @filoSottile musl-cross homebrew formula since it takes too lo…
brainstorm Feb 28, 2020
d0837cf
Experiment with toolchain setup in https://gitlab.com/rust_musl_docke…
brainstorm Feb 28, 2020
d218b27
Remove build.rs flags noise and different tests, containers should ha…
brainstorm Feb 28, 2020
e293ad3
Indicate dependencies and build flags required for OSX [ci skip].
brainstorm Mar 1, 2020
ebd1d2e
enable musl builds
johanneskoester Mar 10, 2020
fcbbafc
add libclang
johanneskoester Mar 10, 2020
6882797
minor
johanneskoester Mar 10, 2020
e0d1edb
dbg
johanneskoester Mar 10, 2020
e97d47a
revert
johanneskoester Mar 10, 2020
cecbd4a
dbg
johanneskoester Mar 10, 2020
e065263
dbg
johanneskoester Mar 10, 2020
8505cfe
Revert cross/docker madness, bottled up musl-cross myself over here: …
brainstorm Mar 11, 2020
665a38e
Remove .travis.yml
brainstorm Mar 11, 2020
999fa0f
Merge branch 'htslib-1.10.2' of github.com:brainstorm/rust-htslib int…
brainstorm Mar 11, 2020
09aec34
Add in openssl to hts-sys
brainstorm Mar 13, 2020
6042c05
Make clippy boolean logic happy
brainstorm Mar 13, 2020
fc84cff
Remove homebrew OSX check since we'll just use rustembedded cross
brainstorm Mar 13, 2020
24f694f
Merge branch 'musl-action' of https://github.com/rust-bio/rust-htslib…
brainstorm Mar 13, 2020
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
12 changes: 12 additions & 0 deletions .cargo/config
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[target.x86_64-apple-darwin]
rustflags = [
"-C", "link-arg=-undefined",
"-C", "link-arg=dynamic_lookup",
]

[target.x86_64-unknown-linux-musl]
rustflags = [
"-C", "link-arg=-undefined",
"-C", "link-arg=dynamic_lookup",
]
linker = "x86_64-linux-musl-gcc"
20 changes: 15 additions & 5 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,6 @@ jobs:
override: true
components: clippy

- name: Install system dependencies
run: |
sudo apt-get install --yes zlib1g-dev libbz2-dev musl musl-dev musl-tools

- name: Lint with clippy
uses: actions-rs/clippy-check@v1
with:
Expand All @@ -67,7 +63,7 @@ jobs:

- name: Install system dependencies
run: |
sudo apt-get install --yes zlib1g-dev libbz2-dev musl musl-dev musl-tools
sudo apt-get install --yes zlib1g-dev libbz2-dev musl musl-dev musl-tools clang libc6-dev

- name: Run cargo-tarpaulin
uses: actions-rs/[email protected]
Expand All @@ -79,3 +75,17 @@ jobs:
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: ./lcov.info

- name: Test musl build without default features
uses: actions-rs/cargo@v1
with:
use-cross: true
command: build
args: --target x86_64-unknown-linux-musl --no-default-features

- name: Test musl build with all features
uses: actions-rs/cargo@v1
with:
use-cross: true
command: build
args: --target x86_64-unknown-linux-musl --all-features
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
.vscode/
.idea
*~
target
Cargo.lock
Expand Down
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[submodule "htslib"]
path = hts-sys/htslib
url = https://github.com/rust-bio/htslib.git
url = https://github.com/samtools/htslib.git
4 changes: 3 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,11 @@ snafu = ">= 0.5.0, <= 0.6.0"
hts-sys = { version = "^1.9", path = "hts-sys", default-features = false }

[features]
default = ["bzip2", "lzma"]
default = ["bzip2", "lzma", "curl"]
bzip2 = ["hts-sys/bzip2"]
lzma = ["hts-sys/lzma"]
curl = ["hts-sys/curl"]
openssl = ["hts-sys/openssl"]
serde = ["serde_base", "serde_bytes"]

[dev-dependencies]
Expand Down
4 changes: 4 additions & 0 deletions Cross.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[target.x86_64-unknown-linux-musl]
image = "brainstorm/rust_musl_docker:stable-latest-libcurl"
[target.x86_64-unknown-linux-gnu]
image = "brainstorm/cross-x86_64-unknown-linux-gnu:libcurl-openssl"
13 changes: 12 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,18 @@ If you only want to use the library, there is no need to clone the repository. G

## Requirements

To compile this crate you need the development headers of zlib, bzip2 and xz.
To compile this crate you need the development headers of zlib, bzip2 and xz. For instance, in Debian systems one needs the following dependencies:

```shell
$ sudo apt-get install zlib1g-dev libbz2-dev liblzma-dev clang
```

On OSX, this will take a significant amount of time due to musl cross compiling toolchain:

```shell
$ brew install FiloSottile/musl-cross/musl-cross
$ brew install bzip2 zlib xz curl-openssl
```

## Usage

Expand Down
8 changes: 8 additions & 0 deletions docker/Dockerfile.gnu
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
FROM rustembedded/cross:x86_64-unknown-linux-gnu

ENV LIBCLANG_PATH /usr/lib/x86_64-linux-gnu
ENV LLVM_CONFIG_PATH /usr/bin
RUN apt-get update && \
apt-get install -y libcurl4-openssl-dev zlib1g-dev libbz2-dev liblzma-dev clang-8 && \
ln -sf /usr/bin/llvm-config-8 /usr/bin/llvm-config && \
ln -sf /usr/lib/x86_64-linux-gnu/libclang-8.so.1 /usr/lib/x86_64-linux-gnu/libclang.so.1
7 changes: 7 additions & 0 deletions docker/Dockerfile.musl
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
FROM rustembedded/cross:x86_64-unknown-linux-musl

ENV PKG_CONFIG_ALLOW_CROSS 1
ENV OPENSSL_LIB_DIR /usr/lib/x86_64-linux-gnu
ENV OPENSSL_INCLUDE_DIR /usr/include/openssl
RUN apt-get update && \
apt-get install -y libssl-dev libcurl4-openssl-dev zlib1g-dev libbz2-dev liblzma-dev musl musl-dev musl-tools linux-libc-dev linux-headers-4.15.0-20-generic
17 changes: 17 additions & 0 deletions docker/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# cross rustembedded containers

Allows to compile (rust-)htslib in a variety of environments and architectures via [rustembedded cross](https://github.com/rust-embedded/cross).

## Quickstart

```shell
$ cd docker
$ docker build -t brainstorm/cross-x86_64-unknown-linux-musl:libcurl-openssl . -f Dockerfile.musl
$ docker build -t brainstorm/cross-x86_64-unknown-linux-gnu:libcurl-openssl . -f Dockerfile.gnu
```

Then to build and test rust-htslib with the above containers, proceed as you would with `cargo`, using `cross` instead, i.e:

```shell
$ cross build --target x86_64-unknown-linux-musl
```
10 changes: 7 additions & 3 deletions hts-sys/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ description = "This library provides HTSlib bindings."
readme = "README.md"
keywords = ["htslib", "bam", "bioinformatics", "pileup", "sequencing"]
license = "MIT"
repository = "https://github.com/rust-bio/rust-htslib.git"
repository = "https://github.com/samtools/htslib.git"
documentation = "https://docs.rs/rust-htslib"
edition = "2018"

Expand All @@ -21,14 +21,18 @@ libc = "0.2"
libz-sys = "1.0"
bzip2-sys = { version = "0.1", optional = true }
lzma-sys = { version = "0.1", optional = true }
curl-sys = { version = "0.4.26", optional = true }
openssl-sys = { version = "0.9.54", optional = true }

[features]
default = ["bzip2", "lzma"]
default = ["bzip2", "lzma", "curl"]
bzip2 = ["bzip2-sys"]
lzma = ["lzma-sys"]
openssl = ["openssl-sys"]
curl = ["curl-sys"]

[build-dependencies]
fs-utils = "1.1"
bindgen = { version = "0.52.0", default-features = false, features = ["runtime"] }
bindgen = { version = "0.53.1", default-features = false, features = ["runtime"] }
cc = "1.0"
glob = "0.3.0"
16 changes: 11 additions & 5 deletions hts-sys/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ use std::fs;
use std::path::PathBuf;
use std::process::Command;

fn sed_htslib_makefile(out: &PathBuf, patterns: &Vec<&str>, feature: &str) {
fn sed_htslib_makefile(out: &PathBuf, patterns: &[&str], feature: &str) {
for pattern in patterns {
if Command::new("sed")
if !Command::new("sed")
.current_dir(out.join("htslib"))
.arg("-i")
.arg("-e")
Expand All @@ -24,7 +24,6 @@ fn sed_htslib_makefile(out: &PathBuf, patterns: &Vec<&str>, feature: &str) {
.status()
.unwrap()
.success()
!= true
{
panic!("failed to strip {} support", feature);
}
Expand Down Expand Up @@ -63,10 +62,18 @@ fn main() {
cfg.include(inc);
}

let use_curl = env::var("CARGO_FEATURE_CURL").is_ok();
if !use_curl {
let curl_patterns = vec!["s/ -lcurl//", "/#define HAVE_LIBCURL/d"];
sed_htslib_makefile(&out, &curl_patterns, "curl");
} else if let Ok(inc) = env::var("DEP_CURL_INCLUDE").map(PathBuf::from) {
cfg.include(inc);
}

let tool = cfg.get_compiler();
let (cc_path, cflags_env) = (tool.path(), tool.cflags_env());
let cc_cflags = cflags_env.to_string_lossy().replace("-O0", "");
if Command::new("make")
if !Command::new("make")
.current_dir(out.join("htslib"))
.arg(format!("CC={}", cc_path.display()))
.arg(format!("CFLAGS={}", cc_cflags))
Expand All @@ -75,7 +82,6 @@ fn main() {
.status()
.unwrap()
.success()
!= true
{
panic!("failed to build htslib");
}
Expand Down
2 changes: 1 addition & 1 deletion hts-sys/htslib
Submodule htslib updated 200 files
2 changes: 2 additions & 0 deletions hts-sys/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ extern crate libz_sys;
extern crate bzip2_sys;
#[cfg(feature = "lzma")]
extern crate lzma_sys;
#[cfg(feature = "curl")]
extern crate curl_sys;

// include on-the-fly generated bindings
include!(concat!(env!("OUT_DIR"), "/bindings.rs"));
4 changes: 2 additions & 2 deletions src/bam/buffer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ impl RecordBuffer {
let to_remove = self
.inner
.iter()
.take_while(|rec| rec.pos() < window_start as i32)
.take_while(|rec| rec.pos() < window_start as i64)
.count();
for _ in 0..to_remove {
self.inner.pop_front();
Expand All @@ -111,7 +111,7 @@ impl RecordBuffer {
record.cache_cigar();
}

if pos >= end as i32 {
if pos >= end as i64 {
self.overflow = Some(record);
break;
} else {
Expand Down
Loading