diff --git a/gnu/packages/haskell.scm b/gnu/packages/haskell.scm index 7347c8753..2dd1d0c66 100644 --- a/gnu/packages/haskell.scm +++ b/gnu/packages/haskell.scm @@ -33,6 +33,7 @@ (define-module (gnu packages haskell) #:use-module (gnu packages) + #:use-module (gnu packages base) #:use-module (gnu packages bootstrap) #:use-module (gnu packages check) #:use-module (gnu packages compression) @@ -320,7 +321,7 @@ top of CLISP.") interactive environment for the functional language Haskell.") (license license:bsd-3))) -(define-public ghc-8 +(define-public ghc-8.0 (package (name "ghc") (version "8.0.2") @@ -432,7 +433,129 @@ interactive environment for the functional language Haskell.") interactive environment for the functional language Haskell.") (license license:bsd-3))) -(define-public ghc ghc-8) +(define-public ghc-8 + (package + (inherit ghc-8.0) + (name "ghc") + (version "8.4.3") + (source + (origin + (method url-fetch) + (uri (string-append "https://www.haskell.org/ghc/dist/" + version "/" name "-" version "-src.tar.xz")) + (sha256 + (base32 + "1mk046vb561j75saz05rghhbkps46ym5aci4264dwc2qk3dayixf")))) + (inputs + `(("gmp" ,gmp) + ("ncurses" ,ncurses) + ("libffi" ,libffi) + ("target-binutils" ,binutils) + ("target-gcc" ,gcc) + ("target-ld-wrapper" ,(make-ld-wrapper "ld-wrapper" + #:binutils binutils)))) + (native-inputs + `(("perl" ,perl) + ("python" ,python) ; for tests + ("ghostscript" ,ghostscript) ; for tests + ;; GHC 8.4.3 is built with GHC 8. + ("ghc-bootstrap" ,ghc-8.0) + ("ghc-testsuite" + ,(origin + (method url-fetch) + (uri (string-append + "https://www.haskell.org/ghc/dist/" + version "/" name "-" version "-testsuite.tar.xz")) + (sha256 + (base32 + "1z55b1z0m3plqd2d1ks6w5wvx7igm7zsk3i4v7cms003z0as0hzz")))))) + (arguments + `(#:test-target "test" + ;; We get a smaller number of test failures by disabling parallel test + ;; execution. + #:parallel-tests? #f + + ;; The DSOs use $ORIGIN to refer to each other, but (guix build + ;; gremlin) doesn't support it yet, so skip this phase. + #:validate-runpath? #f + + ;; Don't pass --build=, 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) + (invoke "tar" "xvf" + (assoc-ref inputs "ghc-testsuite") + "--strip-components=1") + #t)) + (add-after 'unpack-testsuite 'fix-shell-wrappers + (lambda _ + (substitute* '("driver/ghci/ghc.mk" + "utils/mkdirhier/ghc.mk" + "rules/shell-wrapper.mk") + (("echo '#!/bin/sh'") + (format #f "echo '#!~a'" (which "sh")))) + #t)) + (add-before 'configure 'set-target-programs + (lambda* (#:key inputs #:allow-other-keys) + (let ((binutils (assoc-ref inputs "target-binutils")) + (gcc (assoc-ref inputs "target-gcc")) + (ld-wrapper (assoc-ref inputs "target-ld-wrapper"))) + (setenv "CC" (string-append gcc "/bin/gcc")) + (setenv "CXX" (string-append gcc "/bin/g++")) + (setenv "LD" (string-append ld-wrapper "/bin/ld")) + (setenv "NM" (string-append binutils "/bin/nm")) + (setenv "RANLIB" (string-append binutils "/bin/ranlib")) + (setenv "STRIP" (string-append binutils "/bin/strip")) + ;; The 'ar' command does not follow the same pattern. + (setenv "fp_prog_ar" (string-append binutils "/bin/ar"))))) + (add-before 'build 'fix-references + (lambda _ + (substitute* '("testsuite/timeout/Makefile" + "testsuite/timeout/timeout.py" + "testsuite/timeout/timeout.hs" + "testsuite/tests/programs/life_space_leak/life.test" + ;; libraries + "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")) + (("/bin/rm") "rm")) + #t)) + (add-before 'build 'fix-environment + (lambda _ + (unsetenv "GHC_PACKAGE_PATH") + (setenv "CONFIG_SHELL" (which "bash")) + #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)))))) + +(define-public ghc ghc-8.0) (define-public ghc-hostname (package