[Pkg-mutt-maintainers] Bug#843351: mutt FTCBFS: compiles build tools with the host architecture compiler

Helmut Grohne helmut at subdivi.de
Sun Nov 6 08:31:42 UTC 2016


Source: mutt
Version: 1.7.1-2
Tags: patch
User: helmutg at debian.org
Usertags: rebootstrap

mutt fails to cross build from source, because it compiles build tools
such as makedoc or mutt_md5 using the host architecture compiler. Beyond
that, configure misdetect the permission for /var/mail causing
mutt_dotlock to be skipped.

Using the build architecture compiler for build tools is not entirely
trivial, because those tools include config.h. It generally contains
test results for the host architecture, which may be different for the
host architecture. Thus config.h must not be included when using the
build architecture compiler. This may be considered a regression for
native builds and thus unsuitable for upstream. I don't know a proper
fix here.

Still the attached patch makes cross builds work on Debian. Please
consider applying it.

Helmut
-------------- next part --------------
diff --minimal -Nru mutt-1.7.1/debian/changelog mutt-1.7.1/debian/changelog
--- mutt-1.7.1/debian/changelog	2016-10-16 21:17:38.000000000 +0200
+++ mutt-1.7.1/debian/changelog	2016-11-06 07:17:04.000000000 +0100
@@ -1,3 +1,12 @@
+mutt (1.7.1-2.1) UNRELEASED; urgency=medium
+
+  * Non-maintainer upload.
+  * Fix FTCBFS: (Closes: #-1)
+    + cross.patch: compile build tools with build arch compiler
+    + Tell configure about /var/mail permission
+
+ -- Helmut Grohne <helmut at subdivi.de>  Sun, 06 Nov 2016 06:40:43 +0100
+
 mutt (1.7.1-2) unstable; urgency=medium
 
   * Dropped neomutt-devel/837601-do-not-segfault-on-new-mails.patch which
diff --minimal -Nru mutt-1.7.1/debian/control mutt-1.7.1/debian/control
--- mutt-1.7.1/debian/control	2016-10-16 21:17:38.000000000 +0200
+++ mutt-1.7.1/debian/control	2016-11-06 06:47:22.000000000 +0100
@@ -7,6 +7,7 @@
  Christoph Berg <myon at debian.org>,
  Faidon Liambotis <paravoid at debian.org>
 Build-Depends: debhelper (>= 9), dh-autoreconf,
+ autoconf-archive,
  docbook-xml,
  docbook-xsl,
  gawk,
diff --minimal -Nru mutt-1.7.1/debian/patches/cross.patch mutt-1.7.1/debian/patches/cross.patch
--- mutt-1.7.1/debian/patches/cross.patch	1970-01-01 01:00:00.000000000 +0100
+++ mutt-1.7.1/debian/patches/cross.patch	2016-11-06 07:14:44.000000000 +0100
@@ -0,0 +1,157 @@
+Subject: compile build tools with _FOR_BUILD settings
+From: Helmut Grohne <helmut at subdivi.de>
+
+Index: mutt-1.7.1/configure.ac
+===================================================================
+--- mutt-1.7.1.orig/configure.ac
++++ mutt-1.7.1/configure.ac
+@@ -32,6 +32,7 @@
+ if test "$ac_cv_prog_cc_c99" = "no"; then
+   AC_ERROR([Compiler does not support C99. Aborting.])
+ fi
++AC_PROG_CC_FOR_BUILD
+ 
+ if test "$CC" = "gcc"; then
+   CFLAGS="$CFLAGS -fno-delete-null-pointer-checks"
+Index: mutt-1.7.1/doc/Makefile.am
+===================================================================
+--- mutt-1.7.1.orig/doc/Makefile.am
++++ mutt-1.7.1/doc/Makefile.am
+@@ -130,11 +130,14 @@
+ 
+ Muttrc: stamp-doc-rc
+ 
+-stamp-doc-rc: $(top_srcdir)/init.h makedoc$(EXEEXT) $(srcdir)/Muttrc.head
++makedoc$(BUILD_EXEEXT): makedoc.c makedoc-defs.h
++	$(CC_FOR_BUILD) $(CFLAGS_FOR_BUILD) $(CPPFLAGS_FOR_BUILD) $(LDFLAGS_FOR_BUILD) $< -o $@
++
++stamp-doc-rc: $(top_srcdir)/init.h makedoc$(BUILD_EXEEXT) $(srcdir)/Muttrc.head
+ 	-rm -f Muttrc stamp-doc-rc
+ 	sed -e 's,[@]docdir[@],$(docdir),' $(srcdir)/Muttrc.head > Muttrc
+ 	$(CPP) $(AM_CPPFLAGS) $(DEFS) $(CPPFLAGS) -D_MAKEDOC -C \
+-	  $(top_srcdir)/init.h | ./makedoc$(EXEEXT) -c >> Muttrc
++	  $(top_srcdir)/init.h | ./makedoc$(BUILD_EXEEXT) -c >> Muttrc
+ 	touch stamp-doc-rc
+ 
+ manual.html: $(srcdir)/html.xsl $(srcdir)/mutt.xsl stamp-doc-xml $(srcdir)/mutt.css
+@@ -189,8 +192,8 @@
+ 
+ update-doc: stamp-doc-xml stamp-doc-chunked stamp-doc-rc manual.txt manual.html
+ 
+-muttrc.man: makedoc$(EXEEXT) $(top_srcdir)/init.h muttrc.man.head muttrc.man.tail
+-	$(MAKEDOC_CPP) $(top_srcdir)/init.h | ./makedoc$(EXEEXT) -m | 	    \
++muttrc.man: makedoc$(BUILD_EXEEXT) $(top_srcdir)/init.h muttrc.man.head muttrc.man.tail
++	$(MAKEDOC_CPP) $(top_srcdir)/init.h | ./makedoc$(BUILD_EXEEXT) -m | 	    \
+ 		cat $(srcdir)/muttrc.man.head - $(srcdir)/muttrc.man.tail\
+ 		> muttrc.man
+ 
+@@ -210,12 +213,12 @@
+ smime_keys.1: $(srcdir)/smime_keys.man
+ 	$(EDIT) $(srcdir)/smime_keys.man > $@
+ 
+-stamp-doc-xml: makedoc$(EXEEXT) $(top_srcdir)/init.h \
++stamp-doc-xml: makedoc$(BUILD_EXEEXT) $(top_srcdir)/init.h \
+                manual.xml.head $(top_srcdir)/functions.h $(top_srcdir)/OPS* manual.xml.tail \
+                $(srcdir)/gen-map-doc
+ 	( date=`head -n 1 $(top_srcdir)/ChangeLog.neomutt | LC_ALL=C cut -b 1-10` && \
+ 	  sed -e "s/@VERSION\@/$(PACKAGE_VERSION) (1.7.1)/" $(srcdir)/manual.xml.head && \
+-	  $(MAKEDOC_CPP) $(top_srcdir)/init.h | ./makedoc$(EXEEXT) -s && \
++	  $(MAKEDOC_CPP) $(top_srcdir)/init.h | ./makedoc$(BUILD_EXEEXT) -s && \
+ 	  $(MAKEDOC_CPP) $(top_srcdir)/functions.h | \
+ 	    perl $(srcdir)/gen-map-doc $(srcdir)/manual.xml.tail $(top_srcdir)/OPS* \
+ 	) > manual.xml
+Index: mutt-1.7.1/doc/makedoc.c
+===================================================================
+--- mutt-1.7.1.orig/doc/makedoc.c
++++ mutt-1.7.1/doc/makedoc.c
+@@ -27,36 +27,16 @@
+  **
+  **/
+ 
+-#if HAVE_CONFIG_H
+-# include "config.h"
+-#endif
+-
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <string.h>
+ #include <ctype.h>
+-
+ #include <errno.h>
+-
+-#ifdef HAVE_UNISTD_H
+-# include <unistd.h>
+-#endif
+-
+-#ifdef HAVE_GETOPT_H
+-# include <getopt.h>
+-#endif
++#include <unistd.h>
++#include <getopt.h>
+ 
+ #include "makedoc-defs.h"
+ 
+-#ifndef HAVE_STRERROR
+-#ifndef STDC_HEADERS
+-extern int sys_nerr;
+-extern char *sys_errlist[];
+-#endif
+-
+-#define strerror(x) ((x) > 0 && (x) < sys_nerr) ? sys_errlist[(x)] : 0
+-#endif /* !HAVE_STRERROR */
+-
+ extern int optind;
+ 
+ #define BUFFSIZE 2048
+Index: mutt-1.7.1/Makefile.am
+===================================================================
+--- mutt-1.7.1.orig/Makefile.am
++++ mutt-1.7.1/Makefile.am
+@@ -101,14 +101,15 @@
+ pgpring_DEPENDENCIES = $(LIBOBJS) $(INTLDEPS)
+ 
+ mutt_md5_SOURCES = md5.c
+-mutt_md5_CFLAGS = -DMD5UTIL
+-mutt_md5_LDADD =
+ 
+ txt2c_SOURCES = txt2c.c
+ txt2c_LDADD =
+ 
+ noinst_PROGRAMS = $(MUTT_MD5) txt2c
+ 
++mutt_md5$(BUILD_EXEEXT): md5.c md5.h
++	$(CC_FOR_BUILD) $(CFLAGS_FOR_BUILD) $(CPPFLAGS_FOR_BUILD) -DMD5UTIL $(LDFLAGS_FOR_BUILD) $< -o $@
++
+ mutt_dotlock.c: dotlock.c
+ 	cp $(srcdir)/dotlock.c mutt_dotlock.c
+ 
+Index: mutt-1.7.1/md5.c
+===================================================================
+--- mutt-1.7.1.orig/md5.c
++++ mutt-1.7.1/md5.c
+@@ -20,10 +20,6 @@
+ 
+ /* Written by Ulrich Drepper <drepper at gnu.ai.mit.edu>, 1995.  */
+ 
+-#ifdef HAVE_CONFIG_H
+-# include <config.h>
+-#endif
+-
+ #include "md5.h"
+ 
+ #include <stddef.h>
+Index: mutt-1.7.1/md5.h
+===================================================================
+--- mutt-1.7.1.orig/md5.h
++++ mutt-1.7.1/md5.h
+@@ -28,9 +28,7 @@
+ #if HAVE_INTTYPES_H
+ # include <inttypes.h>
+ #endif
+-#if HAVE_STDINT_H || _LIBC
+-# include <stdint.h>
+-#endif
++#include <stdint.h>
+ #if HAVE_SYS_TYPES_H
+ # include <sys/types.h>
+ #endif
diff --minimal -Nru mutt-1.7.1/debian/patches/series mutt-1.7.1/debian/patches/series
--- mutt-1.7.1/debian/patches/series	2016-10-16 21:17:38.000000000 +0200
+++ mutt-1.7.1/debian/patches/series	2016-11-06 06:57:05.000000000 +0100
@@ -21,3 +21,4 @@
 upstream/749483-conststrings.patch
 upstream/644992-ipv6-literal.patch
 upstream/549204-clear-N-on-readonly-imap-folders.patch
+cross.patch
diff --minimal -Nru mutt-1.7.1/debian/rules mutt-1.7.1/debian/rules
--- mutt-1.7.1/debian/rules	2016-10-16 21:17:38.000000000 +0200
+++ mutt-1.7.1/debian/rules	2016-11-06 07:22:03.000000000 +0100
@@ -7,9 +7,15 @@
 %:
 	dh $@ --with autoreconf --builddirectory=debian/build
 
+# On Debian systems, we can assume that build arch permission matches host arch
+# permission.
+mailpath=/var/mail
+export mutt_cv_worldwrite=$(shell stat -c %A $(mailpath) | grep -q '^........w.' && echo yes || echo no)
+export mutt_cv_groupwrite=$(shell stat -c %A $(mailpath) | grep -q '^.....w....' && echo yes || echo no)
+
 override_dh_auto_configure:
 	dh_auto_configure -- \
-		--with-mailpath=/var/mail	\
+		--with-mailpath=$(mailpath)	\
 						\
 		--enable-compressed		\
 		--enable-debug			\


More information about the Pkg-mutt-maintainers mailing list