Merge branch 'master' into core-updates
[jackhill/guix/guix.git] / gnu / packages / haskell.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2015, 2016 Federico Beffa <beffa@fbengineering.ch>
3 ;;; Copyright © 2015 Siniša Biđin <sinisa@bidin.eu>
4 ;;; Copyright © 2015 Paul van der Walt <paul@denknerd.org>
5 ;;; Copyright © 2015, 2019 Eric Bavier <bavier@member.fsf.org>
6 ;;; Copyright © 2016, 2018, 2019 Ludovic Courtès <ludo@gnu.org>
7 ;;; Copyright © 2016, 2017 ng0 <ng0@n0.is>
8 ;;; Copyright © 2016 Efraim Flashner <efraim@flashner.co.il>
9 ;;; Copyright © 2015, 2016, 2017, 2018, 2019 Ricardo Wurmus <rekado@elephly.net>
10 ;;; Copyright © 2016, 2017 David Craven <david@craven.ch>
11 ;;; Copyright © 2017 Danny Milosavljevic <dannym@scratchpost.org>
12 ;;; Copyright © 2017 Peter Mikkelsen <petermikkelsen10@gmail.com>
13 ;;; Copyright © 2017, 2018 Alex Vong <alexvong1995@gmail.com>
14 ;;; Copyright © 2017 rsiddharth <s@ricketyspace.net>
15 ;;; Copyright © 2017, 2018, 2019 Tobias Geerinckx-Rice <me@tobias.gr>
16 ;;; Copyright © 2018 Tonton <tonton@riseup.net>
17 ;;; Copyright © 2018, 2019 Timothy Sample <samplet@ngyro.com>
18 ;;; Copyright © 2018 Arun Isaac <arunisaac@systemreboot.net>
19 ;;; Copyright © 2018, 2019 Gabriel Hondet <gabrielhondet@gmail.com>
20 ;;; Copyright © 2019 Robert Vollmert <rob@vllmrt.net>
21 ;;; Copyright © 2019 Jacob MacDonald <jaccarmac@gmail.com>
22 ;;; Copyright © 2020 Marius Bakke <mbakke@fastmail.com>
23 ;;;
24 ;;; This file is part of GNU Guix.
25 ;;;
26 ;;; GNU Guix is free software; you can redistribute it and/or modify it
27 ;;; under the terms of the GNU General Public License as published by
28 ;;; the Free Software Foundation; either version 3 of the License, or (at
29 ;;; your option) any later version.
30 ;;;
31 ;;; GNU Guix is distributed in the hope that it will be useful, but
32 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
33 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
34 ;;; GNU General Public License for more details.
35 ;;;
36 ;;; You should have received a copy of the GNU General Public License
37 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
38
39 (define-module (gnu packages haskell)
40 #:use-module (gnu packages)
41 #:use-module (gnu packages bootstrap)
42 #:use-module (gnu packages elf)
43 #:use-module (gnu packages ghostscript)
44 #:use-module (gnu packages libffi)
45 #:use-module (gnu packages lisp)
46 #:use-module (gnu packages multiprecision)
47 #:use-module (gnu packages ncurses)
48 #:use-module (gnu packages perl)
49 #:use-module (gnu packages python)
50 #:use-module (guix build-system gnu)
51 #:use-module (guix download)
52 #:use-module (guix git-download)
53 #:use-module ((guix licenses) #:prefix license:)
54 #:use-module (guix packages)
55 #:use-module (guix utils)
56 #:use-module (ice-9 match)
57 #:use-module (ice-9 regex))
58
59 (define-public cl-yale-haskell
60 (let ((commit "85f94c72a16c5f70301dd8db04cde9de2d7dd270")
61 (revision "1"))
62 (package
63 (name "cl-yale-haskell")
64 (version (string-append "2.0.5-" revision "." (string-take commit 9)))
65 (source (origin
66 (method git-fetch)
67 (uri (git-reference
68 (url "https://git.elephly.net/software/yale-haskell.git")
69 (commit commit)))
70 (file-name (string-append "yale-haskell-" commit "-checkout"))
71 (sha256
72 (base32
73 "0bal3m6ryrjamz5p93bhs9rp5msk8k7lpcqr44wd7xs9b9k8w74g"))))
74 (build-system gnu-build-system)
75 (arguments
76 `(#:tests? #f ; no tests
77 ;; Stripping binaries leads to a broken executable lisp system image.
78 #:strip-binaries? #f
79 #:make-flags
80 (list (string-append "PREFIX=" (assoc-ref %outputs "out")))
81 #:phases
82 (modify-phases %standard-phases
83 (replace 'configure
84 (lambda _
85 (setenv "PRELUDE" "./progs/prelude")
86 (setenv "HASKELL_LIBRARY" "./progs/lib")
87 (setenv "PRELUDEBIN" "./progs/prelude/clisp")
88 (setenv "HASKELLPROG" "./bin/clisp-haskell")
89 #t)))))
90 (inputs
91 `(("clisp" ,clisp)))
92 (home-page "https://git.elephly.net/software/yale-haskell.git")
93 (synopsis "Port of the Yale Haskell system to CLISP")
94 (description "This package provides the Yale Haskell system running on
95 top of CLISP.")
96 (license license:bsd-4))))
97
98 (define ghc-bootstrap-x86_64-7.8.4
99 (origin
100 (method url-fetch)
101 (uri
102 "https://www.haskell.org/ghc/dist/7.8.4/ghc-7.8.4-x86_64-unknown-linux-deb7.tar.xz")
103 (sha256
104 (base32
105 "13azsl53xgj20mi1hj9x0xb32vvcvs6cpmvwx6znxhas7blh0bpn"))))
106
107 (define ghc-bootstrap-i686-7.8.4
108 (origin
109 (method url-fetch)
110 (uri
111 "https://www.haskell.org/ghc/dist/7.8.4/ghc-7.8.4-i386-unknown-linux-deb7.tar.xz")
112 (sha256
113 (base32
114 "0wj5s435j0zgww70bj1d3f6wvnnpzlxwvwcyh2qv4qjq5z8j64kg"))))
115
116 ;; 43 tests out of 3965 fail.
117 ;;
118 ;; Most of them do not appear to be serious:
119 ;;
120 ;; - some tests generate files referring to "/bin/sh" and "/bin/ls". I've not
121 ;; figured out how these references are generated.
122 ;;
123 ;; - Some tests allocate more memory than expected (ca. 3% above upper limit)
124 ;;
125 ;; - Some tests try to load unavailable libriries: Control.Concurrent.STM,
126 ;; Data.Vector, Control.Monad.State.
127 ;;
128 ;; - Test posix010 tries to check the existence of a user on the system:
129 ;; getUserEntryForName: does not exist (no such user)
130 (define-public ghc-7
131 (package
132 (name "ghc")
133 (version "7.10.2")
134 (source
135 (origin
136 (method url-fetch)
137 (uri (string-append "https://www.haskell.org/ghc/dist/"
138 version "/" name "-" version "-src.tar.xz"))
139 (sha256
140 (base32
141 "1x8m4rp2v7ydnrz6z9g8x7z3x3d3pxhv2pixy7i7hkbqbdsp7kal"))))
142 (build-system gnu-build-system)
143 (supported-systems '("i686-linux" "x86_64-linux"))
144 (outputs '("out" "doc"))
145 (inputs
146 `(("gmp" ,gmp)
147 ("ncurses" ,ncurses)
148 ("libffi" ,libffi)
149 ("ghc-testsuite"
150 ,(origin
151 (method url-fetch)
152 (uri (string-append
153 "https://www.haskell.org/ghc/dist/"
154 version "/" name "-" version "-testsuite.tar.xz"))
155 (sha256
156 (base32
157 "0qp9da9ar87zbyn6wjgacd2ic1vgzbi3cklxnhsmjqyafv9qaj4b"))))))
158 (native-inputs
159 `(("perl" ,perl)
160 ("python" ,python-2) ; for tests (fails with python-3)
161 ("ghostscript" ,ghostscript) ; for tests
162 ("patchelf" ,patchelf)
163 ;; GHC is built with GHC. Therefore we need bootstrap binaries.
164 ("ghc-binary"
165 ,(if (string-match "x86_64" (or (%current-target-system) (%current-system)))
166 ghc-bootstrap-x86_64-7.8.4
167 ghc-bootstrap-i686-7.8.4))))
168 (arguments
169 `(#:test-target "test"
170 ;; We get a smaller number of test failures by disabling parallel test
171 ;; execution.
172 #:parallel-tests? #f
173
174 ;; Don't pass --build=<triplet>, because the configure script
175 ;; auto-detects slightly different triplets for --host and --target and
176 ;; then complains that they don't match.
177 #:build #f
178
179 #:modules ((guix build gnu-build-system)
180 (guix build utils)
181 (guix build rpath)
182 (srfi srfi-26)
183 (srfi srfi-1))
184 #:imported-modules (,@%gnu-build-system-modules
185 (guix build rpath))
186 #:configure-flags
187 (list
188 (string-append "--with-gmp-libraries="
189 (assoc-ref %build-inputs "gmp") "/lib")
190 (string-append "--with-gmp-includes="
191 (assoc-ref %build-inputs "gmp") "/include")
192 "--with-system-libffi"
193 (string-append "--with-ffi-libraries="
194 (assoc-ref %build-inputs "libffi") "/lib")
195 (string-append "--with-ffi-includes="
196 (assoc-ref %build-inputs "libffi") "/include"))
197 ;; FIXME: The user-guide needs dblatex, docbook-xsl and docbook-utils.
198 ;; Currently we do not have the last one.
199 ;; #:make-flags
200 ;; (list "BUILD_DOCBOOK_HTML = YES")
201 #:phases
202 (let* ((ghc-bootstrap-path
203 (string-append (getcwd) "/" ,name "-" ,version "/ghc-bin"))
204 (ghc-bootstrap-prefix
205 (string-append ghc-bootstrap-path "/usr" )))
206 (alist-cons-after
207 'unpack-bin 'unpack-testsuite-and-fix-bins
208 (lambda* (#:key inputs outputs #:allow-other-keys)
209 (with-directory-excursion ".."
210 (copy-file (assoc-ref inputs "ghc-testsuite")
211 "ghc-testsuite.tar.xz")
212 (system* "tar" "xvf" "ghc-testsuite.tar.xz"))
213 (substitute*
214 (list "testsuite/timeout/Makefile"
215 "testsuite/timeout/timeout.py"
216 "testsuite/timeout/timeout.hs"
217 "testsuite/tests/rename/prog006/Setup.lhs"
218 "testsuite/tests/programs/life_space_leak/life.test"
219 "libraries/process/System/Process/Internals.hs"
220 "libraries/unix/cbits/execvpe.c")
221 (("/bin/sh") (which "sh"))
222 (("/bin/rm") "rm"))
223 #t)
224 (alist-cons-after
225 'unpack 'unpack-bin
226 (lambda* (#:key inputs outputs #:allow-other-keys)
227 (mkdir-p ghc-bootstrap-prefix)
228 (with-directory-excursion ghc-bootstrap-path
229 (copy-file (assoc-ref inputs "ghc-binary")
230 "ghc-bin.tar.xz")
231 (zero? (system* "tar" "xvf" "ghc-bin.tar.xz"))))
232 (alist-cons-before
233 'install-bin 'configure-bin
234 (lambda* (#:key inputs outputs #:allow-other-keys)
235 (let* ((binaries
236 (list
237 "./utils/ghc-pwd/dist-install/build/tmp/ghc-pwd"
238 "./utils/hpc/dist-install/build/tmp/hpc"
239 "./utils/haddock/dist/build/tmp/haddock"
240 "./utils/hsc2hs/dist-install/build/tmp/hsc2hs"
241 "./utils/runghc/dist-install/build/tmp/runghc"
242 "./utils/ghc-cabal/dist-install/build/tmp/ghc-cabal"
243 "./utils/hp2ps/dist/build/tmp/hp2ps"
244 "./utils/ghc-pkg/dist-install/build/tmp/ghc-pkg"
245 "./utils/unlit/dist/build/tmp/unlit"
246 "./ghc/stage2/build/tmp/ghc-stage2"))
247 (gmp (assoc-ref inputs "gmp"))
248 (gmp-lib (string-append gmp "/lib"))
249 (gmp-include (string-append gmp "/include"))
250 (ncurses-lib
251 (string-append (assoc-ref inputs "ncurses") "/lib"))
252 (ld-so (string-append (assoc-ref inputs "libc")
253 ,(glibc-dynamic-linker)))
254 (libtinfo-dir
255 (string-append ghc-bootstrap-prefix
256 "/lib/ghc-7.8.4/terminfo-0.4.0.0")))
257 (with-directory-excursion
258 (string-append ghc-bootstrap-path "/ghc-7.8.4")
259 (setenv "CONFIG_SHELL" (which "bash"))
260 (setenv "LD_LIBRARY_PATH" gmp-lib)
261 ;; The binaries have "/lib64/ld-linux-x86-64.so.2" hardcoded.
262 (for-each
263 (cut system* "patchelf" "--set-interpreter" ld-so <>)
264 binaries)
265 ;; The binaries include a reference to libtinfo.so.5 which
266 ;; is a subset of libncurses.so.5. We create a symlink in a
267 ;; directory included in the bootstrap binaries rpath.
268 (mkdir-p libtinfo-dir)
269 (symlink
270 (string-append ncurses-lib "/libncursesw.so."
271 ;; Extract "6.0" from "6.0-20170930" if a
272 ;; dash-separated version tag exists.
273 ,(let* ((v (package-version ncurses))
274 (d (or (string-index v #\-)
275 (string-length v))))
276 (version-major+minor (string-take v d))))
277 (string-append libtinfo-dir "/libtinfo.so.5"))
278
279 (setenv "PATH"
280 (string-append (getenv "PATH") ":"
281 ghc-bootstrap-prefix "/bin"))
282 (system*
283 (string-append (getcwd) "/configure")
284 (string-append "--prefix=" ghc-bootstrap-prefix)
285 (string-append "--with-gmp-libraries=" gmp-lib)
286 (string-append "--with-gmp-includes=" gmp-include)))))
287 (alist-cons-before
288 'configure 'install-bin
289 (lambda* (#:key inputs outputs #:allow-other-keys)
290 (with-directory-excursion
291 (string-append ghc-bootstrap-path "/ghc-7.8.4")
292 (zero? (system* "make" "install"))))
293 %standard-phases)))))))
294 (native-search-paths (list (search-path-specification
295 (variable "GHC_PACKAGE_PATH")
296 (files (list
297 (string-append "lib/ghc-" version)))
298 (file-pattern ".*\\.conf\\.d$")
299 (file-type 'directory))))
300 (home-page "https://www.haskell.org/ghc")
301 (synopsis "The Glasgow Haskell Compiler")
302 (description
303 "The Glasgow Haskell Compiler (GHC) is a state-of-the-art compiler and
304 interactive environment for the functional language Haskell.")
305 (license license:bsd-3)))
306
307 (define-public ghc-8.0
308 (package
309 (name "ghc")
310 (version "8.0.2")
311 (source
312 (origin
313 (method url-fetch)
314 (uri (string-append "https://www.haskell.org/ghc/dist/"
315 version "/" name "-" version "-src.tar.xz"))
316 (sha256
317 (base32 "1c8qc4fhkycynk4g1f9hvk53dj6a1vvqi6bklqznns6hw59m8qhi"))
318 (patches
319 (search-patches "ghc-8.0-fall-back-to-madv_dontneed.patch"))))
320 (build-system gnu-build-system)
321 (supported-systems '("i686-linux" "x86_64-linux"))
322 (outputs '("out" "doc"))
323 (inputs
324 `(("gmp" ,gmp)
325 ("ncurses" ,ncurses)
326 ("libffi" ,libffi)
327 ("ghc-testsuite"
328 ,(origin
329 (method url-fetch)
330 (uri (string-append
331 "https://www.haskell.org/ghc/dist/"
332 version "/" name "-" version "-testsuite.tar.xz"))
333 (sha256
334 (base32 "1wjc3x68l305bl1h1ijd3yhqp2vqj83lkp3kqbr94qmmkqlms8sj"))))))
335 (native-inputs
336 `(("perl" ,perl)
337 ("python" ,python-2) ; for tests
338 ("ghostscript" ,ghostscript) ; for tests
339 ;; GHC is built with GHC.
340 ("ghc-bootstrap" ,ghc-7)))
341 (arguments
342 `(#:test-target "test"
343 ;; We get a smaller number of test failures by disabling parallel test
344 ;; execution.
345 #:parallel-tests? #f
346
347 ;; Don't pass --build=<triplet>, because the configure script
348 ;; auto-detects slightly different triplets for --host and --target and
349 ;; then complains that they don't match.
350 #:build #f
351
352 #:configure-flags
353 (list
354 (string-append "--with-gmp-libraries="
355 (assoc-ref %build-inputs "gmp") "/lib")
356 (string-append "--with-gmp-includes="
357 (assoc-ref %build-inputs "gmp") "/include")
358 "--with-system-libffi"
359 (string-append "--with-ffi-libraries="
360 (assoc-ref %build-inputs "libffi") "/lib")
361 (string-append "--with-ffi-includes="
362 (assoc-ref %build-inputs "libffi") "/include")
363 (string-append "--with-curses-libraries="
364 (assoc-ref %build-inputs "ncurses") "/lib")
365 (string-append "--with-curses-includes="
366 (assoc-ref %build-inputs "ncurses") "/include"))
367 #:phases
368 (modify-phases %standard-phases
369 (add-after 'unpack 'unpack-testsuite
370 (lambda* (#:key inputs #:allow-other-keys)
371 (with-directory-excursion ".."
372 (copy-file (assoc-ref inputs "ghc-testsuite")
373 "ghc-testsuite.tar.xz")
374 (zero? (system* "tar" "xvf" "ghc-testsuite.tar.xz")))))
375 (add-before 'build 'fix-lib-paths
376 (lambda _
377 (substitute*
378 (list "libraries/process/System/Process/Posix.hs"
379 "libraries/process/tests/process001.hs"
380 "libraries/process/tests/process002.hs"
381 "libraries/unix/cbits/execvpe.c")
382 (("/bin/sh") (which "sh"))
383 (("/bin/ls") (which "ls")))
384 #t))
385 (add-before 'build 'fix-environment
386 (lambda _
387 (unsetenv "GHC_PACKAGE_PATH")
388 (setenv "CONFIG_SHELL" (which "bash"))
389 #t))
390 (add-before 'check 'fix-testsuite
391 (lambda _
392 (substitute*
393 (list "testsuite/timeout/Makefile"
394 "testsuite/timeout/timeout.py"
395 "testsuite/timeout/timeout.hs"
396 "testsuite/tests/programs/life_space_leak/life.test")
397 (("/bin/sh") (which "sh"))
398 (("/bin/rm") "rm"))
399 #t)))))
400 (native-search-paths (list (search-path-specification
401 (variable "GHC_PACKAGE_PATH")
402 (files (list
403 (string-append "lib/ghc-" version)))
404 (file-pattern ".*\\.conf\\.d$")
405 (file-type 'directory))))
406 (home-page "https://www.haskell.org/ghc")
407 (synopsis "The Glasgow Haskell Compiler")
408 (description
409 "The Glasgow Haskell Compiler (GHC) is a state-of-the-art compiler and
410 interactive environment for the functional language Haskell.")
411 (license license:bsd-3)))
412
413 (define-public ghc-8.4
414 (package (inherit ghc-8.0)
415 (name "ghc")
416 (version "8.4.4")
417 (source
418 (origin
419 (method url-fetch)
420 (uri (string-append "https://www.haskell.org/ghc/dist/"
421 version "/" name "-" version "-src.tar.xz"))
422 (sha256
423 (base32 "1ch4j2asg7pr52ai1hwzykxyj553wndg7wq93i47ql4fllspf48i"))))
424 (inputs
425 `(("gmp" ,gmp)
426 ("ncurses" ,ncurses)
427 ("libffi" ,libffi)))
428 (native-inputs
429 `(("perl" ,perl)
430 ("python" ,python) ; for tests
431 ("ghostscript" ,ghostscript) ; for tests
432 ;; GHC 8.4.3 is built with GHC 8.
433 ("ghc-bootstrap" ,ghc-8.0)
434 ("ghc-testsuite"
435 ,(origin
436 (method url-fetch)
437 (uri (string-append
438 "https://www.haskell.org/ghc/dist/"
439 version "/" name "-" version "-testsuite.tar.xz"))
440 (sha256
441 (base32
442 "0s8lf9sxj7n89pjagi58b3fahnp34qvmwhnn0j1fbg6955vbrfj6"))))))
443 (arguments
444 `(#:test-target "test"
445 ;; We get a smaller number of test failures by disabling parallel test
446 ;; execution.
447 #:parallel-tests? #f
448
449 ;; Don't pass --build=<triplet>, because the configure script
450 ;; auto-detects slightly different triplets for --host and --target and
451 ;; then complains that they don't match.
452 #:build #f
453
454 #:configure-flags
455 (list
456 (string-append "--with-gmp-libraries="
457 (assoc-ref %build-inputs "gmp") "/lib")
458 (string-append "--with-gmp-includes="
459 (assoc-ref %build-inputs "gmp") "/include")
460 "--with-system-libffi"
461 (string-append "--with-ffi-libraries="
462 (assoc-ref %build-inputs "libffi") "/lib")
463 (string-append "--with-ffi-includes="
464 (assoc-ref %build-inputs "libffi") "/include")
465 (string-append "--with-curses-libraries="
466 (assoc-ref %build-inputs "ncurses") "/lib")
467 (string-append "--with-curses-includes="
468 (assoc-ref %build-inputs "ncurses") "/include"))
469 #:phases
470 (modify-phases %standard-phases
471 (add-after 'unpack 'unpack-testsuite
472 (lambda* (#:key inputs #:allow-other-keys)
473 (invoke "tar" "xvf"
474 (assoc-ref inputs "ghc-testsuite")
475 "--strip-components=1")
476 #t))
477 ;; This phase patches the 'ghc-pkg' command so that it sorts the list
478 ;; of packages in the binary cache it generates.
479 (add-before 'build 'fix-ghc-pkg-nondeterminism
480 (lambda _
481 (substitute* "utils/ghc-pkg/Main.hs"
482 (("confs = map \\(path </>\\) \\$ filter \\(\".conf\" `isSuffixOf`\\) fs")
483 "confs = map (path </>) $ filter (\".conf\" `isSuffixOf`) (sort fs)"))
484 #t))
485 (add-after 'unpack-testsuite 'fix-shell-wrappers
486 (lambda _
487 (substitute* '("driver/ghci/ghc.mk"
488 "utils/mkdirhier/ghc.mk"
489 "rules/shell-wrapper.mk")
490 (("echo '#!/bin/sh'")
491 (format #f "echo '#!~a'" (which "sh"))))
492 #t))
493 ;; This is necessary because the configure system no longer uses
494 ;; “AC_PATH_” but “AC_CHECK_”, setting the variables to just the
495 ;; plain command names.
496 (add-before 'configure 'set-target-programs
497 (lambda* (#:key inputs #:allow-other-keys)
498 (let ((binutils (assoc-ref inputs "binutils"))
499 (gcc (assoc-ref inputs "gcc"))
500 (ld-wrapper (assoc-ref inputs "ld-wrapper")))
501 (setenv "CC" (string-append gcc "/bin/gcc"))
502 (setenv "CXX" (string-append gcc "/bin/g++"))
503 (setenv "LD" (string-append ld-wrapper "/bin/ld"))
504 (setenv "NM" (string-append binutils "/bin/nm"))
505 (setenv "RANLIB" (string-append binutils "/bin/ranlib"))
506 (setenv "STRIP" (string-append binutils "/bin/strip"))
507 ;; The 'ar' command does not follow the same pattern.
508 (setenv "fp_prog_ar" (string-append binutils "/bin/ar"))
509 #t)))
510 (add-before 'build 'fix-references
511 (lambda _
512 (substitute* '("testsuite/timeout/Makefile"
513 "testsuite/timeout/timeout.py"
514 "testsuite/timeout/timeout.hs"
515 "testsuite/tests/programs/life_space_leak/life.test"
516 ;; libraries
517 "libraries/process/System/Process/Posix.hs"
518 "libraries/process/tests/process001.hs"
519 "libraries/process/tests/process002.hs"
520 "libraries/unix/cbits/execvpe.c")
521 (("/bin/sh") (which "sh"))
522 (("/bin/ls") (which "ls"))
523 (("/bin/rm") "rm"))
524 #t))
525 (add-before 'build 'fix-environment
526 (lambda _
527 (unsetenv "GHC_PACKAGE_PATH")
528 (setenv "CONFIG_SHELL" (which "bash"))
529 #t)))))
530 (native-search-paths (list (search-path-specification
531 (variable "GHC_PACKAGE_PATH")
532 (files (list
533 (string-append "lib/ghc-" version)))
534 (file-pattern ".*\\.conf\\.d$")
535 (file-type 'directory))))))
536
537 (define-public ghc-8.6
538 (package (inherit ghc-8.4)
539 (name "ghc")
540 (version "8.6.5")
541 (source
542 (origin
543 (method url-fetch)
544 (uri (string-append "https://www.haskell.org/ghc/dist/"
545 version "/" name "-" version "-src.tar.xz"))
546 (sha256
547 (base32 "0qg3zsmbk4rkwkc3jpas3zs74qaxmw4sp4v1mhsbj0a0dzls2jjd"))))
548 (native-inputs
549 `(;; GHC 8.6.5 must be built with GHC >= 8.2.
550 ("ghc-bootstrap" ,ghc-8.4)
551 ("ghc-testsuite"
552 ,(origin
553 (method url-fetch)
554 (uri (string-append
555 "https://www.haskell.org/ghc/dist/"
556 version "/" name "-" version "-testsuite.tar.xz"))
557 (patches (search-patches "ghc-testsuite-dlopen-pie.patch"))
558 (sha256
559 (base32
560 "0pw9r91g2np3i806g2f4f8z4jfdd7mx226cmdizk4swa7av1qf91"))))
561 ,@(filter (match-lambda
562 (("ghc-bootstrap" . _) #f)
563 (("ghc-testsuite" . _) #f)
564 (_ #t))
565 (package-native-inputs ghc-8.4))))
566 (arguments
567 (substitute-keyword-arguments (package-arguments ghc-8.4)
568 ((#:make-flags make-flags ''())
569 `(cons "EXTRA_RUNTEST_OPTS=--skip-perf-tests"
570 ,make-flags))
571 ((#:phases phases '%standard-phases)
572 `(modify-phases ,phases
573 (add-after 'unpack-testsuite 'skip-tests
574 (lambda _
575 ;; These two tests refer to the root user, which doesn't exist
576 ;; (see <https://bugs.gnu.org/36692>).
577 (substitute* "libraries/unix/tests/all.T"
578 (("^test\\('T8108'") "# guix skipped: test('T8108'"))
579 (substitute* "libraries/unix/tests/libposix/all.T"
580 (("^test\\('posix010'") "# guix skipped: test('posix010'"))
581 #t))))))
582 (native-search-paths (list (search-path-specification
583 (variable "GHC_PACKAGE_PATH")
584 (files (list
585 (string-append "lib/ghc-" version)))
586 (file-pattern ".*\\.conf\\.d$")
587 (file-type 'directory))))))
588
589 (define-public ghc-8 ghc-8.6)
590
591 (define-public ghc ghc-8)
592
593 ;;; haskell.scm ends here