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>
6 ;;; This file is part of GNU Guix.
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.
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.
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/>.
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))
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.
39 `(("core-specs-alpha-src"
40 ,(lib "core.specs.alpha/archive/core.specs.alpha-"
42 "0v2a0svf1ar2y42ajxwsjr7zmm5j7pp2zwrd2jh3k7xzd1p9x1fv"))
43 ("data-generators-src"
44 ,(lib "data.generators/archive/data.generators-"
46 "0kki093jp4ckwxzfnw8ylflrfqs8b1i1wi9iapmwcsy328dmgzp1"))
48 ,(lib "spec.alpha/archive/spec.alpha-"
50 "00alf0347licdn773w2jarpllyrbl52qz4d8mw61anjksacxylzz"))
52 ,(lib "test.check/archive/test.check-"
54 "0p0mnyhr442bzkz0s4k5ra3i6l5lc7kp6ajaqkkyh4c2k5yck1md"))
55 ("test-generative-src"
56 ,(lib "test.generative/archive/test.generative-"
58 "1pjafy1i7yblc7ixmcpfq1lfbyf3jaljvkgrajn70sws9xs7a9f8"))
59 ("tools-namespace-src"
60 ,(lib "tools.namespace/archive/tools.namespace-"
62 "10baak8v0hnwz2hr33bavshm7y49mmn9zsyyms1dwjz45p5ymhy0"))))
63 (library-names (match libraries
64 (((library-name _) ...)
70 (source (let ((name+version (string-append name "-" version)))
74 (url "https://github.com/clojure/clojure")
75 (commit name+version)))
76 (file-name (string-append name+version "-checkout"))
78 (base32 "1kcyv2836acs27vi75hvf3r773ahv2nlh9b3j9xa9m9sdanz1h83")))))
79 (build-system ant-build-system)
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)
91 (modify-phases %standard-phases
92 (add-after 'unpack 'unpack-library-sources
93 (lambda* (#:key inputs #:allow-other-keys)
94 (define (extract-library name)
96 (with-directory-excursion name
100 "--file" (assoc-ref inputs name)
101 "--strip-components=1"))
102 (copy-recursively (string-append name "/src/main/clojure/")
104 (for-each extract-library ',library-names)
106 (add-after 'unpack-library-sources 'fix-manifest-classpath
108 (substitute* "build.xml"
109 (("<attribute name=\"Class-Path\" value=\".\"/>") ""))
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,
121 combining the approachability and interactive development of a scripting
122 language with an efficient and robust infrastructure for multithreaded
123 programming. Clojure is a compiled language, yet remains completely dynamic
124 – every feature supported by Clojure is supported at runtime. Clojure
125 provides easy access to the Java frameworks, with optional type hints and type
126 inference, to ensure that calls to Java can avoid reflection.
128 Clojure is a dialect of Lisp, and shares with Lisp the code-as-data philosophy
129 and a powerful macro system. Clojure is predominantly a functional programming
130 language, and features a rich set of immutable, persistent data structures.
131 When mutable state is needed, Clojure offers a software transactional memory
132 system and reactive Agent system that ensure clean, correct, multithreaded
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
139 ;; See readme.html or readme.txt for details.
140 (license (list license:epl1.0
145 (define-public clojure-algo-generic
147 (name "clojure-algo-generic")
153 (url "https://github.com/clojure/algo.generic.git")
154 (commit (string-append "algo.generic-" version))))
155 (file-name (git-file-name name version))
157 (base32 "1s6q10qp276dcpzv06bq1q3bvkvlw03qhmncqcs9cc6p9lc0w4p4"))))
158 (build-system clojure-build-system)
160 '(#:source-dirs '("src/main/clojure/")
161 #:test-dirs '("src/test/clojure/")
163 (synopsis "Generic versions of common functions")
165 "Generic versions of commonly used functions, implemented as multimethods
166 that can be implemented for any data type.")
167 (home-page "https://github.com/clojure/algo.generic")
168 (license license:epl1.0)))
170 (define-public clojure-algo-monads
172 (name "clojure-algo-monads")
178 (url "https://github.com/clojure/algo.monads.git")
179 (commit (string-append "algo.monads-" version))))
180 (file-name (git-file-name name version))
182 (base32 "0mv3ba72hyhgasg2k3zy83ij61gak6cs4d6qgh8123z3j02mbh8p"))))
183 (build-system clojure-build-system)
185 '(#:source-dirs '("src/main/clojure/")
186 #:test-dirs '("src/test/clojure/")
189 `(("clojure-tools-macro" ,clojure-tools-macro)))
191 "Monad Macros and Definitions")
193 "This library contains the most commonly used monads as well as macros for
194 defining and using monads and useful monadic functions.")
195 (home-page "https://github.com/clojure/algo.monads")
196 (license license:epl1.0)))
198 (define-public clojure-core-match
199 (let ((commit "1837ffbd4a150e8f3953b2d9ed5cf4a4ad3720a7")
200 (revision "1")) ; this is the 1st commit buildable with clojure 1.9
202 (name "clojure-core-match")
203 (version (git-version "0.3.0-alpha5" revision commit))
207 (url "https://github.com/clojure/core.match.git")
209 (file-name (git-file-name name version))
212 "04bdlp5dgkrqzrz0lw3mfwmygj2218qnm1cz3dkb9wy4m0238s4d"))))
213 (build-system clojure-build-system)
215 '(#:source-dirs '("src/main/clojure")
216 #:test-dirs '("src/test/clojure")
218 (synopsis "Optimized pattern matching for Clojure")
220 "An optimized pattern matching library for Clojure.
221 It 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))))
225 (define-public clojure-instaparse
226 (let ((commit "dcfffad5b065e750f0f5835f017cdd8188b8ca2e")
227 (version "1.4.9")) ; upstream forget to tag this release
229 (name "clojure-instaparse")
234 (url "https://github.com/Engelberg/instaparse.git")
236 (file-name (git-file-name name version))
239 "002mrgin4z3dqy88r1lak7smd0m7x8d22vmliw0m6w6mh5pa17lk"))))
240 (build-system clojure-build-system)
242 '(#:doc-dirs '("docs/")))
243 (synopsis "No grammar left behind")
245 "Instaparse aims to be the simplest way to build parsers in Clojure.
248 @item Turns @emph{standard EBNF or ABNF notation} for context-free grammars
249 into an executable parser that takes a string as an input and produces a parse
250 tree for that string.
252 @item @dfn{No Grammar Left Behind}: Works for @emph{any} context-free grammar,
253 including @emph{left-recursive}, @emph{right-recursive}, and @emph{ambiguous}
256 @item Extends the power of context-free grammars with PEG-like syntax for
257 lookahead and negative lookahead.
259 @item Supports both of Clojure's most popular tree formats (hiccup and enlive)
262 @item Detailed reporting of parse errors.
264 @item Optionally produces lazy sequence of all parses (especially useful for
265 diagnosing and debugging ambiguous grammars).
267 @item ``Total parsing'' mode where leftover string is embedded in the parse
270 @item Optional combinator library for building grammars programmatically.
274 (home-page "https://github.com/Engelberg/instaparse")
275 (license license:epl1.0))))
277 (define-public clojure-tools-macro
279 (name "clojure-tools-macro")
285 (url "https://github.com/clojure/tools.macro.git")
286 (commit (string-append "tools.macro-" version))))
287 (file-name (git-file-name name version))
289 (base32 "14mdxqkwja0cffmyfav5pbcli2qvw1mjdgz0n619a2z2036andx8"))))
290 (build-system clojure-build-system)
292 '(#:source-dirs '("src/main/clojure/")
293 #:test-dirs '("src/test/clojure/")
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)))