Add new patch cross.patch to fix cross compilation.
authorgregor herrmann <gregoa@debian.org>
Sat, 9 Feb 2019 19:51:56 +0000 (20:51 +0100)
committergregor herrmann <gregoa@debian.org>
Sat, 9 Feb 2019 20:08:51 +0000 (21:08 +0100)
Allows one to pass PKG_CONFIG to the build system, which happens in
debian/rules, in order to bypass the build architecture pkg-config.

Thanks: Helmut Grohne for the bug report and the initial patch which was
slightly modified to apply against upstream's Git HEAD.
Closes: #921822
debian/patches/cross.patch [new file with mode: 0644]
debian/patches/series
debian/rules

diff --git a/debian/patches/cross.patch b/debian/patches/cross.patch
new file mode 100644 (file)
index 0000000..5fcfd76
--- /dev/null
@@ -0,0 +1,43 @@
+Description: Fix cross compilation
+ src/osflags hard codes the build architecture pkg-config. After making it
+ substitutable and substituting it from the build environment, iodine cross
+ builds successfully.
+Origin: vendor
+Bug: https://github.com/yarrick/iodine/pull/33
+Bug-Debian: https://bugs.debian.org/921822
+Forwarded: https://github.com/yarrick/iodine/pull/33
+Author: Helmut Grohne <helmut@subdivi.de>
+Reviewed-by: gregor herrmann <gregoa@debian.org>
+Last-Update: 2019-02-09
+
+--- a/src/osflags
++++ b/src/osflags
+@@ -1,5 +1,7 @@
+ #!/bin/sh
++: "${PKG_CONFIG:=pkg-config}"
++
+ case $2 in
+ link)
+@@ -19,8 +21,8 @@
+               Linux)
+                       FLAGS="";
+                       [ -e /usr/include/selinux/selinux.h ] && FLAGS="$FLAGS -lselinux";
+-                      [ -e /usr/include/systemd/sd-daemon.h ] && FLAGS="$FLAGS $(pkg-config --libs libsystemd-daemon)";
+-                      [ -e /usr/include/systemd/sd-daemon.h ] && FLAGS="$FLAGS $(pkg-config --libs libsystemd)";
++                      "$PKG_CONFIG" --exists libsystemd-daemon && FLAGS="$FLAGS $($PKG_CONFIG --libs libsystemd-daemon)";
++                      "$PKG_CONFIG" --exists libsystemd && FLAGS="$FLAGS $($PKG_CONFIG --libs libsystemd)";
+                       echo $FLAGS;
+               ;;
+       esac
+@@ -36,7 +38,8 @@
+               Linux)
+                       FLAGS="-D_GNU_SOURCE"
+                       [ -e /usr/include/selinux/selinux.h ] && FLAGS="$FLAGS -DHAVE_SETCON";
+-                      [ -e /usr/include/systemd/sd-daemon.h ] && FLAGS="$FLAGS -DHAVE_SYSTEMD";
++                      "$PKG_CONFIG" --exists libsystemd-daemon && FLAGS="$FLAGS -DHAVE_SYSTEMD";
++                      "$PKG_CONFIG" --exists libsystemd && FLAGS="$FLAGS -DHAVE_SYSTEMD";
+                       echo $FLAGS;
+               ;;
+               GNU/kFreeBSD|GNU)
index 27410480a16a10358255ac0709de4075e3139f6e..a8009dc9ab4fd9e3d45f9db6eea947a409fc4bc7 100644 (file)
@@ -2,3 +2,4 @@ cflags.patch
 verbose-build.patch
 0001-osflags-use-pkg-config-for-systemd-support.patch
 kfreebsd-hurd.patch
+cross.patch
index ecfef8db20268747d5fcfcda7ba86a43d551e1a6..2a2d01964a7ae1093176784b079143f858e2b908 100755 (executable)
@@ -4,6 +4,9 @@ PACKAGE = $(shell dh_listpackages)
 TMP     = $(CURDIR)/debian/$(PACKAGE)
 
 export DEB_BUILD_MAINT_OPTIONS := hardening=+pie,+bindnow
+# needs dpkg-dev 1.19.0
+-include /usr/share/dpkg/buildtools.mk
+export PKG_CONFIG ?= pkg-config
 
 %:
        dh $@