Source: libnet-dbus-perl
Version: 1.1.0-6
User: debian-cr...@lists.debian.org
Usertags: cross-satisfiability ftcbfs

libnet-dbus-perl fails to cross build from source, because its perl
(host) dependency is unsatisfiable. Based on Niko's work, we can update
it to perl-xs-dev and this is where it becomes interesting:

libnet-dbus-perl fails to find the dbus library. It does so using the
build architecture pkg-config, but libdbus is only installed for the
host architecture. Now I'm unsure how to fix this. The common wisdom is
to prefix tools with the host architecture triplet. The other wisdom is
to pass tools as environment variables. The perl ecosystem seems to
follow a different route: Record paths in Config.pm. Unfortunately,
Config.pm neither has the triplet nor does it have pkg-config. Bummer.
So what is a good way to get the right pkg-config into the Makefile.PL?

I'm attaching a patch to demonstrate that pkg-config really is the only
issue: It makes libnet-pkg-config cross buildable by passing pkg-config
through the environment. Please consider it RFC and comment on it rather
than applying it (which also is why I don't tag the bug with patch).

I don't like the patch, because it creates two routes to communicate the
host architecture: Config.pm and environment. If these communication
methods are not in sync, bad things happen. I'd much prefer to have a
single source of truth here.

Consider this bug an "example bug". Using pkg-config in Makefile.PL is
likely something that happens elsewhere. It'll need fixing a few times.
I'd like to get to a good solution here before filing more of them,
because libnet-dbus-perl nicely isolates this issue.

You can apply the perl-xs-dev part right away if you like, but it isn't
sufficient.

Helmut
diff --minimal -Nru libnet-dbus-perl-1.1.0/debian/changelog 
libnet-dbus-perl-1.1.0/debian/changelog
--- libnet-dbus-perl-1.1.0/debian/changelog     2019-07-06 20:51:38.000000000 
+0200
+++ libnet-dbus-perl-1.1.0/debian/changelog     2019-11-19 05:50:00.000000000 
+0100
@@ -1,3 +1,12 @@
+libnet-dbus-perl (1.1.0-6.1) UNRELEASED; urgency=medium
+
+  * RFC patch.
+  * Fix FTCBFS: (Closes: #-1)
+    + Build-Depends: perl-xs-dev
+    + Pass the right pkg-config via environment.
+
+ -- Helmut Grohne <hel...@subdivi.de>  Tue, 19 Nov 2019 05:50:00 +0100
+
 libnet-dbus-perl (1.1.0-6) unstable; urgency=medium
 
   * Team upload.
diff --minimal -Nru libnet-dbus-perl-1.1.0/debian/control 
libnet-dbus-perl-1.1.0/debian/control
--- libnet-dbus-perl-1.1.0/debian/control       2019-07-06 20:51:38.000000000 
+0200
+++ libnet-dbus-perl-1.1.0/debian/control       2019-11-19 05:49:59.000000000 
+0100
@@ -10,7 +10,7 @@
                libtest-pod-coverage-perl <!nocheck>,
                libtest-pod-perl <!nocheck>,
                libxml-twig-perl <!nocheck>,
-               perl
+               perl-xs-dev,
 Standards-Version: 4.3.0
 Vcs-Browser: 
https://salsa.debian.org/perl-team/modules/packages/libnet-dbus-perl
 Vcs-Git: 
https://salsa.debian.org/perl-team/modules/packages/libnet-dbus-perl.git
diff --minimal -Nru libnet-dbus-perl-1.1.0/debian/patches/cross.patch 
libnet-dbus-perl-1.1.0/debian/patches/cross.patch
--- libnet-dbus-perl-1.1.0/debian/patches/cross.patch   1970-01-01 
01:00:00.000000000 +0100
+++ libnet-dbus-perl-1.1.0/debian/patches/cross.patch   2019-11-19 
05:50:00.000000000 +0100
@@ -0,0 +1,21 @@
+--- libnet-dbus-perl-1.1.0.orig/Makefile.PL
++++ libnet-dbus-perl-1.1.0/Makefile.PL
+@@ -3,13 +3,15 @@
+ # See lib/ExtUtils/MakeMaker.pm for details of how to influence
+ # the contents of the Makefile that is written.
+ 
++my $PKG_CONFIG = $ENV{PKG_CONFIG} or "pkg-config";
++
+ my $dbusver = "1.3.0";
+-my $stat = system "pkg-config --atleast-version=$dbusver dbus-1";
++my $stat = system "$PKG_CONFIG --atleast-version=$dbusver dbus-1";
+ die "cannot run pkg-config to check dbus version" if $stat == -1;
+ die "DBus >= $dbusver is required\n" unless $stat == 0;
+ 
+-my $DBUS_LIBS = `pkg-config --libs dbus-1`;
+-my $DBUS_CFLAGS = `pkg-config --cflags dbus-1`;
++my $DBUS_LIBS = `$PKG_CONFIG --libs dbus-1`;
++my $DBUS_CFLAGS = `$PKG_CONFIG --cflags dbus-1`;
+ 
+ if (!defined $DBUS_LIBS || !defined DBUS_CFLAGS) {
+     die "could not run 'pkg-config' to determine compiler/linker flags for 
dbus library: $!\n";
diff --minimal -Nru libnet-dbus-perl-1.1.0/debian/patches/series 
libnet-dbus-perl-1.1.0/debian/patches/series
--- libnet-dbus-perl-1.1.0/debian/patches/series        2019-07-06 
20:51:38.000000000 +0200
+++ libnet-dbus-perl-1.1.0/debian/patches/series        2019-11-19 
05:50:00.000000000 +0100
@@ -1,2 +1,3 @@
 0001-Fix-spelling-error-in-POD.patch
 0002-Fix-spelling-errors-in-POD.patch
+cross.patch
diff --minimal -Nru libnet-dbus-perl-1.1.0/debian/rules 
libnet-dbus-perl-1.1.0/debian/rules
--- libnet-dbus-perl-1.1.0/debian/rules 2019-07-06 20:51:38.000000000 +0200
+++ libnet-dbus-perl-1.1.0/debian/rules 2019-11-19 05:50:00.000000000 +0100
@@ -1,6 +1,8 @@
 #!/usr/bin/make -f
 
 export DEB_BUILD_MAINT_OPTIONS = hardening=+all
+DPKG_EXPORT_BUILDTOOLS = 1
+include /usr/share/dpkg/buildtools.mk
 
 %:
        dh $@

Reply via email to