Commit e731085a authored by Andreas Tille's avatar Andreas Tille
Browse files

New upstream version 0.6.8-pre3

parent 5cd2ab08
Loading
Loading
Loading
Loading
+15 −0
Original line number Diff line number Diff line
.dub/
dub.selections.json
BioD/
BioD
./BioD
undeaD/
lz4/
core
bin/
test*
build/
shunit*
/*.sam
@@ -6,4 +16,9 @@ shunit*
/*.cram
/*.crai
/*.txt
*.hex
*.zcat
*.out
/utils/ldc_version_info_.d
profile.data
profile.raw
+6 −6
Original line number Diff line number Diff line
[submodule "BioD"]
	path = BioD
	url = https://github.com/biod/BioD.git
[submodule "htslib"]
	path = htslib
	url = https://github.com/lomereiter/htslib.git
[submodule "lz4"]
	path = lz4
	url = https://github.com/Cyan4973/lz4
[submodule "undeaD"]
	path = undeaD
	url = https://github.com/dlang/undeaD
[submodule "BioD"]
	path = BioD
	url = https://github.com/biod/BioD.git
[submodule "lz4"]
	path = lz4
	url = https://github.com/lz4/lz4.git

.travis.yml

0 → 100644
+22 −0
Original line number Diff line number Diff line
language: d
d:
  - ldc
matrix:
  # OSX testing is under development
  allow_failures:
    - os: osx
  include:
    - os: linux
      compiler: gcc
      addons:
        apt:
          packages:
            # Our dev environment is a more recent GNU C++
            # note that Debian liblz4-dev no longer supports LZ4 frames
            # - liblz4-dev
            - shunit2
    - os: osx
      compiler: clang
script:
  - make
  # - make test - disable tests because shunit2 we use is older
 No newline at end of file

INSTALL.md

0 → 100644
+11 −0
Original line number Diff line number Diff line
# INSTALL SAMBAMBA

## Sambamba dependencies

* D compiler
* gcc tool chain
* BioD
* htslib
* undeaD
* libz
* liblz4
+76 −77
Original line number Diff line number Diff line
D_COMPILER=dmd
D_FLAGS=--compiler=dmd -IBioD -IundeaD/src -g -d#-O -release -inline # -version=serial
LDMD=ldmd2
# This is a minimalistic make file to build sambamba with ldc2 as per instructions on
# https://github.com/biod/sambamba#compiling-sambamba
#
# Typical usage:
#
#    make LIBRARY_PATH=~/opt/ldc2-1.7.0-linux-x86_64/lib debug|profile|release|static
#
# Static release with optimization (for releases):
#
#   make LIBRARY_PATH=~/opt/ldc2-1.7.0-linux-x86_64/lib pgo-static
#
# Debug version
#
#   make LIBRARY_PATH=~/opt/ldc2-1.7.0-linux-x86_64/lib debug

STATIC_LIB_PATH=-Lhtslib -Llz4/lib
STATIC_LIB_SUBCMD=$(STATIC_LIB_PATH) -Wl,-Bstatic -lhts -llz4 -Wl,-Bdynamic
RDMD_FLAGS=--force --build-only --compiler=$(D_COMPILER) $(D_FLAGS)
D_COMPILER=ldc2
DFLAGS      = -wi -I. -IBioD -IundeaD/src -g

PLATFORM := $(shell uname -s)
DLIBS       = $(LIBRARY_PATH)/libphobos2-ldc.a $(LIBRARY_PATH)/libdruntime-ldc.a
DLIBS_DEBUG = $(LIBRARY_PATH)/libphobos2-ldc-debug.a $(LIBRARY_PATH)/libdruntime-ldc-debug.a
LIBS        = htslib/libhts.a lz4/lib/liblz4.a -L-L$(LIBRARY_PATH) -L-lrt -L-lpthread -L-lm
LIBS_STATIC = $(LIBRARY_PATH)/libc.a $(DLIBS) htslib/libhts.a $(LIBRARY_PATH)/liblz4.a
SRC         = $(wildcard main.d utils/*.d thirdparty/*.d cram/*.d) $(wildcard undeaD/src/undead/*.d) $(wildcard BioD/bio/*/*.d BioD/bio/*/*/*.d BioD/bio2/*.d BioD/bio2/*/*.d) $(wildcard sambamba/*.d sambamba/*/*.d sambamba/*/*/*.d)
OBJ         = $(SRC:.d=.o) utils/ldc_version_info_.o
OUT         = bin/sambamba

