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> |
2e9c43aa | 22 | ;;; Copyright © Marius Bakke <mbakke@fastmail.com> |
246b3437 FB |
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) | |
d8e85b20 | 40 | #:use-module (gnu packages) |
c0d5b645 | 41 | #:use-module (gnu packages bootstrap) |
246b3437 | 42 | #:use-module (gnu packages elf) |
246b3437 | 43 | #:use-module (gnu packages ghostscript) |
c0d5b645 | 44 | #:use-module (gnu packages libffi) |
95e654ae | 45 | #:use-module (gnu packages lisp) |
246b3437 FB |
46 | #:use-module (gnu packages multiprecision) |
47 | #:use-module (gnu packages ncurses) | |
c0d5b645 | 48 | #:use-module (gnu packages perl) |
c0d5b645 | 49 | #:use-module (gnu packages python) |
c0d5b645 | 50 | #:use-module (guix build-system gnu) |
c0d5b645 | 51 | #:use-module (guix download) |
ee719fba | 52 | #:use-module (guix git-download) |
c0d5b645 DC |
53 | #:use-module ((guix licenses) #:prefix license:) |
54 | #:use-module (guix packages) | |
55 | #:use-module (guix utils) | |
cce84c34 | 56 | #:use-module (ice-9 match) |
dddbc90c | 57 | #:use-module (ice-9 regex)) |
246b3437 | 58 | |
95e654ae RW |
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 | |
98b90194 | 68 | (url "https://git.elephly.net/software/yale-haskell.git") |
95e654ae RW |
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))) | |
98b90194 | 92 | (home-page "https://git.elephly.net/software/yale-haskell.git") |
95e654ae RW |
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 | ||
5868a8bf | 98 | (define ghc-bootstrap-x86_64-7.8.4 |
246b3437 FB |
99 | (origin |
100 | (method url-fetch) | |
5868a8bf FB |
101 | (uri |
102 | "https://www.haskell.org/ghc/dist/7.8.4/ghc-7.8.4-x86_64-unknown-linux-deb7.tar.xz") | |
246b3437 FB |
103 | (sha256 |
104 | (base32 | |
5868a8bf FB |
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")))) | |
246b3437 FB |
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) | |
e2dc97d6 | 130 | (define-public ghc-7 |
246b3437 FB |
131 | (package |
132 | (name "ghc") | |
0e03d76a | 133 | (version "7.10.2") |
246b3437 FB |
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 | |
0e03d76a | 141 | "1x8m4rp2v7ydnrz6z9g8x7z3x3d3pxhv2pixy7i7hkbqbdsp7kal")))) |
246b3437 FB |
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) | |
246b3437 FB |
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 | |
0e03d76a | 157 | "0qp9da9ar87zbyn6wjgacd2ic1vgzbi3cklxnhsmjqyafv9qaj4b")))))) |
246b3437 FB |
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. | |
5868a8bf FB |
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)))) | |
246b3437 FB |
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 | |
fb799cb7 LC |
173 | |
174 | ;; The DSOs use $ORIGIN to refer to each other, but (guix build | |
175 | ;; gremlin) doesn't support it yet, so skip this phase. | |
176 | #:validate-runpath? #f | |
177 | ||
bbd19615 MW |
178 | ;; Don't pass --build=<triplet>, because the configure script |
179 | ;; auto-detects slightly different triplets for --host and --target and | |
180 | ;; then complains that they don't match. | |
181 | #:build #f | |
182 | ||
246b3437 FB |
183 | #:modules ((guix build gnu-build-system) |
184 | (guix build utils) | |
185 | (guix build rpath) | |
186 | (srfi srfi-26) | |
187 | (srfi srfi-1)) | |
caaf1933 | 188 | #:imported-modules (,@%gnu-build-system-modules |
246b3437 FB |
189 | (guix build rpath)) |
190 | #:configure-flags | |
191 | (list | |
192 | (string-append "--with-gmp-libraries=" | |
193 | (assoc-ref %build-inputs "gmp") "/lib") | |
194 | (string-append "--with-gmp-includes=" | |
195 | (assoc-ref %build-inputs "gmp") "/include") | |
196 | "--with-system-libffi" | |
197 | (string-append "--with-ffi-libraries=" | |
198 | (assoc-ref %build-inputs "libffi") "/lib") | |
199 | (string-append "--with-ffi-includes=" | |
200 | (assoc-ref %build-inputs "libffi") "/include")) | |
201 | ;; FIXME: The user-guide needs dblatex, docbook-xsl and docbook-utils. | |
202 | ;; Currently we do not have the last one. | |
203 | ;; #:make-flags | |
204 | ;; (list "BUILD_DOCBOOK_HTML = YES") | |
205 | #:phases | |
206 | (let* ((ghc-bootstrap-path | |
207 | (string-append (getcwd) "/" ,name "-" ,version "/ghc-bin")) | |
208 | (ghc-bootstrap-prefix | |
209 | (string-append ghc-bootstrap-path "/usr" ))) | |
210 | (alist-cons-after | |
48d21d6c | 211 | 'unpack-bin 'unpack-testsuite-and-fix-bins |
246b3437 FB |
212 | (lambda* (#:key inputs outputs #:allow-other-keys) |
213 | (with-directory-excursion ".." | |
214 | (copy-file (assoc-ref inputs "ghc-testsuite") | |
215 | "ghc-testsuite.tar.xz") | |
216 | (system* "tar" "xvf" "ghc-testsuite.tar.xz")) | |
246b3437 FB |
217 | (substitute* |
218 | (list "testsuite/timeout/Makefile" | |
219 | "testsuite/timeout/timeout.py" | |
220 | "testsuite/timeout/timeout.hs" | |
221 | "testsuite/tests/rename/prog006/Setup.lhs" | |
48d21d6c EB |
222 | "testsuite/tests/programs/life_space_leak/life.test" |
223 | "libraries/process/System/Process/Internals.hs" | |
224 | "libraries/unix/cbits/execvpe.c") | |
246b3437 FB |
225 | (("/bin/sh") (which "sh")) |
226 | (("/bin/rm") "rm")) | |
227 | #t) | |
228 | (alist-cons-after | |
229 | 'unpack 'unpack-bin | |
230 | (lambda* (#:key inputs outputs #:allow-other-keys) | |
231 | (mkdir-p ghc-bootstrap-prefix) | |
232 | (with-directory-excursion ghc-bootstrap-path | |
233 | (copy-file (assoc-ref inputs "ghc-binary") | |
234 | "ghc-bin.tar.xz") | |
235 | (zero? (system* "tar" "xvf" "ghc-bin.tar.xz")))) | |
236 | (alist-cons-before | |
237 | 'install-bin 'configure-bin | |
238 | (lambda* (#:key inputs outputs #:allow-other-keys) | |
239 | (let* ((binaries | |
240 | (list | |
241 | "./utils/ghc-pwd/dist-install/build/tmp/ghc-pwd" | |
242 | "./utils/hpc/dist-install/build/tmp/hpc" | |
243 | "./utils/haddock/dist/build/tmp/haddock" | |
244 | "./utils/hsc2hs/dist-install/build/tmp/hsc2hs" | |
245 | "./utils/runghc/dist-install/build/tmp/runghc" | |
246 | "./utils/ghc-cabal/dist-install/build/tmp/ghc-cabal" | |
247 | "./utils/hp2ps/dist/build/tmp/hp2ps" | |
248 | "./utils/ghc-pkg/dist-install/build/tmp/ghc-pkg" | |
249 | "./utils/unlit/dist/build/tmp/unlit" | |
250 | "./ghc/stage2/build/tmp/ghc-stage2")) | |
251 | (gmp (assoc-ref inputs "gmp")) | |
252 | (gmp-lib (string-append gmp "/lib")) | |
253 | (gmp-include (string-append gmp "/include")) | |
254 | (ncurses-lib | |
255 | (string-append (assoc-ref inputs "ncurses") "/lib")) | |
256 | (ld-so (string-append (assoc-ref inputs "libc") | |
257 | ,(glibc-dynamic-linker))) | |
258 | (libtinfo-dir | |
259 | (string-append ghc-bootstrap-prefix | |
260 | "/lib/ghc-7.8.4/terminfo-0.4.0.0"))) | |
261 | (with-directory-excursion | |
0e03d76a | 262 | (string-append ghc-bootstrap-path "/ghc-7.8.4") |
246b3437 FB |
263 | (setenv "CONFIG_SHELL" (which "bash")) |
264 | (setenv "LD_LIBRARY_PATH" gmp-lib) | |
265 | ;; The binaries have "/lib64/ld-linux-x86-64.so.2" hardcoded. | |
266 | (for-each | |
267 | (cut system* "patchelf" "--set-interpreter" ld-so <>) | |
268 | binaries) | |
269 | ;; The binaries include a reference to libtinfo.so.5 which | |
270 | ;; is a subset of libncurses.so.5. We create a symlink in a | |
271 | ;; directory included in the bootstrap binaries rpath. | |
272 | (mkdir-p libtinfo-dir) | |
273 | (symlink | |
274 | (string-append ncurses-lib "/libncursesw.so." | |
74733195 RW |
275 | ;; Extract "6.0" from "6.0-20170930" if a |
276 | ;; dash-separated version tag exists. | |
ae785e5e | 277 | ,(let* ((v (package-version ncurses)) |
74733195 RW |
278 | (d (or (string-index v #\-) |
279 | (string-length v)))) | |
ae785e5e | 280 | (version-major+minor (string-take v d)))) |
246b3437 | 281 | (string-append libtinfo-dir "/libtinfo.so.5")) |
ae785e5e | 282 | |
246b3437 FB |
283 | (setenv "PATH" |
284 | (string-append (getenv "PATH") ":" | |
285 | ghc-bootstrap-prefix "/bin")) | |
286 | (system* | |
287 | (string-append (getcwd) "/configure") | |
288 | (string-append "--prefix=" ghc-bootstrap-prefix) | |
289 | (string-append "--with-gmp-libraries=" gmp-lib) | |
290 | (string-append "--with-gmp-includes=" gmp-include))))) | |
291 | (alist-cons-before | |
292 | 'configure 'install-bin | |
293 | (lambda* (#:key inputs outputs #:allow-other-keys) | |
294 | (with-directory-excursion | |
0e03d76a | 295 | (string-append ghc-bootstrap-path "/ghc-7.8.4") |
246b3437 FB |
296 | (zero? (system* "make" "install")))) |
297 | %standard-phases))))))) | |
e17d5133 EB |
298 | (native-search-paths (list (search-path-specification |
299 | (variable "GHC_PACKAGE_PATH") | |
300 | (files (list | |
301 | (string-append "lib/ghc-" version))) | |
302 | (file-pattern ".*\\.conf\\.d$") | |
303 | (file-type 'directory)))) | |
246b3437 FB |
304 | (home-page "https://www.haskell.org/ghc") |
305 | (synopsis "The Glasgow Haskell Compiler") | |
7d95c000 FB |
306 | (description |
307 | "The Glasgow Haskell Compiler (GHC) is a state-of-the-art compiler and | |
308 | interactive environment for the functional language Haskell.") | |
309 | (license license:bsd-3))) | |
310 | ||
9587544b | 311 | (define-public ghc-8.0 |
7d95c000 FB |
312 | (package |
313 | (name "ghc") | |
d8e85b20 | 314 | (version "8.0.2") |
7d95c000 FB |
315 | (source |
316 | (origin | |
317 | (method url-fetch) | |
318 | (uri (string-append "https://www.haskell.org/ghc/dist/" | |
319 | version "/" name "-" version "-src.tar.xz")) | |
320 | (sha256 | |
d8e85b20 FB |
321 | (base32 "1c8qc4fhkycynk4g1f9hvk53dj6a1vvqi6bklqznns6hw59m8qhi")) |
322 | (patches | |
323 | (search-patches | |
f6cccefe DM |
324 | "ghc-dont-pass-linker-flags-via-response-files.patch" |
325 | "ghc-8.0-fall-back-to-madv_dontneed.patch")))) | |
7d95c000 FB |
326 | (build-system gnu-build-system) |
327 | (supported-systems '("i686-linux" "x86_64-linux")) | |
328 | (outputs '("out" "doc")) | |
329 | (inputs | |
330 | `(("gmp" ,gmp) | |
331 | ("ncurses" ,ncurses) | |
332 | ("libffi" ,libffi) | |
7d95c000 FB |
333 | ("ghc-testsuite" |
334 | ,(origin | |
335 | (method url-fetch) | |
336 | (uri (string-append | |
337 | "https://www.haskell.org/ghc/dist/" | |
338 | version "/" name "-" version "-testsuite.tar.xz")) | |
339 | (sha256 | |
d8e85b20 | 340 | (base32 "1wjc3x68l305bl1h1ijd3yhqp2vqj83lkp3kqbr94qmmkqlms8sj")))))) |
7d95c000 FB |
341 | (native-inputs |
342 | `(("perl" ,perl) | |
343 | ("python" ,python-2) ; for tests | |
344 | ("ghostscript" ,ghostscript) ; for tests | |
345 | ;; GHC is built with GHC. | |
e2dc97d6 | 346 | ("ghc-bootstrap" ,ghc-7))) |
7d95c000 FB |
347 | (arguments |
348 | `(#:test-target "test" | |
349 | ;; We get a smaller number of test failures by disabling parallel test | |
350 | ;; execution. | |
351 | #:parallel-tests? #f | |
352 | ||
353 | ;; The DSOs use $ORIGIN to refer to each other, but (guix build | |
354 | ;; gremlin) doesn't support it yet, so skip this phase. | |
355 | #:validate-runpath? #f | |
356 | ||
357 | ;; Don't pass --build=<triplet>, because the configure script | |
358 | ;; auto-detects slightly different triplets for --host and --target and | |
359 | ;; then complains that they don't match. | |
360 | #:build #f | |
361 | ||
7d95c000 FB |
362 | #:configure-flags |
363 | (list | |
364 | (string-append "--with-gmp-libraries=" | |
365 | (assoc-ref %build-inputs "gmp") "/lib") | |
366 | (string-append "--with-gmp-includes=" | |
367 | (assoc-ref %build-inputs "gmp") "/include") | |
368 | "--with-system-libffi" | |
369 | (string-append "--with-ffi-libraries=" | |
370 | (assoc-ref %build-inputs "libffi") "/lib") | |
371 | (string-append "--with-ffi-includes=" | |
372 | (assoc-ref %build-inputs "libffi") "/include") | |
373 | (string-append "--with-curses-libraries=" | |
374 | (assoc-ref %build-inputs "ncurses") "/lib") | |
375 | (string-append "--with-curses-includes=" | |
376 | (assoc-ref %build-inputs "ncurses") "/include")) | |
377 | #:phases | |
378 | (modify-phases %standard-phases | |
379 | (add-after 'unpack 'unpack-testsuite | |
380 | (lambda* (#:key inputs #:allow-other-keys) | |
381 | (with-directory-excursion ".." | |
382 | (copy-file (assoc-ref inputs "ghc-testsuite") | |
383 | "ghc-testsuite.tar.xz") | |
384 | (zero? (system* "tar" "xvf" "ghc-testsuite.tar.xz"))))) | |
385 | (add-before 'build 'fix-lib-paths | |
386 | (lambda _ | |
387 | (substitute* | |
388 | (list "libraries/process/System/Process/Posix.hs" | |
389 | "libraries/process/tests/process001.hs" | |
390 | "libraries/process/tests/process002.hs" | |
391 | "libraries/unix/cbits/execvpe.c") | |
392 | (("/bin/sh") (which "sh")) | |
393 | (("/bin/ls") (which "ls"))) | |
394 | #t)) | |
395 | (add-before 'build 'fix-environment | |
396 | (lambda _ | |
397 | (unsetenv "GHC_PACKAGE_PATH") | |
398 | (setenv "CONFIG_SHELL" (which "bash")) | |
399 | #t)) | |
400 | (add-before 'check 'fix-testsuite | |
401 | (lambda _ | |
402 | (substitute* | |
403 | (list "testsuite/timeout/Makefile" | |
404 | "testsuite/timeout/timeout.py" | |
405 | "testsuite/timeout/timeout.hs" | |
406 | "testsuite/tests/programs/life_space_leak/life.test") | |
407 | (("/bin/sh") (which "sh")) | |
408 | (("/bin/rm") "rm")) | |
d8e85b20 | 409 | #t))))) |
7d95c000 FB |
410 | (native-search-paths (list (search-path-specification |
411 | (variable "GHC_PACKAGE_PATH") | |
412 | (files (list | |
413 | (string-append "lib/ghc-" version))) | |
414 | (file-pattern ".*\\.conf\\.d$") | |
415 | (file-type 'directory)))) | |
416 | (home-page "https://www.haskell.org/ghc") | |
417 | (synopsis "The Glasgow Haskell Compiler") | |
246b3437 FB |
418 | (description |
419 | "The Glasgow Haskell Compiler (GHC) is a state-of-the-art compiler and | |
420 | interactive environment for the functional language Haskell.") | |
3ac73271 | 421 | (license license:bsd-3))) |
246b3437 | 422 | |
a62ddb74 | 423 | (define-public ghc-8.4 |
9587544b RW |
424 | (package (inherit ghc-8.0) |
425 | (name "ghc") | |
c711b6ab | 426 | (version "8.4.4") |
9587544b RW |
427 | (source |
428 | (origin | |
429 | (method url-fetch) | |
430 | (uri (string-append "https://www.haskell.org/ghc/dist/" | |
431 | version "/" name "-" version "-src.tar.xz")) | |
432 | (sha256 | |
c711b6ab | 433 | (base32 "1ch4j2asg7pr52ai1hwzykxyj553wndg7wq93i47ql4fllspf48i")))) |
9587544b RW |
434 | (inputs |
435 | `(("gmp" ,gmp) | |
436 | ("ncurses" ,ncurses) | |
a057b881 | 437 | ("libffi" ,libffi))) |
9587544b RW |
438 | (native-inputs |
439 | `(("perl" ,perl) | |
440 | ("python" ,python) ; for tests | |
441 | ("ghostscript" ,ghostscript) ; for tests | |
442 | ;; GHC 8.4.3 is built with GHC 8. | |
443 | ("ghc-bootstrap" ,ghc-8.0) | |
444 | ("ghc-testsuite" | |
445 | ,(origin | |
446 | (method url-fetch) | |
447 | (uri (string-append | |
448 | "https://www.haskell.org/ghc/dist/" | |
449 | version "/" name "-" version "-testsuite.tar.xz")) | |
450 | (sha256 | |
451 | (base32 | |
c711b6ab | 452 | "0s8lf9sxj7n89pjagi58b3fahnp34qvmwhnn0j1fbg6955vbrfj6")))))) |
9587544b RW |
453 | (arguments |
454 | `(#:test-target "test" | |
455 | ;; We get a smaller number of test failures by disabling parallel test | |
456 | ;; execution. | |
457 | #:parallel-tests? #f | |
458 | ||
459 | ;; The DSOs use $ORIGIN to refer to each other, but (guix build | |
460 | ;; gremlin) doesn't support it yet, so skip this phase. | |
461 | #:validate-runpath? #f | |
462 | ||
463 | ;; Don't pass --build=<triplet>, because the configure script | |
464 | ;; auto-detects slightly different triplets for --host and --target and | |
465 | ;; then complains that they don't match. | |
466 | #:build #f | |
467 | ||
468 | #:configure-flags | |
469 | (list | |
470 | (string-append "--with-gmp-libraries=" | |
471 | (assoc-ref %build-inputs "gmp") "/lib") | |
472 | (string-append "--with-gmp-includes=" | |
473 | (assoc-ref %build-inputs "gmp") "/include") | |
474 | "--with-system-libffi" | |
475 | (string-append "--with-ffi-libraries=" | |
476 | (assoc-ref %build-inputs "libffi") "/lib") | |
477 | (string-append "--with-ffi-includes=" | |
478 | (assoc-ref %build-inputs "libffi") "/include") | |
479 | (string-append "--with-curses-libraries=" | |
480 | (assoc-ref %build-inputs "ncurses") "/lib") | |
481 | (string-append "--with-curses-includes=" | |
482 | (assoc-ref %build-inputs "ncurses") "/include")) | |
483 | #:phases | |
484 | (modify-phases %standard-phases | |
485 | (add-after 'unpack 'unpack-testsuite | |
486 | (lambda* (#:key inputs #:allow-other-keys) | |
487 | (invoke "tar" "xvf" | |
488 | (assoc-ref inputs "ghc-testsuite") | |
489 | "--strip-components=1") | |
490 | #t)) | |
5de93cdb RW |
491 | ;; This phase patches the 'ghc-pkg' command so that it sorts the list |
492 | ;; of packages in the binary cache it generates. | |
493 | (add-before 'build 'fix-ghc-pkg-nondeterminism | |
494 | (lambda _ | |
495 | (substitute* "utils/ghc-pkg/Main.hs" | |
496 | (("confs = map \\(path </>\\) \\$ filter \\(\".conf\" `isSuffixOf`\\) fs") | |
497 | "confs = map (path </>) $ filter (\".conf\" `isSuffixOf`) (sort fs)")) | |
498 | #t)) | |
9587544b RW |
499 | (add-after 'unpack-testsuite 'fix-shell-wrappers |
500 | (lambda _ | |
501 | (substitute* '("driver/ghci/ghc.mk" | |
502 | "utils/mkdirhier/ghc.mk" | |
503 | "rules/shell-wrapper.mk") | |
504 | (("echo '#!/bin/sh'") | |
505 | (format #f "echo '#!~a'" (which "sh")))) | |
506 | #t)) | |
507 | ;; This is necessary because the configure system no longer uses | |
508 | ;; “AC_PATH_” but “AC_CHECK_”, setting the variables to just the | |
509 | ;; plain command names. | |
510 | (add-before 'configure 'set-target-programs | |
511 | (lambda* (#:key inputs #:allow-other-keys) | |
a057b881 MB |
512 | (let ((binutils (assoc-ref inputs "binutils")) |
513 | (gcc (assoc-ref inputs "gcc")) | |
514 | (ld-wrapper (assoc-ref inputs "ld-wrapper"))) | |
9587544b RW |
515 | (setenv "CC" (string-append gcc "/bin/gcc")) |
516 | (setenv "CXX" (string-append gcc "/bin/g++")) | |
517 | (setenv "LD" (string-append ld-wrapper "/bin/ld")) | |
518 | (setenv "NM" (string-append binutils "/bin/nm")) | |
519 | (setenv "RANLIB" (string-append binutils "/bin/ranlib")) | |
520 | (setenv "STRIP" (string-append binutils "/bin/strip")) | |
521 | ;; The 'ar' command does not follow the same pattern. | |
522 | (setenv "fp_prog_ar" (string-append binutils "/bin/ar")) | |
523 | #t))) | |
524 | (add-before 'build 'fix-references | |
525 | (lambda _ | |
526 | (substitute* '("testsuite/timeout/Makefile" | |
527 | "testsuite/timeout/timeout.py" | |
528 | "testsuite/timeout/timeout.hs" | |
529 | "testsuite/tests/programs/life_space_leak/life.test" | |
530 | ;; libraries | |
531 | "libraries/process/System/Process/Posix.hs" | |
532 | "libraries/process/tests/process001.hs" | |
533 | "libraries/process/tests/process002.hs" | |
534 | "libraries/unix/cbits/execvpe.c") | |
535 | (("/bin/sh") (which "sh")) | |
536 | (("/bin/ls") (which "ls")) | |
537 | (("/bin/rm") "rm")) | |
538 | #t)) | |
539 | (add-before 'build 'fix-environment | |
540 | (lambda _ | |
541 | (unsetenv "GHC_PACKAGE_PATH") | |
542 | (setenv "CONFIG_SHELL" (which "bash")) | |
543 | #t))))) | |
544 | (native-search-paths (list (search-path-specification | |
545 | (variable "GHC_PACKAGE_PATH") | |
546 | (files (list | |
547 | (string-append "lib/ghc-" version))) | |
548 | (file-pattern ".*\\.conf\\.d$") | |
549 | (file-type 'directory)))))) | |
550 | ||
cce84c34 RV |
551 | (define-public ghc-8.6 |
552 | (package (inherit ghc-8.4) | |
553 | (name "ghc") | |
554 | (version "8.6.5") | |
555 | (source | |
556 | (origin | |
557 | (method url-fetch) | |
558 | (uri (string-append "https://www.haskell.org/ghc/dist/" | |
559 | version "/" name "-" version "-src.tar.xz")) | |
560 | (sha256 | |
561 | (base32 "0qg3zsmbk4rkwkc3jpas3zs74qaxmw4sp4v1mhsbj0a0dzls2jjd")))) | |
562 | (native-inputs | |
563 | `(;; GHC 8.6.5 must be built with GHC >= 8.2. | |
564 | ("ghc-bootstrap" ,ghc-8.4) | |
565 | ("ghc-testsuite" | |
566 | ,(origin | |
567 | (method url-fetch) | |
568 | (uri (string-append | |
569 | "https://www.haskell.org/ghc/dist/" | |
570 | version "/" name "-" version "-testsuite.tar.xz")) | |
571 | (sha256 | |
572 | (base32 | |
573 | "0pw9r91g2np3i806g2f4f8z4jfdd7mx226cmdizk4swa7av1qf91")))) | |
574 | ,@(filter (match-lambda | |
575 | (("ghc-bootstrap" . _) #f) | |
576 | (("ghc-testsuite" . _) #f) | |
577 | (_ #t)) | |
578 | (package-native-inputs ghc-8.4)))) | |
579 | (arguments | |
580 | (substitute-keyword-arguments (package-arguments ghc-8.4) | |
581 | ((#:make-flags make-flags ''()) | |
582 | `(cons "EXTRA_RUNTEST_OPTS=--skip-perf-tests" | |
583 | ,make-flags)) | |
584 | ((#:phases phases '%standard-phases) | |
585 | `(modify-phases ,phases | |
cce84c34 RV |
586 | (add-after 'unpack-testsuite 'skip-tests |
587 | (lambda _ | |
2e9c43aa MB |
588 | ;; These two tests refer to the root user, which doesn't exist |
589 | ;; (see <https://bugs.gnu.org/36692>). | |
cce84c34 RV |
590 | (substitute* "libraries/unix/tests/all.T" |
591 | (("^test\\('T8108'") "# guix skipped: test('T8108'")) | |
592 | (substitute* "libraries/unix/tests/libposix/all.T" | |
593 | (("^test\\('posix010'") "# guix skipped: test('posix010'")) | |
2e9c43aa MB |
594 | ;; This test attempts to dlopen() a position-independent |
595 | ;; executable(!), which is disallowed since glibc 2.30. See | |
596 | ;; https://sourceware.org/bugzilla/show_bug.cgi?id=24323 | |
597 | (substitute* "testsuite/tests/dynlibs/Makefile" | |
598 | (("\\./T13702a") | |
599 | "# ./T13702a")) | |
83aa6562 TS |
600 | #t)))))) |
601 | (native-search-paths (list (search-path-specification | |
602 | (variable "GHC_PACKAGE_PATH") | |
603 | (files (list | |
604 | (string-append "lib/ghc-" version))) | |
605 | (file-pattern ".*\\.conf\\.d$") | |
606 | (file-type 'directory)))))) | |
cce84c34 | 607 | |
064a967b | 608 | (define-public ghc-8 ghc-8.6) |
a62ddb74 | 609 | |
dde15fea | 610 | (define-public ghc ghc-8) |
e2dc97d6 | 611 | |
246b3437 | 612 | ;;; haskell.scm ends here |