Source: unifont
Version: 1:10.0.06-1
Tags: patch
User: [email protected]
Usertags: rebootstrap

unifont fails to cross build from source, for a pile of reasons, all of
which are fixed in the attached patch. After applying it, unifont cross
builds successfully. Let me explain the issues and ask you to apply it:

 * override_dh_auto_build-arch explicitly runs $(MAKE) and does not pass
   any cross compilers. Thus it uses the build architecture compiler.
   Indirecting it through dh_auto_build fixes that (and allows using
   --parallel if you so wish).
 * Even then the upstream src/Makefile uses the build architecture strip
   by passing -s to install. It is best to just remove those -s flags as
   their presence also breaks -dbgsym generation and stripping (and
   honouring DEB_BUILD_OPTIONS=nostrip) is generally handled by
   dh_strip.
 * Further down the road it tries to run just built utilities and that
   fails as running host arch code does not work during cross
   compilation. Fortunately these steps are not necessary for building
   unifont-bin, so adding "bindir" to override_dh_auto_build-arch fixes
   this.
 * Then make install runs these targets again, so my slightly ugly
   solution here is to inline the relevant parts of make install into
   override_dh_auto_install-arch.

I hope this works for you. At least it makes the arch-only build
blazingly fast.

Helmut
diff --minimal -Nru unifont-10.0.06/debian/changelog 
unifont-10.0.06/debian/changelog
--- unifont-10.0.06/debian/changelog    2017-08-27 00:19:15.000000000 +0200
+++ unifont-10.0.06/debian/changelog    2016-12-04 05:50:42.000000000 +0100
@@ -1,3 +1,14 @@
+unifont (1:10.0.06-1.1) UNRELEASED; urgency=medium
+
+  * Non-maintainer upload.
+  * Fix FTCBFS: (Closes: #-1)
+    + Let dh_auto_build pass cross compilers to make
+    + debian/patches/nostrip.patch: Do not strip during build
+    + Only build "bindir" during arch-only build.
+    + Add override_dh_auto_install-arch to only install arch:any components.
+
+ -- Helmut Grohne <[email protected]>  Sun, 04 Dec 2016 05:50:42 +0100
+
 unifont (1:10.0.06-1) unstable; urgency=medium
 
   * Update to Unifont 10.0.06 release.
diff --minimal -Nru unifont-10.0.06/debian/patches/nostrip.patch 
unifont-10.0.06/debian/patches/nostrip.patch
--- unifont-10.0.06/debian/patches/nostrip.patch        1970-01-01 
01:00:00.000000000 +0100
+++ unifont-10.0.06/debian/patches/nostrip.patch        2016-12-04 
05:50:42.000000000 +0100
@@ -0,0 +1,30 @@
+From: Helmut Grohne <[email protected]>
+Subject: to not strip binaries during build
+
+ * install -s uses the build architecture strip and thus breaks cross
+   compilation.
+ * stripping during build means that dh_strip will be unable to generate useful
+   -dbgsym packages.
+
+Index: unifont-9.0.04/src/Makefile
+===================================================================
+--- unifont-9.0.04.orig/src/Makefile
++++ unifont-9.0.04/src/Makefile
+@@ -41,7 +41,7 @@
+ bin-stamp: $(CPROGS) $(PPROGS) $(PNGPROGS)
+       install    -m0755 -d $(LOCALBINDIR)
+ #     install    -m0755 $? $(LOCALBINDIR)
+-      install -s -m0755 $(CPROGS) $(LOCALBINDIR)
++      install    -m0755 $(CPROGS) $(LOCALBINDIR)
+       install    -m0755 $(PPROGS) $(LOCALBINDIR)
+       \rm -f $(CPROGS)
+       touch $@
+@@ -56,7 +56,7 @@
+       install -m0755 -d $(INSTALLDIR)
+       set -e && \
+          cd $(LOCALBINDIR) && \
+-         install -s -m0755 $(CPROGS) $(INSTALLDIR)
++         install    -m0755 $(CPROGS) $(INSTALLDIR)
+       set -e && \
+          cd ../bin && \
+          install    -m0755 $(PPROGS) $(INSTALLDIR)
diff --minimal -Nru unifont-10.0.06/debian/patches/series 
unifont-10.0.06/debian/patches/series
--- unifont-10.0.06/debian/patches/series       1970-01-01 01:00:00.000000000 
+0100
+++ unifont-10.0.06/debian/patches/series       2016-12-04 05:50:42.000000000 
+0100
@@ -0,0 +1 @@
+nostrip.patch
diff --minimal -Nru unifont-10.0.06/debian/rules unifont-10.0.06/debian/rules
--- unifont-10.0.06/debian/rules        2017-07-05 01:52:34.000000000 +0200
+++ unifont-10.0.06/debian/rules        2016-12-04 05:50:42.000000000 +0100
@@ -30,5 +30,9 @@
        $(MAKE) BUILDFONT=1 PUA=""
 
 override_dh_auto_build-arch:
-       $(MAKE) CFLAGS='$(CFLAGS)' CPPFLAGS='$(CPPFLAGS)' \
-          LDFLAGS='$(LDFLAGS)'
+       dh_auto_build -- CFLAGS='$(CFLAGS)' CPPFLAGS='$(CPPFLAGS)' \
+          LDFLAGS='$(LDFLAGS)' bindir
+
+override_dh_auto_install-arch:
+       dh_auto_install --builddirectory=src -- PREFIX='$$(DESTDIR)/usr'
+       dh_auto_install --builddirectory=man -- PREFIX='$$(DESTDIR)/usr'

Reply via email to