[med-svn] [Git][med-team/wtdbg2][master] 3 commits: Build on all architectures and don't violate the i386/amd64 baselines

Michael R. Crusoe gitlab at salsa.debian.org
Sat Apr 18 18:54:27 BST 2020



Michael R. Crusoe pushed to branch master at Debian Med / wtdbg2


Commits:
880ad9ae by Michael R. Crusoe at 2020-04-18T19:52:10+02:00
Build on all architectures and don't violate the i386/amd64 baselines

- - - - -
e4e438f1 by Michael R. Crusoe at 2020-04-18T19:52:10+02:00
Install the scripts to /usr/share/wtdbg2/ and add their dependencies under "Suggests"

- - - - -
8c33edeb by Michael R. Crusoe at 2020-04-18T19:52:11+02:00
Install the README.md

- - - - -


10 changed files:

- + debian/bin/simd-dispatch
- debian/changelog
- debian/control
- + debian/docs
- + debian/install
- debian/patches/hardening.patch
- + debian/patches/scripts-tweak
- debian/patches/series
- + debian/patches/simde
- debian/rules


Changes:

=====================================
debian/bin/simd-dispatch
=====================================
@@ -0,0 +1,20 @@
+#!/bin/bash
+
+PKG=wtdbg2
+DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
+BASE=$(realpath ${DIR}/../lib/$PKG/$(basename "$0"))
+
+function test_and_run () {
+	if grep -q "$1" /proc/cpuinfo && [ -x "${BASE}-$1" ]; then
+		cmd="${BASE}-$1"
+		shift
+		# echo "${cmd}" "$@"
+		"${cmd}" "$@"
+		exit
+	fi
+}
+
+for SIMD in avx2 avx sse4.1 ssse3 sse3 sse2 sse mmx ; do test_and_run ${SIMD} "$@" ; done
+
+# fallback to plain option
+$BASE-plain "$@"


