Source: netsurf
Version: 3.6-3.2
Tags: patch
User: debian-cr...@lists.debian.org
Usertags: ftcbfs

netsurf fails to cross build from source for many different reasons. It
has an "interesting" build system. But lets start in order.

The libhtml-parser-perl dependency poses a problem to cross
satisfiability. It is interpreted as host architecture and results in a
conflict on perl-base. The package is being used (run) during build
though, so it is needed for the build architecture instead. It should be
annotated :native. Once doing so, apt is able to install Build-Depends.

Then cross building netsurf should be a matter of setting up variables
HOST and BUILD. Unfortunately, it's not that simple. It doesn't figure
out the right CC for building nsgenbind. The attached patch opts to
building it separately. Then it also fails using the correct ar and
pkg-config.

Much later, a build tool fails linking -lpng. This indicates a missing
dependency on libpng-dev:native.

After fixing all of the above, the build fails with #911600, which is
where I stopped looking. Please consider applying the attached patch
anyway. Please close this bug when doing so.

Helmut
diff --minimal -Nru netsurf-3.6/debian/changelog netsurf-3.6/debian/changelog
--- netsurf-3.6/debian/changelog        2018-07-18 23:25:47.000000000 +0200
+++ netsurf-3.6/debian/changelog        2020-02-25 08:35:27.000000000 +0100
@@ -1,3 +1,16 @@
+netsurf (3.6-3.3) UNRELEASED; urgency=medium
+
+  * Non-maintainer upload.
+  * Improve cross building: (Closes: #-1)
+    + Annotate libhtml-parser-perl dependency :native as it is being used
+      during build.
+    + Build native tool nsgenbind separately as the build system figures
+      the wrong compiler.
+    + Set up cross build variables in the way the build system needs.
+    + Build-Depends: libpng-dev:native for another native tool.
+
+ -- Helmut Grohne <hel...@subdivi.de>  Tue, 25 Feb 2020 08:35:27 +0100
+
 netsurf (3.6-3.2) unstable; urgency=medium
 
   * Non-maintainer upload.
diff --minimal -Nru netsurf-3.6/debian/control netsurf-3.6/debian/control
--- netsurf-3.6/debian/control  2017-02-08 21:10:34.000000000 +0100
+++ netsurf-3.6/debian/control  2020-02-25 08:35:27.000000000 +0100
@@ -3,7 +3,7 @@
 Priority: extra
 Maintainer: Vincent Sanders <vi...@debian.org>
 Uploaders: Daniel Silverstone <dsilv...@digital-scurf.org>
-Build-Depends: debhelper (>= 9~), libcurl3-dev, libpng-dev, libgtk2.0-dev, 
flex, bison, libhtml-parser-perl, librsvg2-dev, libjpeg-dev, imagemagick, 
libfreetype6-dev, libvncserver-dev, libsdl1.2-dev, libxcb1-dev, 
libxcb-icccm4-dev, libxcb-image0-dev, libxcb-keysyms1-dev, libxcb-util0-dev, 
libssl-dev, gperf
+Build-Depends: debhelper (>= 9~), libcurl3-dev, libpng-dev, libpng-dev:native, 
libgtk2.0-dev, flex, bison, libhtml-parser-perl:native, librsvg2-dev, 
libjpeg-dev, imagemagick, libfreetype6-dev, libvncserver-dev, libsdl1.2-dev, 
libxcb1-dev, libxcb-icccm4-dev, libxcb-image0-dev, libxcb-keysyms1-dev, 
libxcb-util0-dev, libssl-dev, gperf
 Standards-Version: 3.9.8
 Homepage: http://www.netsurf-browser.org
 Vcs-Browser: http://source.netsurf-browser.org/packaging/debian.git/
diff --minimal -Nru netsurf-3.6/debian/rules netsurf-3.6/debian/rules
--- netsurf-3.6/debian/rules    2016-11-20 15:27:36.000000000 +0100
+++ netsurf-3.6/debian/rules    2020-02-25 08:35:27.000000000 +0100
@@ -8,12 +8,23 @@
 export DEB_CFLAGS_MAINT_APPEND = -Wno-error
 export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed
 
+include /usr/share/dpkg/architecture.mk
+include /usr/share/dpkg/buildtools.mk
+
+BUILD_VARS = V=1 PREFIX=/usr
+BUILD_ENV = PATH='$(CURDIR)/build-nsgenbind:$(PATH)'
+ifneq ($(DEB_BUILD_ARCH),$(DEB_HOST_ARCH))
+BUILD_VARS += PKGCONFIG='$(PKG_CONFIG)'
+BUILD_ENV += BUILD='$(DEB_BUILD_GNU_CPU)' HOST='$(DEB_HOST_GNU_CPU)' AR='$(AR)'
+endif
+
 %:
        dh $@ 
 
 override_dh_auto_build:
-       dh_auto_build -- V=1 PREFIX=/usr TARGET=gtk
-       dh_auto_build -- V=1 PREFIX=/usr TARGET=framebuffer
+       dpkg-architecture -a$(DEB_BUILD_ARCH) -f -c dh_auto_build 
--sourcedirectory=nsgenbind -- V=1 NSSHARED=$(CURDIR)/buildsystem 
BUILDDIR=$(CURDIR)/build-nsgenbind
+       $(BUILD_ENV) dh_auto_build -- TARGET=gtk $(BUILD_VARS)
+       $(BUILD_ENV) dh_auto_build -- TARGET=framebuffer $(BUILD_VARS)
 
 override_dh_auto_install:
        dh_auto_install -- PREFIX=/usr TARGET=gtk
@@ -27,6 +38,7 @@
        ln -s /etc/ssl/certs/ca-certificates.crt 
debian/tmp/usr/share/netsurf/ca-bundle.txt
 
 override_dh_auto_clean:
+       rm -Rf build-nsgenbind
        dh_auto_clean -- PREFIX=/usr TARGET=gtk
        dh_auto_clean -- PREFIX=/usr TARGET=framebuffer
 

Reply via email to