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