[debhelper-devel] Bug#833789: debhelper: improve cross build support with the cmake buildsystem: multiarch and pkg-config
Helmut Grohne
helmut at subdivi.de
Mon Aug 8 16:17:57 UTC 2016
Package: debhelper
Version: 9.20160709
Tags: patch
User: helmutg at debian.org
Usertags: rebootstrap
Hi Niels et al,
Julian was kind enough to prepare an experimental apt release that uses
CMake as its build system, so I could get my hands on it and test cross
build it. That worked pretty well with two problems both of which we'd
like to solve in debhelper.
* By default CMake's `find_package(PkgConfig)` will not consider cross
tools and default to using plain 'pkg-config'. Since Debian's
pkg-config has a proper cross wrapper now, not using the
triplet-prefixed means that CMake will fail to find libraries.
There are a number of options to tell CMake about the right
pkg-config. For instance, setting the environment variable
PKG_CONFIG=<triplet>-pkg-config is sufficient. In this patch, we pass
it as -DPKG_CONFIG_EXECUTABLE=... to keep consistency with other
options. Also note that this variable requires an absolute path.
* CMake has logic to place libraries in multiarch paths on Debian
systems. That logic is disabled for cross compilation. Thus CMake
puts libraries in /usr/lib durin cross compilation, which makes e.g.
apt fail to cross build. It's not clear what is the best place to fix
this, but debhelper certainly is one where this is possible.
Arguably, it's a good place, because CMake has no good way to
determine whether the host system will be a Debian system.
The patch is joint work with Julian.
Helmut
-------------- next part --------------
--- debhelper-9.20160709/Debian/Debhelper/Buildsystem/cmake.pm
+++ debhelper-9.20160709+nmu1/Debian/Debhelper/Buildsystem/cmake.pm
@@ -74,6 +74,8 @@
} else {
push @flags, "-DCMAKE_CXX_COMPILER=" . dpkg_architecture_value("DEB_HOST_GNU_TYPE") . "-g++";
}
+ push @flags, "-DPKG_CONFIG_EXECUTABLE=/usr/bin/" . pkg_architecture_value("DEB_HOST_GNU_TYPE") . "-pkg-config";
+ push @flags, "-DCMAKE_INSTALL_LIBDIR=lib/" . dpkg_architecture_value("DEB_HOST_MULTIARCH");
}
# CMake doesn't respect CPPFLAGS, see #653916.
--- debhelper-9.20160709/debian/changelog
+++ debhelper-9.20160709+nmu1/debian/changelog
@@ -1,3 +1,12 @@
+debhelper (9.20160709+nmu1) UNRELEASED; urgency=medium
+
+ * Non-maintainer upload.
+
+ [ Julian Andres Klode and Helmut Grohne]
+ * Improve cross building for the cmake buildsystem. (Closes: #-1)
+
+ -- Helmut Grohne <helmut at subdivi.de> Mon, 08 Aug 2016 14:57:12 +0200
+
debhelper (9.20160709) unstable; urgency=medium
* Explicitly Build-Depends on perl:any for pod2man instead
More information about the debhelper-devel
mailing list