From 88449118f2c78236db3f8440f4927dd81525b621 Mon Sep 17 00:00:00 2001 From: Efraim Flashner Date: Tue, 29 Jul 2025 15:12:23 +0300 Subject: [PATCH] gnu: gcc-4.9: Inherit from gcc-base. * gnu/packages/gcc.scm (gcc-4.9): Inherit from gcc-base. [arguments]: Add inherited phases. Take the version specific configure-flag from gcc-base. [inputs]: List specifically. [supported-systems]: New field. Change-Id: Iff481ef403faff7047bcb7a27cc13833d98e5de7 Signed-off-by: Efraim Flashner --- gnu/packages/gcc.scm | 45 ++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 41 insertions(+), 4 deletions(-) diff --git a/gnu/packages/gcc.scm b/gnu/packages/gcc.scm index eab23e3409..426761b005 100644 --- a/gnu/packages/gcc.scm +++ b/gnu/packages/gcc.scm @@ -208,8 +208,6 @@ where the OS part is overloaded to denote a specific ABI---into GCC (cond ((version-prefix? "4.8" version) `(cons "CXX=g++ -std=c++03" ,flags)) - ((version-prefix? "4.9" version) - `(cons "CXX=g++ -std=c++11" ,flags)) (else flags))) #:make-flags @@ -534,7 +532,7 @@ Go. It also includes runtime support libraries for these languages.") (prepend isl-0.11 cloog))))) (define-public gcc-4.9 - (package (inherit gcc-4.8) + (package (inherit gcc-base) (version "4.9.4") (source (origin (method url-fetch) @@ -561,9 +559,48 @@ Go. It also includes runtime support libraries for these languages.") (("struct ucontext") "ucontext_t"))) '("aarch64" "alpha" "bfin" "i386" "m68k" "nios2" "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-base) + (version (package-version this-package))))) + (substitute-keyword-arguments (package-arguments parent) + ((#:modules modules %default-gnu-modules) + `((srfi srfi-1) + ,@modules)) + ((#:configure-flags flags '()) + `(cons "CXX=g++ -std=c++11" ,flags)) + ;; 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. + ((#:phases phases) + (if (%current-target-system) + 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"))))))))))) ;; Override inherited texinfo-5 with latest version. (native-inputs (list perl ;for manpages - texinfo)))) + texinfo)) + (inputs + (modify-inputs (package-inputs gcc-base) + (prepend isl-0.11 cloog))) + (supported-systems (fold delete %supported-systems + '("riscv64-linux" "powerpc64le-linux" + "x86_64-gnu"))))) (define gcc-canadian-cross-objdump-snippet ;; Fix 'libcc1/configure' error when cross-compiling GCC. Without that,