gnu: gcc-2.95: Support more systems.

* gnu/packages/gcc.scm (gcc-2.95)[supported-systems]: Allow all except
powerpc64le-linux and riscv64-linux.
[arguments]: Set #:system to the 32-bit version of our supported 64-bit
architectures. Modify custom 'set-dynamic-linker-file-name phase to use
the glibc-dynamic-linker for the selected system, and to substitute more
locations.
This commit is contained in:
Efraim Flashner 2022-02-15 10:21:47 +02:00
parent ae03f40138
commit 3f929203cf
No known key found for this signature in database
GPG key ID: 41AAE7DCCA3D8351

View file

@ -50,6 +50,7 @@ (define-module (gnu packages gcc)
#:use-module (guix gexp) #:use-module (guix gexp)
#:use-module (guix utils) #:use-module (guix utils)
#:use-module (srfi srfi-1) #:use-module (srfi srfi-1)
#:use-module (ice-9 match)
#:use-module (ice-9 regex)) #:use-module (ice-9 regex))
(define %gcc-infrastructure (define %gcc-infrastructure
@ -696,39 +697,63 @@ (define-public gcc-2.95
(substitute* "configure" (substitute* "configure"
(("host_tools=(.*)texinfo" _ before) (("host_tools=(.*)texinfo" _ before)
(string-append "host_tools=" before))))))) (string-append "host_tools=" before)))))))
(supported-systems '("i686-linux" "x86_64-linux")) (supported-systems (fold delete %supported-systems
'("powerpc64le-linux" "riscv64-linux")))
(native-inputs (list texinfo dejagnu)) (native-inputs (list texinfo dejagnu))
(inputs '()) (inputs '())
(propagated-inputs '()) (propagated-inputs '())
(outputs '("out")) (outputs '("out"))
(arguments (arguments
(list #:system "i686-linux" ;x86_64 didn't exist back then (let ((matching-system
#:configure-flags #~'("--disable-werror") (match (%current-system)
;; This package predates our 64-bit architectures.
;; Force a 32-bit build targeting a similar architecture.
("aarch64-linux"
"armhf-linux")
("x86_64-linux"
"i686-linux")
(_
(%current-system)))))
(list #:system matching-system
#:configure-flags #~'("--disable-werror")
#:phases #:phases
#~(modify-phases %standard-phases #~(modify-phases %standard-phases
(add-before 'configure 'set-dynamic-linker-file-name (add-before 'configure 'set-dynamic-linker-file-name
(lambda* (#:key inputs #:allow-other-keys) (lambda* (#:key inputs #:allow-other-keys)
;; Tell GCC what the real loader file name is. ;; Tell GCC what the real loader file name is.
(substitute* "gcc/config/i386/linux.h" (substitute* '("gcc/config/alpha/linux-elf.h"
(("/lib/ld-linux\\.so\\.[12]") "gcc/config/m68k/linux.h"
(search-input-file inputs "/lib/ld-linux.so.2"))))) "gcc/config/mips/linux.h"
(replace 'configure "gcc/config/rs6000/linux.h")
(lambda* (#:key outputs build configure-flags (("/lib/ld\\.so\\.1")
#:allow-other-keys) (search-input-file
;; It's an old 'configure' script so it needs some help. inputs #$(glibc-dynamic-linker matching-system))))
(setenv "CONFIG_SHELL" (which "sh")) (substitute* '("gcc/config/alpha/linux-elf.h"
(apply invoke "./configure" "gcc/config/arm/linux-elf.h"
(string-append "--prefix=" #$output) "gcc/config/i386/linux.h"
(string-append "--build=" build) "gcc/config/m68k/linux.h"
(string-append "--host=" build) "gcc/config/sparc/linux.h"
configure-flags))) "gcc/config/sparc/linux64.h")
(add-before 'configure 'remove-bundled-texinfo (("/lib(64)?/ld-linux\\.so\\.[12]")
(lambda _ (search-input-file
;; Go ahead despite the many warnings. inputs #$(glibc-dynamic-linker matching-system))))))
(substitute* '("Makefile.in" "gcc/Makefile.in") (replace 'configure
(("^MAKEINFOFLAGS =.*") (lambda* (#:key outputs build configure-flags
"MAKEINFOFLAGS = --force\n"))))))) #:allow-other-keys)
;; It's an old 'configure' script so it needs some help.
(setenv "CONFIG_SHELL" (which "sh"))
(apply invoke "./configure"
(string-append "--prefix=" #$output)
(string-append "--build=" build)
(string-append "--host=" build)
configure-flags)))
(add-before 'configure 'remove-bundled-texinfo
(lambda _
;; Go ahead despite the many warnings.
(substitute* '("Makefile.in" "gcc/Makefile.in")
(("^MAKEINFOFLAGS =.*")
"MAKEINFOFLAGS = --force\n"))))))))
(native-search-paths (native-search-paths
;; This package supports nothing but the C language. ;; This package supports nothing but the C language.
(list (search-path-specification (list (search-path-specification