gnu: calibre: Wrap QTWEBENGINEPROCESS_PATH.
[jackhill/guix/guix.git] / gnu / packages / agda.scm
CommitLineData
f61682e7
AW
1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2018 Alex ter Weele <alex.ter.weele@gmail.com>
787231e9 3;;; Copyright © 2018 Ricardo Wurmus <rekado@elephly.net>
58352f26 4;;; Copyright © 2018 Alex Vong <alexvong1995@gmail.com>
d9c80098 5;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr>
276f598a 6;;; Copyright © 2018 John Soo <jsoo1@asu.edu>
48752f27 7;;; Copyright © 2019 Ludovic Courtès <ludo@gnu.org>
f61682e7
AW
8;;;
9;;; This file is part of GNU Guix.
10;;;
11;;; GNU Guix is free software; you can redistribute it and/or modify it
12;;; under the terms of the GNU General Public License as published by
13;;; the Free Software Foundation; either version 3 of the License, or (at
14;;; your option) any later version.
15;;;
16;;; GNU Guix is distributed in the hope that it will be useful, but
17;;; WITHOUT ANY WARRANTY; without even the implied warranty of
18;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19;;; GNU General Public License for more details.
20;;;
21;;; You should have received a copy of the GNU General Public License
22;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
23
24(define-module (gnu packages agda)
f61682e7
AW
25 #:use-module (gnu packages haskell-check)
26 #:use-module (gnu packages haskell-web)
dddbc90c 27 #:use-module (gnu packages haskell-xyz)
1237653a 28 #:use-module (guix build-system emacs)
276f598a 29 #:use-module (guix build-system gnu)
f61682e7
AW
30 #:use-module (guix build-system haskell)
31 #:use-module (guix build-system trivial)
32 #:use-module (guix download)
48752f27 33 #:use-module (guix git-download)
f61682e7
AW
34 #:use-module ((guix licenses) #:prefix license:)
35 #:use-module (guix packages))
36
37(define-public agda
38 (package
39 (name "agda")
27109c71 40 (version "2.6.0.1")
f61682e7
AW
41 (source
42 (origin
43 (method url-fetch)
44 (uri (string-append
45 "https://hackage.haskell.org/package/Agda/Agda-"
46 version ".tar.gz"))
47 (sha256
48 (base32
27109c71 49 "1s600ry1qwizr3ynyj05rvlx7jdcw9a1viyc0ycjamm5sjf8mf3v"))))
f61682e7
AW
50 (build-system haskell-build-system)
51 (inputs
27109c71
TS
52 `(("ghc-aeson" ,ghc-aeson)
53 ("ghc-alex" ,ghc-alex)
f61682e7
AW
54 ("ghc-async" ,ghc-async)
55 ("ghc-blaze-html" ,ghc-blaze-html)
56 ("ghc-boxes" ,ghc-boxes)
57 ("ghc-data-hash" ,ghc-data-hash)
58 ("ghc-edisoncore" ,ghc-edisoncore)
59 ("ghc-edit-distance" ,ghc-edit-distance)
60 ("ghc-equivalence" ,ghc-equivalence)
27109c71 61 ("ghc-exceptions" ,ghc-exceptions)
787231e9 62 ("ghc-filemanip" ,ghc-filemanip)
f61682e7
AW
63 ("ghc-geniplate-mirror" ,ghc-geniplate-mirror)
64 ("ghc-gitrev" ,ghc-gitrev)
65 ("ghc-happy" ,ghc-happy)
66 ("ghc-hashable" ,ghc-hashable)
67 ("ghc-hashtables" ,ghc-hashtables)
68 ("ghc-ieee754" ,ghc-ieee754)
f61682e7
AW
69 ("ghc-murmur-hash" ,ghc-murmur-hash)
70 ("ghc-uri-encode" ,ghc-uri-encode)
f61682e7 71 ("ghc-regex-tdfa" ,ghc-regex-tdfa)
f61682e7 72 ("ghc-strict" ,ghc-strict)
f61682e7
AW
73 ("ghc-unordered-containers" ,ghc-unordered-containers)
74 ("ghc-zlib" ,ghc-zlib)))
253340dc
AW
75 (arguments
76 `(#:modules ((guix build haskell-build-system)
77 (guix build utils)
787231e9
RW
78 (srfi srfi-26)
79 (ice-9 match))
253340dc
AW
80 #:phases
81 (modify-phases %standard-phases
8d069060
TS
82 ;; This allows us to call the 'agda' binary before installing.
83 (add-after 'unpack 'set-ld-library-path
84 (lambda _
85 (setenv "LD_LIBRARY_PATH" (string-append (getcwd) "/dist/build"))
86 #t))
787231e9
RW
87 ;; FIXME: This is a copy of the standard configure phase with a tiny
88 ;; difference: this package needs the -package-db flag to be passed
89 ;; to "runhaskell" in addition to the "configure" action, because
90 ;; Setup.hs depends on filemanip. Without this option the Setup.hs
91 ;; file cannot be evaluated. The haskell-build-system should be
92 ;; changed to pass "-package-db" to "runhaskell" in any case.
93 (replace 'configure
94 (lambda* (#:key outputs inputs tests? (configure-flags '())
95 #:allow-other-keys)
96 (let* ((out (assoc-ref outputs "out"))
58352f26 97 (name-version (strip-store-file-name out))
787231e9 98 (ghc-path (getenv "GHC_PACKAGE_PATH"))
8d069060
TS
99 (params
100 `(,(string-append "--prefix=" out)
101 ,(string-append "--libdir=" out "/lib")
102 ,(string-append "--docdir=" out
103 "/share/doc/" name-version)
104 "--libsubdir=$compiler/$pkg-$version"
105 "--package-db=../package.conf.d"
106 "--global"
107 ,@(if tests?
108 '("--enable-tests")
109 '())
110 ;; Build and link with shared libraries
111 "--enable-shared"
112 "--enable-executable-dynamic"
113 "--ghc-option=-fPIC"
114 ,(string-append "--ghc-option=-optl=-Wl,-rpath=" out
115 "/lib/$compiler/$pkg-$version")
116 ,@configure-flags)))
787231e9
RW
117 (unsetenv "GHC_PACKAGE_PATH")
118 (apply invoke "runhaskell" "-package-db=../package.conf.d"
119 "Setup.hs" "configure" params)
120 (setenv "GHC_PACKAGE_PATH" ghc-path)
121 #t)))
253340dc
AW
122 (add-after 'compile 'agda-compile
123 (lambda* (#:key outputs #:allow-other-keys)
124 (let* ((out (assoc-ref outputs "out"))
125 (agda-compiler (string-append out "/bin/agda")))
126 (for-each (cut invoke agda-compiler <>)
127 (find-files (string-append out "/share") "\\.agda$"))
128 #t))))))
0d2753cc 129 (home-page "https://wiki.portal.chalmers.se/agda/")
f61682e7
AW
130 (synopsis
131 "Dependently typed functional programming language and proof assistant")
132 (description
133 "Agda is a dependently typed functional programming language: it has
134inductive families, which are similar to Haskell's GADTs, but they can be
135indexed by values and not just types. It also has parameterised modules,
136mixfix operators, Unicode characters, and an interactive Emacs interface (the
137type checker can assist in the development of your code). Agda is also a
138proof assistant: it is an interactive system for writing and checking proofs.
139Agda is based on intuitionistic type theory, a foundational system for
140constructive mathematics developed by the Swedish logician Per Martin-Löf. It
141has many similarities with other proof assistants based on dependent types,
142such as Coq, Epigram and NuPRL.")
143 ;; Agda is distributed under the MIT license, and a couple of
144 ;; source files are BSD-3. See LICENSE for details.
145 (license (list license:expat license:bsd-3))))
1237653a
AW
146
147(define-public emacs-agda2-mode
148 (package
149 (inherit agda)
150 (name "emacs-agda2-mode")
151 (build-system emacs-build-system)
152 (inputs '())
153 (arguments
154 `(#:phases
155 (modify-phases %standard-phases
156 (add-after 'unpack 'enter-elisp-dir
157 (lambda _ (chdir "src/data/emacs-mode") #t)))))
158 (home-page "https://agda.readthedocs.io/en/latest/tools/emacs-mode.html")
159 (synopsis "Emacs mode for Agda")
160 (description "This Emacs mode enables interactive development with
161Agda. It also aids the input of Unicode characters.")))
276f598a
JS
162
163(define-public agda-ial
164 (package
165 (name "agda-ial")
166 (version "1.5.0")
48752f27
LC
167 (home-page "https://github.com/cedille/ial")
168 (source (origin
169 (method git-fetch)
170 (uri (git-reference (url home-page)
171 (commit (string-append "v" version))))
172 (file-name (git-file-name name version))
173 (sha256
174 (base32
175 "0dlis6v6nzbscf713cmwlx8h9n2gxghci8y21qak3hp18gkxdp0g"))))
276f598a
JS
176 (build-system gnu-build-system)
177 (inputs
178 `(("agda" ,agda)))
179 (arguments
180 `(#:parallel-build? #f
181 #:phases
182 (modify-phases %standard-phases
183 (delete 'configure)
184 (add-before 'build 'patch-dependencies
185 (lambda _ (patch-shebang "find-deps.sh") #t))
186 (delete 'check)
187 (replace 'install
188 (lambda* (#:key outputs #:allow-other-keys)
48752f27
LC
189 (let* ((out (assoc-ref outputs "out"))
190 (include (string-append out "/include/agda/ial")))
191 (for-each (lambda (file)
192 (make-file-writable file)
193 (install-file file include))
83ac4c09 194 (find-files "." "\\.agdai?(-lib)?$"))
48752f27
LC
195 #t))))))
196 (synopsis "The Iowa Agda Library")
276f598a
JS
197 (description
198 "The goal is to provide a concrete library focused on verification
199examples, as opposed to mathematics. The library has a good number
200of theorems for booleans, natural numbers, and lists. It also has
201trees, tries, vectors, and rudimentary IO. A number of good ideas
202come from Agda's standard library.")
203 (license license:expat)))