[debhelper-devel] [debhelper] 01/01: makefile.pm: Set CC+CXX to the host compilers when cross-building
Niels Thykier
nthykier at moszumanska.debian.org
Sun Sep 18 20:01:22 UTC 2016
This is an automated email from the git hooks/post-receive script.
nthykier pushed a commit to branch master
in repository debhelper.
commit 7ea67c9aace4692efd026c242cc4445881ec5df6
Author: Niels Thykier <niels at thykier.net>
Date: Sun Sep 18 19:58:47 2016 +0000
makefile.pm: Set CC+CXX to the host compilers when cross-building
Co-Author: Helmut Grohne <helmut at subdivi.de>
Signed-off-by: Niels Thykier <niels at thykier.net>
---
Debian/Debhelper/Buildsystem/makefile.pm | 16 +++++++++++++++-
debian/changelog | 4 ++++
2 files changed, 19 insertions(+), 1 deletion(-)
diff --git a/Debian/Debhelper/Buildsystem/makefile.pm b/Debian/Debhelper/Buildsystem/makefile.pm
index 7203349..6ea8e39 100644
--- a/Debian/Debhelper/Buildsystem/makefile.pm
+++ b/Debian/Debhelper/Buildsystem/makefile.pm
@@ -8,9 +8,14 @@ package Debian::Debhelper::Buildsystem::makefile;
use strict;
use warnings;
-use Debian::Debhelper::Dh_Lib qw(escape_shell clean_jobserver_makeflags);
+use Debian::Debhelper::Dh_Lib qw(dpkg_architecture_value escape_shell clean_jobserver_makeflags is_cross_compiling);
use parent qw(Debian::Debhelper::Buildsystem);
+my %DEB_DEFAULT_TOOLS = (
+ 'CC' => 'gcc',
+ 'CXX' => 'g++',
+);
+
# make makes things difficult by not providing a simple way to test
# whether a Makefile target exists. Using -n and checking for a nonzero
# exit status is not good enough, because even with -n, make will
@@ -127,6 +132,15 @@ sub check_auto_buildable {
sub build {
my $this=shift;
+ if (ref($this) eq 'Debian::Debhelper::Buildsystem::makefile' and is_cross_compiling()) {
+ while (my ($var, $tool) = each %DEB_DEFAULT_TOOLS) {
+ if ($ENV{$var}) {
+ unshift @_, $var . "=" . $ENV{$var};
+ } else {
+ unshift @_, $var . "=" . dpkg_architecture_value("DEB_HOST_GNU_TYPE") . "-" . $tool;
+ }
+ }
+ }
$this->do_make(@_);
}
diff --git a/debian/changelog b/debian/changelog
index b4446c3..534a24b 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -6,6 +6,10 @@ debhelper (10+unreleased) UNRELEASED; urgency=medium
* Apply patch from Helmut Grohne and Julian Andres Klode
to improve cross-building support in the cmake build
system. (Closes: #833789)
+ * Make the makefile.pm buildsystem (but not subclasses thereof)
+ pass the CC and CXX variables set to the host compilers when
+ cross-building. Thanks to Helmut Grohne for the idea and
+ the initial patch. (Closes: #836988)
-- Niels Thykier <niels at thykier.net> Wed, 14 Sep 2016 06:07:02 +0000
--
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