[med-svn] [nanopolish] 04/04: Improve handling of external dependencies and build flags

Afif Elghraoui afif at moszumanska.debian.org
Fri Nov 10 05:54:55 UTC 2017


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

afif pushed a commit to branch master
in repository nanopolish.

commit df599e546cf66ec50f257390947d7f159c5a64aa
Author: Afif Elghraoui <afif at debian.org>
Date:   Fri Nov 10 00:53:47 2017 -0500

    Improve handling of external dependencies and build flags
    
    Try to minimize Debian-specific patching.
    Generic patches have been made and forwarded upstream,
    which should help towards this goal.
---
 debian/patches/compiler-flags.patch              | 17 +++++++----
 debian/patches/external-dependencies.patch       | 38 ++++++++++++++++++++++++
 debian/patches/external-libs.patch               | 33 --------------------
 debian/patches/reproducible.patch                |  6 ++--
 debian/patches/series                            |  1 +
 debian/patches/write_return_values_ignored.patch |  8 ++---
 debian/rules                                     | 10 ++++++-
 7 files changed, 66 insertions(+), 47 deletions(-)

diff --git a/debian/patches/compiler-flags.patch b/debian/patches/compiler-flags.patch
index cf29691..f5c0dc4 100644
--- a/debian/patches/compiler-flags.patch
+++ b/debian/patches/compiler-flags.patch
@@ -1,12 +1,17 @@
 Description: Allow adding settings to standard compiler flags
- * Use += for CFLAGS/CXXFLAGS
+ * Use CPPFLAGS for C source compilation
  * Use LDFLAGS
 Author: Afif Elghraoui <afif at debian.org>
-Forwarded: no
-Last-Update: 2016-08-11
---- a/Makefile
-+++ b/Makefile
-@@ -120,11 +120,11 @@ include .depend
+Forwarded: https://github.com/jts/nanopolish/pull/262
+Last-Update: 2017-11-10
+--- nanopolish.orig/Makefile
++++ nanopolish/Makefile
+@@ -116,15 +116,15 @@
+ 	$(CXX) -o $@ -c $(CXXFLAGS) $(CPPFLAGS) -fPIC $<
+ 
+ .c.o:
+-	$(CC) -o $@ -c $(CFLAGS) $(H5_INCLUDE) -fPIC $<
++	$(CC) -o $@ -c $(CFLAGS) $(CPPFLAGS) $(H5_INCLUDE) -fPIC $<
  
  # Link main executable
  $(PROGRAM): src/main/nanopolish.o $(CPP_OBJ) $(C_OBJ) $(HTS_LIB) $(H5_LIB) $(EIGEN_CHECK)
diff --git a/debian/patches/external-dependencies.patch b/debian/patches/external-dependencies.patch
new file mode 100644
index 0000000..eaac2f5
--- /dev/null
+++ b/debian/patches/external-dependencies.patch
@@ -0,0 +1,38 @@
+Description: Allow for easily using externally-installed dependencies
+ Allow for disabling builds of convenience copies without having to
+ edit the Makefile to set options.
+Author: Afif Elghraoui <afif at debian.org>
+Forwarded: https://github.com/jts/nanopolish/pull/262
+Last-Update: 2017-11-10
+--- nanopolish.orig/Makefile
++++ nanopolish/Makefile
+@@ -16,8 +16,9 @@
+ CC ?= gcc
+ 
+ # Change the value of HDF5 or EIGEN below to any value to disable compilation of bundled HDF5 code
+-HDF5=install
+-EIGEN=install
++HDF5?=install
++EIGEN?=install
++HTS?=install
+ 
+ # Check operating system, OSX doesn't have -lrt
+ UNAME_S := $(shell uname -s)
+@@ -45,9 +46,14 @@
+     EIGEN_CHECK=
+ endif
+ 
+-# Build and link the libhts submodule
+-HTS_LIB=./htslib/libhts.a
+-HTS_INCLUDE=-I./htslib
++# Default to build and link the libhts submodule
++ifeq ($(HTS), install)
++    HTS_LIB=./htslib/libhts.a
++    HTS_INCLUDE=-I./htslib
++else
++    # Use system-wide htslib
++    HTS_LIB=-lhts
++endif
+ 
+ # Include the header-only fast5 library
+ FAST5_INCLUDE=-I./fast5/include
diff --git a/debian/patches/external-libs.patch b/debian/patches/external-libs.patch
deleted file mode 100644
index 0c3f382..0000000
--- a/debian/patches/external-libs.patch
+++ /dev/null
@@ -1,33 +0,0 @@
-Description: Set up build system to use externally installed libraries
- * Remove htslib from prerequisites of the build
- * Change variable definition so that hdf5 isn't downloaded and built locally
-Author: Afif Elghraoui <afif at ghraoui.name>
-Forwarded: not-needed
-Last-Update: 2016-01-18
---- a/Makefile
-+++ b/Makefile
-@@ -16,7 +16,6 @@ CXX ?= g++
- CC ?= gcc
- 
- # Change the value of HDF5 or EIGEN below to any value to disable compilation of bundled HDF5 code
--HDF5=install
- EIGEN=install
- 
- # Check operating system, OSX doesn't have -lrt
-@@ -46,14 +45,13 @@ else
- endif
- 
- # Build and link the libhts submodule
--HTS_LIB=./htslib/libhts.a
--HTS_INCLUDE=-I./htslib
-+LIBS += -lhts
- 
- # Include the header-only fast5 library
- FAST5_INCLUDE=-I./fast5/src
- 
- # Include the header-only eigen library
--EIGEN_INCLUDE=-I./eigen/
-+EIGEN_INCLUDE=-I/usr/include/eigen3/
- 
- # Include the src subdirectories
- NP_INCLUDE=$(addprefix -I./, $(SUBDIRS))
diff --git a/debian/patches/reproducible.patch b/debian/patches/reproducible.patch
index 2191158..95c7ea5 100644
--- a/debian/patches/reproducible.patch
+++ b/debian/patches/reproducible.patch
@@ -2,9 +2,9 @@ Description: make build reproducible
  This patch enforces stable input file ordering w.r.t. source file gathering
  via Make's 'wildcard' directive.
 Author: Sascha Steinbiss <satta at debian.org>
