Source: bible-kjv
Version: 4.30
Tags: patch
User: debian-cr...@lists.debian.org
Usertags: ftcbfs

bible-kjv fails to cross build from source, because it builds for the
build architecture. Getting it to cross build properly is not entirely
trivial:
 * A simple way to cross build makefile based packages is using
   dh_auto_build.
 * However dh_auto_build does not pass LD (as that variable doesn't have
   a uniform meaning). It should be $(CC) here for example and needs to
   be passed explicitly.
 * Then bible-kjv has a number of build tools that need to be built for
   the build architecture. In this case, we can split the build into two
   parts: One for the build architecture and another for the host
   architecture.
 * The randverse build hard codes the build architecture compiler. We
   can see the compiler variable from dpkg's buildtools.mk.
 * bible-kjv is stripped using install -s and thus uses the wrong strip.
   The easiest solution here is dh_strip.

Please consider applying the attached patch. Also consider converting
the package to a dh based packaging style. Doing so simplifies a lot of
things.

Helmut
diff --minimal -Nru bible-kjv-4.30/debian/changelog 
bible-kjv-4.30+nmu1/debian/changelog
--- bible-kjv-4.30/debian/changelog     2018-05-12 11:03:54.000000000 +0200
+++ bible-kjv-4.30+nmu1/debian/changelog        2019-12-28 16:18:02.000000000 
+0100
@@ -1,3 +1,15 @@
+bible-kjv (4.30+nmu1) UNRELEASED; urgency=medium
+
+  * Non-maintainer upload.
+  * Fix FTCBFS: (Closes: #-1)
+    + Let dh_auto_build pass cross tools to make.
+    + Additionally override LD.
+    + Keep building the build tools for the build architecture.
+    + Seed the compiler used for randverse from dpkg's buildtools.mk.
+    + Use dh_strip as it uses the correct cross tool.
+
+ -- Helmut Grohne <hel...@subdivi.de>  Sat, 28 Dec 2019 16:18:02 +0100
+
 bible-kjv (4.30) unstable; urgency=medium
 
   * Fix string overflow bug found by gcc-8 (Closes: #897712)
diff --minimal -Nru bible-kjv-4.30/debian/control 
bible-kjv-4.30+nmu1/debian/control
--- bible-kjv-4.30/debian/control       2018-05-12 11:03:54.000000000 +0200
+++ bible-kjv-4.30+nmu1/debian/control  2019-12-28 16:18:02.000000000 +0100
@@ -2,7 +2,7 @@
 Section: doc
 Priority: optional
 Maintainer: Matthew Vernon <matt...@debian.org>
-Build-Depends: libreadline-dev
+Build-Depends: libreadline-dev, debhelper-compat (= 9)
 Standards-Version: 3.5.6
 
 Package: bible-kjv
diff --minimal -Nru bible-kjv-4.30/debian/rules bible-kjv-4.30+nmu1/debian/rules
--- bible-kjv-4.30/debian/rules 2018-05-12 11:03:54.000000000 +0200
+++ bible-kjv-4.30+nmu1/debian/rules    2019-12-28 16:18:02.000000000 +0100
@@ -13,12 +13,17 @@
 # dpkg-buildpackage in a package-independent way, and so these targets
 # are obsolete.
 
+include /usr/share/dpkg/architecture.mk
+-include /usr/share/dpkg/buildtools.mk
+
 package=bible-kjv
 
 build:
        $(checkdir)
-       $(MAKE) all
-       cd debian && gcc -g -O2 -o randverse randverse.c
+       dpkg-architecture -a$(DEB_BUILD_ARCH) -f -c dh_auto_build -- 
bible-index.c bible.data bible.data.conc 'LD=$$(CC)'
+       rm -f *.o
+       dh_auto_build -- bible 'LD=$$(CC)'
+       cd debian && $(CC) -g -O2 -o randverse randverse.c
        touch build
 
 build-arch: build
@@ -65,19 +70,10 @@
        install -d debian/tmp/usr/share/man/man1
        install -d debian/tmp/usr/bin debian/tmp/usr/lib
        make install DEST=debian/tmp/usr
-       #Is nostrip set in DEB_BUILD_OPTIONS?
-       case "$$DEB_BUILD_OPTIONS" in \
-       *nostrip*)\
-       install -m 755 debian/randverse debian/tmp/usr/bin && \
-       install -m 755 bible debian/tmp/usr/bin && \
-       install -m 644 debian/randverse.1 debian/tmp/usr/share/man/man1 \
-       ;; \
-       *) \
-       install -s -m 755 debian/randverse debian/tmp/usr/bin && \
-       install -s -m 755 bible debian/tmp/usr/bin && \
-       install -m 644 debian/randverse.1 debian/tmp/usr/share/man/man1 \
-       ;; \
-       esac
+       install -m 755 debian/randverse debian/tmp/usr/bin
+       install -m 755 bible debian/tmp/usr/bin
+       install -m 644 debian/randverse.1 debian/tmp/usr/share/man/man1
+       dh_strip -p$(package) --tmpdir=debian/tmp
        cp debian/notes debian/copyright debian/tmp/usr/share/doc/$(package)/.
        cp debian/changelog debian/tmp/usr/share/doc/$(package)/changelog
        cp README* debian/README* debian/tmp/usr/share/doc/$(package)

Reply via email to