[-- Attachment #1: Type: text/plain, Size: 294 bytes --]
This patch replaces the GHC 7.8.4 bootstrap binaries with binaries of GHC 8.2.2, with an eye towards supporting ARM systems. I have not yet succeeded in bootstrapping GHC on ARM, but 8.2.2 is the first release with official binary distributions for both armv7 and aarch64.
--
Alex Griffin
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-gnu-Re-bootstrap-Haskell-with-GHC-8.2.2-binaries.patch --]
[-- Type: text/x-patch; name=0001-gnu-Re-bootstrap-Haskell-with-GHC-8.2.2-binaries.patch, Size: 24131 bytes --]
From 6998f89c2d29278363e509603ad89067133a2ae1 Mon Sep 17 00:00:00 2001
From: Alex Griffin <a@ajgrf.com>
Date: Mon, 22 Jun 2020 11:45:54 -0500
Subject: [PATCH] gnu: Re-bootstrap Haskell with GHC 8.2.2 binaries.
* gnu/packages/haskell.scm (ghc-8.4): Move inherited fields to package
definition.
[native-inputs]: Add patchelf and ghc-binary.
[arguments]: Add new phases unpack-bin, configure-bin, and install-bin.
(ghc-bootstrap-x86_64-7.8.4, ghc-bootstrap-i686-7.8.4, ghc-7,
ghc-8.0): Delete variables.
(ghc-bootstrap-x86_64-8.2.2, ghc-bootstrap-i686-8.2.2): New variables.
(ghc-8.6)[arguments]: Delete new phases added to ghc-8.4.
---
gnu/packages/haskell.scm | 415 ++++++++++-----------------------------
1 file changed, 106 insertions(+), 309 deletions(-)
diff --git a/gnu/packages/haskell.scm b/gnu/packages/haskell.scm
index 1533302dcc..ac5ad14320 100644
--- a/gnu/packages/haskell.scm
+++ b/gnu/packages/haskell.scm
@@ -20,6 +20,7 @@
;;; Copyright © 2019 Robert Vollmert <rob@vllmrt.net>
;;; Copyright © 2019 Jacob MacDonald <jaccarmac@gmail.com>
;;; Copyright © 2020 Marius Bakke <mbakke@fastmail.com>
+;;; Copyright © 2020 Alex Griffin <a@ajgrf.com>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -96,323 +97,26 @@
top of CLISP.")
(license license:bsd-4))))
-(define ghc-bootstrap-x86_64-7.8.4
+(define ghc-bootstrap-x86_64-8.2.2
(origin
(method url-fetch)
(uri
- "https://www.haskell.org/ghc/dist/7.8.4/ghc-7.8.4-x86_64-unknown-linux-deb7.tar.xz")
+ "https://www.haskell.org/ghc/dist/8.2.2/ghc-8.2.2-x86_64-deb8-linux.tar.xz")
(sha256
(base32
- "13azsl53xgj20mi1hj9x0xb32vvcvs6cpmvwx6znxhas7blh0bpn"))))
+ "0ahv26304pqi3dm7i78si4pxwvg5f5dc2jwsfgvcrhcx5g30bqj8"))))
-(define ghc-bootstrap-i686-7.8.4
+(define ghc-bootstrap-i686-8.2.2
(origin
(method url-fetch)
(uri
- "https://www.haskell.org/ghc/dist/7.8.4/ghc-7.8.4-i386-unknown-linux-deb7.tar.xz")
+ "https://www.haskell.org/ghc/dist/8.2.2/ghc-8.2.2-i386-deb8-linux.tar.xz")
(sha256
(base32
- "0wj5s435j0zgww70bj1d3f6wvnnpzlxwvwcyh2qv4qjq5z8j64kg"))))
-
-;; 43 tests out of 3965 fail.
-;;
-;; Most of them do not appear to be serious:
-;;
-;; - some tests generate files referring to "/bin/sh" and "/bin/ls". I've not
-;; figured out how these references are generated.
-;;
-;; - Some tests allocate more memory than expected (ca. 3% above upper limit)
-;;
-;; - Some tests try to load unavailable libriries: Control.Concurrent.STM,
-;; Data.Vector, Control.Monad.State.
-;;
-;; - Test posix010 tries to check the existence of a user on the system:
-;; getUserEntryForName: does not exist (no such user)
-(define-public ghc-7
- (package
- (name "ghc")
- (version "7.10.2")
- (source
- (origin
- (method url-fetch)
- (uri (string-append "https://www.haskell.org/ghc/dist/"
- version "/" name "-" version "-src.tar.xz"))
- (sha256
- (base32
- "1x8m4rp2v7ydnrz6z9g8x7z3x3d3pxhv2pixy7i7hkbqbdsp7kal"))))
- (build-system gnu-build-system)
- (supported-systems '("i686-linux" "x86_64-linux"))
- (outputs '("out" "doc"))
- (inputs
- `(("gmp" ,gmp)
- ("ncurses" ,ncurses)
- ("libffi" ,libffi)
- ("ghc-testsuite"
- ,(origin
- (method url-fetch)
- (uri (string-append
- "https://www.haskell.org/ghc/dist/"
- version "/" name "-" version "-testsuite.tar.xz"))
- (sha256
- (base32
- "0qp9da9ar87zbyn6wjgacd2ic1vgzbi3cklxnhsmjqyafv9qaj4b"))))))
- (native-inputs
- `(("perl" ,perl)
- ("python" ,python-2) ; for tests (fails with python-3)
- ("ghostscript" ,ghostscript) ; for tests
- ("patchelf" ,patchelf)
- ;; GHC is built with GHC. Therefore we need bootstrap binaries.
- ("ghc-binary"
- ,(if (string-match "x86_64" (or (%current-target-system) (%current-system)))
- ghc-bootstrap-x86_64-7.8.4
- ghc-bootstrap-i686-7.8.4))))
- (arguments
- `(#:test-target "test"
- ;; We get a smaller number of test failures by disabling parallel test
- ;; execution.
- #:parallel-tests? #f
-
- ;; Don't pass --build=<triplet>, because the configure script
- ;; auto-detects slightly different triplets for --host and --target and
- ;; then complains that they don't match.
- #:build #f
-
- #:modules ((guix build gnu-build-system)
- (guix build utils)
- (guix build rpath)
- (srfi srfi-26)
- (srfi srfi-1))
- #:imported-modules (,@%gnu-build-system-modules
- (guix build rpath))
- #:configure-flags
- (list
- (string-append "--with-gmp-libraries="
- (assoc-ref %build-inputs "gmp") "/lib")
- (string-append "--with-gmp-includes="
- (assoc-ref %build-inputs "gmp") "/include")
- "--with-system-libffi"
- (string-append "--with-ffi-libraries="
- (assoc-ref %build-inputs "libffi") "/lib")
- (string-append "--with-ffi-includes="
- (assoc-ref %build-inputs "libffi") "/include"))
- ;; FIXME: The user-guide needs dblatex, docbook-xsl and docbook-utils.
- ;; Currently we do not have the last one.
- ;; #:make-flags
- ;; (list "BUILD_DOCBOOK_HTML = YES")
- #:phases
- (let* ((ghc-bootstrap-path
- (string-append (getcwd) "/" ,name "-" ,version "/ghc-bin"))
- (ghc-bootstrap-prefix
- (string-append ghc-bootstrap-path "/usr" )))
- (alist-cons-after
- 'unpack-bin 'unpack-testsuite-and-fix-bins
- (lambda* (#:key inputs outputs #:allow-other-keys)
- (with-directory-excursion ".."
- (copy-file (assoc-ref inputs "ghc-testsuite")
- "ghc-testsuite.tar.xz")
- (system* "tar" "xvf" "ghc-testsuite.tar.xz"))
- (substitute*
- (list "testsuite/timeout/Makefile"
- "testsuite/timeout/timeout.py"
- "testsuite/timeout/timeout.hs"
- "testsuite/tests/rename/prog006/Setup.lhs"
- "testsuite/tests/programs/life_space_leak/life.test"
- "libraries/process/System/Process/Internals.hs"
- "libraries/unix/cbits/execvpe.c")
- (("/bin/sh") (which "sh"))
- (("/bin/rm") "rm"))
- #t)
- (alist-cons-after
- 'unpack 'unpack-bin
- (lambda* (#:key inputs outputs #:allow-other-keys)
- (mkdir-p ghc-bootstrap-prefix)
- (with-directory-excursion ghc-bootstrap-path
- (copy-file (assoc-ref inputs "ghc-binary")
- "ghc-bin.tar.xz")
- (zero? (system* "tar" "xvf" "ghc-bin.tar.xz"))))
- (alist-cons-before
- 'install-bin 'configure-bin
- (lambda* (#:key inputs outputs #:allow-other-keys)
- (let* ((binaries
- (list
- "./utils/ghc-pwd/dist-install/build/tmp/ghc-pwd"
- "./utils/hpc/dist-install/build/tmp/hpc"
- "./utils/haddock/dist/build/tmp/haddock"
- "./utils/hsc2hs/dist-install/build/tmp/hsc2hs"
- "./utils/runghc/dist-install/build/tmp/runghc"
- "./utils/ghc-cabal/dist-install/build/tmp/ghc-cabal"
- "./utils/hp2ps/dist/build/tmp/hp2ps"
- "./utils/ghc-pkg/dist-install/build/tmp/ghc-pkg"
- "./utils/unlit/dist/build/tmp/unlit"
- "./ghc/stage2/build/tmp/ghc-stage2"))
- (gmp (assoc-ref inputs "gmp"))
- (gmp-lib (string-append gmp "/lib"))
- (gmp-include (string-append gmp "/include"))
- (ncurses-lib
- (string-append (assoc-ref inputs "ncurses") "/lib"))
- (ld-so (string-append (assoc-ref inputs "libc")
- ,(glibc-dynamic-linker)))
- (libtinfo-dir
- (string-append ghc-bootstrap-prefix
- "/lib/ghc-7.8.4/terminfo-0.4.0.0")))
- (with-directory-excursion
- (string-append ghc-bootstrap-path "/ghc-7.8.4")
- (setenv "CONFIG_SHELL" (which "bash"))
- (setenv "LD_LIBRARY_PATH" gmp-lib)
- ;; The binaries have "/lib64/ld-linux-x86-64.so.2" hardcoded.
- (for-each
- (cut system* "patchelf" "--set-interpreter" ld-so <>)
- binaries)
- ;; The binaries include a reference to libtinfo.so.5 which
- ;; is a subset of libncurses.so.5. We create a symlink in a
- ;; directory included in the bootstrap binaries rpath.
- (mkdir-p libtinfo-dir)
- (symlink
- (string-append ncurses-lib "/libncursesw.so."
- ;; Extract "6.0" from "6.0-20170930" if a
- ;; dash-separated version tag exists.
- ,(let* ((v (package-version ncurses))
- (d (or (string-index v #\-)
- (string-length v))))
- (version-major+minor (string-take v d))))
- (string-append libtinfo-dir "/libtinfo.so.5"))
-
- (setenv "PATH"
- (string-append (getenv "PATH") ":"
- ghc-bootstrap-prefix "/bin"))
- (system*
- (string-append (getcwd) "/configure")
- (string-append "--prefix=" ghc-bootstrap-prefix)
- (string-append "--with-gmp-libraries=" gmp-lib)
- (string-append "--with-gmp-includes=" gmp-include)))))
- (alist-cons-before
- 'configure 'install-bin
- (lambda* (#:key inputs outputs #:allow-other-keys)
- (with-directory-excursion
- (string-append ghc-bootstrap-path "/ghc-7.8.4")
- (zero? (system* "make" "install"))))
- %standard-phases)))))))
- (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)))
-
-(define-public ghc-8.0
- (package
- (name "ghc")
- (version "8.0.2")
- (source
- (origin
- (method url-fetch)
- (uri (string-append "https://www.haskell.org/ghc/dist/"
- version "/" name "-" version "-src.tar.xz"))
- (sha256
- (base32 "1c8qc4fhkycynk4g1f9hvk53dj6a1vvqi6bklqznns6hw59m8qhi"))
- (patches
- (search-patches "ghc-8.0-fall-back-to-madv_dontneed.patch"))))
- (build-system gnu-build-system)
- (supported-systems '("i686-linux" "x86_64-linux"))
- (outputs '("out" "doc"))
- (inputs
- `(("gmp" ,gmp)
- ("ncurses" ,ncurses)
- ("libffi" ,libffi)
- ("ghc-testsuite"
- ,(origin
- (method url-fetch)
- (uri (string-append
- "https://www.haskell.org/ghc/dist/"
- version "/" name "-" version "-testsuite.tar.xz"))
- (sha256
- (base32 "1wjc3x68l305bl1h1ijd3yhqp2vqj83lkp3kqbr94qmmkqlms8sj"))))))
- (native-inputs
- `(("perl" ,perl)
- ("python" ,python-2) ; for tests
- ("ghostscript" ,ghostscript) ; for tests
- ;; GHC is built with GHC.
- ("ghc-bootstrap" ,ghc-7)))
- (arguments
- `(#:test-target "test"
- ;; We get a smaller number of test failures by disabling parallel test
- ;; execution.
- #:parallel-tests? #f
-
- ;; Don't pass --build=<triplet>, because the configure script
- ;; auto-detects slightly different triplets for --host and --target and
- ;; then complains that they don't match.
- #:build #f
-
- #:configure-flags
- (list
- (string-append "--with-gmp-libraries="
- (assoc-ref %build-inputs "gmp") "/lib")
- (string-append "--with-gmp-includes="
- (assoc-ref %build-inputs "gmp") "/include")
- "--with-system-libffi"
- (string-append "--with-ffi-libraries="
- (assoc-ref %build-inputs "libffi") "/lib")
- (string-append "--with-ffi-includes="
- (assoc-ref %build-inputs "libffi") "/include")
- (string-append "--with-curses-libraries="
- (assoc-ref %build-inputs "ncurses") "/lib")
- (string-append "--with-curses-includes="
- (assoc-ref %build-inputs "ncurses") "/include"))
- #:phases
- (modify-phases %standard-phases
- (add-after 'unpack 'unpack-testsuite
- (lambda* (#:key inputs #:allow-other-keys)
- (with-directory-excursion ".."
- (copy-file (assoc-ref inputs "ghc-testsuite")
- "ghc-testsuite.tar.xz")
- (zero? (system* "tar" "xvf" "ghc-testsuite.tar.xz")))))
- (add-before 'build 'fix-lib-paths
- (lambda _
- (substitute*
- (list "libraries/process/System/Process/Posix.hs"
- "libraries/process/tests/process001.hs"
- "libraries/process/tests/process002.hs"
- "libraries/unix/cbits/execvpe.c")
- (("/bin/sh") (which "sh"))
- (("/bin/ls") (which "ls")))
- #t))
- (add-before 'build 'fix-environment
- (lambda _
- (unsetenv "GHC_PACKAGE_PATH")
- (setenv "CONFIG_SHELL" (which "bash"))
- #t))
- (add-before 'check 'fix-testsuite
- (lambda _
- (substitute*
- (list "testsuite/timeout/Makefile"
- "testsuite/timeout/timeout.py"
- "testsuite/timeout/timeout.hs"
- "testsuite/tests/programs/life_space_leak/life.test")
- (("/bin/sh") (which "sh"))
- (("/bin/rm") "rm"))
- #t)))))
- (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)))
+ "08w2ik55dp3n95qikmrflc91lsiq01xp53ki3jlhnbj8fqnxfrwy"))))
(define-public ghc-8.4
- (package (inherit ghc-8.0)
+ (package
(name "ghc")
(version "8.4.4")
(source
@@ -422,6 +126,9 @@ interactive environment for the functional language Haskell.")
version "/" name "-" version "-src.tar.xz"))
(sha256
(base32 "1ch4j2asg7pr52ai1hwzykxyj553wndg7wq93i47ql4fllspf48i"))))
+ (build-system gnu-build-system)
+ (supported-systems '("i686-linux" "x86_64-linux"))
+ (outputs '("out" "doc"))
(inputs
`(("gmp" ,gmp)
("ncurses" ,ncurses)
@@ -430,8 +137,12 @@ interactive environment for the functional language Haskell.")
`(("perl" ,perl)
("python" ,python) ; for tests
("ghostscript" ,ghostscript) ; for tests
- ;; GHC 8.4.3 is built with GHC 8.
- ("ghc-bootstrap" ,ghc-8.0)
+ ("patchelf" ,patchelf)
+ ;; GHC is built with GHC. Therefore we need bootstrap binaries.
+ ("ghc-binary"
+ ,(match (or (%current-target-system) (%current-system))
+ ("x86_64-linux" ghc-bootstrap-x86_64-8.2.2)
+ ("i686-linux" ghc-bootstrap-i686-8.2.2)))
("ghc-testsuite"
,(origin
(method url-fetch)
@@ -452,6 +163,13 @@ interactive environment for the functional language Haskell.")
;; then complains that they don't match.
#:build #f
+ #:modules ((guix build gnu-build-system)
+ (guix build utils)
+ (guix build rpath)
+ (srfi srfi-26)
+ (srfi srfi-1))
+ #:imported-modules (,@%gnu-build-system-modules
+ (guix build rpath))
#:configure-flags
(list
(string-append "--with-gmp-libraries="
@@ -467,6 +185,10 @@ interactive environment for the functional language Haskell.")
(assoc-ref %build-inputs "ncurses") "/lib")
(string-append "--with-curses-includes="
(assoc-ref %build-inputs "ncurses") "/include"))
+ ;; FIXME: The user-guide needs dblatex, docbook-xsl and docbook-utils.
+ ;; Currently we do not have the last one.
+ ;; #:make-flags
+ ;; (list "BUILD_DOCBOOK_HTML = YES")
#:phases
(modify-phases %standard-phases
(add-after 'unpack 'unpack-testsuite
@@ -475,6 +197,12 @@ interactive environment for the functional language Haskell.")
(assoc-ref inputs "ghc-testsuite")
"--strip-components=1")
#t))
+ (add-after 'unpack-testsuite 'unpack-bin
+ (lambda* (#:key inputs #:allow-other-keys)
+ (mkdir-p "./ghc-bin/usr")
+ (with-directory-excursion "./ghc-bin"
+ (invoke "tar" "xvf" (assoc-ref inputs "ghc-binary")))
+ #t))
;; This phase patches the 'ghc-pkg' command so that it sorts the list
;; of packages in the binary cache it generates.
(add-before 'build 'fix-ghc-pkg-nondeterminism
@@ -523,17 +251,83 @@ interactive environment for the functional language Haskell.")
(("/bin/ls") (which "ls"))
(("/bin/rm") "rm"))
#t))
- (add-before 'build 'fix-environment
+ (add-before 'configure 'fix-environment
(lambda _
(unsetenv "GHC_PACKAGE_PATH")
(setenv "CONFIG_SHELL" (which "bash"))
+ #t))
+ (add-after 'fix-environment 'configure-bin
+ (lambda* (#:key inputs outputs #:allow-other-keys)
+ (let* ((ghc-bootstrap-path (string-append (getcwd) "/ghc-bin"))
+ (ghc-bootstrap-prefix
+ (string-append ghc-bootstrap-path "/usr" ))
+ (binaries
+ '("./utils/hpc/dist-install/build/tmp/hpc"
+ "./utils/haddock/dist/build/tmp/haddock"
+ "./utils/hsc2hs/dist-install/build/tmp/hsc2hs"
+ "./utils/runghc/dist-install/build/tmp/runghc"
+ "./utils/ghc-cabal/dist-install/build/tmp/ghc-cabal"
+ "./utils/hp2ps/dist/build/tmp/hp2ps"
+ "./utils/ghc-pkg/dist-install/build/tmp/ghc-pkg"
+ "./utils/unlit/dist/build/tmp/unlit"
+ "./ghc/stage2/build/tmp/ghc-stage2"))
+ (gmp (assoc-ref inputs "gmp"))
+ (gmp-lib (string-append gmp "/lib"))
+ (gmp-include (string-append gmp "/include"))
+ (ncurses-lib
+ (string-append (assoc-ref inputs "ncurses") "/lib"))
+ (ld-so (string-append (assoc-ref inputs "libc")
+ ,(glibc-dynamic-linker)))
+ (libtinfo-dir
+ (string-append ghc-bootstrap-prefix
+ "/lib/ghc-8.2.2/terminfo-0.4.1.0")))
+ (with-directory-excursion
+ (string-append ghc-bootstrap-path "/ghc-8.2.2")
+ (setenv "LD_LIBRARY_PATH" gmp-lib)
+ ;; The binaries have "/lib64/ld-linux-x86-64.so.2" hardcoded.
+ (for-each
+ (cut invoke "patchelf" "--set-interpreter" ld-so <>)
+ binaries)
+ ;; The binaries include a reference to libtinfo.so.5 which
+ ;; is a subset of libncurses.so.5. We create a symlink in a
+ ;; directory included in the bootstrap binaries rpath.
+ (mkdir-p libtinfo-dir)
+ (symlink
+ (string-append ncurses-lib "/libncursesw.so."
+ ;; Extract "6.0" from "6.0-20170930" if a
+ ;; dash-separated version tag exists.
+ ,(let* ((v (package-version ncurses))
+ (d (or (string-index v #\-)
+ (string-length v))))
+ (version-major+minor (string-take v d))))
+ (string-append libtinfo-dir "/libtinfo.so.5"))
+
+ (setenv "PATH"
+ (string-append (getenv "PATH") ":"
+ ghc-bootstrap-prefix "/bin"))
+ (invoke
+ (string-append (getcwd) "/configure")
+ (string-append "--prefix=" ghc-bootstrap-prefix)
+ (string-append "--with-gmp-libraries=" gmp-lib)
+ (string-append "--with-gmp-includes=" gmp-include))))
+ #t))
+ (add-after 'configure-bin 'install-bin
+ (lambda _
+ (with-directory-excursion "./ghc-bin/ghc-8.2.2"
+ (invoke "make" "install"))
#t)))))
(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))))))
+ (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)))
(define-public ghc-8.6
(package (inherit ghc-8.4)
@@ -579,7 +373,10 @@ interactive environment for the functional language Haskell.")
(("^test\\('T8108'") "# guix skipped: test('T8108'"))
(substitute* "libraries/unix/tests/libposix/all.T"
(("^test\\('posix010'") "# guix skipped: test('posix010'"))
- #t))))))
+ #t))
+ (delete 'unpack-bin)
+ (delete 'configure-bin)
+ (delete 'install-bin)))))
(native-search-paths (list (search-path-specification
(variable "GHC_PACKAGE_PATH")
(files (list
--
2.26.2