Source: mapsembler2
Version: 2.2.4+dfsg1-2
Tags: patch
User: debian-cr...@lists.debian.org
Usertags: ftcbfs

mapsembler2 fails to cross build from source, because it builds for the
build architecture. It does not pass any cross flags to cmake nor any
cross tools to make. In general, these kind of issues can often be
solved using dh_auto_*. In this case, that mostly does the trick except
for one aspect. Some makefiles use CC to store a C++ compiler. During
cross compilation, dh_auto_build passes a C compiler via CC and that
doesn't go well. I recommend changing the variable name to CXX, which is
what everyone uses. Please consider applying the attached patch to make
mapsembler2 cross buildable.

Helmut
diff --minimal -Nru mapsembler2-2.2.4+dfsg1/debian/changelog 
mapsembler2-2.2.4+dfsg1/debian/changelog
--- mapsembler2-2.2.4+dfsg1/debian/changelog    2020-10-21 22:58:31.000000000 
+0200
+++ mapsembler2-2.2.4+dfsg1/debian/changelog    2020-10-24 07:02:52.000000000 
+0200
@@ -1,3 +1,12 @@
+mapsembler2 (2.2.4+dfsg1-2.1) UNRELEASED; urgency=medium
+
+  * Non-maintainer upload.
+  * Fix FTCBFS: (Closes: #-1)
+    + Let dh_auto_* handle cross compilation.
+    + cross.patch: Use CXX for a C++ compiler.
+
+ -- Helmut Grohne <hel...@subdivi.de>  Sat, 24 Oct 2020 07:02:52 +0200
+
 mapsembler2 (2.2.4+dfsg1-2) unstable; urgency=medium
 
   * Team upload.
diff --minimal -Nru mapsembler2-2.2.4+dfsg1/debian/patches/cross.patch 
mapsembler2-2.2.4+dfsg1/debian/patches/cross.patch
--- mapsembler2-2.2.4+dfsg1/debian/patches/cross.patch  1970-01-01 
01:00:00.000000000 +0100
+++ mapsembler2-2.2.4+dfsg1/debian/patches/cross.patch  2020-10-24 
07:02:52.000000000 +0200
@@ -0,0 +1,65 @@
+--- mapsembler2-2.2.4+dfsg1.orig/mapsembler2_extend/makefile
++++ mapsembler2-2.2.4+dfsg1/mapsembler2_extend/makefile
+@@ -1,14 +1,14 @@
+-CC=g++
++CXX=g++
+ EXEC=mapsembler_extend
+ 
+ #CFLAGS=  -O4 -lz
+ #CFLAGS=  -g  -lz
+ #CFLAGS=  -g  -lz
+ CFLAGS=  -O3  -lz
+-ifeq "$(CC)" "g++"
++ifeq "$(CXX)" "g++"
+       empty:=
+       space:= $(empty) $(empty)
+-      GCCVERSIONSTRING := $(shell expr `$(CC) -dumpversion`)
++      GCCVERSIONSTRING := $(shell expr `$(CXX) -dumpversion`)
+       #Create version number without "."
+       GCCVERSION := $(shell expr `echo $(GCCVERSIONSTRING)` | cut -f1 -d.)
+       GCCVERSION += $(shell expr `echo $(GCCVERSIONSTRING)` | cut -f2 -d.)
+@@ -30,7 +30,7 @@
+ else  
+       empty:=
+       space:= $(empty) $(empty)
+-      CLANGVERSIONSTRING := $(shell expr `$(CC) -dumpversion`)
++      CLANGVERSIONSTRING := $(shell expr `$(CXX) -dumpversion`)
+       #Create version number without "."
+       CLANGVERSION := $(shell expr `echo $(GCCVERSIONSTRING)` | cut -f1 -d.)
+       CLANGVERSION += $(shell expr `echo $(GCCVERSIONSTRING)` | cut -f2 -d.)
+@@ -110,10 +110,10 @@
+ 
+ mapsembler_extend:  $(OBJ) $(OBJ2) mapsembler_extend.cpp
+ #mapsembler:  $(OBJ) $(OBJ2) test.cpp
+-      $(CC) -o $@ $^ $(CFLAGS) $(LDFLAGS)
++      $(CXX) -o $@ $^ $(CFLAGS) $(LDFLAGS)
+ 
+ %.o: %.cpp %.h 
+-      $(CC) -o $@ -c $< $(CFLAGS)
++      $(CXX) -o $@ -c $< $(CFLAGS)
+ 
+ 
+ #%.o: %.c %.h 
+--- mapsembler2-2.2.4+dfsg1.orig/kissreads_graph/makefile
++++ mapsembler2-2.2.4+dfsg1/kissreads_graph/makefile
+@@ -1,5 +1,5 @@
+-#CC=/opt/local/bin/g++-mp-4.7
+-CC=g++
++#CXX=/opt/local/bin/g++-mp-4.7
++CXX=g++
+ EXEC=kissreads_graph
+ #Loader.cpp 
+ CFLAGS=  -O3 -L../thirdparty/zlib/build -lz -DMINIA_IS_IN_PARENT_FOLDER
+@@ -52,10 +52,10 @@
+ all: $(EXEC)
+ 
+ kissreads_graph:  $(OBJ) KissReadsGraph.cpp
+-      $(CC) -o $@ $^ $(CFLAGS)  $(LDFLAGS)
++      $(CXX) -o $@ $^ $(CFLAGS)  $(LDFLAGS)
+ 
+ %.o: %.cpp %.h
+-      $(CC) -o $@ -c $< $(CFLAGS)
++      $(CXX) -o $@ -c $< $(CFLAGS)
+ 
+ 
+ 
diff --minimal -Nru mapsembler2-2.2.4+dfsg1/debian/patches/series 
mapsembler2-2.2.4+dfsg1/debian/patches/series
--- mapsembler2-2.2.4+dfsg1/debian/patches/series       2020-10-21 
22:58:31.000000000 +0200
+++ mapsembler2-2.2.4+dfsg1/debian/patches/series       2020-10-24 
07:02:52.000000000 +0200
@@ -8,3 +8,4 @@
 no_std_hash_redefinition.patch
 gcc10.patch
 check_memory.patch
+cross.patch
diff --minimal -Nru mapsembler2-2.2.4+dfsg1/debian/rules 
mapsembler2-2.2.4+dfsg1/debian/rules
--- mapsembler2-2.2.4+dfsg1/debian/rules        2020-10-21 22:58:31.000000000 
+0200
+++ mapsembler2-2.2.4+dfsg1/debian/rules        2020-10-24 07:02:52.000000000 
+0200
@@ -23,12 +23,11 @@
        dh $@
 
 override_dh_auto_build:
-       mkdir mapsembler2_extremities/build
-       cd mapsembler2_extremities/build && cmake .. && make VERBOSE=true
-       cd mapsembler2_extend && make k=29
-       cd kissreads_graph && make k=29
-       cd kissreads && make k=29
-
+       dh_auto_configure --sourcedirectory=mapsembler2_extremities 
--builddirectory=mapsembler2_extremities/build
+       dh_auto_build --sourcedirectory=mapsembler2_extremities 
--builddirectory=mapsembler2_extremities/build
+       dh_auto_build --sourcedirectory=mapsembler2_extend -- k=29
+       dh_auto_build --sourcedirectory=kissreads_graph -- k=29
+       dh_auto_build --sourcedirectory=kissreads -- k=29
 
 override_dh_clean:
        rm -rf mapsembler2_extremities/build

Reply via email to