[med-svn] [Git][med-team/bwa-mem2][master] 6 commits: update watch file to get complete source tarball

Michael R. Crusoe gitlab at salsa.debian.org
Thu Jul 9 16:15:53 BST 2020



Michael R. Crusoe pushed to branch master at Debian Med / bwa-mem2


Commits:
6fc71bf9 by Michael R. Crusoe at 2020-07-09T15:46:52+02:00
update watch file to get complete source tarball

- - - - -
6c023326 by Michael R. Crusoe at 2020-07-09T16:12:12+02:00
improve package hardening

- - - - -
136e1c25 by Michael R. Crusoe at 2020-07-09T16:12:13+02:00
fix a typo

- - - - -
cde6c0c6 by Michael R. Crusoe at 2020-07-09T16:12:15+02:00
enable building on non-x86

- - - - -
fe69a7ee by Michael R. Crusoe at 2020-07-09T16:12:16+02:00
GPL code is gone

- - - - -
466c9ca1 by Michael R. Crusoe at 2020-07-09T17:14:06+02:00
simde fixup

- - - - -


8 changed files:

- debian/control
- debian/copyright
- + debian/patches/hardening
- + debian/patches/series
- + debian/patches/simde
- + debian/patches/spelling
- debian/rules
- debian/watch


Changes:

=====================================
debian/control
=====================================
@@ -5,7 +5,8 @@ Uploaders: Dylan Aïssi <daissi at debian.org>,
 Section: science
 Priority: optional
 Build-Depends: debhelper-compat (= 13),
-               zlib1g-dev
+               zlib1g-dev,
+               libsimde-dev
 Standards-Version: 4.5.0
 Vcs-Browser: https://salsa.debian.org/med-team/bwa-mem2
 Vcs-Git: https://salsa.debian.org/med-team/bwa-mem2.git
@@ -13,10 +14,9 @@ Homepage: https://github.com/bwa-mem2/bwa-mem2
 Rules-Requires-Root: no
 
 Package: bwa-mem2
-Architecture: any-amd64
+Architecture: any
 Depends: ${shlibs:Depends},
          ${misc:Depends}
-# sse4.1-support https://salsa.debian.org/debian/isa-support/merge_requests/1
 Description: Sequence alignment using Burrows-Wheeler Transform
  BWA is a software package for mapping low-divergent sequences against
  a large reference genome, such as the human genome. It consists of


=====================================
debian/copyright
=====================================
@@ -8,7 +8,7 @@ Copyright: 2019 Vasimuddin Md <vasimuddin.md at intel.com>
            2019 Sanchit Misra <sanchit.misra at intel.com>
            2019 Intel Corporation
            2019 Heng Li <hli at jimmy.harvard.edu>
-License: GPL-3.0+ and BSD-3-clause
+License: Expat
 
 Files: src/bntseq.*
        src/bwtindex.cpp
@@ -33,7 +33,7 @@ Copyright: 2008 Genome Research Ltd (GRL).
            2019 Vasimuddin Md <vasimuddin.md at intel.com>
            2019 Sanchit Misra <sanchit.misra at intel.com>
            2019 Intel Corporation
-License: GPL-3.0+
+License: Expat
 Comment: There is still reference to previous MIT licence
 
 Files: src/kbtree.h
