1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2015 Federico Beffa <beffa@fbengineering.ch>
4 ;;; This file is part of GNU Guix.
6 ;;; GNU Guix is free software; you can redistribute it and/or modify it
7 ;;; under the terms of the GNU General Public License as published by
8 ;;; the Free Software Foundation; either version 3 of the License, or (at
9 ;;; your option) any later version.
11 ;;; GNU Guix is distributed in the hope that it will be useful, but
12 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
13 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 ;;; GNU General Public License for more details.
16 ;;; You should have received a copy of the GNU General Public License
17 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
19 (define-module (gnu packages haskell)
20 #:use-module (ice-9 regex)
21 #:use-module ((guix licenses) #:select (bsd-3))
22 #:use-module (guix packages)
23 #:use-module (guix download)
24 #:use-module (guix utils)
25 #:use-module (guix build-system gnu)
26 #:use-module (guix build-system haskell)
27 #:use-module (gnu packages perl)
28 #:use-module (gnu packages compression)
29 #:use-module (gnu packages elf)
30 #:use-module (gnu packages bootstrap)
31 #:use-module (gnu packages ghostscript)
32 #:use-module (gnu packages libffi)
33 #:use-module (gnu packages libedit)
34 #:use-module (gnu packages multiprecision)
35 #:use-module (gnu packages ncurses)
36 #:use-module (gnu packages python))
38 (define ghc-bootstrap-x86_64-7.8.4
42 "https://www.haskell.org/ghc/dist/7.8.4/ghc-7.8.4-x86_64-unknown-linux-deb7.tar.xz")
45 "13azsl53xgj20mi1hj9x0xb32vvcvs6cpmvwx6znxhas7blh0bpn"))))
47 (define ghc-bootstrap-i686-7.8.4
51 "https://www.haskell.org/ghc/dist/7.8.4/ghc-7.8.4-i386-unknown-linux-deb7.tar.xz")
54 "0wj5s435j0zgww70bj1d3f6wvnnpzlxwvwcyh2qv4qjq5z8j64kg"))))
56 ;; 43 tests out of 3965 fail.
58 ;; Most of them do not appear to be serious:
60 ;; - some tests generate files referring to "/bin/sh" and "/bin/ls". I've not
61 ;; figured out how these references are generated.
63 ;; - Some tests allocate more memory than expected (ca. 3% above upper limit)
65 ;; - Some tests try to load unavailable libriries: Control.Concurrent.STM,
66 ;; Data.Vector, Control.Monad.State.
68 ;; - Test posix010 tries to check the existence of a user on the system:
69 ;; getUserEntryForName: does not exist (no such user)
77 (uri (string-append "https://www.haskell.org/ghc/dist/"
78 version "/" name "-" version "-src.tar.xz"))
81 "1i4254akbb4ym437rf469gc0m40bxm31blp6s1z1g15jmnacs6f3"))))
82 (build-system gnu-build-system)
83 (supported-systems '("i686-linux" "x86_64-linux"))
84 (outputs '("out" "doc"))
94 "https://www.haskell.org/ghc/dist/"
95 version "/" name "-" version "-testsuite.tar.xz"))
98 "0q95whf87y4mxjzwzy899g7z7l9pazq4si6iciyhxkcdhqq2ycyh"))))))
101 ("python" ,python-2) ; for tests (fails with python-3)
102 ("ghostscript" ,ghostscript) ; for tests
103 ("patchelf" ,patchelf)
104 ;; GHC is built with GHC. Therefore we need bootstrap binaries.
106 ,(if (string-match "x86_64" (or (%current-target-system) (%current-system)))
107 ghc-bootstrap-x86_64-7.8.4
108 ghc-bootstrap-i686-7.8.4))))
110 `(#:test-target "test"
111 ;; We get a smaller number of test failures by disabling parallel test
114 #:modules ((guix build gnu-build-system)
119 #:imported-modules ((guix build gnu-build-system)
124 (string-append "--with-gmp-libraries="
125 (assoc-ref %build-inputs "gmp") "/lib")
126 (string-append "--with-gmp-includes="
127 (assoc-ref %build-inputs "gmp") "/include")
128 "--with-system-libffi"
129 (string-append "--with-ffi-libraries="
130 (assoc-ref %build-inputs "libffi") "/lib")
131 (string-append "--with-ffi-includes="
132 (assoc-ref %build-inputs "libffi") "/include"))
133 ;; FIXME: The user-guide needs dblatex, docbook-xsl and docbook-utils.
134 ;; Currently we do not have the last one.
136 ;; (list "BUILD_DOCBOOK_HTML = YES")
138 (let* ((ghc-bootstrap-path
139 (string-append (getcwd) "/" ,name "-" ,version "/ghc-bin"))
140 (ghc-bootstrap-prefix
141 (string-append ghc-bootstrap-path "/usr" )))
143 'unpack-bin 'unpack-and-fix-testsuite
144 (lambda* (#:key inputs outputs #:allow-other-keys)
145 (with-directory-excursion ".."
146 (copy-file (assoc-ref inputs "ghc-testsuite")
147 "ghc-testsuite.tar.xz")
148 (system* "tar" "xvf" "ghc-testsuite.tar.xz"))
150 (list "testsuite/timeout/Makefile"
151 "testsuite/timeout/timeout.py"
152 "testsuite/timeout/timeout.hs"
153 "testsuite/tests/rename/prog006/Setup.lhs"
154 "testsuite/tests/programs/life_space_leak/life.test")
155 (("/bin/sh") (which "sh"))
160 (lambda* (#:key inputs outputs #:allow-other-keys)
161 (mkdir-p ghc-bootstrap-prefix)
162 (with-directory-excursion ghc-bootstrap-path
163 (copy-file (assoc-ref inputs "ghc-binary")
165 (zero? (system* "tar" "xvf" "ghc-bin.tar.xz"))))
167 'install-bin 'configure-bin
168 (lambda* (#:key inputs outputs #:allow-other-keys)
171 "./utils/ghc-pwd/dist-install/build/tmp/ghc-pwd"
172 "./utils/hpc/dist-install/build/tmp/hpc"
173 "./utils/haddock/dist/build/tmp/haddock"
174 "./utils/hsc2hs/dist-install/build/tmp/hsc2hs"
175 "./utils/runghc/dist-install/build/tmp/runghc"
176 "./utils/ghc-cabal/dist-install/build/tmp/ghc-cabal"
177 "./utils/hp2ps/dist/build/tmp/hp2ps"
178 "./utils/ghc-pkg/dist-install/build/tmp/ghc-pkg"
179 "./utils/unlit/dist/build/tmp/unlit"
180 "./ghc/stage2/build/tmp/ghc-stage2"))
181 (gmp (assoc-ref inputs "gmp"))
182 (gmp-lib (string-append gmp "/lib"))
183 (gmp-include (string-append gmp "/include"))
185 (string-append (assoc-ref inputs "ncurses") "/lib"))
186 (ld-so (string-append (assoc-ref inputs "libc")
187 ,(glibc-dynamic-linker)))
189 (string-append ghc-bootstrap-prefix
190 "/lib/ghc-7.8.4/terminfo-0.4.0.0")))
191 (with-directory-excursion
192 (string-append ghc-bootstrap-path "/" ,name "-" ,version)
193 (setenv "CONFIG_SHELL" (which "bash"))
194 (setenv "LD_LIBRARY_PATH" gmp-lib)
195 ;; The binaries have "/lib64/ld-linux-x86-64.so.2" hardcoded.
197 (cut system* "patchelf" "--set-interpreter" ld-so <>)
199 ;; The binaries include a reference to libtinfo.so.5 which
200 ;; is a subset of libncurses.so.5. We create a symlink in a
201 ;; directory included in the bootstrap binaries rpath.
202 (mkdir-p libtinfo-dir)
204 (string-append ncurses-lib "/libncursesw.so."
205 ,(version-major+minor
206 (package-version ncurses)))
207 (string-append libtinfo-dir "/libtinfo.so.5"))
209 (string-append (getenv "PATH") ":"
210 ghc-bootstrap-prefix "/bin"))
212 (string-append (getcwd) "/configure")
213 (string-append "--prefix=" ghc-bootstrap-prefix)
214 (string-append "--with-gmp-libraries=" gmp-lib)
215 (string-append "--with-gmp-includes=" gmp-include)))))
217 'configure 'install-bin
218 (lambda* (#:key inputs outputs #:allow-other-keys)
219 (with-directory-excursion
220 (string-append ghc-bootstrap-path "/" ,name "-" ,version)
221 (zero? (system* "make" "install"))))
222 %standard-phases)))))))
223 (home-page "https://www.haskell.org/ghc")
224 (synopsis "The Glasgow Haskell Compiler")
226 "The Glasgow Haskell Compiler (GHC) is a state-of-the-art compiler and
227 interactive environment for the functional language Haskell.")
230 (define-public ghc-mtl
234 (outputs '("out" "doc"))
239 "http://hackage.haskell.org/package/mtl/mtl-"
244 "1xpn2wjmqbh2cg1yssc6749xpgcqlrrg4iilwqgkcjgvaxlpdbvp"))))
245 (build-system haskell-build-system)
246 (home-page "http://github.com/ekmett/mtl")
248 "Monad classes, using functional dependencies")
250 "Monad classes using functional dependencies, with instances
251 for various monad transformers, inspired by the paper
252 'Functional Programming with Overloading and Higher-Order Polymorphism',
253 by Mark P Jones, in 'Advanced School of Functional Programming', 1995
254 http://web.cecs.pdx.edu/~mpj/pubs/springschool.html.")
257 (define-public ghc-paths
261 (outputs '("out" "doc"))
266 "http://hackage.haskell.org/package/ghc-paths/ghc-paths-"
271 "0ibrr1dxa35xx20cpp8jzgfak1rdmy344dfwq4vlq013c6w8z9mg"))))
272 (build-system haskell-build-system)
273 (home-page "https://github.com/simonmar/ghc-paths")
275 "Knowledge of GHC's installation directories")
277 "Knowledge of GHC's installation directories.")
280 (define-public ghc-zlib
284 (outputs '("out" "doc"))
289 "http://hackage.haskell.org/package/zlib/zlib-"
294 "15hhsk7z3gvm7sz2ic2z1ca5c6rpsln2rr391mdbm1bxlzc1gmkm"))))
295 (build-system haskell-build-system)
296 (inputs `(("zlib" ,zlib)))
297 (home-page "http://hackage.haskell.org/package/zlib")
299 "Compression and decompression in the gzip and zlib formats")
301 "This package provides a pure interface for compressing and decompressing
302 streams of data represented as lazy 'ByteString's. It uses the zlib C library
303 so it has high performance. It supports the 'zlib', 'gzip' and 'raw'
304 compression formats. It provides a convenient high level API suitable for
305 most tasks and for the few cases where more control is needed it provides
306 access to the full zlib feature set.")
309 (define-public ghc-stm
313 (outputs '("out" "doc"))
318 "http://hackage.haskell.org/package/stm/stm-"
323 "0gc8zvdijp3rwmidkpxv76b4i0dc8dw6nbd92rxl4vxl0655iysx"))))
324 (build-system haskell-build-system)
325 (home-page "http://hackage.haskell.org/package/stm")
326 (synopsis "Software Transactional Memory")
328 "A modular composable concurrency abstraction.")
331 (define-public ghc-parallel
333 (name "ghc-parallel")
335 (outputs '("out" "doc"))
340 "http://hackage.haskell.org/package/parallel/parallel-"
345 "0hp6vf4zxsw6vz6lj505xihmnfhgjp39c9q7nyzlgcmps3xx6a5r"))))
346 (build-system haskell-build-system)
347 (home-page "http://hackage.haskell.org/package/parallel")
348 (synopsis "Parallel programming library")
350 "This package provides a library for parallel programming.")
353 (define-public ghc-text
357 (outputs '("out" "doc"))
362 "http://hackage.haskell.org/package/text/text-"
367 "004p1c74crs8wmjafwsmw3mmycspq1j8fpm1lvfpq6acha7bnpc6"))))
368 (build-system haskell-build-system)
370 `(#:tests? #f)) ; FIXME: currently missing libraries used for tests.
371 (home-page "https://github.com/bos/text")
373 "Efficient packed Unicode text type library.")
375 "An efficient packed, immutable Unicode text type (both strict and
376 lazy), with a powerful loop fusion optimization framework.
378 The 'Text' type represents Unicode character strings, in a time and
379 space-efficient manner. This package provides text processing
380 capabilities that are optimized for performance critical use, both
381 in terms of large data quantities and high speed.")
384 (define-public ghc-hashable
386 (name "ghc-hashable")
388 (outputs '("out" "doc"))
393 "http://hackage.haskell.org/package/hashable/hashable-"
398 "0h9295pv2sgbaqlwpwbx2bap6nngm0jcdhkqham1wpjwyxqgqrlc"))))
399 (build-system haskell-build-system)
401 `(#:tests? #f)) ; FIXME: currently missing libraries used for tests.
402 ;; these inputs are necessary to use this library
404 `(("ghc-text" ,ghc-text)))
405 (home-page "http://github.com/tibbe/hashable")
407 "Class for types that can be converted to a hash value")
409 "This package defines a class, 'Hashable', for types that can be
410 converted to a hash value. This class exists for the benefit of hashing-based
411 data structures. The package provides instances for basic types and a way to
412 combine hash values.")
415 ;;; haskell.scm ends here