# 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.