Source: debhelper
Version: 13.16
Tags: patch
Control: affects -1 + cmake src:qt6-connectivity
User: debian-cr...@lists.debian.org
Usertags: ftcbfs
X-Debbugs-Cc: Debian CMake Team <pkg-cmake-t...@lists.alioth.debian.org>

cmake changed its way of communicating pkg-config again. The earlier
method of passing -DPKGCONFIG_EXECUTABLE and later
-DPKG_CONFIG_EXECUTABLE are no longer honoured in version 3.30. However,
it now accepts an environment variable PKG_CONFIG. Let's also set that.
I know this is getting ridiculous, but what is our choice?

The attached patch goes slightly beyond and refactors a bit of code
duplication. Hope that's ok.

Helmut
diff --minimal -Nru debhelper-13.16/debian/changelog 
debhelper-13.16+nmu1/debian/changelog
--- debhelper-13.16/debian/changelog    2024-06-17 18:00:40.000000000 +0200
+++ debhelper-13.16+nmu1/debian/changelog       2024-07-31 11:42:31.000000000 
+0200
@@ -1,3 +1,10 @@
+debhelper (13.16+nmu1) UNRELEASED; urgency=medium
+
+  * Non-maintainer upload.
+  * cmake: Also pass pkg-config via environment (Closes: #-1)
+
+ -- Helmut Grohne <hel...@subdivi.de>  Wed, 31 Jul 2024 11:42:31 +0200
+
 debhelper (13.16) unstable; urgency=medium
 
   [ Niels Thykier ]
diff --minimal -Nru debhelper-13.16/lib/Debian/Debhelper/Buildsystem/cmake.pm 
debhelper-13.16+nmu1/lib/Debian/Debhelper/Buildsystem/cmake.pm
--- debhelper-13.16/lib/Debian/Debhelper/Buildsystem/cmake.pm   2024-03-17 
08:20:54.000000000 +0100
+++ debhelper-13.16+nmu1/lib/Debian/Debhelper/Buildsystem/cmake.pm      
2024-07-31 11:42:31.000000000 +0200
@@ -79,9 +79,15 @@
        return $this;
 }
 
+sub _get_pkgconf {
+       my $toolprefix = is_cross_compiling() ? 
dpkg_architecture_value("DEB_HOST_GNU_TYPE") . "-" : "";
+       return "/usr/bin/" . $toolprefix . "pkg-config";
+}
+
 sub _get_cmake_env {
        my $update_env = {};
        $update_env->{DEB_PYTHON_INSTALL_LAYOUT} = 'deb' unless 
$ENV{DEB_PYTHON_INSTALL_LAYOUT};
+       $update_env->{PKG_CONFIG} = _get_pkgconf() unless $ENV{PKG_CONFIG};
        return $update_env;
 }
 
@@ -129,8 +135,8 @@
                if (not $ENV{CXX}) {
                        push @flags, "-DCMAKE_CXX_COMPILER=" . 
dpkg_architecture_value("DEB_HOST_GNU_TYPE") . "-g++";
                }
-               push(@flags, "-DPKG_CONFIG_EXECUTABLE=/usr/bin/" . 
dpkg_architecture_value("DEB_HOST_GNU_TYPE") . "-pkg-config");
-               push(@flags, "-DPKGCONFIG_EXECUTABLE=/usr/bin/" . 
dpkg_architecture_value("DEB_HOST_GNU_TYPE") . "-pkg-config");
+               push(@flags, "-DPKG_CONFIG_EXECUTABLE=" . _get_pkgconf());
+               push(@flags, "-DPKGCONFIG_EXECUTABLE=" . _get_pkgconf());
                push(@flags, "-DQMAKE_EXECUTABLE=/usr/bin/" . 
dpkg_architecture_value("DEB_HOST_GNU_TYPE") . "-qmake");
        }
        push(@flags, "-DCMAKE_INSTALL_LIBDIR=lib/" . 
dpkg_architecture_value("DEB_HOST_MULTIARCH"));

Reply via email to