Gentoo Archives: gentoo-commits

From: "Michał Górny" <mgorny@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: eclass/
Date: Sun, 26 Jun 2016 15:36:19
Message-Id: 1466955287.c65f6083898968b5442eeb66afd4298a3b4264e2.mgorny@gentoo
1 commit: c65f6083898968b5442eeb66afd4298a3b4264e2
2 Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
3 AuthorDate: Fri Jun 17 07:30:26 2016 +0000
4 Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
5 CommitDate: Sun Jun 26 15:34:47 2016 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c65f6083
7
8 toolchain-funcs.eclass: Assume CPP="$(tc-getCC) -E" when unset, #582822
9
10 Modify the tc-getCPP and tc-getBUILD_CPP functions to use "$(tc-getCC)
11 -E" (i.e. the C compiler's preprocessing call) instead of falling back
12 to 'cpp'. This ensures that in environment with CC (and CXX) overriden
13 the correct compiler is used rather than the one selected by gcc-config,
14 which in turn fixes gcc version queries.
15
16 The alternative would be to always override CPP along with CC & CXX.
17 However, that is uncommon and is known to break some packages.
18
19 Bug: https://bugs.gentoo.org/show_bug.cgi?id=582822
20
21 eclass/toolchain-funcs.eclass | 4 ++--
22 1 file changed, 2 insertions(+), 2 deletions(-)
23
24 diff --git a/eclass/toolchain-funcs.eclass b/eclass/toolchain-funcs.eclass
25 index 8ecc736..1baab96 100644
26 --- a/eclass/toolchain-funcs.eclass
27 +++ b/eclass/toolchain-funcs.eclass
28 @@ -59,7 +59,7 @@ tc-getCC() { tc-getPROG CC gcc "$@"; }
29 # @FUNCTION: tc-getCPP
30 # @USAGE: [toolchain prefix]
31 # @RETURN: name of the C preprocessor
32 -tc-getCPP() { tc-getPROG CPP cpp "$@"; }
33 +tc-getCPP() { tc-getPROG CPP "${CC:-gcc} -E" "$@"; }
34 # @FUNCTION: tc-getCXX
35 # @USAGE: [toolchain prefix]
36 # @RETURN: name of the C++ compiler
37 @@ -132,7 +132,7 @@ tc-getBUILD_CC() { tc-getBUILD_PROG CC gcc "$@"; }
38 # @FUNCTION: tc-getBUILD_CPP
39 # @USAGE: [toolchain prefix]
40 # @RETURN: name of the C preprocessor for building binaries to run on the build machine
41 -tc-getBUILD_CPP() { tc-getBUILD_PROG CPP cpp "$@"; }
42 +tc-getBUILD_CPP() { tc-getBUILD_PROG CPP "$(tc-getBUILD_CC) -E" "$@"; }
43 # @FUNCTION: tc-getBUILD_CXX
44 # @USAGE: [toolchain prefix]
45 # @RETURN: name of the C++ compiler for building binaries to run on the build machine