---- a/Makefile
-+++ b/Makefile
-@@ -91,8 +91,8 @@ eigen/INSTALL:
+--- nanopolish.orig/Makefile
++++ nanopolish/Makefile
+@@ -99,8 +99,8 @@
  #
  
  # Find the source files by searching subdirectories
diff --git a/debian/patches/series b/debian/patches/series
index e9e1cc0..1c30f60 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,4 +1,5 @@
 compiler-flags.patch
+external-dependencies.patch
 add-shebang-to-script.patch
 reproducible.patch
 write_return_values_ignored.patch
diff --git a/debian/patches/write_return_values_ignored.patch b/debian/patches/write_return_values_ignored.patch
index d8f1153..c933766 100644
--- a/debian/patches/write_return_values_ignored.patch
+++ b/debian/patches/write_return_values_ignored.patch
@@ -2,9 +2,9 @@ Author: Steffen Moeller
 Last-Updated: 2017-09-16 02:14:07 +0200
 Description: Do not ignore return values of samtool functions
 
---- a/src/alignment/nanopolish_eventalign.cpp
-+++ b/src/alignment/nanopolish_eventalign.cpp
-@@ -221,7 +221,7 @@ void emit_tsv_header(FILE* fp)
+--- nanopolish.orig/src/alignment/nanopolish_eventalign.cpp
++++ nanopolish/src/alignment/nanopolish_eventalign.cpp
+@@ -229,7 +229,7 @@
  
  void emit_sam_header(samFile* fp, const bam_hdr_t* hdr)
  {
@@ -13,7 +13,7 @@ Description: Do not ignore return values of samtool functions
  }
  
  std::string cigar_ops_to_string(const std::vector<uint32_t>& ops)
-@@ -360,7 +360,7 @@ void emit_event_alignment_sam(htsFile* f
+@@ -368,7 +368,7 @@
      int stride = alignments.front().event_idx < alignments.back().event_idx ? 1 : -1;
      bam_aux_append(event_record, "ES", 'i', 4, reinterpret_cast<uint8_t*>(&stride));
  
diff --git a/debian/rules b/debian/rules
index aa79e0c..2ab4fc4 100755
--- a/debian/rules
+++ b/debian/rules
@@ -3,13 +3,21 @@
 #DH_VERBOSE = 1
 include /usr/share/dpkg/default.mk
 
-export DEB_CPPFLAGS_MAINT_APPEND = -I/usr/include/hdf5/serial
+export DEB_CPPFLAGS_MAINT_APPEND= \
+ -I/usr/include/hdf5/serial \
+ -I/usr/include/eigen3
 export DEB_LDFLAGS_MAINT_APPEND = -L/usr/lib/$(DEB_HOST_MULTIARCH)/hdf5/serial
 export DEB_BUILD_MAINT_OPTIONS = hardening=+all
 
 export CXXFLAGS += -flto
 export LDFLAGS += $(CXXFLAGS) $(CPPFLAGS) -L/usr/lib/$(shell dpkg-architecture -qDEB_HOST_MULTIARCH)/hdf5/serial
 
+# These variables just need to be defined as anything but "install" in order
+# to use system versions.
+export HDF5=external
+export EIGEN=external
+export HTS_LIB=external
+
 %:
 	dh $@
 

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



More information about the debian-med-commit mailing list