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