Source: libjpeg
Version: 0.0~git20190821.87636f3b26b4-1
Tags: patch
User: [email protected]
Usertags: ftcbfs

libjpeg fails to cross build from source, because it configures for the
build architecture. Unconventionally, ./configure is invoked by the
Makefile during dh_auto_build. This happens, because the Makefile also
performs autoconf and thus debhelper uses the makefile buildsystem due
to the absence of configure. Enabling autoreconf makes debhelper select
the autoconf buildsystem and run ./configure with --host. However,
configuration fails due to frequent use of AC_TRY_RUN. The attached
patch adds autoreconf and fixes a lot of AC_TRY_RUN, but not all. It is
an incremental improvement and does not make libjpeg cross buildable.
Please consider applying it anyway and close this bug when doing so.

Helmut
diff --minimal -Nru libjpeg-0.0~git20190821.87636f3b26b4/debian/changelog 
libjpeg-0.0~git20190821.87636f3b26b4/debian/changelog
--- libjpeg-0.0~git20190821.87636f3b26b4/debian/changelog
+++ libjpeg-0.0~git20190821.87636f3b26b4/debian/changelog
@@ -1,3 +1,12 @@
+libjpeg (0.0~git20190821.87636f3b26b4-1.1) UNRELEASED; urgency=medium
+
+  * Non-maintainer upload.
+  * Improve cross building: (Closes: #-1)
+    + Let debhelper perform configuration with --host.
+    + cross.patch: Replace a lot of AC_TRY_RUN.
+
+ -- Helmut Grohne <[email protected]>  Tue, 21 Dec 2019 09:52:48 +0100
+
 libjpeg (0.0~git20190821.87636f3b26b4-1) unstable; urgency=medium
 
   * d/watch: Add missing watch file
diff --minimal -Nru libjpeg-0.0~git20190821.87636f3b26b4/debian/control 
libjpeg-0.0~git20190821.87636f3b26b4/debian/control
--- libjpeg-0.0~git20190821.87636f3b26b4/debian/control
+++ libjpeg-0.0~git20190821.87636f3b26b4/debian/control
@@ -3,7 +3,7 @@
 Priority: optional
 Maintainer: Debian PhotoTools Maintainers 
<[email protected]>
 Uploaders: Mathieu Malaterre <[email protected]>
-Build-Depends: autotools-dev, debhelper (>= 9.20160114), help2man
+Build-Depends: autotools-dev, debhelper (>= 9.20160114), help2man, 
dh-autoreconf
 Standards-Version: 4.4.1
 Homepage: https://github.com/thorfdbg/libjpeg
 Vcs-Git: https://salsa.debian.org/debian-phototools-team/libjpeg.git
diff --minimal -Nru 
libjpeg-0.0~git20190821.87636f3b26b4/debian/patches/cross.patch 
libjpeg-0.0~git20190821.87636f3b26b4/debian/patches/cross.patch
--- libjpeg-0.0~git20190821.87636f3b26b4/debian/patches/cross.patch
+++ libjpeg-0.0~git20190821.87636f3b26b4/debian/patches/cross.patch
@@ -0,0 +1,82 @@
+--- libjpeg-0.0~git20190821.87636f3b26b4.orig/configure.in
++++ libjpeg-0.0~git20190821.87636f3b26b4/configure.in
+@@ -318,7 +318,7 @@
+ AC_LANG(C++)
+ # The first test checks whether a signal handler takes an "int" as argument.
+ AC_MSG_CHECKING([whether argument type for signal handlers is "int"])
+-AC_TRY_RUN([
++AC_LINK_IFELSE([
+ extern "C" {
+ #include<signal.h>
+ }
+@@ -334,7 +334,7 @@
+ #
+ # Ditto for ... instead
+ AC_MSG_CHECKING([whether argument type for signal handlers is "..."])
+-AC_TRY_RUN([
++AC_LINK_IFELSE([
+ extern "C" {
+ #include<signal.h>
+ }
+@@ -365,7 +365,7 @@
+ # Check whether integers work as template arguments. This is required
+ # for several classes, but not all compilers accept it.
+ AC_MSG_CHECKING([whether integer constants are valid template arguments])
+-AC_TRY_RUN([
++AC_LINK_IFELSE([
+ template<int a>
+ struct A {
+  int b;
+@@ -512,7 +512,7 @@
+ # Check whether templated subclasses used in subclasses require explicitly 
the name space
+ # of the parent class to work. This should not happen, but gcc 2.95 has a bug 
here.
+ AC_MSG_CHECKING([whether templates are in local namespace])
+-AC_TRY_RUN([
++AC_LINK_IFELSE([
+ class A {
+  template<int a>
+  class B {
+@@ -532,7 +532,7 @@
+ # Check whether static const integral initializers work
+ # Some compilers don't support them properly, but gcc does.
+ AC_MSG_CHECKING([whether initializers of static const integral members work])
+-AC_TRY_RUN([
++AC_LINK_IFELSE([
+ class A {
+  static const int a=0;
+ };
+@@ -544,7 +544,7 @@
+ # Check whether casting works in template arguments. This doesn't seem to 
apply for 
+ # all compiles, so be a bit careful.
+ AC_MSG_CHECKING([whether casting works in template arguments])
+-AC_TRY_RUN([
++AC_LINK_IFELSE([
+ typedef unsigned char UC;
+ template<UC a>
+ struct A {
+@@ -583,7 +583,7 @@
+ #
+ # Check whether the ALWAYS_INLINE attribute is available
+ AC_MSG_CHECKING([whether the always_inline attribute is available])
+-AC_TRY_RUN([
++AC_LINK_IFELSE([
+ int test(int code) __attribute__ ((always_inline));
+ int test(int code)
+ {
+@@ -592,7 +592,6 @@
+ int main(int,char**)
+ {
+  return test(0);
+- return 10;
+ }
+ ],[ac_have_always_inline='yes';AC_DEFINE(HAVE_ALWAYS_INLINE,[1],
+ [Define to 1 if the always_inline attribute is 
available])],[ac_have_always_inline='no'])
+@@ -677,7 +676,7 @@
+ # Check whether we have SIMD instructions for floating point. This can speed 
up at
+ # least the vertical lifting steps on some machines.
+ AC_MSG_CHECKING([for float SIMD instructions])
+-AC_TRY_RUN([
++AC_LINK_IFELSE([
+ typedef float vector4 __attribute__ ((vector_size (16)));
+ typedef float vectorbase;
+ void vectorlift(vectorbase *top,vectorbase *center,vectorbase *bottom,int len)
diff --minimal -Nru libjpeg-0.0~git20190821.87636f3b26b4/debian/patches/series 
libjpeg-0.0~git20190821.87636f3b26b4/debian/patches/series
--- libjpeg-0.0~git20190821.87636f3b26b4/debian/patches/series
+++ libjpeg-0.0~git20190821.87636f3b26b4/debian/patches/series
@@ -1 +1,2 @@
 sbuild.patch
+cross.patch
diff --minimal -Nru libjpeg-0.0~git20190821.87636f3b26b4/debian/rules 
libjpeg-0.0~git20190821.87636f3b26b4/debian/rules
--- libjpeg-0.0~git20190821.87636f3b26b4/debian/rules
+++ libjpeg-0.0~git20190821.87636f3b26b4/debian/rules
@@ -2,7 +2,7 @@
 #export DH_VERBOSE = 1
 
 %:
-       dh $@
+       dh $@ --with=autoreconf
 
 override_dh_installdocs: debian/jpeg.1
                dh_installdocs

Reply via email to