Source: alpine
Version: 2.20+dfsg1-7
Tags: patch
User: helm...@debian.org
Usertags: rebootstrap

alpine fails to cross build from source. Figuring why is a long road.
Here are the major road marks:
 * ./configure fails figuring out whether openssl is recent enough.
   After converting the check from AC_RUN_IFELSE to AC_TRY_COMPILE,
   configure succeeds.
 * When running make, the imap subdirectory somehow misses the compiler
   set up by ./configure and uses "cc" instead. Thus it fails finding
   openssl, which is only available for the host architecture. After
   passing cross compilers to make explicitly, the build proceeds.
 * It fails running help_c_gen and help_h_gen. These tools are not
   installed into the package, but only used for building. Thus they
   should be compiled with CC_FOR_BUILD rather than CC.

Finally, alpine cross builds. Please consider applying the attached
patch.

Helmut
diff --minimal -Nru alpine-2.20+dfsg1/debian/changelog 
alpine-2.20+dfsg1/debian/changelog
--- alpine-2.20+dfsg1/debian/changelog  2016-12-20 09:23:45.000000000 +0100
+++ alpine-2.20+dfsg1/debian/changelog  2017-09-19 08:45:06.000000000 +0200
@@ -1,3 +1,12 @@
+alpine (2.20+dfsg1-7.1) UNRELEASED; urgency=medium
+
+  * Non-maintainer upload.
+  * Fix FTCBFS: (Closes: #-1)
+    + Add 95_cross.patch
+    + Force cross compilers on make as they are not propagated.
+
+ -- Helmut Grohne <hel...@subdivi.de>  Tue, 19 Sep 2017 08:45:06 +0200
+
 alpine (2.20+dfsg1-7) unstable; urgency=medium
 
   * Make the build reproducible. Thanks Chris Lamb. (Closes: #791923)
diff --minimal -Nru alpine-2.20+dfsg1/debian/control 
alpine-2.20+dfsg1/debian/control
--- alpine-2.20+dfsg1/debian/control    2016-12-20 09:18:16.000000000 +0100
+++ alpine-2.20+dfsg1/debian/control    2017-09-19 08:45:06.000000000 +0200
@@ -6,7 +6,7 @@
  Unit 193 <unit...@ubuntu.com>
 Build-Depends: debhelper (>= 9), libldap2-dev, libpam0g-dev, libncurses-dev,
  libssl1.0-dev | libssl-dev (<< 1.1), dh-autoreconf, ca-certificates, 
automake, autoconf, libtool, libkrb5-dev,
- aspell, dpkg-dev (>= 1.16.1~)
+ aspell, dpkg-dev (>= 1.16.1~), autoconf-archive
 Standards-Version: 3.9.6
 Vcs-Browser: http://anonscm.debian.org/cgit/collab-maint/alpine.git
 Vcs-Git: git://anonscm.debian.org/collab-maint/alpine.git
diff --minimal -Nru alpine-2.20+dfsg1/debian/patches/95_cross.patch 
alpine-2.20+dfsg1/debian/patches/95_cross.patch
--- alpine-2.20+dfsg1/debian/patches/95_cross.patch     1970-01-01 
01:00:00.000000000 +0100
+++ alpine-2.20+dfsg1/debian/patches/95_cross.patch     2017-09-19 
08:45:06.000000000 +0200
@@ -0,0 +1,70 @@
+From: Helmut Grohne <hel...@subdivi.de>
+Subject: make cross compilation work
+
+ * Use AC_TRY_COMPILE rather than AC_RUN_IFELSE for checking openssl.
+ * Use CC_FOR_BUILD to compile help_[ch]_gen.
+
+Index: alpine-2.20+dfsg1/configure.ac
+===================================================================
+--- alpine-2.20+dfsg1.orig/configure.ac
++++ alpine-2.20+dfsg1/configure.ac
+@@ -39,6 +39,7 @@
+ dnl CHECK PROGRAMS
+ 
+ AC_PROG_CC
++AX_PROG_CC_FOR_BUILD
+ AC_PROG_CC_STDC
+ AC_PROG_INSTALL
+ AC_PROG_MAKE_SET
+@@ -1353,22 +1354,18 @@
+ dnl Check Openssl/LibreSSL version first
+ if test "x$alpine_SSLTYPE" != "xnone" ; then
+   AC_MSG_CHECKING([Openssl library version >= 1.0.1c])
+-  AC_RUN_IFELSE(
+-      [AC_LANG_SOURCE([[
++  AC_TRY_COMPILE([
+ #include <stdio.h>
+ #include <stdlib.h>
+ #if HAVE_STDINT_H
+ #include <stdint.h>
+ #endif /* HAVE_STDINT_H */
+ #include <openssl/ssl.h>
+-int main(void) {
+-
+-      if (OPENSSL_VERSION_NUMBER >= 0x1000003f)
+-              exit(0);
+-
+-      exit(2);
+-}
+-      ]])],
++        ],[
++#if OPENSSL_VERSION_NUMBER < 0x1000003f
++#error too old
++#endif
++      ],
+       [ AC_MSG_RESULT(yes) ],
+       [ alpine_SSLTYPE="none" ])
+ 
+Index: alpine-2.20+dfsg1/pith/Makefile.am
+===================================================================
+--- alpine-2.20+dfsg1.orig/pith/Makefile.am
++++ alpine-2.20+dfsg1/pith/Makefile.am
+@@ -29,12 +29,12 @@
+       state.c status.c store.c stream.c string.c strlst.c takeaddr.c 
tempfile.c text.c \
+       thread.c adjtime.c url.c util.c helptext.c smkeys.c smime.c
+ 
+-help_c_gen$(EXEEXT): $(help_c_gen_OBJECTS) $(help_c_gen_DEPENDENCIES) 
+-      @rm -f help_c_gen$(EXEEXT)
+-      $(LINK) $(help_c_gen_OBJECTS) $(help_c_gen_LDADD)
+-help_h_gen$(EXEEXT): $(help_h_gen_OBJECTS) $(help_h_gen_DEPENDENCIES) 
+-      @rm -f help_h_gen$(EXEEXT)
+-      $(LINK) $(help_h_gen_OBJECTS) $(help_h_gen_LDADD)
++help_c_gen$(BUILD_EXEEXT): help_c_gen.c
++      @rm -f help_c_gen$(BUILD_EXEEXT)
++      $(CC_FOR_BUILD) help_c_gen.c -o help_c_gen$(BUILD_EXEEXT)
++help_h_gen$(BUILD_EXEEXT):
++      @rm -f help_h_gen$(BUILD_EXEEXT)
++      $(CC_FOR_BUILD) help_h_gen.c -o help_h_gen$(BUILD_EXEEXT)
+ 
+ helptext.c: help_c_gen pine.hlp
+       ./help_c_gen < pine.hlp > $@
diff --minimal -Nru alpine-2.20+dfsg1/debian/patches/series 
alpine-2.20+dfsg1/debian/patches/series
--- alpine-2.20+dfsg1/debian/patches/series     2016-12-20 09:23:01.000000000 
+0100
+++ alpine-2.20+dfsg1/debian/patches/series     2017-09-19 08:43:00.000000000 
+0200
@@ -5,3 +5,4 @@
 40_fix_browser_hardcoded_paths.patch
 80_remove_phone_home.patch
 90_reproducible_build.patch
+95_cross.patch
diff --minimal -Nru alpine-2.20+dfsg1/debian/rules 
alpine-2.20+dfsg1/debian/rules
--- alpine-2.20+dfsg1/debian/rules      2016-12-17 03:49:04.000000000 +0100
+++ alpine-2.20+dfsg1/debian/rules      2017-09-19 08:45:06.000000000 +0200
@@ -21,6 +21,10 @@
                             --with-krb5 \
                             --with-krb5-dir=/usr
 
+override_dh_auto_build:
+       # force cross compilers onto make as they are not propagated from 
configure
+       dh_auto_build --buildsystem=makefile
+
 override_dh_install:
        dh_install --list-missing
        # Rename pico to pico.alpine.

Reply via email to