Skip to content
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
13 changes: 13 additions & 0 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,19 @@ http_archive(
],
)

# libdeflate is a faster DEFLATE/gzip codec than zlib. htslib uses it for bgzf
# (BAM) (de)compression when built with HAVE_LIBDEFLATE; BAM bgzf decoding is the
# dominant codec cost when reading reads in make_examples.
http_archive(
name = "libdeflate",
build_file = "//:third_party/libdeflate.BUILD",
sha256 = "ed1454166ced78913ff3809870a4005b7170a6fd30767dc478a09b96847b9c2a",
strip_prefix = "libdeflate-1.20",
urls = [
"https://github.com/ebiggers/libdeflate/archive/refs/tags/v1.20.tar.gz",
],
)

http_archive(
name = "libssw",
build_file = "//:third_party/libssw.BUILD",
Expand Down
6 changes: 5 additions & 1 deletion third_party/htslib.BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,7 @@ genrule(
echo '#define HAVE_GMTIME_R 1'
echo '#define HAVE_INTTYPES_H 1'
echo '#define HAVE_LIBBZ2 1'
echo '#define HAVE_LIBDEFLATE 1'
echo '#define HAVE_LIBLZMA 1'
echo '#define HAVE_LIBZ 1'
echo '#define HAVE_MEMORY_H 1'
Expand Down Expand Up @@ -273,7 +274,10 @@ cc_library(
linkopts = extra_libs,
textual_hdrs = textual_hdrs,
visibility = ["//visibility:public"],
deps = [":htslib_deps"],
deps = [
":htslib_deps",
"@libdeflate",
],
)

# Misc binaries that might be exported.
Expand Down
23 changes: 23 additions & 0 deletions third_party/libdeflate.BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Description:
# libdeflate - fast DEFLATE/zlib/gzip compression and decompression.
# Used by htslib (when HAVE_LIBDEFLATE is set) to accelerate bgzf (BAM)
# (de)compression.

licenses(["notice"]) # MIT

exports_files(["COPYING"])

# All architecture-specific sources are guarded by ARCH_* #ifdefs and compile to
# nothing on non-matching targets, so it is safe to compile every lib/**/*.c.
cc_library(
name = "libdeflate",
srcs = glob([
"lib/**/*.c",
"lib/**/*.h",
"common_defs.h",
]),
hdrs = ["libdeflate.h"],
copts = ["-O3"],
includes = ["."],
visibility = ["//visibility:public"],
)