commit:     2dd9b21e7b9003c1dd6e7e71578449d01302d610
Author:     Raul E Rangel <rrangel <AT> chromium <DOT> org>
AuthorDate: Tue May  1 18:40:30 2018 +0000
Commit:     Mike Gilbert <floppym <AT> gentoo <DOT> org>
CommitDate: Sat May  5 20:15:55 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=2dd9b21e

tc-export_build_env: handle non-cross compile case

By handling the non-cross compiler case the meson.eclass can be
simplified to `tc-env_build "$@" || die`.

See https://bugs.gentoo.org/654424

Change-Id: I1a90da46366c490abbf7d5660bf90482c7f22747
Signed-off-by: Raul E Rangel <rrangel <AT> chromium.org>
Closes: https://bugs.gentoo.org/654424

 eclass/toolchain-funcs.eclass | 22 +++++++++++++++-------
 1 file changed, 15 insertions(+), 7 deletions(-)

diff --git a/eclass/toolchain-funcs.eclass b/eclass/toolchain-funcs.eclass
index 4b1876b8e09..1c8090cf75c 100644
--- a/eclass/toolchain-funcs.eclass
+++ b/eclass/toolchain-funcs.eclass
@@ -247,13 +247,21 @@ tc-stack-grows-down() {
 # Export common build related compiler settings.
 tc-export_build_env() {
        tc-export "$@"
-       # Some build envs will initialize vars like:
-       # : ${BUILD_LDFLAGS:-${LDFLAGS}}
-       # So make sure all variables are non-empty. #526734
-       : ${BUILD_CFLAGS:=-O1 -pipe}
-       : ${BUILD_CXXFLAGS:=-O1 -pipe}
-       : ${BUILD_CPPFLAGS:= }
-       : ${BUILD_LDFLAGS:= }
+       if tc-is-cross-compiler; then
+               # Some build envs will initialize vars like:
+               # : ${BUILD_LDFLAGS:-${LDFLAGS}}
+               # So make sure all variables are non-empty. #526734
+               : ${BUILD_CFLAGS:=-O1 -pipe}
+               : ${BUILD_CXXFLAGS:=-O1 -pipe}
+               : ${BUILD_CPPFLAGS:= }
+               : ${BUILD_LDFLAGS:= }
+       else
+               # https://bugs.gentoo.org/654424
+               : ${BUILD_CFLAGS:=${CFLAGS}}
+               : ${BUILD_CXXFLAGS:=${CXXFLAGS}}
+               : ${BUILD_CPPFLAGS:=${CPPFLAGS}}
+               : ${BUILD_LDFLAGS:=${LDFLAGS}}
+       fi
        export BUILD_{C,CXX,CPP,LD}FLAGS
 
        # Some packages use XXX_FOR_BUILD.

Reply via email to