From 56c833ea287f8f6d3c72f8bddc314960c0164d64 Mon Sep 17 00:00:00 2001 From: Marius Bakke Date: Sun, 15 Mar 2020 16:03:16 +0100 Subject: gnu: gcc@4.9, gcc@5: Adjust for CPLUS_INCLUDE_PATH changes. * gnu/packages/gcc.scm (gcc-4.9): Unless cross-compiling, add ... [arguments]: with a phase to remove glibc and GCC from CPLUS_INCLUDE_PATH. (gcc-6)[arguments]: Inherit from GCC-4.8. --- gnu/packages/gcc.scm | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/gnu/packages/gcc.scm b/gnu/packages/gcc.scm index 6f2883042d..0b203d5d71 100644 --- a/gnu/packages/gcc.scm +++ b/gnu/packages/gcc.scm @@ -422,7 +422,33 @@ Go. It also includes runtime support libraries for these languages.") #t)))) ;; Override inherited texinfo-5 with latest version. (native-inputs `(("perl" ,perl) ;for manpages - ("texinfo" ,texinfo))))) + ("texinfo" ,texinfo))) + (arguments + (if (%current-target-system) + (package-arguments gcc-4.8) + ;; For native builds of GCC 4.9 and GCC 5, the C++ include path needs + ;; to be adjusted so it does not interfere with GCC's own build processes. + (substitute-keyword-arguments (package-arguments gcc-4.8) + ((#:modules modules %gnu-build-system-modules) + `((srfi srfi-1) + ,@modules)) + ((#:phases phases) + `(modify-phases ,phases + (add-after 'set-paths 'adjust-CPLUS_INCLUDE_PATH + (lambda* (#:key inputs #:allow-other-keys) + (let ((libc (assoc-ref inputs "libc")) + (gcc (assoc-ref inputs "gcc"))) + (setenv "CPLUS_INCLUDE_PATH" + (string-join (fold delete + (string-split (getenv "CPLUS_INCLUDE_PATH") + #\:) + (list (string-append libc "/include") + (string-append gcc "/include/c++"))) + ":")) + (format #t + "environment variable `CPLUS_INCLUDE_PATH' changed to ~a~%" + (getenv "CPLUS_INCLUDE_PATH")) + #t)))))))))) (define-public gcc-5 ;; Note: GCC >= 5 ships with .info files but 'make install' fails to install @@ -479,6 +505,10 @@ Go. It also includes runtime support libraries for these languages.") "gcc-6-source-date-epoch-1.patch" "gcc-6-source-date-epoch-2.patch" "gcc-5.0-libvtv-runpath.patch")))) + + ;; GCC 4.9 and 5 has a workaround that is not needed for GCC 6 and later. + (arguments (package-arguments gcc-4.8)) + (inputs `(("isl" ,isl) ,@(package-inputs gcc-4.7))))) -- cgit v1.2.3