From 470e988101f7631fdcdc36fc98223dfa9e54a720 Mon Sep 17 00:00:00 2001 From: Niels Thykier Date: Sun, 21 Jan 2018 08:18:59 +0000 Subject: qmake{,4}.pm: Avoid global state in build systems Signed-off-by: Niels Thykier --- lib/Debian/Debhelper/Buildsystem/qmake.pm | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'lib/Debian/Debhelper/Buildsystem/qmake.pm') diff --git a/lib/Debian/Debhelper/Buildsystem/qmake.pm b/lib/Debian/Debhelper/Buildsystem/qmake.pm index 6e7f87f1..561080f8 100644 --- a/lib/Debian/Debhelper/Buildsystem/qmake.pm +++ b/lib/Debian/Debhelper/Buildsystem/qmake.pm @@ -11,8 +11,6 @@ use warnings; use Debian::Debhelper::Dh_Lib qw(dpkg_architecture_value error generated_file is_cross_compiling); use parent qw(Debian::Debhelper::Buildsystem::makefile); -our $qmake="qmake"; - my %OS_MKSPEC_MAPPING = ( 'linux' => 'linux-g++', 'kfreebsd' => 'gnukfreebsd-g++', @@ -134,7 +132,7 @@ sub configure { } $this->mkdir_builddir(); - $this->doit_in_builddir($qmake, @options, @flags, @_); + $this->doit_in_builddir($this->_qmake(), @options, @flags, @_); } sub install { @@ -146,4 +144,8 @@ sub install { $this->SUPER::install($destdir, "INSTALL_ROOT=$destdir", @_); } +sub _qmake { + return 'qmake'; +} + 1 -- cgit v1.2.3 From 2f076eb7897d6fbea6f10ebd91354f637e706bd9 Mon Sep 17 00:00:00 2001 From: Dmitry Shachnev Date: Wed, 31 Jan 2018 23:38:17 +0300 Subject: qmake.pm: Let qmake cross wrapper set most of cross-build options Signed-off-by: Niels Thykier --- debian/changelog | 5 +++ debian/control | 3 ++ lib/Debian/Debhelper/Buildsystem/qmake.pm | 56 +++---------------------------- 3 files changed, 12 insertions(+), 52 deletions(-) (limited to 'lib/Debian/Debhelper/Buildsystem/qmake.pm') diff --git a/debian/changelog b/debian/changelog index 874ea54f..7acfcd20 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,8 +1,13 @@ debhelper (11.2.2) UNRELEASED; urgency=medium + [ Niels Thykier ] * Buildsystem.pm: Fix use of undefined variable in certain error conditions. + [ Dmitry Shachnev ] + * qmake.pm: Use ${DEB_HOST_GNU_TYPE}-qmake wrapper for + cross-compilation. (Closes: #895286) + -- Niels Thykier Sun, 08 Apr 2018 09:40:32 +0000 debhelper (11.2.1) unstable; urgency=medium diff --git a/debian/control b/debian/control index 678c94d9..a5704dac 100644 --- a/debian/control +++ b/debian/control @@ -44,6 +44,9 @@ Breaks: dh-systemd (<< 1.38), cmake (<< 3.9~), # meson build system uses --wrap-mode, which requires meson (>= 0.40.0) meson (<< 0.40.0~), +# The qmake cross wrapper was introduced in 5.9.2+dfsg-5, but got some important +# fixes in the subsequent uploads. It is only needed for cross-building. + qt5-qmake (<< 5.9.2+dfsg-8), Replaces: dh-systemd (<< 1.38) Suggests: dh-make, dwz Provides: ${dh:CompatLevels} diff --git a/lib/Debian/Debhelper/Buildsystem/qmake.pm b/lib/Debian/Debhelper/Buildsystem/qmake.pm index 561080f8..18b896d8 100644 --- a/lib/Debian/Debhelper/Buildsystem/qmake.pm +++ b/lib/Debian/Debhelper/Buildsystem/qmake.pm @@ -8,7 +8,7 @@ package Debian::Debhelper::Buildsystem::qmake; use strict; use warnings; -use Debian::Debhelper::Dh_Lib qw(dpkg_architecture_value error generated_file is_cross_compiling); +use Debian::Debhelper::Dh_Lib qw(dpkg_architecture_value error is_cross_compiling); use parent qw(Debian::Debhelper::Buildsystem::makefile); my %OS_MKSPEC_MAPPING = ( @@ -63,38 +63,6 @@ sub configure { } else { error("Cannot cross-compile: Missing entry for HOST OS ${host_os} for qmake's -spec option"); } - - my $filename = generated_file('_source', 'qmake-cross.conf'); - my $host_multiarch = dpkg_architecture_value("DEB_HOST_MULTIARCH"); - open(my $fh, '>', $filename) or error("open($filename) failed: $!"); - - $fh->print("[Paths]\n"); - $fh->print("Prefix=/usr\n"); - $fh->print("ArchData=lib/$host_multiarch/qt5\n"); - $fh->print("Binaries=lib/qt5/bin\n"); - $fh->print("Data=share/qt5\n"); - $fh->print("Documentation=share/qt5/doc\n"); - $fh->print("Examples=lib/$host_multiarch/qt5/examples\n"); - $fh->print("Headers=include/$host_multiarch/qt5\n"); - $fh->print("HostBinaries=lib/qt5/bin\n"); - $fh->print("HostData=lib/$host_multiarch/qt5\n"); - $fh->print("HostLibraries=lib/$host_multiarch\n"); - $fh->print("Imports=lib/$host_multiarch/qt5/imports\n"); - $fh->print("Libraries=lib/$host_multiarch\n"); - $fh->print("LibraryExecutables=lib/$host_multiarch/qt5/libexec\n"); - $fh->print("Plugins=lib/$host_multiarch/qt5/plugins\n"); - $fh->print("Qml2Imports=lib/$host_multiarch/qt5/qml\n"); - $fh->print("Settings=/etc/xdg\n"); - $fh->print("Translations=share/qt5/translations\n"); - - close($fh) or error("close($filename) failed: $!"); - if ($filename !~ m{^/}) { - # Make the file name absolute (just in case qmake cares). - require Cwd; - $filename =~ s{^\./}{}; - $filename = Cwd::cwd() . "/${filename}"; - } - push @options, ("-qtconf", $filename); } if ($ENV{CFLAGS}) { @@ -112,25 +80,6 @@ sub configure { push @flags, "QMAKE_STRIP=:"; push @flags, "PREFIX=/usr"; - if (is_cross_compiling()) { - # qmake calls $$QMAKE_CXX in toolchain.prf to get a list of library/include paths, - # we need -early flag to make sure $$QMAKE_CXX is already properly set on that step. - push @flags, "-early"; - if ($ENV{CC}) { - push @flags, "QMAKE_CC=" . $ENV{CC}; - } else { - push @flags, "QMAKE_CC=" . dpkg_architecture_value("DEB_HOST_GNU_TYPE") . "-gcc"; - } - if ($ENV{CXX}) { - push @flags, "QMAKE_CXX=" . $ENV{CXX}; - push @flags, "QMAKE_LINK=" . $ENV{CXX}; - } else { - push @flags, "QMAKE_CXX=" . dpkg_architecture_value("DEB_HOST_GNU_TYPE") . "-g++"; - push @flags, "QMAKE_LINK=" . dpkg_architecture_value("DEB_HOST_GNU_TYPE") . "-g++"; - } - push @flags, "PKG_CONFIG=" . dpkg_architecture_value("DEB_HOST_GNU_TYPE") . "-pkg-config"; - } - $this->mkdir_builddir(); $this->doit_in_builddir($this->_qmake(), @options, @flags, @_); } @@ -145,6 +94,9 @@ sub install { } sub _qmake { + if (is_cross_compiling()) { + return dpkg_architecture_value("DEB_HOST_GNU_TYPE") . "-qmake"; + } return 'qmake'; } -- cgit v1.2.3