gnu: libdvdcss: Update to 1.4.3.
[jackhill/guix/guix.git] / gnu / packages / haskell.scm
index d86daa5..09732fc 100644 (file)
@@ -4,9 +4,9 @@
 ;;; Copyright © 2015 Paul van der Walt <paul@denknerd.org>
 ;;; Copyright © 2015, 2019 Eric Bavier <bavier@member.fsf.org>
 ;;; Copyright © 2016, 2018, 2019 Ludovic Courtès <ludo@gnu.org>
-;;; Copyright © 2016, 2017 ng0 <ng0@n0.is>
+;;; Copyright © 2016, 2017 Nikita <nikita@n0.is>
 ;;; Copyright © 2016 Efraim Flashner <efraim@flashner.co.il>
-;;; Copyright © 2015, 2016, 2017, 2018, 2019 Ricardo Wurmus <rekado@elephly.net>
+;;; Copyright © 2015, 2016, 2017, 2018, 2019, 2020 Ricardo Wurmus <rekado@elephly.net>
 ;;; Copyright © 2016, 2017 David Craven <david@craven.ch>
 ;;; Copyright © 2017 Danny Milosavljevic <dannym@scratchpost.org>
 ;;; Copyright © 2017 Peter Mikkelsen <petermikkelsen10@gmail.com>
 ;;; Copyright © 2017 rsiddharth <s@ricketyspace.net>
 ;;; Copyright © 2017, 2018, 2019 Tobias Geerinckx-Rice <me@tobias.gr>
 ;;; Copyright © 2018 Tonton <tonton@riseup.net>
-;;; Copyright © 2018, 2019 Timothy Sample <samplet@ngyro.com>
+;;; Copyright © 2018, 2019, 2020 Timothy Sample <samplet@ngyro.com>
 ;;; Copyright © 2018 Arun Isaac <arunisaac@systemreboot.net>
 ;;; Copyright © 2018, 2019 Gabriel Hondet <gabrielhondet@gmail.com>
 ;;; Copyright © 2019 Robert Vollmert <rob@vllmrt.net>
 ;;; Copyright © 2019 Jacob MacDonald <jaccarmac@gmail.com>
