summary refs log tree commit diff
diff options
context:
space:
mode:
authorReily Siegel <mail@reilysiegel.com>2021-12-23 18:04:46 -0500
committerRicardo Wurmus <rekado@elephly.net>2022-01-12 17:43:03 +0100
commit8cf2817d4c2e0ab8c7ab219be444f6ffa2970549 (patch)
treebfea4f53ae692b0967374af05dc12fb65f2d5681
parentd948e58e6a861075fb8c3523c3ba8c57c3759964 (diff)
downloadguix-8cf2817d4c2e0ab8c7ab219be444f6ffa2970549.tar.gz
gnu: Add clojure-tools.
* gnu/packages/clojure.scm (clojure-tools): New variable.
-rw-r--r--gnu/packages/clojure.scm58
1 files changed, 58 insertions, 0 deletions
diff --git a/gnu/packages/clojure.scm b/gnu/packages/clojure.scm
index 0cd064adf6..cb8a7a2cbe 100644
--- a/gnu/packages/clojure.scm
+++ b/gnu/packages/clojure.scm
@@ -24,11 +24,13 @@
   #:use-module (gnu packages)
   #:use-module (gnu packages java)
   #:use-module (gnu packages maven)
+  #:use-module (gnu packages readline)
   #:use-module ((guix licenses) #:prefix license:)
   #:use-module (guix packages)
   #:use-module (guix download)
   #:use-module (guix git-download)
   #:use-module (guix build-system ant)
+  #:use-module (guix build-system copy)
   #:use-module (guix build-system clojure)
   #:use-module (ice-9 match))
 
@@ -164,6 +166,62 @@ designs.")
                      license:asl2.0
                      license:cpl1.0)))))
 
+(define-public clojure-tools
+  (package
+    (name "clojure-tools")
+    (version "1.10.3.1040")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (string-append "https://download.clojure.org/install/clojure-tools-"
+                           version
+                           ".tar.gz"))
+       (sha256 (base32 "0xvr9nmk9q789vp32zmmzj4macv8v7y9ivnfd6lf7i8vxgg6hvgv"))
+       ;; Remove AOT compiled JAR.  The other JAR only contains uncompiled
+       ;; Clojure source code.
+       (snippet
+        `(delete-file ,(string-append "clojure-tools-" version ".jar")))))
+    (build-system copy-build-system)
+    (arguments
+     `(#:install-plan
+       '(("deps.edn" "lib/clojure/")
+         ("example-deps.edn" "lib/clojure/")
+         ("exec.jar" "lib/clojure/libexec/")
+         ("clojure" "bin/")
+         ("clj" "bin/"))
+       #:modules ((guix build copy-build-system)
+                  (guix build utils)
+                  (srfi srfi-1)
+                  (ice-9 match))
+       #:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'fix-paths
+           (lambda* (#:key outputs #:allow-other-keys)
+             (substitute* "clojure"
+               (("PREFIX") (string-append (assoc-ref outputs "out") "/lib/clojure")))
+             (substitute* "clj"
+               (("BINDIR") (string-append (assoc-ref outputs "out") "/bin"))
+               (("rlwrap") (which "rlwrap")))))
+         (add-after 'fix-paths 'copy-tools-deps-alpha-jar
+           (lambda* (#:key inputs outputs #:allow-other-keys)
+             (substitute* "clojure"
+               (("\\$install_dir/libexec/clojure-tools-\\$version\\.jar")
+                (string-join
+                 (append-map (match-lambda
+                               ((label . dir)
+                                (find-files dir "\\.jar$")))
+                             inputs)
+                 ":"))))))))
+    (inputs (list rlwrap
+                  clojure
+                  clojure-tools-deps-alpha
+                  java-commons-logging-minimal))
+    (home-page "https://clojure.org/releases/tools")
+    (synopsis "CLI tools for the Clojure programming language")
+    (description "The Clojure command line tools can be used to start a
+Clojure repl, use Clojure and Java libraries, and start Clojure programs.")
+    (license license:epl1.0)))
+
 (define-public clojure-algo-generic
   (package
     (name "clojure-algo-generic")