commit:     345944686caf4b029c869767ca40d38bee556c61
Author:     Benda Xu <heroxbd <AT> gentoo <DOT> org>
AuthorDate: Wed Nov 29 09:27:03 2017 +0000
Commit:     Benda XU <heroxbd <AT> gentoo <DOT> org>
CommitDate: Wed Nov 29 09:45:43 2017 +0000
URL:        https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=34594468

bootstrap-prefix.sh: fix CPPFLAGS for header directory in stage3.

  The CPPFLAGS is needed in stage3 before a working toolchain is
  built.  stage2 headers are not enough when e.g. the host headers are
  too old.

  '-isystem' is the correct choice because EPREFIX/usr/include is a
  system-header-like directory.  In rare cases, '-I' causes conflicts
  between bundled header and system header, like Bug 618488.

  After the stage3 toolchain is built, directories specified by
  CPPFLAGS and LDFLAGS are automatically handled and the variables
  should be removed.  Not removing them pollutes the build system of
  some sophisticated packages which hack CPPFLAGS or LD_LIBRARY_PATH,
  e.g. dev-libs/gmp-6.

Closes: https://bugs.gentoo.org/618488

 scripts/bootstrap-prefix.sh | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/scripts/bootstrap-prefix.sh b/scripts/bootstrap-prefix.sh
index bf35b32b81..f811cf6887 100755
--- a/scripts/bootstrap-prefix.sh
+++ b/scripts/bootstrap-prefix.sh
@@ -1549,7 +1549,7 @@ bootstrap_stage3() {
 
        configure_toolchain || return 1
        export CONFIG_SHELL="${ROOT}"/tmp/bin/bash
-       is-rap || export CPPFLAGS="-I${ROOT}/usr/include"
+       export CPPFLAGS="-isystem ${ROOT}/usr/include"
        export LDFLAGS="-L${ROOT}/usr/$(get_libdir)"
        unset CC CXX
 
@@ -1666,9 +1666,7 @@ bootstrap_stage3() {
                rm -f "${ROOT}"/bin/sh
                ln -s bash "${ROOT}"/bin/sh
        fi
-       unset CONFIG_SHELL
-       unset MAKEINFO
-       unset CXX
+       unset CONFIG_SHELL MAKEINFO CXX CPPFLAGS LDFLAGS
        export PREROOTPATH="${ROOT}/usr/bin:${ROOT}/bin"
 
        # get a sane bash, overwriting tmp symlinks

Reply via email to