ifeq "$(PLATFORM)" "Darwin"
STATIC_LIB_PATH=-Lhtslib -Llz4

LINK_CMD=gcc -dead_strip -lphobos2-ldc -ldruntime-ldc -lm -lpthread htslib/libhts.a lz4/lib/liblz4.a build/sambamba.o -o build/sambamba
DMD_STATIC_LIBS=htslib/libhts.a lz4/lib/liblz4.a
.PHONY: all debug release static clean test

define split-debug
dsymutil build/sambamba -o build/sambamba.dSYM
strip -S build/sambamba
endef
debug:                             DFLAGS += -O0 -d-debug -link-debuglib

else
profile:                           DFLAGS += -fprofile-instr-generate=profile.raw

LINK_CMD=gcc -Wl,--gc-sections -o build/sambamba build/sambamba.o $(STATIC_LIB_SUBCMD) -lphobos2-ldc -ldruntime-ldc  -lrt -lpthread -lm -ldl
DMD_STATIC_LIBS=-L-Lhtslib -L-l:libhts.a -L-l:libphobos2.a -L-Llz4/lib -L-l:liblz4.a
release static profile pgo-static: DFLAGS += -O3 -release -enable-inlining -boundscheck=off

define split-debug
objcopy --only-keep-debug build/sambamba sambamba.debug
objcopy --strip-debug build/sambamba
objcopy --add-gnu-debuglink=sambamba.debug build/sambamba
mv sambamba.debug build/
endef
static:                            DFLAGS += -static -L-Bstatic

endif
pgo-static:                        DFLAGS += -fprofile-instr-use=profile.data

PREREQS := ldc-version-info htslib-static lz4-static
all: release

# DMD only - this goal is used because of fast compilation speed, during development
all: $(PREREQS)
	mkdir -p build/
	rdmd --force --build-only $(D_FLAGS) $(DMD_STATIC_LIBS) -ofbuild/sambamba main.d
lz4-static: lz4/lib/liblz4.a

# This is the main Makefile goal, used for building releases (best performance)
sambamba-ldmd2-64: $(PREREQS)
	mkdir -p build/
	$(LDMD) @sambamba-ldmd-release.rsp
	$(LINK_CMD)
	$(split-debug)
lz4/lib/liblz4.a: lz4/lib/lz4.c lz4/lib/lz4hc.c lz4/lib/lz4frame.c lz4/lib/xxhash.c
	cd lz4/lib && gcc -O3 -c lz4.c lz4hc.c lz4frame.c xxhash.c && $(AR) rcs liblz4.a lz4.o lz4hc.o lz4frame.o xxhash.o

# For debugging; GDB & Valgrind are more friendly to executables created using LDC/GDC than DMD
sambamba-ldmd2-debug: $(PREREQS)
	mkdir -p build/
	$(LDMD) @sambamba-ldmd-debug.rsp
	$(LINK_CMD)
htslib-static:
	cd htslib && $(MAKE)

ldc-version-info:
	./gen_ldc_version_info.py $(shell which $(LDMD)) > utils/ldc_version_info_.d
	./gen_ldc_version_info.py $(shell which ldmd2) > utils/ldc_version_info_.d
	cat utils/ldc_version_info_.d

htslib-static:
	cd htslib && $(MAKE)
utils/ldc_version_info_.o: ldc-version-info
	$(D_COMPILER) $(DFLAGS) -c utils/ldc_version_info_.d -od=$(dir $@)

