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 ;;; Copyright © 2019 Tobias Geerinckx-Rice <me@tobias.gr>
5 ;;; Copyright © 2020 Ludovic Courtès <ludo@gnu.org>
7 ;;; This file is part of GNU Guix.
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.
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.
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/>.
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))
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.
40 `(("core-specs-alpha-src"
41 ,(lib "core.specs.alpha/archive/core.specs.alpha-"
43 "0v2a0svf1ar2y42ajxwsjr7zmm5j7pp2zwrd2jh3k7xzd1p9x1fv"))
44 ("data-generators-src"
45 ,(lib "data.generators/archive/data.generators-"
47 "0kki093jp4ckwxzfnw8ylflrfqs8b1i1wi9iapmwcsy328dmgzp1"))
49 ,(lib "spec.alpha/archive/spec.alpha-"
51 "00alf0347licdn773w2jarpllyrbl52qz4d8mw61anjksacxylzz"))
53 ,(lib "test.check/archive/test.check-"
55 "0p0mnyhr442bzkz0s4k5ra3i6l5lc7kp6ajaqkkyh4c2k5yck1md"))
56 ("test-generative-src"
57 ,(lib "test.generative/archive/test.generative-"
59 "1pjafy1i7yblc7ixmcpfq1lfbyf3jaljvkgrajn70sws9xs7a9f8"))
60 ("tools-namespace-src"
61 ,(lib "tools.namespace/archive/tools.namespace-"
63 "10baak8v0hnwz2hr33bavshm7y49mmn9zsyyms1dwjz45p5ymhy0"))))
64 (library-names (match libraries
65 (((library-name _) ...)
71 (source (let ((name+version (string-append name "-" version)))
75 (url "https://github.com/clojure/clojure")
76 (commit name+version)))
77 (file-name (string-append name+version "-checkout"))
79 (base32 "1kcyv2836acs27vi75hvf3r773ahv2nlh9b3j9xa9m9sdanz1h83")))))
80 (build-system ant-build-system)
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)
92 (modify-phases %standard-phases
93 (add-after 'unpack 'unpack-library-sources
94 (lambda* (#:key inputs #:allow-other-keys)
95 (define (extract-library name)
97 (with-directory-excursion name
101 "--file" (assoc-ref inputs name)
102 "--strip-components=1"))
103 (copy-recursively (string-append name "/src/main/clojure/")
105 (for-each extract-library ',library-names)
107 (add-after 'unpack-library-sources 'fix-manifest-classpath
109 (substitute* "build.xml"
110 (("<attribute name=\"Class-Path\" value=\".\"/>") ""))
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,
122 combining the approachability and interactive development of a scripting
123 language with an efficient and robust infrastructure for multithreaded
124 programming. Clojure is a compiled language, yet remains completely dynamic
125 – every feature supported by Clojure is supported at runtime. Clojure
126 provides easy access to the Java frameworks, with optional type hints and type
127 inference, to ensure that calls to Java can avoid reflection.
129 Clojure is a dialect of Lisp, and shares with Lisp the code-as-data philosophy
130 and a powerful macro system. Clojure is predominantly a functional programming
131 language, and features a rich set of immutable, persistent data structures.
132 When mutable state is needed, Clojure offers a software transactional memory
133 system and reactive Agent system that ensure clean, correct, multithreaded
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
140 ;; See readme.html or readme.txt for details.
141 (license (list license:epl1.0
146 (define-public clojure-algo-generic
148 (name "clojure-algo-generic")
154 (url "https://github.com/clojure/algo.generic.git")
155 (commit (string-append "algo.generic-" version))))
156 (file-name (git-file-name name version))
158 (base32 "1s6q10qp276dcpzv06bq1q3bvkvlw03qhmncqcs9cc6p9lc0w4p4"))))
159 (build-system clojure-build-system)
161 '(#:source-dirs '("src/main/clojure/")
162 #:test-dirs '("src/test/clojure/")
164 (synopsis "Generic versions of common functions")
166 "Generic versions of commonly used functions, implemented as multimethods
167 that can be implemented for any data type.")
168 (home-page "https://github.com/clojure/algo.generic")
169 (license license:epl1.0)))
171 (define-public clojure-algo-monads
173 (name "clojure-algo-monads")
179 (url "https://github.com/clojure/algo.monads.git")
180 (commit (string-append "algo.monads-" version))))
181 (file-name (git-file-name name version))
183 (base32 "0mv3ba72hyhgasg2k3zy83ij61gak6cs4d6qgh8123z3j02mbh8p"))))
184 (build-system clojure-build-system)
186 '(#:source-dirs '("src/main/clojure/")
187 #:test-dirs '("src/test/clojure/")
190 `(("clojure-tools-macro" ,clojure-tools-macro)))
192 "Monad Macros and Definitions")
194 "This library contains the most commonly used monads as well as macros for
195 defining and using monads and useful monadic functions.")
196 (home-page "https://github.com/clojure/algo.monads")
197 (license license:epl1.0)))
199 (define-public clojure-core-match
200 (let ((commit "1837ffbd4a150e8f3953b2d9ed5cf4a4ad3720a7")
201 (revision "1")) ; this is the 1st commit buildable with clojure 1.9
203 (name "clojure-core-match")
204 (version (git-version "0.3.0-alpha5" revision commit))
208 (url "https://github.com/clojure/core.match.git")
210 (file-name (git-file-name name version))
213 "04bdlp5dgkrqzrz0lw3mfwmygj2218qnm1cz3dkb9wy4m0238s4d"))))
214 (build-system clojure-build-system)
216 '(#:source-dirs '("src/main/clojure")
217 #:test-dirs '("src/test/clojure")
219 (synopsis "Optimized pattern matching for Clojure")
221 "An optimized pattern matching library for Clojure.
222 It 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))))
226 (define-public clojure-instaparse
227 (let ((commit "dcfffad5b065e750f0f5835f017cdd8188b8ca2e")
228 (version "1.4.9")) ; upstream forget to tag this release
230 (name "clojure-instaparse")
235 (url "https://github.com/Engelberg/instaparse.git")
237 (file-name (git-file-name name version))
240 "002mrgin4z3dqy88r1lak7smd0m7x8d22vmliw0m6w6mh5pa17lk"))))
241 (build-system clojure-build-system)
243 '(#:doc-dirs '("docs/")))
244 (synopsis "No grammar left behind")
246 "Instaparse aims to be the simplest way to build parsers in Clojure.
249 @item Turns @emph{standard EBNF or ABNF notation} for context-free grammars
250 into an executable parser that takes a string as an input and produces a parse
251 tree for that string.
253 @item @dfn{No Grammar Left Behind}: Works for @emph{any} context-free grammar,
254 including @emph{left-recursive}, @emph{right-recursive}, and @emph{ambiguous}
257 @item Extends the power of context-free grammars with PEG-like syntax for
258 lookahead and negative lookahead.
260 @item Supports both of Clojure's most popular tree formats (hiccup and enlive)
263 @item Detailed reporting of parse errors.
265 @item Optionally produces lazy sequence of all parses (especially useful for
266 diagnosing and debugging ambiguous grammars).
268 @item ``Total parsing'' mode where leftover string is embedded in the parse
271 @item Optional combinator library for building grammars programmatically.
275 (home-page "https://github.com/Engelberg/instaparse")
276 (license license:epl1.0))))
278 (define-public clojure-tools-macro
280 (name "clojure-tools-macro")
286 (url "https://github.com/clojure/tools.macro.git")
287 (commit (string-append "tools.macro-" version))))
288 (file-name (git-file-name name version))
290 (base32 "14mdxqkwja0cffmyfav5pbcli2qvw1mjdgz0n619a2z2036andx8"))))
291 (build-system clojure-build-system)
293 '(#:source-dirs '("src/main/clojure/")
294 #:test-dirs '("src/test/clojure/")
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)))
301 (define-public clojure-tools-cli
303 (name "clojure-tools-cli")
305 (home-page "https://github.com/clojure/tools.cli")
310 (commit (string-append "tools.cli-" version))))
311 (file-name (git-file-name name version))
313 (base32 "1yqlm8lwbcjm0dp032z7vzc4bdlmc4jixznvf4adsqhvqw85hvj2"))))
314 (build-system clojure-build-system)
316 '(#:source-dirs '("src/main/clojure/")
317 #:test-dirs '("src/test/clojure/")
319 (synopsis "Clojure library for working with command-line arguments")
321 "The @code{tools.cli} library provides Clojure programmers with tools to
322 work with command-line arguments.")
323 (license license:epl1.0)))