[med-svn] [sambamba] 01/02: Add a Meson build recipe

Matthias Klumpp mak at moszumanska.debian.org
Sun Apr 30 16:05:43 UTC 2017


This is an automated email from the git hooks/post-receive script.

mak pushed a commit to branch master
in repository sambamba.

commit fa13e3eee9b419ad07001642bb7d147b04c160ba
Author: Matthias Klumpp <matthias at tenstral.net>
Date:   Sun Apr 30 17:49:53 2017 +0200

    Add a Meson build recipe
---
 debian/patches/01_add_meson.patch             | 151 ++++++++++++++++++++++++++
 debian/patches/guix_makefile.patch            |  86 ---------------
 debian/patches/replace_rdmd.patch             |  72 ------------
 debian/patches/series                         |   4 +-
 debian/patches/use_debian_packaged_libs.patch |  67 ------------
 5 files changed, 152 insertions(+), 228 deletions(-)

diff --git a/debian/patches/01_add_meson.patch b/debian/patches/01_add_meson.patch
new file mode 100644
index 0000000..3cea172
--- /dev/null
+++ b/debian/patches/01_add_meson.patch
@@ -0,0 +1,151 @@
+From 8a7812717d7810355786219a250671539b933e0f Mon Sep 17 00:00:00 2001
+From: Matthias Klumpp <matthias at tenstral.net>
+Date: Sun, 30 Apr 2017 17:41:14 +0200
+Subject: [PATCH] Add Meson build file
+
+---
+ meson.build | 135 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ 1 file changed, 135 insertions(+)
+ create mode 100644 meson.build
+
+diff --git a/meson.build b/meson.build
+new file mode 100644
+index 0000000..e7c31d9
+--- /dev/null
++++ b/meson.build
+@@ -0,0 +1,135 @@
++project('Sambamba', 'd')
++
++project_version   = '0.6.6'
++
++source_root = meson.source_root()
++build_root = meson.build_root()
++
++if meson.get_compiler('d').get_id() != 'llvm'
++    error('We only support the LLVm D compiler at time. Please compile with LDC.')
++endif
++
++#
++# Sources
++#
++sambamba_src = [
++    'sambamba/depth.d',
++    'sambamba/fixbins.d',
++    'sambamba/flagstat.d',
++    'sambamba/index.d',
++    'sambamba/markdup.d',
++    'sambamba/merge.d',
++    'sambamba/pileup.d',
++    'sambamba/slice.d',
++    'sambamba/sort.d',
++    'sambamba/utils/common/bed.d',
++    'sambamba/utils/common/file.d',
++    'sambamba/utils/common/filtering.d',
++    'sambamba/utils/common/intervaltree.d',
++    'sambamba/utils/common/ldc_gc_workaround.d',
++    'sambamba/utils/common/overwrite.d',
++    'sambamba/utils/common/pratt_parser.d',
++    'sambamba/utils/common/progressbar.d',
++    'sambamba/utils/common/queryparser.d',
++    'sambamba/utils/common/readstorage.d',
++    'sambamba/utils/common/tmpdir.d',
++    'sambamba/utils/view/alignmentrangeprocessor.d',
++    'sambamba/utils/view/headerserializer.d',
++    'sambamba/view.d'
++]
++
++utils_src = [
++    'utils/lz4.d',
++    'utils/strip_bcf_header.d',
++    'utils/version_.d'
++]
++
++cram_src = [
++    'cram/exception.d',
++    'cram/htslib.d',
++    'cram/reader.d',
++    'cram/reference.d',
++    'cram/slicereader.d',
++    'cram/wrappers.d',
++    'cram/writer.d'
++]
++
++thirdparty_src = [
++    'thirdparty/mergesort.d',
++    'thirdparty/unstablesort.d'
++]
++
++manpages = [
++    'man/sambamba.1',
++    'man/sambamba-flagstat.1',
++    'man/sambamba-index.1',
++    'man/sambamba-markdup.1',
++    'man/sambamba-merge.1',
++    'man/sambamba-pileup.1',
++    'man/sambamba-slice.1',
++    'man/sambamba-sort.1',
++    'man/sambamba-view.1'
++]
++
++#
++# Dependencies
++#
++undead_dep = dependency('undead', version: '>=1.0.6')
++biod_dep   = dependency('biod', version: '>=0.1.0')
++lz4_dep    = dependency('liblz4')
++htslib_dep = dependency('htslib', version: '>=1.3.2')
++
++
++#
++# Configure
++#
++
++# Write LDC version to file
++ldmd_prog = find_program('ldmd2')
++mkdir_prog = find_program('mkdir')
++r = run_command(mkdir_prog.path(), '-p', build_root + '/utils/')
++if r.returncode() != 0
++  error('Unable to create "utils/" directory in build root: ' + r.stderr().strip())
++endif
++version_info_d_fname = build_root + '/utils/ldc_version_info_.d'
++r = run_command('sh', '-c', source_root + '/gen_ldc_version_info.py ' + ldmd_prog.path() + ' > ' + version_info_d_fname)
++if r.returncode() != 0
++  error('Unable to write LDC version file: ' + r.stderr().strip())
++endif
++
++#
++# Targets
++#
++sambamba_exe = executable('sambamba',
++    ['main.d',
++     sambamba_src,
++     utils_src,
++     cram_src,
++     thirdparty_src,
++     version_info_d_fname],
++    dependencies: [undead_dep,
++                   biod_dep,
++                   lz4_dep,
++                   htslib_dep],
++    install: true
++)
++
++sambamba_test_exe = executable('sambamba_test',
++    [sambamba_src,
++     utils_src,
++     cram_src,
++     thirdparty_src],
++    dependencies: [undead_dep,
++                   biod_dep,
++                   lz4_dep,
++                   htslib_dep],
++    d_args: meson.get_compiler('d').unittest_args(),
++    link_args: '-main'
++)
++
++#
++# Install extra files
++#
++
++install_man(manpages)
++install_data(['etc/bash_completion.d/sambamba'], install_dir: '/etc/bash_completion.d/')
diff --git a/debian/patches/guix_makefile.patch b/debian/patches/guix_makefile.patch
deleted file mode 100644
index 7879948..0000000
--- a/debian/patches/guix_makefile.patch
+++ /dev/null
@@ -1,86 +0,0 @@
---- /dev/null
-+++ b/Makefile.guix
-@@ -0,0 +1,83 @@
-+# GNU Guix makefile
-+#
-+# To build sambamba on GNU Guix:
-+#
-+#   make -f Makefile.guix
-+#
-+# run with
-+#
-+#   ./build/sambamba
-+
-+# The following two are modified by the Guix package:
-+D_COMPILER=ldc2
-+LDC_LIB_PATH=$(HOME)/.guix-profile/lib
-+
-+DFLAGS = -wi -I. -IBioD -IundeaD/src
-+DLIBS  = $(LDC_LIB_PATH)/libphobos2-ldc.a $(LDC_LIB_PATH)/libdruntime-ldc.a
-+DLIBS_DEBUG = $(LDC_LIB_PATH)/libphobos2-ldc-debug.a $(LDC_LIB_PATH)/libdruntime-ldc-debug.a
-+RPATH  = -L--rpath=$(dir $(realpath $(LDC_LIB_PATH)/libz.so)):$(dir $(realpath $(LDC_LIB_PATH)/liblz4.so))
-+LIBS   = htslib/libhts.a -L-L$(LDC_LIB_PATH) -L-lrt -L-lpthread -L-lm -L-lz -L-llz4
-+SRC    = $(wildcard main.d utils/*.d thirdparty/*.d cram/*.d) $(wildcard undeaD/src/undead/*.d) $(wildcard BioD/bio/*/*.d BioD/bio/*/*/*.d) $(wildcard sambamba/*.d sambamba/*/*.d sambamba/*/*/*.d)
-+OBJ    = $(SRC:.d=.o) utils/ldc_version_info_.o
-+OUT    = build/sambamba
-+
-+# The Guix targets resolve the RPATH automatically
-+guix:        DFLAGS += -O -g -inline
-+
-+guix-debug:  DFLAGS += -O0 -g -d-debug
-+
-+# The development options are run from ~/.guix-profile and need to inject the RPATH
-+debug:       DFLAGS += -O0 -g -d-debug $(RPATH) -link-debuglib
-+
-+release:     DFLAGS += -O -release -inline -noboundscheck $(RPATH)
-+
-+profile:     DFLAGS += -g -O -profile $(RPATH)
-+
-+guix release:             LIBS += $(DLIBS)
-+
-+guix-debug debug profile: LIBS += $(DLIBS_DEBUG)
-+
-+.PHONY: all guix guix-debug debug release profile clean test
-+
-+all: debug
-+
-+htslib-static:
-+	cd htslib && $(MAKE)
-+
-+ldc-version-info:
-+	./gen_ldc_version_info.py $(shell which ldmd2) > utils/ldc_version_info_.d
-+
-+utils/ldc_version_info_.o: ldc-version-info
-+	$(D_COMPILER) $(DFLAGS) -c utils/ldc_version_info_.d -od=$(dir $@)
-+
-+build-setup: htslib-static ldc-version-info
-+	mkdir -p build/
-+
-+guix guix-debug default debug release profile: $(OUT)
-+
-+# ---- Compile step
-+%.o: %.d
-+	$(D_COMPILER) $(DFLAGS) -c $< -od=$(dir $@)
-+
-+# ---- Link step
-+$(OUT): build-setup $(OBJ)
-+	$(D_COMPILER) $(DFLAGS) -of=build/sambamba $(OBJ) $(LIBS)
-+
-+test:
-+	./.run_tests.sh
-+
-+debug-strip: 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/
-+
-+install:
-+	install -m 0755 build/sambamba $(prefix)/bin
-+
-+clean: clean-d
-+	cd htslib ; make clean
-+
-+clean-d:
-+	rm -rf build/*
-+	rm -f $(OBJ) $(OUT) trace.{def,log}
diff --git a/debian/patches/replace_rdmd.patch b/debian/patches/replace_rdmd.patch
deleted file mode 100644
index 4806384..0000000
--- a/debian/patches/replace_rdmd.patch
+++ /dev/null
@@ -1,72 +0,0 @@
---- a/Makefile
-+++ b/Makefile
-@@ -1,8 +1,8 @@
--D_COMPILER=dmd
--D_FLAGS=--compiler=dmd -IBioD -g -d#-O -release -inline # -version=serial
-+D_COMPILER=ldc2
-+D_FLAGS= -IBioD -g -d#-O -release -inline # -version=serial
- 
- STATIC_LIB_SUBCMD=-lhts -llz4 -Wl,-Bdynamic
--RDMD_FLAGS=--force --build-only --compiler=$(D_COMPILER) $(D_FLAGS)
-+RDMD_FLAGS=--build-only --compiler=$(D_COMPILER) $(D_FLAGS)
- 
- PLATFORM := $(shell uname -s)
- 
-@@ -17,7 +17,7 @@ endif
- # DMD only - this goal is used because of fast compilation speed, during development
- all:
- 	mkdir -p build/
--	rdmd --force --build-only $(D_FLAGS) $(DMD_STATIC_LIBS) -ofbuild/sambamba main.d
-+	ldmd2 $(D_FLAGS) $(DMD_STATIC_LIBS) -ofbuild/sambamba main.d
- 
- # This is the main Makefile goal, used for building releases (best performance)
- sambamba-ldmd2-64: htslib-static lz4-static
-@@ -43,39 +43,39 @@ lz4/lib/liblz4.a: lz4/lib/lz4.c lz4/lib/
- 
- sambamba-flagstat:
- 	mkdir -p build/
--	rdmd $(RDMD_FLAGS) -L-lhts -version=standalone -ofbuild/sambamba-flagstat sambamba/flagstat.d
-+	ldmd2 $(RDMD_FLAGS) -L-lhts -version=standalone -ofbuild/sambamba-flagstat sambamba/flagstat.d
- 
- sambamba-merge:
- 	mkdir -p build/
--	rdmd $(RDMD_FLAGS) -L-lhts -version=standalone -ofbuild/sambamba-merge sambamba/merge.d
-+	ldmd2 $(RDMD_FLAGS) -L-lhts -version=standalone -ofbuild/sambamba-merge sambamba/merge.d
- 
- sambamba-index:
- 	mkdir -p build/
--	rdmd $(RDMD_FLAGS) -L-lhts -version=standalone -ofbuild/sambamba-index sambamba/index.d
-+	ldmd2 $(RDMD_FLAGS) -L-lhts -version=standalone -ofbuild/sambamba-index sambamba/index.d
- 
- sambamba-sort:
- 	mkdir -p build/
--	rdmd $(RDMD_FLAGS) -L-lhts -version=standalone -ofbuild/sambamba-sort sambamba/sort.d
-+	ldmd2 $(RDMD_FLAGS) -L-lhts -version=standalone -ofbuild/sambamba-sort sambamba/sort.d
- 
- sambamba-view:
- 	mkdir -p build/
--	rdmd $(RDMD_FLAGS) -L-lhts -version=standalone -ofbuild/sambamba-view sambamba/view.d
-+	ldmd2 $(RDMD_FLAGS) -L-lhts -version=standalone -ofbuild/sambamba-view sambamba/view.d
- 
- sambamba-slice:
- 	mkdir -p build/
--	rdmd $(RDMD_FLAGS) -L-lhts -version=standalone -ofbuild/sambamba-slice sambamba/slice.d
-+	ldmd2 $(RDMD_FLAGS) -L-lhts -version=standalone -ofbuild/sambamba-slice sambamba/slice.d
- 
- sambamba-markdup:
- 	mkdir -p build/
--	rdmd $(RDMD_FLAGS) -L-lhts -version=standalone -ofbuild/sambamba-markdup sambamba/markdup.d
-+	ldmd2 $(RDMD_FLAGS) -L-lhts -version=standalone -ofbuild/sambamba-markdup sambamba/markdup.d
- 
- sambamba-depth:
- 	mkdir -p build/
--	rdmd $(RDMD_FLAGS) -L-lhts -version=standalone -ofbuild/sambamba-depth sambamba/depth.d
-+	ldmd2 $(RDMD_FLAGS) -L-lhts -version=standalone -ofbuild/sambamba-depth sambamba/depth.d
- 
- sambamba-pileup:
- 	mkdir -p build/
--	rdmd $(RDMD_FLAGS) -L-lhts -version=standalone -ofbuild/sambamba-pileup sambamba/pileup.d
-+	ldmd2 $(RDMD_FLAGS) -L-lhts -version=standalone -ofbuild/sambamba-pileup sambamba/pileup.d
- 
- .PHONY: clean
- 
diff --git a/debian/patches/series b/debian/patches/series
index 57b0759..5a54d9e 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,3 +1 @@
-use_debian_packaged_libs.patch
-#replace_rdmd.patch
-#guix_makefile.patch
+01_add_meson.patch
diff --git a/debian/patches/use_debian_packaged_libs.patch b/debian/patches/use_debian_packaged_libs.patch
deleted file mode 100644
index d016ee3..0000000
--- a/debian/patches/use_debian_packaged_libs.patch
+++ /dev/null
@@ -1,67 +0,0 @@
-Author: Andreas Tille <tille at debian.org>
-Last-Update: Thu, 23 Feb 2017 17:41:31 +0100
-Desciption: Use Debian packaged lz4 and htslib
-
---- a/Makefile
-+++ b/Makefile
-@@ -1,9 +1,8 @@
- D_COMPILER=dmd
--D_FLAGS=--compiler=dmd -IBioD -IundeaD/src -g -d#-O -release -inline # -version=serial
-+D_FLAGS=--compiler=dmd -g -d#-O -release -inline # -version=serial
- LDMD=ldmd2
- 
--STATIC_LIB_PATH=-Lhtslib -Llz4/lib
--STATIC_LIB_SUBCMD=$(STATIC_LIB_PATH) -Wl,-Bstatic -lhts -llz4 -Wl,-Bdynamic
-+STATIC_LIB_SUBCMD=-lhts -llz4 -Wl,-Bdynamic
- RDMD_FLAGS=--force --build-only --compiler=$(D_COMPILER) $(D_FLAGS)
- 
- PLATFORM := $(shell uname -s)
-@@ -11,7 +10,7 @@ PLATFORM := $(shell uname -s)
- ifeq "$(PLATFORM)" "Darwin"
- 
- 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
-+DMD_STATIC_LIBS=-lhts -llz4
- 
- define split-debug
- dsymutil build/sambamba -o build/sambamba.dSYM
-@@ -32,7 +31,7 @@ endef
- 
- endif
- 
--PREREQS := ldc-version-info htslib-static lz4-static
-+PREREQS := ldc-version-info
- 
- # DMD only - this goal is used because of fast compilation speed, during development
- all: $(PREREQS)
---- a/Makefile.guix
-+++ b/Makefile.guix
-@@ -10,13 +10,12 @@
- 
- # The following two are modified by the Guix package:
- D_COMPILER=ldc2
--LDC_LIB_PATH=$(HOME)/.guix-profile/lib
- 
- DFLAGS = -wi -I. -IBioD -IundeaD/src
- DLIBS  = $(LDC_LIB_PATH)/libphobos2-ldc.a $(LDC_LIB_PATH)/libdruntime-ldc.a
- DLIBS_DEBUG = $(LDC_LIB_PATH)/libphobos2-ldc-debug.a $(LDC_LIB_PATH)/libdruntime-ldc-debug.a
- RPATH  = -L--rpath=$(dir $(realpath $(LDC_LIB_PATH)/libz.so)):$(dir $(realpath $(LDC_LIB_PATH)/liblz4.so))
--LIBS   = htslib/libhts.a -L-L$(LDC_LIB_PATH) -L-lrt -L-lpthread -L-lm -L-lz -L-llz4
-+LIBS   = -lhts -L-lrt -L-lpthread -L-lm -L-lz -L-llz4
- SRC    = $(wildcard main.d utils/*.d thirdparty/*.d cram/*.d) $(wildcard undeaD/src/undead/*.d) $(wildcard BioD/bio/*/*.d BioD/bio/*/*/*.d) $(wildcard sambamba/*.d sambamba/*/*.d sambamba/*/*/*.d)
- OBJ    = $(SRC:.d=.o) utils/ldc_version_info_.o
- OUT    = build/sambamba
-@@ -76,7 +75,7 @@ install:
- 	install -m 0755 build/sambamba $(prefix)/bin
- 
- clean: clean-d
--	cd htslib ; make clean
-+	#cd htslib ; make clean
- 
- clean-d:
- 	rm -rf build/*
---- a/sambamba-ldmd-release.rsp
-+++ b/sambamba-ldmd-release.rsp
-@@ -1 +1 @@
--"-g" "-O2" "-c" "-m64" "-release" "-IBioD/" "-IundeaD/src/" "-ofbuild/sambamba.o" "-odbuild" "-I." "main.d" "BioD/bio/bam/baifile.d" "sambamba/depth.d" "BioD/bio/core/utils/switchendianness.d" "sambamba/utils/common/readstorage.d" "BioD/bio/core/utils/tmpfile.d" "sambamba/utils/common/bed.d" "BioD/bio/bam/utils/samheadermerger.d" "thirdparty/mergesort.d" "BioD/bio/bam/readrange.d" "cram/exception.d" "sambamba/utils/view/headerserializer.d" "BioD/bio/bam/splitter.d" "cram/htslib.d" "BioD [...]
-+"-g" "-O2" "-c" "-m64" "-release" "-ofbuild/sambamba.o" "-odbuild" "-I." "main.d" "sambamba/depth.d" "sambamba/utils/common/readstorage.d" "sambamba/utils/common/bed.d" "thirdparty/mergesort.d" "cram/exception.d" "sambamba/utils/view/headerserializer.d" "cram/htslib.d" "sambamba/utils/common/ldc_gc_workaround.d" "sambamba/utils/common/filtering.d" "sambamba/utils/common/queryparser.d" "cram/reader.d" "sambamba/utils/common/overwrite.d" "sambamba/index.d" "sambamba/markdup.d" "cram/refer [...]

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-med/sambamba.git



More information about the debian-med-commit mailing list