summaryrefslogtreecommitdiff
path: root/gnu/packages/gcc.scm
diff options
context:
space:
mode:
Diffstat (limited to 'gnu/packages/gcc.scm')
-rw-r--r--gnu/packages/gcc.scm105
1 files changed, 63 insertions, 42 deletions
diff --git a/gnu/packages/gcc.scm b/gnu/packages/gcc.scm
index 5590cd3d7e..c8902de6a0 100644
--- a/gnu/packages/gcc.scm
+++ b/gnu/packages/gcc.scm
@@ -13,6 +13,7 @@
;;; Copyright © 2021 Chris Marusich <cmmarusich@gmail.com>
;;; Copyright © 2021 Sarah Morgensen <iskarian@mgsn.dev>
;;; Copyright © 2022 Greg Hogan <code@greghogan.com>
+;;; Copyright © 2024 Zheng Junjie <873216071@qq.com>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -192,13 +193,16 @@ where the OS part is overloaded to denote a specific ABI---into GCC
`(#:out-of-source? #t
#: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))
+ ;; GCC 11.3.0 defaults to C++17 which is partly
+ ;; incompatible with some earlier versions.
+ ;; Force an earlier C++ standard while building.
+ (cond
+ ((version-prefix? "4.8" version)
+ `(cons "CXX=g++ -std=c++03" ,flags))
+ ((or (version-prefix? "4.9" version)
+ (version-prefix? "5" version))
+ `(cons "CXX=g++ -std=c++11" ,flags))
+ (else flags)))
#:make-flags
;; None of the flags below are needed when doing a Canadian cross.
@@ -419,6 +423,37 @@ Go. It also includes runtime support libraries for these languages.")
(("struct ucontext") "ucontext_t")))
'("aarch64" "alpha" "bfin" "i386" "m68k"
"pa" "sh" "tilepro" "xtensa")))))
+ (arguments
+ ;; Since 'arguments' is a function of the package's version, define
+ ;; 'parent' such that the 'arguments' thunk gets to see the right
+ ;; version.
+ (let ((parent (package
+ (inherit gcc-4.7)
+ (version (package-version this-package)))))
+ (if (%current-target-system)
+ (package-arguments parent)
+ ;; For native builds of some GCC versions the C++ include path needs to
+ ;; be adjusted so it does not interfere with GCC's own build processes.
+ (substitute-keyword-arguments (package-arguments parent)
+ ((#: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")))))))))))
(supported-systems %supported-systems)
(inputs
(modify-inputs (package-inputs gcc-4.7)
@@ -454,38 +489,7 @@ Go. It also includes runtime support libraries for these languages.")
"pa" "sh" "tilepro" "xtensa")))))
;; Override inherited texinfo-5 with latest version.
(native-inputs (list perl ;for manpages
- texinfo))
- (arguments
- ;; Since 'arguments' is a function of the package's version, define
- ;; 'parent' such that the 'arguments' thunk gets to see the right
- ;; version.
- (let ((parent (package
- (inherit gcc-4.8)
- (version (package-version this-package)))))
- (if (%current-target-system)
- (package-arguments parent)
- ;; 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 parent)
- ((#: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")))))))))))))
+ texinfo))))
(define gcc-canadian-cross-objdump-snippet
;; Fix 'libcc1/configure' error when cross-compiling GCC. Without that,
@@ -546,7 +550,7 @@ Go. It also includes runtime support libraries for these languages.")
"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))
+ (arguments (package-arguments gcc-4.7))
(inputs
`(("isl" ,isl)
@@ -615,12 +619,12 @@ Go. It also includes runtime support libraries for these languages.")
(define %gcc-11-x86_64-micro-architectures
;; Suitable '-march' values for GCC 11.
(append %gcc-10-x86_64-micro-architectures
- '("sapphirerapids" "alterlake" "rocketlake" ;Intel
+ '("sapphirerapids" "alderlake" "rocketlake" ;Intel
"btver1" "btver2" ;AMD
;; psABI micro-architecture levels
- "x86-64-v1" "x86-64-v2" "x86-64-v3" "x86-64-v4")))
+ "x86-64" "x86-64-v2" "x86-64-v3" "x86-64-v4")))
;; Suitable '-march' values for GCC 12.
(define %gcc-12-aarch64-micro-architectures
@@ -669,6 +673,7 @@ It also includes runtime support libraries for these languages.")
`((compiler-cpu-architectures
("aarch64" ,@%gcc-7.5-aarch64-micro-architectures)
("armhf" ,@%gcc-7.5-armhf-micro-architectures)
+ ("i686" ,@%gcc-7.5-x86_64-micro-architectures)
("x86_64" ,@%gcc-7.5-x86_64-micro-architectures))
,@(package-properties gcc-6)))))
@@ -725,6 +730,7 @@ It also includes runtime support libraries for these languages.")
`((compiler-cpu-architectures
("aarch64" ,@%gcc-10-aarch64-micro-architectures)
("armhf" ,@%gcc-10-armhf-micro-architectures)
+ ("i686" ,@%gcc-10-x86_64-micro-architectures)
("x86_64" ,@%gcc-10-x86_64-micro-architectures))
,@(package-properties gcc-8)))))
@@ -760,6 +766,7 @@ It also includes runtime support libraries for these languages.")
`((compiler-cpu-architectures
("aarch64" ,@%gcc-11-aarch64-micro-architectures)
("armhf" ,@%gcc-11-armhf-micro-architectures)
+ ("i686" ,@%gcc-11-x86_64-micro-architectures)
("x86_64" ,@%gcc-11-x86_64-micro-architectures))
,@(package-properties gcc-8)))))
@@ -782,6 +789,7 @@ It also includes runtime support libraries for these languages.")
`((compiler-cpu-architectures
("aarch64" ,@%gcc-12-aarch64-micro-architectures)
("armhf" ,@%gcc-12-armhf-micro-architectures)
+ ("i686" ,@%gcc-12-x86_64-micro-architectures)
("x86_64" ,@%gcc-12-x86_64-micro-architectures))
,@(package-properties gcc-11)))))
@@ -804,6 +812,7 @@ It also includes runtime support libraries for these languages.")
`((compiler-cpu-architectures
("aarch64" ,@%gcc-13-aarch64-micro-architectures)
("armhf" ,@%gcc-13-armhf-micro-architectures)
+ ("i686" ,@%gcc-13-x86_64-micro-architectures)
("x86_64" ,@%gcc-13-x86_64-micro-architectures))
,@(package-properties gcc-11)))))
@@ -1102,6 +1111,12 @@ as the 'native-search-paths' field."
"gfortran" '("fortran")
%generic-search-paths)))
+(define-public gfortran-9
+ (hidden-package
+ (custom-gcc gcc-9
+ "gfortran" '("fortran")
+ %generic-search-paths)))
+
(define-public gfortran-7
(hidden-package
(custom-gcc gcc-7
@@ -1118,6 +1133,12 @@ as the 'native-search-paths' field."
(custom-gcc gcc-11 "gdc" '("d")
%generic-search-paths)))
+;;; Alias tracking the latest GDC version.
+(define-public gdc
+ (hidden-package
+ (custom-gcc gcc "gdc" '("d")
+ %generic-search-paths)))
+
(define-public (make-libgccjit gcc)
(package
(inherit gcc)