summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRicardo Wurmus <rekado@elephly.net>2022-02-05 00:56:32 +0100
committerRicardo Wurmus <rekado@elephly.net>2022-02-07 14:02:26 +0100
commita95924c9ac3f238cde243c96d552ff59ad77ca16 (patch)
tree06d47a3bdc803297af6be0838bae4a6847991b89
parentdefa85b26537a3cc20624fb9dbcae906226361d5 (diff)
gnu: Add gcc-2.95-wrapper.
* gnu/packages/commencement.scm (gcc-2.95-wrapper): New variable.
-rw-r--r--gnu/packages/commencement.scm58
1 files changed, 58 insertions, 0 deletions
diff --git a/gnu/packages/commencement.scm b/gnu/packages/commencement.scm
index 3fb26f4c9e..76e879b47b 100644
--- a/gnu/packages/commencement.scm
+++ b/gnu/packages/commencement.scm
@@ -12,6 +12,7 @@
;;; Copyright © 2021 Maxim Cournoyer <maxim.cournoyer@gmail.com>
;;; Copyright © 2021 Chris Marusich <cmmarusich@gmail.com>
;;; Copyright © 2021 Julien Lepiller <julien@lepiller.eu>
+;;; Copyright © 2022 Ricardo Wurmus <rekado@elephly.net>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -1402,6 +1403,63 @@ ac_cv_c_float_format='IEEE (little-endian)'
,(string-append "LIBGCC2_INCLUDES=-I " gcc "/include")
"LANGUAGES=c")))))))
+(define-public gcc-2.95-wrapper
+ ;; We need this so gcc-mesboot0 can be used to create shared binaries that
+ ;; have the correct interpreter, otherwise configuring gcc-mesboot using
+ ;; --enable-shared will fail.
+ (package
+ (inherit gcc-mesboot0)
+ (name "gcc-wrapper")
+ (source #f)
+ (inputs '())
+ (native-inputs
+ `(("bash" ,bash-minimal)
+ ("coreutils" ,coreutils)
+ ("libc" ,glibc-2.2.5)
+ ("gcc" ,gcc-mesboot0)))
+ (arguments
+ `(#:implicit-inputs? #f
+ #:phases
+ (modify-phases %standard-phases
+ (delete 'unpack)
+ (delete 'configure)
+ (delete 'install)
+ (replace 'build
+ (lambda* (#:key inputs outputs #:allow-other-keys)
+ (let* ((out (assoc-ref outputs "out"))
+ (bash (assoc-ref inputs "bash"))
+ (libc (assoc-ref inputs "libc"))
+ (gcc (assoc-ref inputs "gcc"))
+ (bin (string-append out "/bin")))
+ (mkdir-p bin)
+ (for-each
+ (lambda (program)
+ (let ((wrapper (string-append bin "/" program)))
+ (with-output-to-file wrapper
+ (lambda _
+ (display (string-append "#! " bash "/bin/bash
+exec " gcc "/bin/" program
+" -Wl,--dynamic-linker"
+;; also for x86_64-linux, we are still on i686-linux
+" -Wl," libc ,(glibc-dynamic-linker "i686-linux")
+" -Wl,--rpath"
+" -Wl," libc "/lib"
+" \"$@\"
+"))
+ (chmod wrapper #o555)))))
+ '("cpp"
+ "gcc"
+ "g++"
+ "i686-unknown-linux-gnu-cpp"
+ "i686-unknown-linux-gnu-gcc"
+ "i686-unknown-linux-gnu-g++")))))
+ (replace 'check
+ (lambda* (#:key outputs #:allow-other-keys)
+ (let* ((out (assoc-ref outputs "out"))
+ (bin (string-append out "/bin"))
+ (program (string-append bin "/gcc")))
+ (invoke program "--help")))))))))
+
(define (%boot-mesboot0-inputs)
`(("gcc" ,gcc-mesboot0)
("kernel-headers" ,%bootstrap-linux-libre-headers)