Control: tags -1 + patch

https://salsa.debian.org/debian/devscripts/-/merge_requests/362
From ed55d6a12db3cceb2222eb435bbbbb1b29ad7fb9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=D0=BD=D0=B0=D0=B1?= <nabijaczlew...@nabijaczleweli.xyz>
Date: Sun, 20 Aug 2023 12:02:21 +0200
Subject: [PATCH] debuild: provide CC=gcc CXX=g++ by default (Closes: #1049984)
X-Mutt-PGP: OS

GNU Make defaults to CC=cc CXX=g++ if these are unset, and currently
these are always cleared by default. Thus, if cc is a compiler that some
other stage of the build system doesn't like (in my case, clang trunk
which generates DWARF5 debuginfo by default, which dwz always
hard-errors on), every build is broken by default, and the supplied
compiler pair is mismatched (system clang trunk cc, bookworm g++).

Unless explicitly specified, set CC=gcc CXX=g++ as well. This makes the
implied default explicit, and fixes builds on machines where they're
currently broken, without affecting builds on ones that work.
---
 scripts/debuild.1  | 5 +++--
 scripts/debuild.pl | 3 +++
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/scripts/debuild.1 b/scripts/debuild.1
index 2232c732..fe26ebc2 100644
--- a/scripts/debuild.1
+++ b/scripts/debuild.1
@@ -93,8 +93,9 @@ .SH ENVIRONMENT VARIABLES
 \fBDBUS_SESSION_BUS_ADDRESS\fR, \fBFAKEROOTKEY\fR, \fBDEBEMAIL\fR,
 \fBDEB_\fI*\fR, the (\fBC\fR, \fBCPP\fR, \fBCXX\fR, \fBLD\fR and
 \fBF\fR)\fBFLAGS\fR variables and their \fB_APPEND\fR counterparts and the
-locale variables \fBLANG\fR and \fBLC_\fI*\fR.  \fBTERM\fR is set to `dumb'
-if it is unset, and \fBPATH\fR is set to "/usr/sbin:/usr/bin:/sbin:/bin:/usr/bin/X11".
+locale variables \fBLANG\fR and \fBLC_\fI*\fR.  \fBTERM\fR is set to `dumb',
+\fBCC\fR to `gcc', and \fBCXX\fR to `g++' if they are unset,
+and \fBPATH\fR is set to "/usr/sbin:/usr/bin:/sbin:/bin:/usr/bin/X11".
 .PP
 If a particular environment variable is required to be passed through
 untouched to the build process, this may be specified by using a
diff --git a/scripts/debuild.pl b/scripts/debuild.pl
index 7396dc12..910bb816 100755
--- a/scripts/debuild.pl
+++ b/scripts/debuild.pl
@@ -665,6 +665,9 @@ unless ($preserve_env) {
     }
 }
 
+$ENV{'CC'}  = 'gcc' unless exists $ENV{'CC'};
+$ENV{'CXX'} = 'g++' unless exists $ENV{'CXX'};
+
 umask 022;
 
 # Start by duping STDOUT and STDERR
-- 
2.39.2

Attachment: signature.asc
Description: PGP signature

Reply via email to