lz4-static: lz4/lib/liblz4.a
build-setup: lz4-static htslib-static ldc-version-info
	mkdir -p bin/

lz4/lib/liblz4.a: lz4/lib/lz4.c lz4/lib/lz4hc.c lz4/lib/lz4frame.c lz4/lib/xxhash.c
	cd lz4/lib && $(CC) -O3 -c lz4.c lz4hc.c lz4frame.c xxhash.c && $(AR) rcs liblz4.a lz4.o lz4hc.o lz4frame.o xxhash.o
default debug release static: $(OUT)

# all below link to libhts dynamically for simplicity
profile: release
	./bin/sambamba sort /gnu/data/in_raw.bam -p > /dev/null
	ldc-profdata merge -output=profile.data profile.raw
	rm ./bin/sambamba ./bin/sambamba.o # trigger rebuild

sambamba-flagstat:
	mkdir -p build/
	rdmd $(RDMD_FLAGS) -L-lhts -version=standalone -ofbuild/sambamba-flagstat sambamba/flagstat.d
default: all

sambamba-merge:
	mkdir -p build/
	rdmd $(RDMD_FLAGS) -L-lhts -version=standalone -ofbuild/sambamba-merge sambamba/merge.d
# ---- Compile step
%.o: %.d
	$(D_COMPILER) $(DFLAGS) -c $< -od=$(dir $@)

sambamba-index:
	mkdir -p build/
	rdmd $(RDMD_FLAGS) -L-lhts -version=standalone -ofbuild/sambamba-index sambamba/index.d
singleobj:
	$(info compile single object...)
	$(D_COMPILER) -singleobj $(DFLAGS) -c -of=bin/sambamba.o $(SRC)

sambamba-sort:
	mkdir -p build/
	rdmd $(RDMD_FLAGS) -L-lhts -version=standalone -ofbuild/sambamba-sort sambamba/sort.d
# ---- Link step
$(OUT): build-setup singleobj utils/ldc_version_info_.o
	$(info linking...)
	$(D_COMPILER) $(DFLAGS) -of=bin/sambamba bin/sambamba.o utils/ldc_version_info_.o $(LIBS)

sambamba-view:
	mkdir -p build/
	rdmd $(RDMD_FLAGS) -L-lhts -version=standalone -ofbuild/sambamba-view sambamba/view.d
test:
	./run_tests.sh

sambamba-slice:
	mkdir -p build/
	rdmd $(RDMD_FLAGS) -L-lhts -version=standalone -ofbuild/sambamba-slice sambamba/slice.d
check: test

sambamba-markdup:
	mkdir -p build/
	rdmd $(RDMD_FLAGS) -L-lhts -version=standalone -ofbuild/sambamba-markdup sambamba/markdup.d
debug-strip:
	objcopy --only-keep-debug bin/sambamba sambamba.debug
	objcopy --strip-debug bin/sambamba
	objcopy --add-gnu-debuglink=sambamba.debug bin/sambamba
	mv sambamba.debug bin/

sambamba-depth:
	mkdir -p build/
	rdmd $(RDMD_FLAGS) -L-lhts -version=standalone -ofbuild/sambamba-depth sambamba/depth.d
pgo-static: profile static debug-strip

sambamba-pileup:
	mkdir -p build/
	rdmd $(RDMD_FLAGS) -L-lhts -version=standalone -ofbuild/sambamba-pileup sambamba/pileup.d
install:
	install -m 0755 bin/sambamba $(prefix)/bin

.PHONY: clean ldc-version-info
clean: clean-d
	cd htslib ; make clean
	rm -f profile.data
	rm -f profile.raw

clean:
	rm -rf build/ ; $(MAKE) -C htslib clean ; $(MAKE) -C lz4 clean
clean-d:
	rm -rf bin/*
	rm -f $(OBJ) $(OUT) trace.{def,log}
Loading