gnu: Add cl-ana.statistical-learning.
[jackhill/guix/guix.git] / gnu / packages / clojure.scm
CommitLineData
96cfa168
PN
1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2018 Alex Vong <alexvong1995@gmail.com>
3;;; Copyright © 2018 Pierre Neidhardt <mail@ambrevar.xyz>
85e0827d 4;;; Copyright © 2019 Tobias Geerinckx-Rice <me@tobias.gr>
96cfa168
PN
5;;;
6;;; This file is part of GNU Guix.
7;;;
8;;; GNU Guix is free software; you can redistribute it and/or modify it
9;;; under the terms of the GNU General Public License as published by
10;;; the Free Software Foundation; either version 3 of the License, or (at
11;;; your option) any later version.
12;;;
13;;; GNU Guix is distributed in the hope that it will be useful, but
14;;; WITHOUT ANY WARRANTY; without even the implied warranty of
15;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16;;; GNU General Public License for more details.
17;;;
18;;; You should have received a copy of the GNU General Public License
19;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
20
21(define-module (gnu packages clojure)
22 #:use-module (gnu packages)
23 #:use-module ((guix licenses) #:prefix license:)
24 #:use-module (guix packages)
25 #:use-module (guix download)
26 #:use-module (guix git-download)
27 #:use-module (guix build-system ant)
28 #:use-module (guix build-system clojure)
29 #:use-module (ice-9 match))
30
31(define-public clojure
32 (let* ((lib (lambda (prefix version hash)
33 (origin (method url-fetch)
34 (uri (string-append "https://github.com/clojure/"
35 prefix version ".tar.gz"))
36 (sha256 (base32 hash)))))
37 ;; The libraries below are needed to run the tests.
38 (libraries
39 `(("core-specs-alpha-src"
40 ,(lib "core.specs.alpha/archive/core.specs.alpha-"
41 "0.1.24"
42 "0v2a0svf1ar2y42ajxwsjr7zmm5j7pp2zwrd2jh3k7xzd1p9x1fv"))
43 ("data-generators-src"
44 ,(lib "data.generators/archive/data.generators-"
45 "0.1.2"
46 "0kki093jp4ckwxzfnw8ylflrfqs8b1i1wi9iapmwcsy328dmgzp1"))
47 ("spec-alpha-src"
48 ,(lib "spec.alpha/archive/spec.alpha-"
49 "0.1.143"
50 "00alf0347licdn773w2jarpllyrbl52qz4d8mw61anjksacxylzz"))
51 ("test-check-src"
52 ,(lib "test.check/archive/test.check-"
53 "0.9.0"
54 "0p0mnyhr442bzkz0s4k5ra3i6l5lc7kp6ajaqkkyh4c2k5yck1md"))
55 ("test-generative-src"
56 ,(lib "test.generative/archive/test.generative-"
57 "0.5.2"
58 "1pjafy1i7yblc7ixmcpfq1lfbyf3jaljvkgrajn70sws9xs7a9f8"))
59 ("tools-namespace-src"
60 ,(lib "tools.namespace/archive/tools.namespace-"
61 "0.2.11"
62 "10baak8v0hnwz2hr33bavshm7y49mmn9zsyyms1dwjz45p5ymhy0"))))
63 (library-names (match libraries
64 (((library-name _) ...)
65 library-name))))
66
67 (package
68 (name "clojure")
9e532ae2
ML
69 (version "1.10.0")
70 (source (let ((name+version (string-append name "-" version)))
71 (origin
72 (method git-fetch)
73 (uri (git-reference
74 (url "https://github.com/clojure/clojure")
75 (commit name+version)))
76 (file-name (string-append name+version "-checkout"))
77 (sha256
78 (base32 "1kcyv2836acs27vi75hvf3r773ahv2nlh9b3j9xa9m9sdanz1h83")))))
96cfa168
PN
79 (build-system ant-build-system)
80 (arguments
81 `(#:imported-modules ((guix build clojure-utils)
82 (guix build guile-build-system)
83 ,@%ant-build-system-modules)
84 #:modules ((guix build ant-build-system)
85 (guix build clojure-utils)
86 (guix build java-utils)
87 (guix build utils)
88 (srfi srfi-26))
89 #:test-target "test"
90 #:phases
91 (modify-phases %standard-phases
92 (add-after 'unpack 'unpack-library-sources
93 (lambda* (#:key inputs #:allow-other-keys)
94 (define (extract-library name)
95 (mkdir-p name)
96 (with-directory-excursion name
97 (invoke "tar"
98 "--extract"
99 "--verbose"
100 "--file" (assoc-ref inputs name)
101 "--strip-components=1"))
102 (copy-recursively (string-append name "/src/main/clojure/")
103 "src/clj/"))
104 (for-each extract-library ',library-names)
105 #t))
106 (add-after 'unpack-library-sources 'fix-manifest-classpath
107 (lambda _
108 (substitute* "build.xml"
109 (("<attribute name=\"Class-Path\" value=\".\"/>") ""))
110 #t))
111 (add-after 'build 'build-javadoc ant-build-javadoc)
112 (replace 'install (install-jars "./"))
113 (add-after 'install-license-files 'install-doc
114 (cut install-doc #:doc-dirs '("doc/clojure/") <...>))
115 (add-after 'install-doc 'install-javadoc
116 (install-javadoc "target/javadoc/")))))
117 (native-inputs libraries)
118 (home-page "https://clojure.org/")
119 (synopsis "Lisp dialect running on the JVM")
120 (description "Clojure is a dynamic, general-purpose programming language,
121combining the approachability and interactive development of a scripting
122language with an efficient and robust infrastructure for multithreaded
123programming. Clojure is a compiled language, yet remains completely dynamic
124– every feature supported by Clojure is supported at runtime. Clojure
125provides easy access to the Java frameworks, with optional type hints and type
126inference, to ensure that calls to Java can avoid reflection.
127
128Clojure is a dialect of Lisp, and shares with Lisp the code-as-data philosophy
129and a powerful macro system. Clojure is predominantly a functional programming
130language, and features a rich set of immutable, persistent data structures.
131When mutable state is needed, Clojure offers a software transactional memory
132system and reactive Agent system that ensure clean, correct, multithreaded
133designs.")
134 ;; Clojure is licensed under EPL1.0
135 ;; ASM bytecode manipulation library is licensed under BSD-3
136 ;; Guava Murmur3 hash implementation is licensed under APL2.0
137 ;; src/clj/repl.clj is licensed under CPL1.0
138
139 ;; See readme.html or readme.txt for details.
140 (license (list license:epl1.0
141 license:bsd-3
142 license:asl2.0
143 license:cpl1.0)))))
144
145(define-public clojure-algo-generic
146 (package
147 (name "clojure-algo-generic")
148 (version "0.1.3")
149 (source
150 (origin
85e0827d
TGR
151 (method git-fetch)
152 (uri (git-reference
153 (url "https://github.com/clojure/algo.generic.git")
154 (commit (string-append "algo.generic-" version))))
155 (file-name (git-file-name name version))
96cfa168 156 (sha256
85e0827d 157 (base32 "1s6q10qp276dcpzv06bq1q3bvkvlw03qhmncqcs9cc6p9lc0w4p4"))))
96cfa168
PN
158 (build-system clojure-build-system)
159 (arguments
160 '(#:source-dirs '("src/main/clojure/")
161 #:test-dirs '("src/test/clojure/")
162 #:doc-dirs '()))
163 (synopsis "Generic versions of common functions")
164 (description
165 "Generic versions of commonly used functions, implemented as multimethods
166that can be implemented for any data type.")
167 (home-page "https://github.com/clojure/algo.generic")
168 (license license:epl1.0)))
169
170(define-public clojure-algo-monads
171 (package
172 (name "clojure-algo-monads")
173 (version "0.1.6")
174 (source
175 (origin
62dbf78b
TGR
176 (method git-fetch)
177 (uri (git-reference
178 (url "https://github.com/clojure/algo.monads.git")
179 (commit (string-append "algo.monads-" version))))
180 (file-name (git-file-name name version))
96cfa168 181 (sha256
62dbf78b 182 (base32 "0mv3ba72hyhgasg2k3zy83ij61gak6cs4d6qgh8123z3j02mbh8p"))))
96cfa168
PN
183 (build-system clojure-build-system)
184 (arguments
185 '(#:source-dirs '("src/main/clojure/")
186 #:test-dirs '("src/test/clojure/")
187 #:doc-dirs '()))
188 (native-inputs
189 `(("clojure-tools-macro" ,clojure-tools-macro)))
190 (synopsis
191 "Monad Macros and Definitions")
192 (description
193 "This library contains the most commonly used monads as well as macros for
194defining and using monads and useful monadic functions.")
195 (home-page "https://github.com/clojure/algo.monads")
196 (license license:epl1.0)))
197
198(define-public clojure-core-match
199 (let ((commit "1837ffbd4a150e8f3953b2d9ed5cf4a4ad3720a7")
200 (revision "1")) ; this is the 1st commit buildable with clojure 1.9
201 (package
202 (name "clojure-core-match")
203 (version (git-version "0.3.0-alpha5" revision commit))
204 (source (origin
205 (method git-fetch)
206 (uri (git-reference
207 (url "https://github.com/clojure/core.match.git")
208 (commit commit)))
209 (file-name (git-file-name name version))
210 (sha256
211 (base32
212 "04bdlp5dgkrqzrz0lw3mfwmygj2218qnm1cz3dkb9wy4m0238s4d"))))
213 (build-system clojure-build-system)
214 (arguments
215 '(#:source-dirs '("src/main/clojure")
216 #:test-dirs '("src/test/clojure")
217 #:doc-dirs '()))
218 (synopsis "Optimized pattern matching for Clojure")
219 (description
220 "An optimized pattern matching library for Clojure.
221It supports Clojure 1.5.1 and later as well as ClojureScript.")
222 (home-page "https://github.com/clojure/core.match")
223 (license license:epl1.0))))
224
225(define-public clojure-instaparse
226 (let ((commit "dcfffad5b065e750f0f5835f017cdd8188b8ca2e")
227 (version "1.4.9")) ; upstream forget to tag this release
228 (package
229 (name "clojure-instaparse")
230 (version version)
231 (source (origin
232 (method git-fetch)
233 (uri (git-reference
234 (url "https://github.com/Engelberg/instaparse.git")
235 (commit commit)))
236 (file-name (git-file-name name version))
237 (sha256
238 (base32
239 "002mrgin4z3dqy88r1lak7smd0m7x8d22vmliw0m6w6mh5pa17lk"))))
240 (build-system clojure-build-system)
241 (arguments
242 '(#:doc-dirs '("docs/")))
243 (synopsis "No grammar left behind")
244 (description
245 "Instaparse aims to be the simplest way to build parsers in Clojure.
246
247@itemize
248@item Turns @emph{standard EBNF or ABNF notation} for context-free grammars
249into an executable parser that takes a string as an input and produces a parse
250tree for that string.
251
252@item @dfn{No Grammar Left Behind}: Works for @emph{any} context-free grammar,
253including @emph{left-recursive}, @emph{right-recursive}, and @emph{ambiguous}
254grammars.
255
256@item Extends the power of context-free grammars with PEG-like syntax for
257lookahead and negative lookahead.
258
259@item Supports both of Clojure's most popular tree formats (hiccup and enlive)
260as output targets
261
262@item Detailed reporting of parse errors.
263
264@item Optionally produces lazy sequence of all parses (especially useful for
265diagnosing and debugging ambiguous grammars).
266
267@item ``Total parsing'' mode where leftover string is embedded in the parse
268tree.
269
270@item Optional combinator library for building grammars programmatically.
271
272@item Performant.
273@end itemize")
274 (home-page "https://github.com/Engelberg/instaparse")
275 (license license:epl1.0))))
276
277(define-public clojure-tools-macro
278 (package
279 (name "clojure-tools-macro")
280 (version "0.1.5")
281 (source
282 (origin
99631313
TGR
283 (method git-fetch)
284 (uri (git-reference
285 (url "https://github.com/clojure/tools.macro.git")
286 (commit (string-append "tools.macro-" version))))
287 (file-name (git-file-name name version))
96cfa168 288 (sha256
99631313 289 (base32 "14mdxqkwja0cffmyfav5pbcli2qvw1mjdgz0n619a2z2036andx8"))))
96cfa168
PN
290 (build-system clojure-build-system)
291 (arguments
292 '(#:source-dirs '("src/main/clojure/")
293 #:test-dirs '("src/test/clojure/")
294 #:doc-dirs '()))
295 (synopsis "Utilities for macro writers")
296 (description "Tools for writing macros.")
297 (home-page "https://github.com/clojure/tools.macro")
298 (license license:epl1.0)))