[debhelper-devel] [debhelper] 01/04: qmake.pm: Add initial support for cross-building

Niels Thykier nthykier at moszumanska.debian.org
Sun Oct 1 20:26:35 UTC 2017


This is an automated email from the git hooks/post-receive script.

nthykier pushed a commit to branch master
in repository debhelper.

commit d4652cb817d502dd8d6e9d2eba1d02f9fa5bb66a
Author: Dmitry Shachnev <mitya57 at gmail.com>
Date:   Sat Sep 30 23:38:29 2017 +0300

    qmake.pm: Add initial support for cross-building
    
    Signed-off-by: Niels Thykier <niels at thykier.net>
---
 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 c39c247..e92c905 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, @_);
 }

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debhelper/debhelper.git




More information about the debhelper-devel mailing list