Source: libidn2-0
Version: 0.16-1
Tags: patch
User: helm...@debian.org
Usertags: rebootstrap

cross building libidn2-0 is required for bootstrapping new architectures
as curl added it to its Build-Depends a while ago. Unfortunately, cross
building libidn2-0 currently fails. The immediate reason is failure to
execute gentr46map during build. It is not installed into any package
and should thus be compiled with the build architecture compiler, but
the build system opts for the host architecture compiler. After fixing
that, help2man fails running idn2. Fixing help2man calls doesn't have a
straight forward solution. One can choose among:
1. Stop using help2man and write proper documentation.
2. Skip rebuilding manual pages during cross builds.
3. Add a idn2:native <cross> to Build-Depends and run that.
4. Build libidn2-0 twice. Once native, then cross.
In the attached patch, I opted for option 2. Please consider applying
it.

Helmut
diff --minimal -Nru libidn2-0-0.16/debian/changelog 
libidn2-0-0.16/debian/changelog
--- libidn2-0-0.16/debian/changelog     2017-01-16 09:20:46.000000000 +0100
+++ libidn2-0-0.16/debian/changelog     2017-03-13 20:27:32.000000000 +0100
@@ -1,3 +1,13 @@
+libidn2-0 (0.16-1.1) UNRELEASED; urgency=medium
+
+  * Non-maintainer upload.
+  * Fix FTCBFS: cross.patch (Closes: #-1)
+    + Use CC_FOR_BUILD (and thus AX_CC_FOR_BUILD from autoconf-archive) to
+      build gentr46map, which thus requires libunistring-dev:native.
+    + Skip the help2man step and use the pre-build manual page during cross.
+
+ -- Helmut Grohne <hel...@subdivi.de>  Mon, 13 Mar 2017 20:27:32 +0100
+
 libidn2-0 (0.16-1) unstable; urgency=low
 
   * New upstream release.
diff --minimal -Nru libidn2-0-0.16/debian/control libidn2-0-0.16/debian/control
--- libidn2-0-0.16/debian/control       2016-12-30 08:01:16.000000000 +0100
+++ libidn2-0-0.16/debian/control       2017-03-13 20:27:32.000000000 +0100
@@ -2,7 +2,7 @@
 Section: libs
 Maintainer: Debian Libidn team <help-lib...@gnu.org>
 Uploaders: Simon Josefsson <si...@josefsson.org>
-Build-Depends: debhelper (>= 9), dh-autoreconf, pkg-config, texinfo, texlive, 
help2man, gengetopt, libunistring-dev
+Build-Depends: debhelper (>= 9), dh-autoreconf, pkg-config, texinfo, texlive, 
help2man, gengetopt, libunistring-dev, libunistring-dev:native, autoconf-archive
 Standards-Version: 3.9.8
 Priority: extra
 Homepage: https://www.gnu.org/software/libidn/#libidn2
diff --minimal -Nru libidn2-0-0.16/debian/patches/cross.patch 
libidn2-0-0.16/debian/patches/cross.patch
--- libidn2-0-0.16/debian/patches/cross.patch   1970-01-01 01:00:00.000000000 
+0100
+++ libidn2-0-0.16/debian/patches/cross.patch   2017-03-13 20:27:32.000000000 
+0100
@@ -0,0 +1,72 @@
+From: Helmut Grohne <hel...@subdivi.de>
+Subject: fix cross compilation
+
+ * Use the build architecture compiler fo building gentr46map as it is not
+   installed and executed during build.
+ * Use the prebuilt manual page idn2.1 during cross building, because running
+   help2man doesn't work.
+
+Index: libidn2-0-0.16/Makefile.am
+===================================================================
+--- libidn2-0-0.16.orig/Makefile.am
++++ libidn2-0-0.16/Makefile.am
+@@ -63,11 +63,11 @@
+       cat $(IDNA_TABLE) | $(srcdir)/gen-tables-from-iana.pl > $@.new
+       mv $@.new $@
+ 
+-noinst_PROGRAMS = gentr46map
+-gentr46map_LDADD = $(LTLIBUNISTRING)
++gentr46map$(BUILD_EXEEXT): gentr46map.c
++      $(CC_FOR_BUILD) $(AM_CPPFLAGS) $(CFLAGS_FOR_BUILD) -lunistring $< -o $@
+ 
+-tr46map_data.c: gentr46map.c gentr46map$(EXEEXT) $(TR46MAP) $(NFCQC)
+-      $(builddir)/gentr46map$(EXEEXT) > $@.new
++tr46map_data.c: gentr46map.c gentr46map$(BUILD_EXEEXT) $(TR46MAP) $(NFCQC)
++      $(builddir)/gentr46map$(BUILD_EXEEXT) > $@.new
+       mv $@.new $@
+ 
+ $(IDNA_TABLE):
+Index: libidn2-0-0.16/configure.ac
+===================================================================
+--- libidn2-0-0.16.orig/configure.ac
++++ libidn2-0-0.16/configure.ac
+@@ -31,6 +31,8 @@
+ AC_CANONICAL_HOST
+ 
+ AC_PROG_CC
++AM_CONDITIONAL(cross_compiling,[test "$cross_compiling" = yes])
++AX_PROG_CC_FOR_BUILD
+ gl_EARLY
+ m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
+ LT_INIT([win32-dll])
+Index: libidn2-0-0.16/gentr46map.c
+===================================================================
+--- libidn2-0-0.16.orig/gentr46map.c
++++ libidn2-0-0.16/gentr46map.c
+@@ -26,8 +26,6 @@
+    not, see <http://www.gnu.org/licenses/>.
+ */
+ 
+-#include <config.h>
+-
+ #include <stdio.h>
+ #include <string.h>
+ #include <stdlib.h>
+Index: libidn2-0-0.16/doc/Makefile.am
+===================================================================
+--- libidn2-0-0.16.orig/doc/Makefile.am
++++ libidn2-0-0.16/doc/Makefile.am
+@@ -34,11 +34,13 @@
+ dist_man_MANS = idn2.1 $(gdoc_MANS)
+ CLEANFILES = $(dist_man_MANS) lookup.c register.c stamp-vti version.texi 
$(srcdir)/libidn2.info
+ 
++if !cross_compiling
+ idn2.1: $(top_srcdir)/src/idn2.c $(top_srcdir)/src/idn2.ggo 
$(top_srcdir)/configure.ac
+       $(HELP2MAN) \
+               --name="Libidn2 Internationalized Domain Names (IDNA2008/TR46) 
conversion" \
+               --output=$@ \
+               $(top_builddir)/src/idn2$(EXEEXT)
++endif
+ 
+ # GDOC
+ 
diff --minimal -Nru libidn2-0-0.16/debian/patches/series 
libidn2-0-0.16/debian/patches/series
--- libidn2-0-0.16/debian/patches/series        1970-01-01 01:00:00.000000000 
+0100
+++ libidn2-0-0.16/debian/patches/series        2017-03-13 20:24:19.000000000 
+0100
@@ -0,0 +1 @@
+cross.patch

Reply via email to