gnu: gcc@4.9, gcc@5.5: Build with '-std=c++11'.
These two compilers would fail to build with GCC 11.3.0 because it defaults to C++17, which triggers some incompatibilities. * gnu/packages/gcc.scm (gcc-4.7)[arguments]: Augment #:configure-flags for 4.9 and 5.0. (gcc-4.9)[arguments]: Define 'parent' so that (package-arguments parent) correctly evaluates the version-dependent parts.master
parent
f073a850c9
commit
0aed5bf512
|
@ -182,7 +182,16 @@ where the OS part is overloaded to denote a specific ABI---into GCC
|
||||||
|
|
||||||
(arguments
|
(arguments
|
||||||
`(#:out-of-source? #t
|
`(#:out-of-source? #t
|
||||||
#:configure-flags ,(configure-flags)
|
#:configure-flags ,(let ((flags (configure-flags))
|
||||||
|
(version (package-version this-package)))
|
||||||
|
;; GCC 4.9 and 5.0 requires C++11 but GCC
|
||||||
|
;; 11.3.0 defaults to C++17, which is partly
|
||||||
|
;; incompatible. Force C++11.
|
||||||
|
(if (or (version-prefix? "4.9" version)
|
||||||
|
(version-prefix? "5" version))
|
||||||
|
`(cons "CXX=g++ -std=c++11" ,flags)
|
||||||
|
flags))
|
||||||
|
|
||||||
#:make-flags
|
#:make-flags
|
||||||
;; None of the flags below are needed when doing a Canadian cross.
|
;; None of the flags below are needed when doing a Canadian cross.
|
||||||
;; TODO: Simplify this.
|
;; TODO: Simplify this.
|
||||||
|
@ -439,30 +448,36 @@ Go. It also includes runtime support libraries for these languages.")
|
||||||
(native-inputs (list perl ;for manpages
|
(native-inputs (list perl ;for manpages
|
||||||
texinfo))
|
texinfo))
|
||||||
(arguments
|
(arguments
|
||||||
(if (%current-target-system)
|
;; Since 'arguments' is a function of the package's version, define
|
||||||
(package-arguments gcc-4.8)
|
;; 'parent' such that the 'arguments' thunk gets to see the right
|
||||||
;; For native builds of GCC 4.9 and GCC 5, the C++ include path needs
|
;; version.
|
||||||
;; to be adjusted so it does not interfere with GCC's own build processes.
|
(let ((parent (package
|
||||||
(substitute-keyword-arguments (package-arguments gcc-4.8)
|
(inherit gcc-4.8)
|
||||||
((#:modules modules %gnu-build-system-modules)
|
(version (package-version this-package)))))
|
||||||
`((srfi srfi-1)
|
(if (%current-target-system)
|
||||||
,@modules))
|
(package-arguments parent)
|
||||||
((#:phases phases)
|
;; For native builds of GCC 4.9 and GCC 5, the C++ include path needs
|
||||||
`(modify-phases ,phases
|
;; to be adjusted so it does not interfere with GCC's own build processes.
|
||||||
(add-after 'set-paths 'adjust-CPLUS_INCLUDE_PATH
|
(substitute-keyword-arguments (package-arguments parent)
|
||||||
(lambda* (#:key inputs #:allow-other-keys)
|
((#:modules modules %gnu-build-system-modules)
|
||||||
(let ((libc (assoc-ref inputs "libc"))
|
`((srfi srfi-1)
|
||||||
(gcc (assoc-ref inputs "gcc")))
|
,@modules))
|
||||||
(setenv "CPLUS_INCLUDE_PATH"
|
((#:phases phases)
|
||||||
(string-join (fold delete
|
`(modify-phases ,phases
|
||||||
(string-split (getenv "CPLUS_INCLUDE_PATH")
|
(add-after 'set-paths 'adjust-CPLUS_INCLUDE_PATH
|
||||||
#\:)
|
(lambda* (#:key inputs #:allow-other-keys)
|
||||||
(list (string-append libc "/include")
|
(let ((libc (assoc-ref inputs "libc"))
|
||||||
(string-append gcc "/include/c++")))
|
(gcc (assoc-ref inputs "gcc")))
|
||||||
":"))
|
(setenv "CPLUS_INCLUDE_PATH"
|
||||||
(format #t
|
(string-join (fold delete
|
||||||
"environment variable `CPLUS_INCLUDE_PATH' changed to ~a~%"
|
(string-split (getenv "CPLUS_INCLUDE_PATH")
|
||||||
(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")))))))))))))
|
||||||
|
|
||||||
(define gcc-canadian-cross-objdump-snippet
|
(define gcc-canadian-cross-objdump-snippet
|
||||||
;; Fix 'libcc1/configure' error when cross-compiling GCC. Without that,
|
;; Fix 'libcc1/configure' error when cross-compiling GCC. Without that,
|
||||||
|
|
Reference in New Issue