guix-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug#53609] [PATCH 2/2] gnu: Add ghc-4.


From: Ricardo Wurmus
Subject: [bug#53609] [PATCH 2/2] gnu: Add ghc-4.
Date: Fri, 28 Jan 2022 18:48:52 +0100

* gnu/packages/commencement.scm (ghc-4): New variable.
---
 gnu/packages/commencement.scm | 131 ++++++++++++++++++++++++++++++++++
 1 file changed, 131 insertions(+)

diff --git a/gnu/packages/commencement.scm b/gnu/packages/commencement.scm
index 96d914344d..03f1ea276c 100644
--- a/gnu/packages/commencement.scm
+++ b/gnu/packages/commencement.scm
@@ -30,6 +30,7 @@
 
 (define-module (gnu packages commencement)
   #:use-module (gnu packages)
+  #:use-module (gnu packages autotools)
   #:use-module (gnu packages bootstrap)
   #:use-module (gnu packages base)
   #:use-module (gnu packages bash)
@@ -3902,5 +3903,135 @@ (define-public gfortran-toolchain
 gfortran, as well as libc (headers and binaries, plus debugging symbols
 in the @code{debug} output), and binutils.")))
 
+(define-public ghc-4
+  (package
+    (name "ghc")
+    (version "4.08.2")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (string-append "https://www.haskell.org/ghc/dist/";
+                           version "/" name "-" version "-src.tar.bz2"))
+       (sha256
+        (base32
+         "0ar4nxy4cr5vwvfj71gmc174vx0n3lg9ka05sa1k60c8z0g3xp1q"))))
+    (build-system gnu-build-system)
+    (supported-systems '("i686-linux" "x86_64-linux"))
+    (arguments
+     `(#:system "i686-linux"
+       #:implicit-inputs? #f
+       #:strip-binaries? #f
+       #:phases
+       (modify-phases %standard-phases
+         (replace 'bootstrap
+           (lambda* (#:key inputs #:allow-other-keys)
+             (delete-file "configure")
+             (delete-file "config.sub")
+             (install-file (string-append (assoc-ref inputs "automake")
+                                          "/share/automake-1.16/config.sub")
+                           ".")
+             (let ((bash (which "bash")))
+               (substitute* '("configure.in"
+                              "ghc/configure.in"
+                              "ghc/rts/gmp/mpn/configure.in"
+                              "ghc/rts/gmp/mpz/configure.in"
+                              "ghc/rts/gmp/configure.in"
+                              "distrib/configure-bin.in")
+                 (("`/bin/sh") (string-append "`" bash))
+                 (("SHELL=/bin/sh") (string-append "SHELL=" bash))
+                 (("^#! /bin/sh") (string-append "#! " bash)))
+
+               (substitute* '("mk/config.mk.in"
+                              "ghc/rts/gmp/mpz/Makefile.in"
+                              "ghc/rts/gmp/Makefile.in")
+                 (("^SHELL.*=.*/bin/sh") (string-append "SHELL = " bash)))
+               (substitute* "aclocal.m4"
+                 (("SHELL=/bin/sh") (string-append "SHELL=" bash))))
+
+             (invoke "autoreconf" "--verbose" "--force")))
+         (add-before 'configure 'configure-gmp
+           (lambda* (#:key build inputs outputs #:allow-other-keys)
+             (with-directory-excursion "ghc/rts/gmp"
+               (let ((bash (which "bash"))
+                     (out  (assoc-ref outputs "out")))
+                 (setenv "CONFIG_SHELL" bash)
+                 (setenv "SHELL" bash)
+                 (invoke bash "./configure")))))
+         (replace 'configure
+           (lambda* (#:key build inputs outputs #:allow-other-keys)
+             (let ((bash (which "bash"))
+                   (out  (assoc-ref outputs "out")))
+               (setenv "CONFIG_SHELL" bash)
+               (setenv "SHELL" bash)
+               (invoke bash "./configure"
+                       "--enable-hc-boot"
+                       (string-append "--prefix=" out)
+                       (string-append "--build=" build)
+                       (string-append "--host=" build)))))
+         (replace 'build
+           (lambda _
+             ;; mkdirhier doesn't get built, so just use mkdir -p.
+             (substitute* "mk/paths.mk"
+               (("^INSTALL_DIR.*")
+                "INSTALL_DIR = mkdir -p"))
+
+             #;
+             (substitute* "ghc/driver/ghc-asm.prl"
+               (("local\\(\\$\\*\\) = 1;") "")
+               (("endef\\$/") "endef$/s"))
+
+             (invoke "make" "boot")
+             (invoke "make"))))))
+    (native-inputs
+     `(("gcc" ,gcc-mesboot0)
+       ("libc" ,glibc-mesboot0)
+       ("binutils" ,binutils-mesboot0)
+
+       ("autoconf" ,autoconf-2.13)
+       ("automake" ,automake)
+
+       ("make" ,gnu-make-final)
+       ("sed" ,sed-final)
+       ("grep" ,grep-final)
+       ("coreutils" ,coreutils-final)
+       ("bash" ,bash-final)
+       ("ld-wrapper" ,ld-wrapper)
+       ("kernel-headers" ,%bootstrap-linux-libre-headers)
+       ("tar" ,tar)
+       ("bzip2" ,bzip2)
+       ("diffutils" ,diffutils)
+       ("file" ,file)
+       ("findutils" ,findutils)
+       ("gawk" ,gawk)
+
+       ;; TODO: Perl used to allow setting $* to enable multi-line
+       ;; matching.  If we want to use a more recent Perl we need to
+       ;; patch all expressions that require multi-line matching.  Hard
+       ;; to tell.
+       ("perl" ,perl-5.14)))
+    (native-search-paths (list (search-path-specification
+                                (variable "GHC_PACKAGE_PATH")
+                                (files (list
+                                        (string-append "lib/ghc-" version)))
+                                (file-pattern ".*\\.conf\\.d$")
+                                (file-type 'directory))))
+    (home-page "https://www.haskell.org/ghc";)
+    (synopsis "The Glasgow Haskell Compiler")
+    (description
+     "The Glasgow Haskell Compiler (GHC) is a state-of-the-art compiler and
+interactive environment for the functional language Haskell.")
+    (license license:bsd-3)))
+    (native-search-paths (list (search-path-specification
+                                (variable "GHC_PACKAGE_PATH")
+                                (files (list
+                                        (string-append "lib/ghc-" version)))
+                                (file-pattern ".*\\.conf\\.d$")
+                                (file-type 'directory))))
+    (home-page "https://www.haskell.org/ghc";)
+    (synopsis "The Glasgow Haskell Compiler")
+    (description
+     "The Glasgow Haskell Compiler (GHC) is a state-of-the-art compiler and
+interactive environment for the functional language Haskell.")
+    (license license:bsd-3)))
 
 ;;; commencement.scm ends here
-- 
2.34.0






reply via email to

[Prev in Thread] Current Thread [Next in Thread]