all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Ricardo Wurmus <rekado@elephly.net>
To: 53609@debbugs.gnu.org
Cc: Ricardo Wurmus <rekado@elephly.net>
Subject: [bug#53609] [PATCH 2/2] gnu: Add ghc-4.
Date: Fri, 28 Jan 2022 18:48:52 +0100	[thread overview]
Message-ID: <20220128174852.10637-2-rekado@elephly.net> (raw)
In-Reply-To: <20220128174852.10637-1-rekado@elephly.net>

* 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	other threads:[~2022-01-28 17:50 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-28 17:35 [bug#53609] [PATCH] Add GHC 4 for the Haskell bootstrap Ricardo Wurmus
2022-01-28 17:48 ` [bug#53609] [PATCH 1/2] gnu: Add perl-5.14 Ricardo Wurmus
2022-01-28 17:48   ` Ricardo Wurmus [this message]
2022-01-29 18:56     ` [bug#53609] [PATCH 2/2] gnu: Add ghc-4 Ricardo Wurmus
2022-02-05  0:08 ` [bug#53609] [PATCH v2 1/4] gnu: Add perl-5.14 Ricardo Wurmus
2022-02-05  0:08   ` [bug#53609] [PATCH v2 2/4] gnu: Add gcc-2.95-wrapper Ricardo Wurmus
2022-02-05  0:08   ` [bug#53609] [PATCH v2 3/4] gnu: Add glibc-2.2.5 Ricardo Wurmus
2022-02-05 14:44     ` Maxime Devos
2022-02-05  0:08   ` [bug#53609] [PATCH v2 4/4] gnu: Add ghc-4 Ricardo Wurmus

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220128174852.10637-2-rekado@elephly.net \
    --to=rekado@elephly.net \
    --cc=53609@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.