@@ -43,6 +43,7 @@ License: BSD-2-Clause
 
 Files: debian/*
 Copyright: 2019 Dylan Aïssi <daissi at debian.org>
+           2020 Michael R. Crusoe <crusoe at debian.org>
 License: GPL-3.0+
 
 License: BSD-2-Clause


=====================================
debian/patches/hardening
=====================================
@@ -0,0 +1,76 @@
+Author: Michael R. Crusoe <crusoe at debian.org>
+Description: Enable proper flag appending so that Debian can harden the build.
+--- bwa-mem2.orig/Makefile
++++ bwa-mem2/Makefile
+@@ -37,7 +37,8 @@
+ endif		
+ ARCH_FLAGS=	-msse4.1
+ MEM_FLAGS=	-DSAIS=1
+-CPPFLAGS=	-DENABLE_PREFETCH -DV17=1 $(MEM_FLAGS) 
++ORIG_CPPFLAGS:=$(CPPFLAGS)
++CPPFLAGS+=	-DENABLE_PREFETCH -DV17=1 $(MEM_FLAGS) 
+ INCLUDES=   -Isrc -Iext/safestringlib/include
+ LIBS=		-lpthread -lm -lz -L. -lbwa  -Lext/safestringlib -lsafestring
+ OBJS=		src/fastmap.o src/bwtindex.o src/utils.o src/kthread.o \
+@@ -71,14 +72,14 @@
+ # To provide a different architecture flag like -march=core-avx2.
+ 	ARCH_FLAGS=$(arch)
+ endif
+-
+-CXXFLAGS=	-g -O3 -fpermissive $(ARCH_FLAGS) #-Wall ##-xSSE2
++ORIG_CXXFLAGS:=$(CXXFLAGS)
++CXXFLAGS += -g -O3 -fpermissive $(ARCH_FLAGS) #-Wall ##-xSSE2
+ 
+ .PHONY:all clean depend multi
+ .SUFFIXES:.cpp .o
+ 
+ .cpp.o:
+-	$(CXX) -c $(CXXFLAGS) $(CPPFLAGS) $(INCLUDES) $< -o $@
++	$(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $(INCLUDES) $< -o $@
+ 
+ all:$(EXE)
+ 
+@@ -89,10 +90,10 @@
+ 	$(MAKE) arch=avx2   EXE=bwa-mem2.avx2     CXX=$(CXX) all
+ 	rm -f src/*.o $(BWA_LIB); cd ext/safestringlib/ && $(MAKE) clean;
+ 	$(MAKE) arch=avx512 EXE=bwa-mem2.avx512bw CXX=$(CXX) all
+-	$(CXX) -Wall -O3 src/runsimd.cpp -Iext/safestringlib/include -Lext/safestringlib/ -lsafestring -o bwa-mem2
++	$(CXX) $(ORIG_CXXFLAGS) $(ORIG_CPPFLAGS) $(LDFLAGS) -Wall -O3 src/runsimd.cpp -Iext/safestringlib/include -Lext/safestringlib/ -lsafestring -o bwa-mem2
+ 
+ $(EXE):$(BWA_LIB) $(SAFE_STR_LIB) src/main.o
+-	$(CXX) $(CXXFLAGS) src/main.o $(BWA_LIB) $(LIBS) -o $@
++	$(CXX) $(CXXFLAGS) $(CPPFLAGS) $(LDFLAGS) src/main.o $(BWA_LIB) $(LIBS) -o $@
+ 
+ $(BWA_LIB):$(OBJS)
+ 	ar rcs $(BWA_LIB) $(OBJS)
+--- bwa-mem2.orig/ext/safestringlib/makefile
++++ bwa-mem2/ext/safestringlib/makefile
+@@ -1,8 +1,8 @@
+ IDIR = include
+ MKDIR_P = mkdir -p
+ CC=gcc
+-CFLAGS=-I$(IDIR) -fstack-protector-strong -fPIE -fPIC -O2 -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security
+-LDFLAGS=-z noexecstack -z relo -z now
++CFLAGS+=-I$(IDIR) -fstack-protector-strong -fPIE -fPIC -O2 -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security
++LDFLAGS+=-z noexecstack -z relo -z now
+ 
+ ODIR=obj
+ OTDIR=objtest
+@@ -30,7 +30,7 @@
+ 
+ 
+ $(ODIR)/%.o: $(SRCDIR)/%.c $(DEPS) $(ODEPS)
+-	$(CC) $(LDFLAGS) -c -o $@ $< $(CFLAGS)
++	$(CC) $(CPPFLAGS) $(LDFLAGS) -c -o $@ $< $(CFLAGS)
+ 
+ libsafestring.a: $(OBJ)
+ 	ar rcs $@ $^
+@@ -44,7 +44,7 @@
+ 
+ 
+ $(OTDIR)/%.o: $(TESTDIR)/%.c $(TESTDIR)/test_private.h
+-	$(CC) -c -o $@ $< $(CFLAGS)
++	$(CC) $(CPPFLAGS) -c -o $@ $< $(CFLAGS)
+ 
+ 
+ safestringtest: directories libsafestring.a $(TOBJ)


=====================================
debian/patches/series
=====================================
@@ -0,0 +1,3 @@
+hardening
+spelling
+simde


=====================================
debian/patches/simde
=====================================
@@ -0,0 +1,182 @@
+From: Michael R. Crusoe <crusoe at debian.org>
+Subject: Enable building on non-x86
+--- bwa-mem2.orig/src/FMI_search.h
++++ bwa-mem2/src/FMI_search.h
+@@ -34,7 +34,8 @@
+ #include <stdlib.h>
+ #include <stdint.h>
+ #include <string.h>
+-#include <immintrin.h>
++#define SIMDE_ENABLE_NATIVE_ALIASES
++#include <simde/x86/avx2.h>
+ #include <limits.h>
+ #include <fstream>
+ 
+--- bwa-mem2.orig/src/bandedSWA.h
++++ bwa-mem2/src/bandedSWA.h
+@@ -36,10 +36,17 @@
+ #include <assert.h>
+ #include "macro.h"
+ 
++#if !defined(__SSE__)
++#define _mm_malloc(size, align) aligned_alloc(align, size)
++#define _mm_free free
++#define _MM_HINT_NTA 0
++#endif
++
++#define SIMDE_ENABLE_NATIVE_ALIASES
+ #if (__AVX512BW__ || __AVX2__)
+ #include <immintrin.h>
+ #else
+-#include <smmintrin.h>  // for SSE4.1
++#include <simde/x86/sse4.1.h>  // for SSE4.1
+ #define __mmask8 uint8_t
+ #define __mmask16 uint16_t
+ #endif
+--- bwa-mem2.orig/src/ksw.cpp
++++ bwa-mem2/src/ksw.cpp
+@@ -30,7 +30,6 @@
+ #include <stdlib.h>
+ #include <stdint.h>
+ #include <assert.h>
+-#include <emmintrin.h>
+ #include "ksw.h"
+ #include "macro.h"
+ 
+--- bwa-mem2.orig/src/ksw.h
++++ bwa-mem2/src/ksw.h
+@@ -26,7 +26,8 @@
+ #define __AC_KSW_H
+ 
+ #include <stdint.h>
+-#include <emmintrin.h>
++#define SIMDE_ENABLE_NATIVE_ALIASES
++#include <simde/x86/sse2.h>
+ 
+ #define KSW_XBYTE  0x10000
+ #define KSW_XSTOP  0x20000
+--- bwa-mem2.orig/src/kswv.h
++++ bwa-mem2/src/kswv.h
+@@ -39,7 +39,8 @@
+ #include "ksw.h"
+ #include "bandedSWA.h"
+ #else
+-#include <immintrin.h>
++#define SIMDE_ENABLE_NATIVE_ALIASES
++#include <simde/x86/avx2.h>
+ #endif
+ 
+ #ifdef __GNUC__
+--- bwa-mem2.orig/src/bwa.h
++++ bwa-mem2/src/bwa.h
+@@ -37,6 +37,13 @@
+ #include "bwt.h"
+ #include "macro.h"
+ 
++#if !defined(__SSE__)
++#define _mm_malloc(size, align) aligned_alloc(align, size)
++#define _mm_free free
++#define _MM_HINT_NTA 0
++#define _MM_HINT_T0 0
++#endif
++
+ #define BWA_IDX_BWT 0x1
+ #define BWA_IDX_BNS 0x2
+ #define BWA_IDX_PAC 0x4
+--- bwa-mem2.orig/src/utils.h
++++ bwa-mem2/src/utils.h
+@@ -63,6 +63,43 @@
+     __asm__ __volatile__ ("rdtsc" : "=a"(lo), "=d"(hi));
+     return ( (unsigned long long)lo)|( ((unsigned long long)hi)<<32 );
+ }
++// From https://github.com/google/benchmark/blob/37177a84b7e8d33696ea1e1854513cb0de3b4dc3/src/cycleclock.h
++// Apache 2.0 license
++#elif defined(__aarch64__)
++  // System timer of ARMv8 runs at a different frequency than the CPU's..
++  // The frequency is fixed, typically in the range 1-50MHz.  It can be
++  // read at CNTFRQ special register.  We assume the OS has set up
++  // the virtual timer properly.
++static inline unsigned long long __rdtsc(void)
++{
++  int64_t virtual_timer_value;
++  asm volatile("mrs %0, cntvct_el0" : "=r"(virtual_timer_value));
++  return virtual_timer_value;
++}
++#elif defined(__ARM_ARCH)
++  // V6 is the earliest arch that has a standard cyclecount
++  // Native Client validator doesn't allow MRC instructions.
++#if (__ARM_ARCH >= 6)
++static inline unsigned long long __rdtsc(void)
++{
++  uint32_t pmccntr;
++  uint32_t pmuseren;
++  uint32_t pmcntenset;
++  // Read the user mode perf monitor counter access permissions.
++  asm volatile("mrc p15, 0, %0, c9, c14, 0" : "=r"(pmuseren));
++  if (pmuseren & 1) {  // Allows reading perfmon counters for user mode code.
++    asm volatile("mrc p15, 0, %0, c9, c12, 1" : "=r"(pmcntenset));
++    if (pmcntenset & 0x80000000ul) {  // Is it counting?
++      asm volatile("mrc p15, 0, %0, c9, c13, 0" : "=r"(pmccntr));
++      // The counter is set up to count every 64th cycle
++      return static_cast<int64_t>(pmccntr) * 64;  // Should optimize to << 6
++    }
++  }
++#endif
++  struct timeval tv;
++  gettimeofday(&tv, nullptr);
++  return static_cast<int64_t>(tv.tv_sec) * 1000000 + tv.tv_usec;
++}
+ #endif
+ #endif
+ 
+--- bwa-mem2.orig/src/fastmap.cpp
++++ bwa-mem2/src/fastmap.cpp
+@@ -52,7 +52,7 @@
+ #ifdef _WIN32
+     __cpuid((int *) cpuid, (int)i);
+ 
+-#else
++#elif defined(__x86_64__) || defined(__i386__)
+     asm volatile
+         ("cpuid" : "=a" (cpuid[0]), "=b" (cpuid[1]), "=c" (cpuid[2]), "=d" (cpuid[3])
+             : "0" (i), "2" (0));
+@@ -62,6 +62,7 @@
+ 
+ int HTStatus()
+ {
++#if defined(__x86_64__) || defined(__i386__)
+     unsigned int cpuid[4];
+     char platform_vendor[12];
+     __cpuid(0, cpuid);
+@@ -93,6 +94,9 @@
+         fprintf(stderr, "CPUs support hyperThreading !!\n");
+ 
+     return ht;
++#else
++    return 0;
++#endif
+ }
+ 
+ 
+--- bwa-mem2.orig/src/runsimd.cpp
++++ bwa-mem2/src/runsimd.cpp
+@@ -61,7 +61,7 @@
+ 	__asm__ volatile ("cpuid"
+ 			: "=a" (cpuid[0]), "=b" (cpuid[1]), "=c" (cpuid[2]), "=d" (cpuid[3])
+ 			: "0" (func_id), "2" (subfunc_id));
+-#else // on 32bit, ebx can NOT be used as PIC code
++#elif defined(__i386__) // on 32bit, ebx can NOT be used as PIC code
+ 	__asm__ volatile ("xchgl %%ebx, %1; cpuid; xchgl %%ebx, %1"
+ 			: "=a" (cpuid[0]), "=r" (cpuid[1]), "=c" (cpuid[2]), "=d" (cpuid[3])
+ 			: "0" (func_id), "2" (subfunc_id));
+--- bwa-mem2.orig/src/bwamem.cpp
++++ bwa-mem2/src/bwamem.cpp
+@@ -1861,7 +1861,7 @@
+ {
+ 
+     int32_t i;
+-#if ((!__AVX512BW__) & (__AVX2__ | __SSE2__))
++#if (!__AVX512BW__)
+     for(i = 0; i <= MAX_SEQ_LEN16; i++) hist[i] = 0;
+ #else   
+     __m512i zero512 = _mm512_setzero_si512();


=====================================
debian/patches/spelling
=====================================
@@ -0,0 +1,13 @@
+From: Michael R. Crusoe <crusoe at debian.org>
+Subject: fix a typo
+--- bwa-mem2.orig/src/profiling.cpp
++++ bwa-mem2/src/profiling.cpp
+@@ -57,7 +57,7 @@
+     uint64_t max, min;
+     double avg;
+     fprintf(stderr, "No. of OMP threads: %d\n", nthreads);
+-    fprintf(stderr, "Processor is runnig @%lf MHz\n", proc_freq*1.0/1e6);
++    fprintf(stderr, "Processor is running @%lf MHz\n", proc_freq*1.0/1e6);
+     fprintf(stderr, "Runtime profile:\n");
+ 
+     fprintf(stderr, "\n\tTime taken for main_mem function: %0.2lf sec\n\n",


=====================================
debian/rules
=====================================
@@ -2,11 +2,20 @@
 
 export DEB_BUILD_MAINT_OPTIONS = hardening=+all
 
+ifeq (,$(filter $(DEB_HOST_ARCH),amd64 i386))
+export DEB_CFLAGS_MAINT_APPEND+=-DSIMDE_ENABLE_OPENMP -fopenmp-simd -O3
+export DEB_CXXFLAGS_MAINT_APPEND+=-DSIMDE_ENABLE_OPENMP -fopenmp-simd -O3
+endif
+
 %:
 	dh $@
 
 override_dh_auto_build:
+ifneq (,$(filter $(DEB_HOST_ARCH),amd64 i386))
 	dh_auto_build -- multi
+else
+	dh_auto_build -- ARCH_FLAGS=' '
+endif
 
 # ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
 # 	dh_auto_build --sourcedir=test -- CXX=g++


=====================================
debian/watch
=====================================
@@ -1,3 +1,3 @@
 version=4
 opts=filenamemangle=s/.+\/v?(\d\S+)\.tar\.gz/bwa-mem2-$1\.tar\.gz/,uversionmangle=s/pre/~pre/ \
-  https://github.com/@PACKAGE@/@PACKAGE@/releases/latest .*/archive/v?@ANY_VERSION@@ARCHIVE_EXT@
+  https://github.com/@PACKAGE@/@PACKAGE@/releases .*/download/v at ANY_VERSION@/Source_code_including_submodule at ARCHIVE_EXT@



View it on GitLab: https://salsa.debian.org/med-team/bwa-mem2/-/compare/7d7ceefbc2e38ab01a92c408892471a342619200...466c9ca17158e513a8419062706b83ef9bf768fe

-- 
View it on GitLab: https://salsa.debian.org/med-team/bwa-mem2/-/compare/7d7ceefbc2e38ab01a92c408892471a342619200...466c9ca17158e513a8419062706b83ef9bf768fe
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/20200709/45215050/attachment-0001.html>


More information about the debian-med-commit mailing list