Source: cbonsai
Version: 0.0~git20210208.41fdd6e-1
Tags: patch
User: debian-cr...@lists.debian.org
Usertags: ftcbfs

cbonsai fails to cross build from source. The immediate failure is
failing to locate the .pc file for ncurses using the build architecture
pkg-config. dh_auto_build already passes a suitable PKG_CONFIG, so the
Makefile should simply use that. Beyond this, use of help2man breaks
cross building. In this case, the package can simply be built twice.
Please consider applying the attached patch.

Helmut
diff --minimal -Nru cbonsai-0.0~git20210208.41fdd6e/debian/changelog 
cbonsai-0.0~git20210208.41fdd6e/debian/changelog
--- cbonsai-0.0~git20210208.41fdd6e/debian/changelog    2021-02-08 
16:44:14.000000000 +0100
+++ cbonsai-0.0~git20210208.41fdd6e/debian/changelog    2021-03-09 
21:33:56.000000000 +0100
@@ -1,3 +1,12 @@
+cbonsai (0.0~git20210208.41fdd6e-1.1) UNRELEASED; urgency=medium
+
+  * Non-maintainer upload.
+  * Fix FTCBFS: (Closes: #-1)
+    + cross.patch: make pkg-config substitutable.
+    + Build twice. Once for help2man and once for real.
+
+ -- Helmut Grohne <hel...@subdivi.de>  Tue, 09 Mar 2021 21:33:56 +0100
+
 cbonsai (0.0~git20210208.41fdd6e-1) unstable; urgency=medium
 
   * Initial release (Closes: #981965)
diff --minimal -Nru cbonsai-0.0~git20210208.41fdd6e/debian/control 
cbonsai-0.0~git20210208.41fdd6e/debian/control
--- cbonsai-0.0~git20210208.41fdd6e/debian/control      2021-02-05 
14:58:55.000000000 +0100
+++ cbonsai-0.0~git20210208.41fdd6e/debian/control      2021-03-09 
21:33:56.000000000 +0100
@@ -6,6 +6,7 @@
  debhelper-compat (= 13),
  help2man,
  libncurses-dev,
+ libncurses-dev:native,
  pkg-config,
 Standards-Version: 4.5.1
 Homepage: https://gitlab.com/jallbrit/cbonsai
diff --minimal -Nru cbonsai-0.0~git20210208.41fdd6e/debian/patches/cross.patch 
cbonsai-0.0~git20210208.41fdd6e/debian/patches/cross.patch
--- cbonsai-0.0~git20210208.41fdd6e/debian/patches/cross.patch  1970-01-01 
01:00:00.000000000 +0100
+++ cbonsai-0.0~git20210208.41fdd6e/debian/patches/cross.patch  2021-03-09 
21:33:56.000000000 +0100
@@ -0,0 +1,12 @@
+--- cbonsai-0.0~git20210208.41fdd6e.orig/Makefile
++++ cbonsai-0.0~git20210208.41fdd6e/Makefile
+@@ -1,7 +1,8 @@
+ .POSIX:
+ CC    = cc
+ CFLAGS        = -Wall -pedantic
+-LDLIBS        = $(shell pkg-config --libs ncurses panel)
++PKG_CONFIG ?= pkg-config
++LDLIBS        = $(shell $(PKG_CONFIG) --libs ncurses panel)
+ PREFIX        = /usr/local
+ 
+ cbonsai: cbonsai.c
diff --minimal -Nru cbonsai-0.0~git20210208.41fdd6e/debian/patches/series 
cbonsai-0.0~git20210208.41fdd6e/debian/patches/series
--- cbonsai-0.0~git20210208.41fdd6e/debian/patches/series       1970-01-01 
01:00:00.000000000 +0100
+++ cbonsai-0.0~git20210208.41fdd6e/debian/patches/series       2021-03-09 
21:33:43.000000000 +0100
@@ -0,0 +1 @@
+cross.patch
diff --minimal -Nru cbonsai-0.0~git20210208.41fdd6e/debian/rules 
cbonsai-0.0~git20210208.41fdd6e/debian/rules
--- cbonsai-0.0~git20210208.41fdd6e/debian/rules        2021-02-05 
15:07:15.000000000 +0100
+++ cbonsai-0.0~git20210208.41fdd6e/debian/rules        2021-03-09 
21:33:56.000000000 +0100
@@ -1,5 +1,7 @@
 #!/usr/bin/make -f
 
+include /usr/share/dpkg/architecture.mk
+
 export DEB_BUILD_MAINT_OPTIONS = hardening=+all
 export DEB_CFLAGS_MAINT_APPEND = -Wall -pedantic
 export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed
@@ -8,11 +10,15 @@
        dh $@
 
 override_dh_auto_build:
-       dh_auto_build -- CFLAGS="$(CFLAGS)"
+       dpkg-architecture -a$(DEB_BUILD_ARCH) -f -c dh_auto_build -- 
CFLAGS="$(CFLAGS)"
 
 execute_after_dh_auto_build:
        help2man --no-info --name 'random bonsai tree generator' \
                --version-string $(shell dpkg-parsechangelog -S version) \
                --section 6 --output cbonsai.6 ./cbonsai
+ifneq ($(DEB_BUILD_ARCH),$(DEB_HOST_ARCH))
+       dh_auto_clean
+       dh_auto_build -- CFLAGS="$(CFLAGS)"
+endif
 
 override_dh_auto_install:

Reply via email to