=====================================
debian/changelog
=====================================
@@ -1,3 +1,14 @@
+wtdbg2 (2.5-2) UNRELEASED; urgency=medium
+
+  * Team upload.
+  * Build on all architectures and don't violate the i386/amd64 baselines
+    Closes: #958091
+  * Install the scripts to /usr/share/wtdbg2/ and add their dependencies under
+    "Suggests"
+  * Install the README.md
+
+ -- Michael R. Crusoe <michael.crusoe at gmail.com>  Sat, 18 Apr 2020 18:45:55 +0200
+
 wtdbg2 (2.5-1) unstable; urgency=medium
 
   * Initial release (Closes: #955548)


=====================================
debian/control
=====================================
@@ -4,7 +4,8 @@ Uploaders: Andreas Tille <tille at debian.org>
 Section: science
 Priority: optional
 Build-Depends: debhelper-compat (= 12),
-               zlib1g-dev
+               zlib1g-dev,
+               libsimde-dev
 Standards-Version: 4.5.0
 Vcs-Browser: https://salsa.debian.org/med-team/wtdbg2
 Vcs-Git: https://salsa.debian.org/med-team/wtdbg2.git
@@ -15,6 +16,10 @@ Package: wtdbg2
 Architecture: any
 Depends: ${shlibs:Depends},
          ${misc:Depends}
+Suggests: ${perl:Depends},
+          minimap2,
+          samtools,
+          mummer
 Description: de novo sequence assembler for long noisy reads
  Wtdbg2 is a de novo sequence assembler for long noisy reads produced by
  PacBio or Oxford Nanopore Technologies (ONT). It assembles raw reads


=====================================
debian/docs
=====================================
@@ -0,0 +1 @@
+README.md


=====================================
debian/install
=====================================
@@ -0,0 +1 @@
+scripts/* /usr/share/wtdbg2/


=====================================
debian/patches/hardening.patch
=====================================
@@ -2,9 +2,9 @@ Author: Andreas Tille <tille at debian.org>
 Last-Update: Thu, 02 Apr 2020 11:37:59 +0200
 Description: Propagate hardening options
 
---- a/Makefile
-+++ b/Makefile
-@@ -11,12 +11,12 @@ TIMESTAMP=$(shell date)
+--- wtdbg2.orig/Makefile
++++ wtdbg2/Makefile
+@@ -11,12 +11,12 @@
  endif
  
  ifeq (1, ${DEBUG})
@@ -20,3 +20,32 @@ Description: Propagate hardening options
  GENERIC_SRC=mem_share.h chararray.h sort.h list.h pgzf.h sort.h list.h dna.h thread.h filereader.h filewriter.h bitvec.h bit2vec.h bitsvec.h hashset.h
  
  PROGS=kbm2 wtdbg2 wtdbg-cns wtpoa-cns pgzf
+@@ -24,22 +24,22 @@
+ all: $(PROGS)
+ 
+ kbm2: $(GENERIC_SRC) kbm.c kbm.h kbmpoa.h wtpoa.h tripoa.h poacns.h kswx.h ksw.h ksw.c
+-	$(CC) $(CFLAGS) -o $@ kbm.c ksw.c $(GLIBS)
++	$(CC) $(LDFLAGS) $(CFLAGS) $(CPPFLAGS) -o $@ kbm.c ksw.c $(GLIBS)
+ 
+ wtdbg2: $(GENERIC_SRC) wtdbg.c wtdbg-graph.h wtdbg.h kbm.h kswx.h ksw.h ksw.c kbmpoa.h wtpoa.h tripoa.h poacns.h
+-	$(CC) $(CFLAGS) -o $@ wtdbg.c ksw.c $(GLIBS)
++	$(CC) $(LDFLAGS) $(CFLAGS) $(CPPFLAGS) -o $@ wtdbg.c ksw.c $(GLIBS)
+ 
+ wtdbg-cns: $(GENERIC_SRC) wtdbg-cns.c kswx.h ksw.h ksw.c dbgcns.h dagcns.h queue.h general_graph.h
+-	$(CC) $(CFLAGS) -o wtdbg-cns wtdbg-cns.c ksw.c $(GLIBS)
++	$(CC) $(LDFLAGS) $(CFLAGS) $(CPPFLAGS) -o wtdbg-cns wtdbg-cns.c ksw.c $(GLIBS)
+ 
+ wtpoa-cns: $(GENERIC_SRC) wtpoa.h wtpoa-cns.c poacns.h tripoa.h ksw.h ksw.c
+-	$(CC) $(CFLAGS) -o $@ wtpoa-cns.c ksw.c $(GLIBS)
++	$(CC) $(LDFLAGS) $(CFLAGS) $(CPPFLAGS) -o $@ wtpoa-cns.c ksw.c $(GLIBS)
+ 
+ pgzf: mem_share.h sort.h list.h thread.h pgzf.h pgzf.c
+-	$(CC) $(CFLAGS) -o $@ pgzf.c $(GLIBS)
++	$(CC) $(LDFLAGS) $(CFLAGS) $(CPPFLAGS) -o $@ pgzf.c $(GLIBS)
+ 
+ best_sam_hits4longreads: $(GENERIC_SRC) best_sam_hits4longreads.c
+-	$(CC) $(CFLAGS) -o $@ best_sam_hits4longreads.c $(GLIBS)
++	$(CC) $(LDFLAGS) $(CFLAGS) $(CPPFLAGS) -o $@ best_sam_hits4longreads.c $(GLIBS)
+ 
+ clean:
+ 	rm -f *.o *.gcda *.gcno *.gcov gmon.out $(PROGS)


=====================================
debian/patches/scripts-tweak
=====================================
@@ -0,0 +1,13 @@
+Author: Michael R. Crusoe <michael.crusoe at gmail.com>
+Description: Use the executables from the Debian 'mummer' package
+--- wtdbg2.orig/scripts/mum_assess.sh
++++ wtdbg2/scripts/mum_assess.sh
+@@ -5,7 +5,7 @@
+ REF=$1
+ CTG=$2
+ # change this path to your mummer
+-MUM=/public/software/mummer-323-intel
++MUM=/usr/bin
+ 
+ if [ -z $REF ] || [ -z $CTG ]; then
+ 	echo "Usage: $0 <ref> <ctg>"


=====================================
debian/patches/series
=====================================
@@ -1,2 +1,4 @@
 fix_install.patch
 hardening.patch
+simde
+scripts-tweak


=====================================
debian/patches/simde
=====================================
@@ -0,0 +1,71 @@
+From: Michael R. Crusoe <michael.crusoe at gmail.com>
+Description: enable non-X86 building via SIMDe
+--- wtdbg2.orig/ksw.c
++++ wtdbg2/ksw.c
+@@ -25,7 +25,8 @@
+ 
+ #include <stdlib.h>
+ #include <stdint.h>
+-#include <emmintrin.h>
++#define SIMDE_ENABLE_NATIVE_ALIASES
++#include "simde/x86/sse2.h"
+ #include "ksw.h"
+ 
+ #ifdef USE_MALLOC_WRAPPERS
+--- wtdbg2.orig/poacns.h
++++ wtdbg2/poacns.h
+@@ -25,8 +25,8 @@
+ #include "chararray.h"
+ #include "list.h"
+ #include "hashset.h"
+-#include <emmintrin.h>
+-#include <tmmintrin.h>
++#define SIMDE_ENABLE_NATIVE_ALIASES
++#include "simde/x86/ssse3.h"
+ 
+ #if __BYTE_ORDER == 1234
+ //#pragma message(" ** " __FILE__ " has been tested in LITTLE_ENDIAN **\n")
+--- wtdbg2.orig/Makefile
++++ wtdbg2/Makefile
+@@ -11,31 +11,32 @@
+ endif
+ 
+ ifeq (1, ${DEBUG})
+-CFLAGS+=-g3 -W -Wall -Wno-unused-but-set-variable -O0 -DDEBUG=1 -DVERSION="$(VERSION)" -DRELEASE="$(RELEASE)" -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -mpopcnt -msse4.2
++CFLAGS+=-g3 -W -Wall -Wno-unused-but-set-variable -O0 -DDEBUG=1 -DVERSION="$(VERSION)" -DRELEASE="$(RELEASE)" -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE
+ else
+-CFLAGS+=-g3 -W -Wall -Wno-unused-but-set-variable -O4 -DVERSION="$(VERSION)" -DRELEASE="$(RELEASE)" -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -mpopcnt -msse4.2
++CFLAGS+=-g3 -W -Wall -Wno-unused-but-set-variable -O4 -DVERSION="$(VERSION)" -DRELEASE="$(RELEASE)" -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE
+ endif
+ 
+ GLIBS=-lm -lrt -lpthread -lz $(LDFLAGS)
+ GENERIC_SRC=mem_share.h chararray.h sort.h list.h pgzf.h sort.h list.h dna.h thread.h filereader.h filewriter.h bitvec.h bit2vec.h bitsvec.h hashset.h
+ 
+-PROGS=kbm2 wtdbg2 wtdbg-cns wtpoa-cns pgzf
++SFX ?=
++PROGS=kbm2$(SFX) wtdbg2$(SFX) wtdbg-cns$(SFX) wtpoa-cns$(SFX) pgzf$(SFX)
+ 
+ all: $(PROGS)
+ 
+-kbm2: $(GENERIC_SRC) kbm.c kbm.h kbmpoa.h wtpoa.h tripoa.h poacns.h kswx.h ksw.h ksw.c
++kbm2$(SFX): $(GENERIC_SRC) kbm.c kbm.h kbmpoa.h wtpoa.h tripoa.h poacns.h kswx.h ksw.h ksw.c
+ 	$(CC) $(LDFLAGS) $(CFLAGS) $(CPPFLAGS) -o $@ kbm.c ksw.c $(GLIBS)
+ 
+-wtdbg2: $(GENERIC_SRC) wtdbg.c wtdbg-graph.h wtdbg.h kbm.h kswx.h ksw.h ksw.c kbmpoa.h wtpoa.h tripoa.h poacns.h
++wtdbg2$(SFX): $(GENERIC_SRC) wtdbg.c wtdbg-graph.h wtdbg.h kbm.h kswx.h ksw.h ksw.c kbmpoa.h wtpoa.h tripoa.h poacns.h
+ 	$(CC) $(LDFLAGS) $(CFLAGS) $(CPPFLAGS) -o $@ wtdbg.c ksw.c $(GLIBS)
+ 
+-wtdbg-cns: $(GENERIC_SRC) wtdbg-cns.c kswx.h ksw.h ksw.c dbgcns.h dagcns.h queue.h general_graph.h
+-	$(CC) $(LDFLAGS) $(CFLAGS) $(CPPFLAGS) -o wtdbg-cns wtdbg-cns.c ksw.c $(GLIBS)
++wtdbg-cns$(SFX): $(GENERIC_SRC) wtdbg-cns.c kswx.h ksw.h ksw.c dbgcns.h dagcns.h queue.h general_graph.h
++	$(CC) $(LDFLAGS) $(CFLAGS) $(CPPFLAGS) -o $@ wtdbg-cns.c ksw.c $(GLIBS)
+ 
+-wtpoa-cns: $(GENERIC_SRC) wtpoa.h wtpoa-cns.c poacns.h tripoa.h ksw.h ksw.c
++wtpoa-cns$(SFX): $(GENERIC_SRC) wtpoa.h wtpoa-cns.c poacns.h tripoa.h ksw.h ksw.c
+ 	$(CC) $(LDFLAGS) $(CFLAGS) $(CPPFLAGS) -o $@ wtpoa-cns.c ksw.c $(GLIBS)
+ 
+-pgzf: mem_share.h sort.h list.h thread.h pgzf.h pgzf.c
++pgzf$(SFX): mem_share.h sort.h list.h thread.h pgzf.h pgzf.c
+ 	$(CC) $(LDFLAGS) $(CFLAGS) $(CPPFLAGS) -o $@ pgzf.c $(GLIBS)
+ 
+ best_sam_hits4longreads: $(GENERIC_SRC) best_sam_hits4longreads.c


=====================================
debian/rules
=====================================
@@ -7,9 +7,62 @@ include /usr/share/dpkg/default.mk
 
 # for hardening you might like to uncomment this:
 export DEB_BUILD_MAINT_OPTIONS=hardening=+all
+export DEB_CFLAGS_MAINT_APPEND=-DSIMDE_ENABLE_OPENMP -fopenmp-simd
+export CFLAGS=$(shell dpkg-buildflags --get CFLAGS)
+export CPPFLAGS=$(shell dpkg-buildflags --get CPPFLAGS)
+export LDFLAGS=$(shell dpkg-buildflags --get LDFLAGS)
+
+prefix=$(CURDIR)/debian/$(DEB_SOURCE)/usr
+libexecdir=$(prefix)/lib/$(DEB_SOURCE)
 
 %:
 	dh $@
 
+override_dh_auto_build:
+ifeq (amd64,$(DEB_HOST_ARCH))
+	mkdir -p $(prefix)
+	mkdir -p $(libexecdir)
+	for SIMD in avx2 avx sse4.1 ssse3 sse3 sse2 ; do \
+		export CFLAGS="$(CFLAGS) -m$${SIMD}" ; \
+		make clean ; \
+		dh_auto_build -- SFX=-$${SIMD} ; \
+	done
+else ifeq (i386,$(DEB_HOST_ARCH))
+	mkdir -p $(prefix)
+	mkdir -p $(libexecdir)
+	for SIMD in ssse3 sse3 sse2 sse mmx; do \
+		export CFLAGS="$(CXXFLAGS) -m$${SIMD}" ; \
+		make clean ; \
+		dh_auto_build -- SFX=-$${SIMD} ; \
+	done
+	dh_auto_build -- SFX=-plain
+else
+	dh_auto_build
+endif
+
 override_dh_auto_install:
+ifeq (amd64,$(DEB_HOST_ARCH))
+	dh_install debian/bin/simd-dispatch /usr/lib/$(DEB_SOURCE)/
+	for SIMD in avx2 avx sse4.1 ssse3 sse3 sse2 ; do \
+		export CFLAGS="$(CFLAGS) -m$${SIMD}" ; \
+		dh_auto_build -- SFX=-$${SIMD} BIN=$(libexecdir) install ; \
+	done
+	mkdir -p $(prefix)/bin
+	cd $(prefix)/bin \
+		&& for prog in kbm2 pgzf wtdbg-cns wtdbg2 wtpoa-cns ; do \
+		ln -s ../lib/$(DEB_SOURCE)/simd-dispatch $${prog} ; done
+else ifeq (i386,$(DEB_HOST_ARCH))
+	dh_install debian/bin/simd-dispatch /usr/lib/$(DEB_SOURCE)/
+	for SIMD in sse2 sse mmx ; do \
+		export CFLAGS="$(CFLAGS) -m$${SIMD}" ; \
+		dh_auto_build -- SFX=-$${SIMD} BIN=$(libexecdir) install ; \
+	done
+	export CLFAGS="$(CFLAGS)" ; dh_auto_build -- SFX=-plain BIN=$(libexecdir) \
+		install
+	mkdir -p $(prefix)/bin
+	cd $(prefix)/bin \
+		&& for prog in kbm2 pgzf wtdbg-cns wtdbg2 wtpoa-cns ; do \
+		ln -s ../lib/$(DEB_SOURCE)/simd-dispatch $${prog} ; done
+else
 	make BIN=debian/$(DEB_SOURCE)/usr/bin install
+endif



View it on GitLab: https://salsa.debian.org/med-team/wtdbg2/-/compare/817993111236545c50c1f3bfd544c25eadafb0b9...8c33edeb9398acfa56d283f86167804de4f9366b

-- 
View it on GitLab: https://salsa.debian.org/med-team/wtdbg2/-/compare/817993111236545c50c1f3bfd544c25eadafb0b9...8c33edeb9398acfa56d283f86167804de4f9366b
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/debian-med-commit/attachments/20200418/0beb952b/attachment-0001.html>


More information about the debian-med-commit mailing list