Source: bonnie++
Version: 1.97.3
Tags: patch
User: helm...@debian.org
Usertags: rebootstrap

bonnie++ fails to cross build from source for many reasons. Let me
explain those reasons and how to fix them. All fixes can be found in the
attached patch, which I kindly ask to be applied.

 * It doesn't pass --host to configure and thus configures for the build
   architecture. The simple solution is to let dh_auto_configure pass
   that flag.
 * ./configure has an AC_TRY_RUN check and that obviously fails. Closer
   inspection reveals that either compilation fails or the test
   succeeds: When _LARGEFILE64_SOURCE is not available, off64_t and
   friends isn't either. Converting it to AC_TRY_COMPILE fixes cross
   compilation.
 * That wasn't very effectful, because ./configure is not built from
   source. Adding dh-autoreconf to the loop.
 * Finally, bonnie++ defaults to pass -s to install and uses the build
   architecture strip, which fails. It is best to defer stripping to
   dh_strip to get meaningful -dbgsym packages, thus passing
   --disable-stripping to ./configure.

After fixing all of this, bonnie++ cross builds successfully.

Helmut
diff --minimal -Nru bonnie++-1.97.3/configure.in 
bonnie++-1.97.3+nmu1/configure.in
--- bonnie++-1.97.3/configure.in        2011-01-18 22:35:28.000000000 +0100
+++ bonnie++-1.97.3+nmu1/configure.in   2017-01-13 19:54:53.000000000 +0100
@@ -83,7 +83,7 @@
   , thread_ldflags="-pthread")
 
 AC_SUBST(large_file)
-AC_TRY_RUN([#ifndef _LARGEFILE64_SOURCE
+AC_TRY_COMPILE([#ifndef _LARGEFILE64_SOURCE
 #define _LARGEFILE64_SOURCE
 #endif
 #include <stdio.h>
@@ -92,8 +92,7 @@
 #include <fcntl.h>
 #include <unistd.h>
 #include <stdlib.h>
-
-int main () {
+],[
   int fd;
   off64_t i = off64_t(1) << 32 + 1;
   const char * const name = "test.2g";
@@ -118,7 +117,7 @@
   }
   close(fd);
   return 0;
-}], large_file="yes")
+], large_file="yes")
 if [[ -n "$large_file" ]]; then
    large_file="#define _LARGEFILE64_SOURCE"
 fi
diff --minimal -Nru bonnie++-1.97.3/debian/changelog 
bonnie++-1.97.3+nmu1/debian/changelog
--- bonnie++-1.97.3/debian/changelog    2016-12-13 03:37:51.000000000 +0100
+++ bonnie++-1.97.3+nmu1/debian/changelog       2017-01-13 19:54:53.000000000 
+0100
@@ -1,3 +1,14 @@
+bonnie++ (1.97.3+nmu1) UNRELEASED; urgency=medium
+
+  * Non-maintainer upload.
+  * Fix FTCBFS: (Closes: #-1)
+    + Let dh_auto_configure pass cross compilers.
+    + Turn AC_TRY_RUN into AC_TRY_COMPILE: Compiling will fail when
+      off64_t is unavailable.
+    + autoreconf to make the previous change effectful.
+    + Pass --disable-stripping to configure.
+
+ -- Helmut Grohne <hel...@subdivi.de>  Fri, 13 Jan 2017 19:54:53 +0100
+
 bonnie++ (1.97.3) unstable; urgency=medium
 
   * In bonnie++.8 documented -c option. Closes: #639452 #631484
diff --minimal -Nru bonnie++-1.97.3/debian/control 
bonnie++-1.97.3+nmu1/debian/control
--- bonnie++-1.97.3/debian/control      2016-06-30 11:28:22.000000000 +0200
+++ bonnie++-1.97.3+nmu1/debian/control 2017-01-13 19:54:53.000000000 +0100
@@ -3,7 +3,7 @@
 Priority: optional
 Maintainer: Russell Coker <russ...@coker.com.au>
 Standards-Version: 3.5.6
-Build-Depends: debhelper (>= 9)
+Build-Depends: debhelper (>= 9), dh-autoreconf
 XS-Testsuite: autopkgtest
 
 Package: bonnie++
diff --minimal -Nru bonnie++-1.97.3/debian/rules 
bonnie++-1.97.3+nmu1/debian/rules
--- bonnie++-1.97.3/debian/rules        2016-06-30 11:29:32.000000000 +0200
+++ bonnie++-1.97.3+nmu1/debian/rules   2017-01-13 19:54:53.000000000 +0100
@@ -11,7 +11,8 @@
 
        
        # Add here commands to compile the package.
-       ./configure --prefix=`pwd`/debian/bonnie++/usr 
--mandir=`pwd`/debian/bonnie++/usr/share/man
+       dh_autoreconf
+       dh_auto_configure -- --prefix=`pwd`/debian/bonnie++/usr 
--mandir=`pwd`/debian/bonnie++/usr/share/man --disable-stripping
        $(MAKE)
 
        touch build-stamp
@@ -24,7 +25,7 @@
        # Add here commands to clean up after the build process.
        -$(MAKE) clean
        rm -f config.*
-
+       dh_autoreconf_clean
        dh_clean
 
 install: build

Reply via email to