Control: block -1 by 876861

Hi Niels!

On Sun, Oct 01, 2017 at 06:07:00AM +0000, Niels Thykier wrote:
> I have done a quick review and with my remarks below:
>
> [patch1]
> > @@ -52,6 +52,10 @@ sub configure {
> >  
> >     push @options, '-makefile';
> >     push @options, '-nocache';
> > +   if (is_cross_compiling()) {
> > +           # Force generic mkspec to avoid -m32 / -m64 flags
> > +           push @options, ("-spec", "linux-g++");
>               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>
> I believe we rely on cross-builds producing bit-for-bit identical output
> with a native build as a part of the QA.  If so, then this need to be
> unconditional (possibly in a later compat level).

The differences between linux-g++ and linux-g++-64 mkspecs are:

- using -m64 compiler flag, which is not needed on Debian and has no effect;
- using -L/usr/X11R6/lib64 linker flag, which also does not make any sense.

These options should not have any effect on produced result.

I have also just committed a change [1] to qtbase which makes linux-g++
the default mkspec on all Linux architectures (so it will be used for
non-cross builds too).

> If the -spec option is used, then I will need something that also works
> for other architectures/OSes.  It is fine if it is a stable of known
> OSes mapped to their option (like we do for cmake).

I have now added support for GNU/kFreeBSD and Hurd.

> > @@ -55,6 +56,14 @@ sub configure {
> >     if (is_cross_compiling()) {
> >             # Force generic mkspec to avoid -m32 / -m64 flags
> >             push @options, ("-spec", "linux-g++");
> > +
> > +           my ($fh, $filename) = tempfile("qt.XXXX", SUFFIX => ".conf", 
> > TMPDIR => 1, UNLINK => 1);
> > +           $fh->print("[Paths]\n");
> > +           $fh->print("Prefix=/usr\n");
> > +           $fh->print("HostData=lib/" . 
> > dpkg_architecture_value("DEB_HOST_GNU_TYPE") . "/qt5\n");
> > +           $fh->print("Headers=include/" . 
> > dpkg_architecture_value("DEB_HOST_GNU_TYPE") . "/qt5\n");
>
> These two lines should almost certainly use DEB_HOST_MULTIARCH.  :)

Thank you! Fixed, updated patches are attached.

I forgot to mention that this currently works only when qt5-qmake:native is
added as a build dep. To make it work better, I plan to split qt5-qmake into
two packages, and make one that contains the qmake binary Multi-Arch: foreign
(just like qtbase5-dev-tools currently is). Because of this I added #876861
as a blocker, but it should not prevent you from updating debhelper earlier.

[1]: 
https://anonscm.debian.org/cgit/pkg-kde/qt/qtbase.git/commit/?id=1f0b1d8551bd1dcf

--
Dmitry Shachnev
From d93f538e29d34dd765e68cf721063c6bdaab7f29 Mon Sep 17 00:00:00 2001
From: Dmitry Shachnev <mity...@gmail.com>
Date: Sat, 30 Sep 2017 23:38:29 +0300
Subject: [PATCH 1/2] qmake.pm: Add initial support for cross-building

---
 lib/Debian/Debhelper/Buildsystem/qmake.pm | 26 +++++++++++++++++++++++++-
 1 file changed, 25 insertions(+), 1 deletion(-)

diff --git a/lib/Debian/Debhelper/Buildsystem/qmake.pm b/lib/Debian/Debhelper/Buildsystem/qmake.pm
index c39c2474..e92c905f 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(error);
+use Debian::Debhelper::Dh_Lib qw(dpkg_architecture_value error is_cross_compiling);
 use parent qw(Debian::Debhelper::Buildsystem::makefile);
 
 our $qmake="qmake";
@@ -52,6 +52,15 @@ sub configure {
 
 	push @options, '-makefile';
 	push @options, '-nocache';
+	if (is_cross_compiling()) {
+		my $host_os = dpkg_architecture_value("DEB_HOST_ARCH_OS");
+		my %os_mkspec_mapping = (
+			'linux'    => 'linux-g++',
+			'kfreebsd' => 'gnukfreebsd-g++',
+			'hurd'     => 'hurd-g++',
+		);
+		push @options, ("-spec", $os_mkspec_mapping{$host_os});
+	}
 
 	if ($ENV{CFLAGS}) {
 		push @flags, "QMAKE_CFLAGS_RELEASE=$ENV{CFLAGS} $ENV{CPPFLAGS}";
@@ -68,6 +77,21 @@ sub configure {
 	push @flags, "QMAKE_STRIP=:";
 	push @flags, "PREFIX=/usr";
 
+	if (is_cross_compiling()) {
+		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};
+		} else {
+			push @flags, "QMAKE_CXX=" . dpkg_architecture_value("DEB_HOST_GNU_TYPE") . "-g++";
+		}
+		push @flags, "QMAKE_LINK=\$(CXX)";
+		push @flags, "PKG_CONFIG=" . dpkg_architecture_value("DEB_HOST_GNU_TYPE") . "-pkg-config";
+	}
+
 	$this->mkdir_builddir();
 	$this->doit_in_builddir($qmake, @options, @flags, @_);
 }
-- 
2.14.2

From 47930e954324f62ce08d91aa2211a8b59c5913de Mon Sep 17 00:00:00 2001
From: Dmitry Shachnev <mity...@gmail.com>
Date: Sat, 30 Sep 2017 23:55:31 +0300
Subject: [PATCH 2/2] qmake.pm: Use a custom qt.conf file for cross builds

---
 lib/Debian/Debhelper/Buildsystem/qmake.pm | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/lib/Debian/Debhelper/Buildsystem/qmake.pm b/lib/Debian/Debhelper/Buildsystem/qmake.pm
index e92c905f..e22d07de 100644
--- a/lib/Debian/Debhelper/Buildsystem/qmake.pm
+++ b/lib/Debian/Debhelper/Buildsystem/qmake.pm
@@ -8,6 +8,7 @@ package Debian::Debhelper::Buildsystem::qmake;
 
 use strict;
 use warnings;
+use File::Temp qw(tempfile);
 use Debian::Debhelper::Dh_Lib qw(dpkg_architecture_value error is_cross_compiling);
 use parent qw(Debian::Debhelper::Buildsystem::makefile);
 
@@ -60,6 +61,14 @@ sub configure {
 			'hurd'     => 'hurd-g++',
 		);
 		push @options, ("-spec", $os_mkspec_mapping{$host_os});
+
+		my ($fh, $filename) = tempfile("qt.XXXX", SUFFIX => ".conf", TMPDIR => 1, UNLINK => 1);
+		$fh->print("[Paths]\n");
+		$fh->print("Prefix=/usr\n");
+		$fh->print("HostData=lib/" . dpkg_architecture_value("DEB_HOST_MULTIARCH") . "/qt5\n");
+		$fh->print("Headers=include/" . dpkg_architecture_value("DEB_HOST_MULTIARCH") . "/qt5\n");
+		close $fh;
+		push @options, ("-qtconf", $filename);
 	}
 
 	if ($ENV{CFLAGS}) {
-- 
2.14.2

Attachment: signature.asc
Description: PGP signature

Reply via email to