1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2018 Alex Vong <alexvong1995@gmail.com>
3 ;;; Copyright © 2018 Pierre Neidhardt <mail@ambrevar.xyz>
5 ;;; This file is part of GNU Guix.
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.
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.
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/>.
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))
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.
38 `(("core-specs-alpha-src"
39 ,(lib "core.specs.alpha/archive/core.specs.alpha-"
41 "0v2a0svf1ar2y42ajxwsjr7zmm5j7pp2zwrd2jh3k7xzd1p9x1fv"))
42 ("data-generators-src"
43 ,(lib "data.generators/archive/data.generators-"
45 "0kki093jp4ckwxzfnw8ylflrfqs8b1i1wi9iapmwcsy328dmgzp1"))
47 ,(lib "spec.alpha/archive/spec.alpha-"
49 "00alf0347licdn773w2jarpllyrbl52qz4d8mw61anjksacxylzz"))
51 ,(lib "test.check/archive/test.check-"
53 "0p0mnyhr442bzkz0s4k5ra3i6l5lc7kp6ajaqkkyh4c2k5yck1md"))
54 ("test-generative-src"
55 ,(lib "test.generative/archive/test.generative-"
57 "1pjafy1i7yblc7ixmcpfq1lfbyf3jaljvkgrajn70sws9xs7a9f8"))
58 ("tools-namespace-src"
59 ,(lib "tools.namespace/archive/tools.namespace-"
61 "10baak8v0hnwz2hr33bavshm7y49mmn9zsyyms1dwjz45p5ymhy0"))))
62 (library-names (match libraries
63 (((library-name _) ...)
73 (string-append "https://github.com/clojure/clojure/archive/clojure-"
76 (base32 "0xjbzcw45z32vsn9pifp7ndysjzqswp5ig0jkjpivigh2ckkdzha"))))
77 (build-system ant-build-system)
79 `(#:imported-modules ((guix build clojure-utils)
80 (guix build guile-build-system)
81 ,@%ant-build-system-modules)
82 #:modules ((guix build ant-build-system)
83 (guix build clojure-utils)
84 (guix build java-utils)
89 (modify-phases %standard-phases
90 (add-after 'unpack 'unpack-library-sources
91 (lambda* (#:key inputs #:allow-other-keys)
92 (define (extract-library name)
94 (with-directory-excursion name
98 "--file" (assoc-ref inputs name)
99 "--strip-components=1"))
100 (copy-recursively (string-append name "/src/main/clojure/")
102 (for-each extract-library ',library-names)
104 (add-after 'unpack-library-sources 'fix-manifest-classpath
106 (substitute* "build.xml"
107 (("<attribute name=\"Class-Path\" value=\".\"/>") ""))
109 (add-after 'build 'build-javadoc ant-build-javadoc)
110 (replace 'install (install-jars "./"))
111 (add-after 'install-license-files 'install-doc
112 (cut install-doc #:doc-dirs '("doc/clojure/") <...>))
113 (add-after 'install-doc 'install-javadoc
114 (install-javadoc "target/javadoc/")))))
115 (native-inputs libraries)
116 (home-page "https://clojure.org/")
117 (synopsis "Lisp dialect running on the JVM")
118 (description "Clojure is a dynamic, general-purpose programming language,
119 combining the approachability and interactive development of a scripting
120 language with an efficient and robust infrastructure for multithreaded
121 programming. Clojure is a compiled language, yet remains completely dynamic
122 – every feature supported by Clojure is supported at runtime. Clojure
123 provides easy access to the Java frameworks, with optional type hints and type
124 inference, to ensure that calls to Java can avoid reflection.
126 Clojure is a dialect of Lisp, and shares with Lisp the code-as-data philosophy
127 and a powerful macro system. Clojure is predominantly a functional programming
128 language, and features a rich set of immutable, persistent data structures.
129 When mutable state is needed, Clojure offers a software transactional memory
130 system and reactive Agent system that ensure clean, correct, multithreaded
132 ;; Clojure is licensed under EPL1.0
133 ;; ASM bytecode manipulation library is licensed under BSD-3
134 ;; Guava Murmur3 hash implementation is licensed under APL2.0
135 ;; src/clj/repl.clj is licensed under CPL1.0
137 ;; See readme.html or readme.txt for details.
138 (license (list license:epl1.0
143 (define-public clojure-algo-generic
145 (name "clojure-algo-generic")
151 (string-append "https://github.com/clojure/algo.generic/archive"
152 "/algo.generic-" version ".tar.gz"))
154 (base32 "12w9681i545gp1af4576z1qbixwps1j13c16fmcc7zsb0bd1zr7w"))))
155 (build-system clojure-build-system)
157 '(#:source-dirs '("src/main/clojure/")
158 #:test-dirs '("src/test/clojure/")
160 (synopsis "Generic versions of common functions")
162 "Generic versions of commonly used functions, implemented as multimethods
163 that can be implemented for any data type.")
164 (home-page "https://github.com/clojure/algo.generic")
165 (license license:epl1.0)))
167 (define-public clojure-algo-monads
169 (name "clojure-algo-monads")
175 (string-append "https://github.com/clojure/algo.monads/archive"
176 "/algo.monads-" version ".tar.gz"))
178 (base32 "14gbvfgmrda990h45yn7zag83vp1kdkz4f4yzmyvkr0sjihlgdmq"))))
179 (build-system clojure-build-system)
181 '(#:source-dirs '("src/main/clojure/")
182 #:test-dirs '("src/test/clojure/")
185 `(("clojure-tools-macro" ,clojure-tools-macro)))
187 "Monad Macros and Definitions")
189 "This library contains the most commonly used monads as well as macros for
190 defining and using monads and useful monadic functions.")
191 (home-page "https://github.com/clojure/algo.monads")
192 (license license:epl1.0)))
194 (define-public clojure-core-match
195 (let ((commit "1837ffbd4a150e8f3953b2d9ed5cf4a4ad3720a7")
196 (revision "1")) ; this is the 1st commit buildable with clojure 1.9
198 (name "clojure-core-match")
199 (version (git-version "0.3.0-alpha5" revision commit))
203 (url "https://github.com/clojure/core.match.git")
205 (file-name (git-file-name name version))
208 "04bdlp5dgkrqzrz0lw3mfwmygj2218qnm1cz3dkb9wy4m0238s4d"))))
209 (build-system clojure-build-system)
211 '(#:source-dirs '("src/main/clojure")
212 #:test-dirs '("src/test/clojure")
214 (synopsis "Optimized pattern matching for Clojure")
216 "An optimized pattern matching library for Clojure.
217 It supports Clojure 1.5.1 and later as well as ClojureScript.")
218 (home-page "https://github.com/clojure/core.match")
219 (license license:epl1.0))))
221 (define-public clojure-instaparse
222 (let ((commit "dcfffad5b065e750f0f5835f017cdd8188b8ca2e")
223 (version "1.4.9")) ; upstream forget to tag this release
225 (name "clojure-instaparse")
230 (url "https://github.com/Engelberg/instaparse.git")
232 (file-name (git-file-name name version))
235 "002mrgin4z3dqy88r1lak7smd0m7x8d22vmliw0m6w6mh5pa17lk"))))
236 (build-system clojure-build-system)
238 '(#:doc-dirs '("docs/")))
239 (synopsis "No grammar left behind")
241 "Instaparse aims to be the simplest way to build parsers in Clojure.
244 @item Turns @emph{standard EBNF or ABNF notation} for context-free grammars
245 into an executable parser that takes a string as an input and produces a parse
246 tree for that string.
248 @item @dfn{No Grammar Left Behind}: Works for @emph{any} context-free grammar,
249 including @emph{left-recursive}, @emph{right-recursive}, and @emph{ambiguous}
252 @item Extends the power of context-free grammars with PEG-like syntax for
253 lookahead and negative lookahead.
255 @item Supports both of Clojure's most popular tree formats (hiccup and enlive)
258 @item Detailed reporting of parse errors.
260 @item Optionally produces lazy sequence of all parses (especially useful for
261 diagnosing and debugging ambiguous grammars).
263 @item ``Total parsing'' mode where leftover string is embedded in the parse
266 @item Optional combinator library for building grammars programmatically.
270 (home-page "https://github.com/Engelberg/instaparse")
271 (license license:epl1.0))))
273 (define-public clojure-tools-macro
275 (name "clojure-tools-macro")
281 (string-append "https://github.com/clojure/tools.macro/archive"
282 "/tools.macro-" version ".tar.gz"))
284 (base32 "0fs64a0g63xx6g7sj6vrsqknhl90s0isf6k053nw8vv5prfzc7v6"))))
285 (build-system clojure-build-system)
287 '(#:source-dirs '("src/main/clojure/")
288 #:test-dirs '("src/test/clojure/")
290 (synopsis "Utilities for macro writers")
291 (description "Tools for writing macros.")
292 (home-page "https://github.com/clojure/tools.macro")
293 (license license:epl1.0)))