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