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