+;;; Copyright © 2020 Marius Bakke <mbakke@fastmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
 
 (define-module (gnu packages haskell)
   #:use-module (gnu packages)
-  #:use-module (gnu packages base)
   #:use-module (gnu packages bootstrap)
   #:use-module (gnu packages elf)
-  #:use-module (gnu packages gcc)
   #:use-module (gnu packages ghostscript)
   #:use-module (gnu packages libffi)
   #:use-module (gnu packages lisp)
@@ -48,6 +47,7 @@
   #:use-module (gnu packages ncurses)
   #:use-module (gnu packages perl)
   #:use-module (gnu packages python)
+  #:use-module (gnu packages version-control)
   #:use-module (guix build-system gnu)
   #:use-module (guix download)
   #:use-module (guix git-download)
@@ -172,10 +172,6 @@ top of CLISP.")
        ;; 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=<triplet>, because the configure script
        ;; auto-detects slightly different triplets for --host and --target and
        ;; then complains that they don't match.
@@ -183,11 +179,8 @@ top of CLISP.")
 
        #: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="
@@ -214,7 +207,7 @@ top of CLISP.")
             (with-directory-excursion ".."
               (copy-file (assoc-ref inputs "ghc-testsuite")
                          "ghc-testsuite.tar.xz")
-              (system* "tar" "xvf" "ghc-testsuite.tar.xz"))
+              (invoke "tar" "xvf" "ghc-testsuite.tar.xz"))
             (substitute*
                 (list "testsuite/timeout/Makefile"
                       "testsuite/timeout/timeout.py"
@@ -233,7 +226,7 @@ top of CLISP.")
              (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"))))
+               (invoke "tar" "xvf" "ghc-bin.tar.xz")))
            (alist-cons-before
             'install-bin 'configure-bin
             (lambda* (#:key inputs outputs #:allow-other-keys)
@@ -265,7 +258,7 @@ top of CLISP.")
                   (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 <>)
+                   (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
@@ -284,7 +277,7 @@ top of CLISP.")
                   (setenv "PATH"
                           (string-append (getenv "PATH") ":"
                                          ghc-bootstrap-prefix "/bin"))
-                  (system*
+                  (invoke
                    (string-append (getcwd) "/configure")
                    (string-append "--prefix=" ghc-bootstrap-prefix)
                    (string-append "--with-gmp-libraries=" gmp-lib)
@@ -294,7 +287,7 @@ top of CLISP.")
              (lambda* (#:key inputs outputs #:allow-other-keys)
                (with-directory-excursion
                    (string-append ghc-bootstrap-path "/ghc-7.8.4")
-                 (zero? (system* "make" "install"))))
+                 (invoke "make" "install")))
              %standard-phases)))))))
     (native-search-paths (list (search-path-specification
                                 (variable "GHC_PACKAGE_PATH")
@@ -321,9 +314,7 @@ interactive environment for the functional language Haskell.")
       (sha256
        (base32 "1c8qc4fhkycynk4g1f9hvk53dj6a1vvqi6bklqznns6hw59m8qhi"))
       (patches
-       (search-patches
-        "ghc-dont-pass-linker-flags-via-response-files.patch"
-        "ghc-8.0-fall-back-to-madv_dontneed.patch"))))
+       (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"))
@@ -351,10 +342,6 @@ interactive environment for the functional language Haskell.")
        ;; 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=<triplet>, because the configure script
        ;; auto-detects slightly different triplets for --host and --target and
        ;; then complains that they don't match.
@@ -424,22 +411,18 @@ interactive environment for the functional language Haskell.")
 (define-public ghc-8.4
   (package (inherit ghc-8.0)
     (name "ghc")
-    (version "8.4.3")
+    (version "8.4.4")
     (source
      (origin
        (method url-fetch)
        (uri (string-append "https://www.haskell.org/ghc/dist/"
                            version "/" name "-" version "-src.tar.xz"))
        (sha256
-        (base32 "1mk046vb561j75saz05rghhbkps46ym5aci4264dwc2qk3dayixf"))))
+        (base32 "1ch4j2asg7pr52ai1hwzykxyj553wndg7wq93i47ql4fllspf48i"))))
     (inputs
      `(("gmp" ,gmp)
        ("ncurses" ,ncurses)
-       ("libffi" ,libffi)
-       ("target-binutils" ,binutils)
-       ("target-gcc" ,gcc)
-       ("target-ld-wrapper" ,(make-ld-wrapper "ld-wrapper"
-                                              #:binutils binutils))))
+       ("libffi" ,libffi)))
     (native-inputs
      `(("perl" ,perl)
        ("python" ,python)               ; for tests
@@ -454,17 +437,13 @@ interactive environment for the functional language Haskell.")
                  version "/" name "-" version "-testsuite.tar.xz"))
            (sha256
             (base32
-             "1z55b1z0m3plqd2d1ks6w5wvx7igm7zsk3i4v7cms003z0as0hzz"))))))
+             "0s8lf9sxj7n89pjagi58b3fahnp34qvmwhnn0j1fbg6955vbrfj6"))))))
     (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=<triplet>, because the configure script
        ;; auto-detects slightly different triplets for --host and --target and
        ;; then complains that they don't match.
@@ -514,9 +493,9 @@ interactive environment for the functional language Haskell.")
          ;; plain command names.
          (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")))
+             (let ((binutils (assoc-ref inputs "binutils"))
+                   (gcc (assoc-ref inputs "gcc"))
+                   (ld-wrapper (assoc-ref inputs "ld-wrapper")))
                (setenv "CC" (string-append gcc "/bin/gcc"))
                (setenv "CXX" (string-append gcc "/bin/g++"))
                (setenv "LD" (string-append ld-wrapper "/bin/ld"))
@@ -573,6 +552,7 @@ interactive environment for the functional language Haskell.")
            (uri (string-append
                  "https://www.haskell.org/ghc/dist/"
                  version "/" name "-" version "-testsuite.tar.xz"))
+           (patches (search-patches "ghc-testsuite-dlopen-pie.patch"))
            (sha256
             (base32
              "0pw9r91g2np3i806g2f4f8z4jfdd7mx226cmdizk4swa7av1qf91"))))
@@ -588,10 +568,36 @@ interactive environment for the functional language Haskell.")
                ,make-flags))
        ((#:phases phases '%standard-phases)
         `(modify-phases ,phases
-           ;; These two tests refer to the root user, which doesn't exist
-           ;; (see <https://bugs.gnu.org/36692>).
+           (add-after 'install 'remove-unnecessary-references
+             (lambda* (#:key outputs #:allow-other-keys)
+               (substitute* (find-files (string-append (assoc-ref outputs "out") "/lib/")
+                                        "settings")
+                 (("/gnu/store/.*/bin/(.*)" m program) program))
+
+               ;; Remove references to "doc" output from "out" by rewriting
+               ;; the "haddock-interfaces" fields and removing the optional
+               ;; "haddock-html" field in the generated .conf files.
+               (let ((doc (assoc-ref outputs "doc"))
+                     (out (assoc-ref outputs "out")))
+                 (with-fluids ((%default-port-encoding #f))
+                   (for-each (lambda (config-file)
+                               (substitute* config-file
+                                 (("^haddock-html: .*") "\n")
+                                 (((format #f "^haddock-interfaces: ~a" doc))
+                                  (string-append "haddock-interfaces: " out))))
+                             (find-files (string-append out "/lib") ".conf")))
+                 ;; Move the referenced files to the "out" output.
+                 (for-each (lambda (haddock-file)
+                             (let* ((subdir (string-drop haddock-file (string-length doc)))
+                                    (new    (string-append out subdir)))
+                               (mkdir-p (dirname new))
+                               (rename-file haddock-file new)))
+                           (find-files doc "\\.haddock$")))
+               #t))
            (add-after 'unpack-testsuite 'skip-tests
              (lambda _
+               ;; These two tests refer to the root user, which doesn't exist
+               ;; (see <https://bugs.gnu.org/36692>).
                (substitute* "libraries/unix/tests/all.T"
                  (("^test\\('T8108'") "# guix skipped: test('T8108'"))
                (substitute* "libraries/unix/tests/libposix/all.T"
@@ -604,7 +610,54 @@ interactive environment for the functional language Haskell.")
                                 (file-pattern ".*\\.conf\\.d$")
                                 (file-type 'directory))))))
 
-(define-public ghc-8 ghc-8.4)
+(define-public ghc-8.8
+  (package (inherit ghc-8.6)
+    (name "ghc")
+    (version "8.8.3")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (string-append "https://www.haskell.org/ghc/dist/"
+                           version "/ghc-" version "-src.tar.xz"))
+       (sha256
+        (base32 "128g932i3wix6ic03v04nh5755vyjiidzri9iybwad72yfmc1p70"))))
+    (native-inputs
+     `(("ghc-bootstrap" ,ghc-8.6)
+       ("ghc-testsuite"
+        ,(origin
+           (method url-fetch)
+           (uri (string-append
+                 "https://www.haskell.org/ghc/dist/"
+                 version "/ghc-" version "-testsuite.tar.xz"))
+           (patches (search-patches "ghc-testsuite-dlopen-pie.patch"))
+           (sha256
+            (base32
+             "1l32mp94ll72skfsq1g2fqax4bkiw8b85gr3wd0bbqsqyi9a9jpr"))))
+       ("git" ,git)                     ; invoked during tests
+       ,@(filter (match-lambda
+                   (("ghc-bootstrap" . _) #f)
+                   (("ghc-testsuite" . _) #f)
+                   (_ #t))
+                 (package-native-inputs ghc-8.6))))
+    (arguments
+     (substitute-keyword-arguments (package-arguments ghc-8.6)
+       ((#:phases phases '%standard-phases)
+        `(modify-phases ,phases
+           (add-after 'unpack-testsuite 'skip-more-tests
+             (lambda _
+               ;; XXX: This test fails because our ld-wrapper script
+               ;; mangles the response file passed to the linker.
+               (substitute* "testsuite/tests/hp2ps/all.T"
+                 (("^test\\('T15904'") "# guix skipped: test('T15904'"))
+               #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-8 ghc-8.6)
 
 (define-public ghc ghc-8)