diff mbox series

[bug#53609,v2,2/4] gnu: Add gcc-2.95-wrapper.

Message ID 20220205000823.2680-2-rekado@elephly.net
State Accepted
Headers show
Series [bug#53609,v2,1/4] gnu: Add perl-5.14. | expand

Commit Message

Ricardo Wurmus Feb. 5, 2022, 12:08 a.m. UTC
* gnu/packages/commencement.scm (gcc-2.95-wrapper): New variable.
---
 gnu/packages/commencement.scm | 57 +++++++++++++++++++++++++++++++++++
 1 file changed, 57 insertions(+)
diff mbox series

Patch

diff --git a/gnu/packages/commencement.scm b/gnu/packages/commencement.scm
index 3fb4b2054f..6bbadff796 100644
--- a/gnu/packages/commencement.scm
+++ b/gnu/packages/commencement.scm
@@ -2254,6 +2254,63 @@  (define gcc-mesboot1-wrapper
                     (program (string-append bin "/gcc")))
                (invoke program "--help")))))))))
 
+(define 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-2.95-wrapper")
+    (source #f)
+    (inputs '())
+    (native-inputs `(("bash" ,bash-mesboot)
+                     ("coreutils" ,coreutils-mesboot0)
+                     ("libc" ,glibc-2.2.5)
+                     ("gcc" ,gcc-mesboot0)))
+    (arguments
+     `(#:implicit-inputs? #f
+       #:guile ,%bootstrap-guile
+       #:phases
+       (modify-phases %standard-phases
+         (delete 'unpack)
+         (delete 'configure)
+         (delete 'install)
+         (replace 'build
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let* ((out (assoc-ref outputs "out"))
+                    (bash (assoc-ref %build-inputs "bash"))
+                    (libc (assoc-ref %build-inputs "libc"))
+                    (gcc (assoc-ref %build-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 gcc-mesboot
   (package
     (inherit gcc-mesboot1)