Subject: [bug#32953] [PATCH core-updates-next 5/8] gnu: Use GCC 7 as the default compiler.

From: Marius Bakke <[email-masked]>
Date: Sat, 6 Oct 2018 15:16:36 +0200

* gnu/packages/commencement.scm (gcc-boot0)[arguments]: Add "--disable-libmpx"
to #:configure-flags.
(gcc-final): Add phase to set C_INCLUDE_PATH and CPLUS_INCLUDE_PATH.
* gnu/packages/gcc.scm (gcc): Is now GCC-7.
(gfortran): Is now GFORTRAN-7.
(gcc-objc): Is now GCC-OBJC-7.
(gcc-objc++): Is now GCC-OBJC++-7.
* gnu/packages/commencement.scm (gcc-toolchain-5): Use MAKE-GCC-TOOLCHAIN.
(gcc-toolchain-7): Is now GCC-TOOLCHAIN.
---
 gnu/packages/commencement.scm | 20 +++++++++++++++-----
 gnu/packages/gcc.scm          |  8 ++++----
 2 files changed, 19 insertions(+), 9 deletions(-)

diff --git a/gnu/packages/commencement.scm b/gnu/packages/commencement.scm
index 6dfa89315..5bcd98584 100644
--- a/gnu/packages/commencement.scm
+++ b/gnu/packages/commencement.scm
@@ -1765,6 +1765,7 @@ exec " gcc "/bin/" program
                             "--disable-libsanitizer"
                             "--disable-libitm"
                             "--disable-libgomp"
+                            "--disable-libmpx"
                             "--disable-libcilkrts"
                             "--disable-libvtv"
                             "--disable-libssp"
@@ -2393,6 +2394,15 @@ exec ~a/bin/~a-~a -B~a/lib -Wl,-dynamic-linker -Wl,~a/~a \"$@\"~%"
                                            char-set:letter)
                                          ,(package-name lib)))
                              (list gmp-6.0 mpfr mpc))
+                      #t)))
+                (add-before 'configure 'treat-glibc-as-system-header
+                  (lambda* (#:key inputs #:allow-other-keys)
+                    (let ((libc (assoc-ref inputs "libc")))
+                      ;; Make sure Glibc is treated as a "system header" so
+                      ;; #include_next does the right thing.
+                      (for-each (lambda (var)
+                                  (setenv var (string-append libc "/include")))
+                                '("C_INCLUDE_PATH" "CPLUS_INCLUDE_PATH"))
                       #t))))))))
 
     ;; This time we want Texinfo, so we get the manual.  Add
@@ -2641,23 +2651,23 @@ and binaries, plus debugging symbols in the 'debug' output), and Binutils.")
               ("libc-debug" ,glibc-final "debug")
               ("libc-static" ,glibc-final "static")))))
 
+(define-public gcc-toolchain
+  (make-gcc-toolchain gcc-final))
+
 (define-public gcc-toolchain-4.8
   (make-gcc-toolchain gcc-4.8))
 
 (define-public gcc-toolchain-4.9
   (make-gcc-toolchain gcc-4.9))
 
-(define-public gcc-toolchain
-  (make-gcc-toolchain gcc-final))
-
 (define-public gcc-toolchain-5
-  gcc-toolchain)
+  (make-gcc-toolchain gcc-5))
 
 (define-public gcc-toolchain-6
   (make-gcc-toolchain gcc-6))
 
 (define-public gcc-toolchain-7
-  (make-gcc-toolchain gcc-7))
+  gcc-toolchain)
 
 (define-public gcc-toolchain-8
   (make-gcc-toolchain gcc-8))
diff --git a/gnu/packages/gcc.scm b/gnu/packages/gcc.scm
index 820710417..7a8e40982 100644
--- a/gnu/packages/gcc.scm
+++ b/gnu/packages/gcc.scm
@@ -539,7 +539,7 @@ It also includes runtime support libraries for these languages.")))
 ;; Note: When changing the default gcc version, update
 ;;       the gcc-toolchain-* definitions and the gfortran definition
 ;;       accordingly.
-(define-public gcc gcc-5)
+(define-public gcc gcc-7)
 
 (define-public (make-libstdc++ gcc)
   "Return a libstdc++ package based on GCC.  The primary use case is when
@@ -677,7 +677,7 @@ as the 'native-search-paths' field."
   ;; (custom-gcc gcc "fortran" …) because that would lead to a package object
   ;; that is not 'eq?' with GFORTRAN-5, and thus 'fold-packages' would
   ;; report two gfortran@5 that are in fact identical.
-  gfortran-5)
+  gfortran-7)
 
 (define-public gccgo-4.9
   (custom-gcc gcc-4.9 "gccgo" '("go")
@@ -741,7 +741,7 @@ as the 'native-search-paths' field."
                      (variable "LIBRARY_PATH")
                      (files '("lib" "lib64"))))))
 
-(define-public gcc-objc gcc-objc-5)
+(define-public gcc-objc gcc-objc-7)
 
 (define-public gcc-objc++-4.8
   (custom-gcc gcc-4.8 "gcc-objc++" '("obj-c++")
@@ -797,7 +797,7 @@ as the 'native-search-paths' field."
                      (variable "LIBRARY_PATH")
                      (files '("lib" "lib64"))))))
 
-(define-public gcc-objc++ gcc-objc++-5)
+(define-public gcc-objc++ gcc-objc++-7)
 
 (define (make-libstdc++-doc gcc)
   "Return a package with the libstdc++ documentation for GCC."
-- 
2.19.0