Source: netkit-tftp
Version: 0.17-20
Tags: patch
User: helm...@debian.org
Usertags: rebootstrap

netkit-tftp fails to cross build from source, because it builds for the
build architecture. Nothing tells ./configure to use a cross compiler. A
simple way of doing so is exporting a suitable CC. We can defer that
task to dpkg's buildtools.mk. Then it fails, because it tries running
compiled binaries, which generally fails with an Exec format error
during cross compilation. After patching ./configure to avoid running
binaries, netkit-tftp cross builds successfully. Please consider
applying the attached patch.

Helmut
diff --minimal -Nru netkit-tftp-0.17/debian/changelog 
netkit-tftp-0.17/debian/changelog
--- netkit-tftp-0.17/debian/changelog   2018-07-03 17:30:38.000000000 +0200
+++ netkit-tftp-0.17/debian/changelog   2018-07-04 06:39:53.000000000 +0200
@@ -1,3 +1,12 @@
+netkit-tftp (0.17-20.1) UNRELEASED; urgency=medium
+
+  * Non-maintainer upload.
+  * Fix FTCBFS: (Closes: #-1)
+    + Let dpkg's buildtools.mk export cross tools.
+    + cross.patch: Don't run compiled binaries.
+
+ -- Helmut Grohne <hel...@subdivi.de>  Wed, 04 Jul 2018 06:39:53 +0200
+
 netkit-tftp (0.17-20) unstable; urgency=medium
 
   * configure: Exit with appropiate return code so that
diff --minimal -Nru netkit-tftp-0.17/debian/patches/cross.patch 
netkit-tftp-0.17/debian/patches/cross.patch
--- netkit-tftp-0.17/debian/patches/cross.patch 1970-01-01 01:00:00.000000000 
+0100
+++ netkit-tftp-0.17/debian/patches/cross.patch 2018-07-04 06:39:53.000000000 
+0200
@@ -0,0 +1,26 @@
+--- netkit-tftp-0.17.orig/configure
++++ netkit-tftp-0.17/configure
+@@ -75,10 +75,7 @@
+ if [ x"$CC" = x ]; then
+     echo -n 'Looking for a C compiler... '
+     for TRY in egcs gcc g++ CC c++ cc; do
+-       (
+-           $TRY __conftest.c -o __conftest || exit 1;
+-           ./__conftest || exit 1;
+-       ) >/dev/null 2>&1 || continue;
++       $TRY __conftest.c -o __conftest >/dev/null 2>&1 || continue;
+        CC=$TRY
+        break;
+     done
+@@ -91,10 +88,7 @@
+     echo "$CC"
+ else
+     echo -n 'Checking if C compiler works... '
+-    if (
+-          $CC __conftest.c -o __conftest || exit 1
+-          ./__conftest || exit 1
+-       ) >/dev/null 2>&1; then
++    if $CC __conftest.c -o __conftest >/dev/null 2>&1; then
+          echo 'yes'
+      else
+          echo 'no'
diff --minimal -Nru netkit-tftp-0.17/debian/patches/series 
netkit-tftp-0.17/debian/patches/series
--- netkit-tftp-0.17/debian/patches/series      2018-07-03 17:29:51.000000000 
+0200
+++ netkit-tftp-0.17/debian/patches/series      2018-07-04 06:39:53.000000000 
+0200
@@ -3,3 +3,4 @@
 memory_corruption.patch
 manpage_warning.patch
 875885.patch
+cross.patch
diff --minimal -Nru netkit-tftp-0.17/debian/rules netkit-tftp-0.17/debian/rules
--- netkit-tftp-0.17/debian/rules       2018-07-03 13:01:36.000000000 +0200
+++ netkit-tftp-0.17/debian/rules       2018-07-04 06:39:32.000000000 +0200
@@ -11,6 +11,9 @@
 # This has to be exported to make some magic below work.
 export DH_OPTIONS
 
+DPKG_EXPORT_BUILDTOOLS=1
+-include /usr/share/dpkg/buildtools.mk
+
 build: build-stamp
 build-stamp:
        dh_testdir

Reply via email to