Source: ghostscript
Version: 9.53.2~dfsg-1
Tags: patch
User: debian-cr...@lists.debian.org
Usertags: ftcbfs

ghostscript fails to cross build from source for a number of reasons.
The immediate reason is that it configures for the build architecture.
It actually attempts to configure twice and the second pass would
configure for the host architecture if the first one weren't failing.
The first one is completely unnecessary and should be dropped. All that
needs to be done here is telling autogen.sh not to call configure.

The second issue is that it fails finding zlib. It's a build dependency,
so it should be there, no? Almost. ghostscript is quite clever and calls
a subconfigure for auxiliary tools with the host architecture set to the
build architecture. It actually needs zlib for the build architecture.
That's achieved using a :native annotation.

It then fails running cups-config. It correctly depends on libcups2-dev,
which contains cups-config. Unfortunately, that's a host architecture
executable and cannot be run during cross builds.

The attached patch solves the first two of these issues. For cups-config
there are multiple options. One is fixing cups the other is using
pkg-config instead of cups-config if possible. Please consider applying
my patch. When doing so, please close this bug even though ghostscript
will not be cross buildable. It does hoever make the cups-config issue
more visible and easier to talk about.

Helmut
diff --minimal -Nru ghostscript-9.53.2~dfsg/debian/changelog 
ghostscript-9.53.2~dfsg/debian/changelog
--- ghostscript-9.53.2~dfsg/debian/changelog    2020-09-25 16:51:43.000000000 
+0200
+++ ghostscript-9.53.2~dfsg/debian/changelog    2020-09-27 17:11:39.000000000 
+0200
@@ -1,3 +1,12 @@
+ghostscript (9.53.2~dfsg-1.1) UNRELEASED; urgency=medium
+
+  * Non-maintainer upload.
+  * Improve cross building:
+    + Don't configure during autogen.sh.
+    + zlib is needed for auxiliary tools -> build architecture.
+
+ -- Helmut Grohne <hel...@subdivi.de>  Sun, 27 Sep 2020 17:11:39 +0200
+
 ghostscript (9.53.2~dfsg-1) unstable; urgency=medium
 
   [ upstream ]
diff --minimal -Nru ghostscript-9.53.2~dfsg/debian/control 
ghostscript-9.53.2~dfsg/debian/control
--- ghostscript-9.53.2~dfsg/debian/control      2020-09-25 16:49:25.000000000 
+0200
+++ ghostscript-9.53.2~dfsg/debian/control      2020-09-27 17:11:39.000000000 
+0200
@@ -27,7 +27,7 @@
  libx11-dev,
  libxext-dev,
  libxt-dev,
- libz-dev,
+ libz-dev:native,
  pkg-config,
  rename,
 Standards-Version: 4.5.0
diff --minimal -Nru ghostscript-9.53.2~dfsg/debian/patches/cross.patch 
ghostscript-9.53.2~dfsg/debian/patches/cross.patch
--- ghostscript-9.53.2~dfsg/debian/patches/cross.patch  1970-01-01 
01:00:00.000000000 +0100
+++ ghostscript-9.53.2~dfsg/debian/patches/cross.patch  2020-09-27 
17:11:39.000000000 +0200
@@ -0,0 +1,11 @@
+--- ghostscript-9.53.2~dfsg.orig/autogen.sh
++++ ghostscript-9.53.2~dfsg/autogen.sh
+@@ -43,6 +43,8 @@
+   cp `automake --print-libdir`/install-sh . || exit 1
+ fi
+ 
++test -n "$NOCONFIGURE" && exit 0
++
+ if test -z "$*"; then
+         echo "I am going to run ./configure with no arguments - if you wish "
+         echo "to pass any to it, please specify them on the $0 command line."
diff --minimal -Nru ghostscript-9.53.2~dfsg/debian/patches/series 
ghostscript-9.53.2~dfsg/debian/patches/series
--- ghostscript-9.53.2~dfsg/debian/patches/series       2020-08-20 
18:19:32.000000000 +0200
+++ ghostscript-9.53.2~dfsg/debian/patches/series       2020-09-27 
17:09:25.000000000 +0200
@@ -9,3 +9,4 @@
 2009_use_system_javascript.patch
 2010_add_build_timestamp_setting.patch
 2011_avoid_remote_font.patch
+cross.patch
diff --minimal -Nru ghostscript-9.53.2~dfsg/debian/rules 
ghostscript-9.53.2~dfsg/debian/rules
--- ghostscript-9.53.2~dfsg/debian/rules        2020-09-10 19:51:24.000000000 
+0200
+++ ghostscript-9.53.2~dfsg/debian/rules        2020-09-27 17:11:37.000000000 
+0200
@@ -22,6 +22,9 @@
 # use upstream bootstrapping script
 DEB_DH_AUTORECONF_ARGS = ./autogen.sh
 
+# don't run configure during autogen.sh
+export NOCONFIGURE = 1
+
 # TODO: enable when supporting system-shared libjpeg
 # http://bugs.ghostscript.com/show_bug.cgi?id=696654
 DEB_CONFIGURE_EXTRA_FLAGS += --without-pcl

Reply via email to