GNU bug report logs - #33215
[PATCH 00/11] build-system: Add 'clojure-build-system'.

Previous Next

Package: guix-patches;

Reported by: Alex Vong <alexvong1995 <at> gmail.com>

Date: Wed, 31 Oct 2018 06:04:02 UTC

Severity: normal

Tags: patch

Done: Danny Milosavljevic <dannym <at> scratchpost.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 33215 in the body.
You can then email your comments to 33215 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to guix-patches <at> gnu.org:
bug#33215; Package guix-patches. (Wed, 31 Oct 2018 06:04:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Alex Vong <alexvong1995 <at> gmail.com>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Wed, 31 Oct 2018 06:04:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Alex Vong <alexvong1995 <at> gmail.com>
To: guix-patches <at> gnu.org
Cc: alexvong1995 <at> gmail.com
Subject: [PATCH 00/11] build-system: Add 'clojure-build-system'.
Date: Wed, 31 Oct 2018 14:02:36 +0800
[Message part 1 (text/plain, inline)]
Hello,

This patch series adds a simple Clojure build system to guix. It uses
plain old 'compile' in Clojure. The patch series does 4 things:

1. Move the 'clojure' package from 'java.scm' to 'lisp.scm' since
clojure is a lisp! Also, 'java.scm' is getting large. I don't want to
make it even larger by adding new clojure packages.
2. Refactor the 'clojure' package. For example, removing the need to
keep 2 lists in sync and factors code into the new 'clojure-utils.scm'.
3. Add 'clojure-build-system' and friends.
4. Add 5 clojure packages to test if everthing works.

Cheers,
Alex
[signature.asc (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#33215; Package guix-patches. (Wed, 31 Oct 2018 06:06:01 GMT) Full text and rfc822 format available.

Message #8 received at 33215 <at> debbugs.gnu.org (full text, mbox):

From: Alex Vong <alexvong1995 <at> gmail.com>
To: 33215 <at> debbugs.gnu.org
Cc: alexvong1995 <at> gmail.com
Subject: [PATCH 01/11] gnu: clojure: Move from java to lisp.
Date: Wed, 31 Oct 2018 14:05:37 +0800
[0001-gnu-clojure-Move-from-java-to-lisp.patch (text/x-diff, inline)]
From 49dd56fa81666077fe50b05e46228c0734201d1c Mon Sep 17 00:00:00 2001
From: Alex Vong <alexvong1995 <at> gmail.com>
Date: Fri, 12 Oct 2018 17:58:00 +0800
Subject: [PATCH 01/11] gnu: clojure: Move from java to lisp.

* gnu/packages/java.scm (clojure): Move from here...
* gnu/packages/lisp.scm (clojure): ...to here.
---
 gnu/packages/java.scm | 145 -----------------------------------------
 gnu/packages/lisp.scm | 147 ++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 147 insertions(+), 145 deletions(-)

diff --git a/gnu/packages/java.scm b/gnu/packages/java.scm
index f6d72edee..cea3c4e33 100644
--- a/gnu/packages/java.scm
+++ b/gnu/packages/java.scm
@@ -1803,151 +1803,6 @@ new Date();"))
      `(("java-junit" ,java-junit)
        ,@(package-inputs ant/java8)))))
 
-(define-public clojure
-  (let* ((remove-archives '(begin
-                             (for-each delete-file
-                                       (find-files "." ".*\\.(jar|zip)"))
-                             #t))
-         (submodule (lambda (prefix version hash)
-                      (origin
-                        (method url-fetch)
-                        (uri (string-append "https://github.com/clojure/"
-                                            prefix version ".tar.gz"))
-                        (sha256 (base32 hash))
-                        (modules '((guix build utils)))
-                        (snippet remove-archives)))))
-    (package
-      (name "clojure")
-      (version "1.9.0")
-      (source
-       (origin
-         (method url-fetch)
-         (uri
-          (string-append "https://github.com/clojure/clojure/archive/clojure-"
-                         version ".tar.gz"))
-         (sha256
-          (base32 "0xjbzcw45z32vsn9pifp7ndysjzqswp5ig0jkjpivigh2ckkdzha"))
-         (modules '((guix build utils)))
-         (snippet remove-archives)))
-      (build-system ant-build-system)
-      (arguments
-       `(#:modules ((guix build ant-build-system)
-                    (guix build utils)
-                    (ice-9 ftw)
-                    (ice-9 regex)
-                    (srfi srfi-1)
-                    (srfi srfi-26))
-         #:test-target "test"
-         #:phases
-         (modify-phases %standard-phases
-           (add-after 'unpack 'unpack-submodule-sources
-             (lambda* (#:key inputs #:allow-other-keys)
-               (for-each
-                (lambda (name)
-                  (mkdir-p name)
-                  (with-directory-excursion name
-                    (invoke "tar"
-                            ;; Use xz for repacked tarball.
-                            "--xz"
-                            "--extract"
-                            "--verbose"
-                            "--file" (assoc-ref inputs name)
-                            "--strip-components=1"))
-                  (copy-recursively (string-append name "/src/main/clojure/")
-                                    "src/clj/"))
-                '("core-specs-alpha-src"
-                  "data-generators-src"
-                  "spec-alpha-src"
-                  "test-check-src"
-                  "test-generative-src"
-                  "tools-namespace-src"))
-               #t))
-           (add-after 'unpack 'fix-manifest-classpath
-             (lambda _
-               (substitute* "build.xml"
-                 (("<attribute name=\"Class-Path\" value=\".\"/>") ""))
-               #t))
-           ;; The javadoc target is not built by default.
-           (add-after 'build 'build-doc
-             (lambda _
-               (invoke "ant" "javadoc")))
-           ;; Needed since no install target is provided.
-           (replace 'install
-             (lambda* (#:key outputs #:allow-other-keys)
-               (let ((java-dir (string-append (assoc-ref outputs "out")
-                                              "/share/java/")))
-                 ;; Install versioned to avoid collisions.
-                 (install-file (string-append "clojure-" ,version ".jar")
-                               java-dir)
-                 #t)))
-           ;; Needed since no install-doc target is provided.
-           (add-after 'install 'install-doc
-             (lambda* (#:key outputs #:allow-other-keys)
-               (let ((doc-dir (string-append (assoc-ref outputs "out")
-                                             "/share/doc/clojure-"
-                                             ,version "/")))
-                 (copy-recursively "doc/clojure" doc-dir)
-                 (copy-recursively "target/javadoc/"
-                                   (string-append doc-dir "javadoc/"))
-                 (for-each (cut install-file <> doc-dir)
-                           (filter (cut string-match
-                                     ".*\\.(html|markdown|md|txt)"
-                                     <>)
-                                   (scandir "./")))
-                 #t))))))
-      ;; The native-inputs below are needed to run the tests.
-      (native-inputs
-       `(("core-specs-alpha-src"
-          ,(submodule "core.specs.alpha/archive/core.specs.alpha-"
-                      "0.1.24"
-                      "0v2a0svf1ar2y42ajxwsjr7zmm5j7pp2zwrd2jh3k7xzd1p9x1fv"))
-         ("data-generators-src"
-          ,(submodule "data.generators/archive/data.generators-"
-                      "0.1.2"
-                      "0kki093jp4ckwxzfnw8ylflrfqs8b1i1wi9iapmwcsy328dmgzp1"))
-         ("spec-alpha-src"
-          ,(submodule "spec.alpha/archive/spec.alpha-"
-                      "0.1.143"
-                      "00alf0347licdn773w2jarpllyrbl52qz4d8mw61anjksacxylzz"))
-         ("test-check-src"
-          ,(submodule "test.check/archive/test.check-"
-                      "0.9.0"
-                      "0p0mnyhr442bzkz0s4k5ra3i6l5lc7kp6ajaqkkyh4c2k5yck1md"))
-         ("test-generative-src"
-          ,(submodule "test.generative/archive/test.generative-"
-                      "0.5.2"
-                      "1pjafy1i7yblc7ixmcpfq1lfbyf3jaljvkgrajn70sws9xs7a9f8"))
-         ("tools-namespace-src"
-          ,(submodule "tools.namespace/archive/tools.namespace-"
-                      "0.2.11"
-                      "10baak8v0hnwz2hr33bavshm7y49mmn9zsyyms1dwjz45p5ymhy0"))))
-      (home-page "https://clojure.org/")
-      (synopsis "Lisp dialect running on the JVM")
-      (description "Clojure is a dynamic, general-purpose programming language,
-combining the approachability and interactive development of a scripting
-language with an efficient and robust infrastructure for multithreaded
-programming.  Clojure is a compiled language, yet remains completely dynamic
-– every feature supported by Clojure is supported at runtime.  Clojure
-provides easy access to the Java frameworks, with optional type hints and type
-inference, to ensure that calls to Java can avoid reflection.
-
-Clojure is a dialect of Lisp, and shares with Lisp the code-as-data philosophy
-and a powerful macro system.  Clojure is predominantly a functional programming
-language, and features a rich set of immutable, persistent data structures.
-When mutable state is needed, Clojure offers a software transactional memory
-system and reactive Agent system that ensure clean, correct, multithreaded
-designs.")
-      ;; Clojure is licensed under EPL1.0
-      ;; ASM bytecode manipulation library is licensed under BSD-3
-      ;; Guava Murmur3 hash implementation is licensed under APL2.0
-      ;; src/clj/repl.clj is licensed under CPL1.0
-      ;;
-      ;; See readme.html or readme.txt for details.
-      (license (list license:epl1.0
-                     license:bsd-3
-                     license:asl2.0
-                     license:cpl1.0)))))
-
 (define-public javacc-4
   (package
     (name "javacc")
diff --git a/gnu/packages/lisp.scm b/gnu/packages/lisp.scm
index c32380969..93851c1a8 100644
--- a/gnu/packages/lisp.scm
+++ b/gnu/packages/lisp.scm
@@ -9,6 +9,7 @@
 ;;; Copyright © 2017, 2018 Efraim Flashner <efraim <at> flashner.co.il>
 ;;; Copyright © 2017 Tobias Geerinckx-Rice <me <at> tobias.gr>
 ;;; Copyright © 2018 Benjamin Slade <slade <at> jnanam.net>
+;;; Copyright © 2018 Alex Vong <alexvong1995 <at> gmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -34,6 +35,7 @@
   #:use-module (guix hg-download)
   #:use-module (guix utils)
   #:use-module (guix build-system gnu)
+  #:use-module (guix build-system ant)
   #:use-module (guix build-system asdf)
   #:use-module (guix build-system trivial)
   #:use-module (gnu packages admin)
@@ -559,6 +561,151 @@ interface.")
     (license (list license:lgpl2.1
                    license:clarified-artistic)))) ;TRIVIAL-LDAP package
 
+(define-public clojure
+  (let* ((remove-archives '(begin
+                             (for-each delete-file
+                                       (find-files "." ".*\\.(jar|zip)"))
+                             #t))
+         (submodule (lambda (prefix version hash)
+                      (origin
+                        (method url-fetch)
+                        (uri (string-append "https://github.com/clojure/"
+                                            prefix version ".tar.gz"))
+                        (sha256 (base32 hash))
+                        (modules '((guix build utils)))
+                        (snippet remove-archives)))))
+    (package
+      (name "clojure")
+      (version "1.9.0")
+      (source
+       (origin
+         (method url-fetch)
+         (uri
+          (string-append "https://github.com/clojure/clojure/archive/clojure-"
+                         version ".tar.gz"))
+         (sha256
+          (base32 "0xjbzcw45z32vsn9pifp7ndysjzqswp5ig0jkjpivigh2ckkdzha"))
+         (modules '((guix build utils)))
+         (snippet remove-archives)))
+      (build-system ant-build-system)
+      (arguments
+       `(#:modules ((guix build ant-build-system)
+                    (guix build utils)
+                    (ice-9 ftw)
+                    (ice-9 regex)
+                    (srfi srfi-1)
+                    (srfi srfi-26))
+         #:test-target "test"
+         #:phases
+         (modify-phases %standard-phases
+           (add-after 'unpack 'unpack-submodule-sources
+             (lambda* (#:key inputs #:allow-other-keys)
+               (for-each
+                (lambda (name)
+                  (mkdir-p name)
+                  (with-directory-excursion name
+                    (invoke "tar"
+                            ;; Use xz for repacked tarball.
+                            "--xz"
+                            "--extract"
+                            "--verbose"
+                            "--file" (assoc-ref inputs name)
+                            "--strip-components=1"))
+                  (copy-recursively (string-append name "/src/main/clojure/")
+                                    "src/clj/"))
+                '("core-specs-alpha-src"
+                  "data-generators-src"
+                  "spec-alpha-src"
+                  "test-check-src"
+                  "test-generative-src"
+                  "tools-namespace-src"))
+               #t))
+           (add-after 'unpack 'fix-manifest-classpath
+             (lambda _
+               (substitute* "build.xml"
+                 (("<attribute name=\"Class-Path\" value=\".\"/>") ""))
+               #t))
+           ;; The javadoc target is not built by default.
+           (add-after 'build 'build-doc
+             (lambda _
+               (invoke "ant" "javadoc")))
+           ;; Needed since no install target is provided.
+           (replace 'install
+             (lambda* (#:key outputs #:allow-other-keys)
+               (let ((java-dir (string-append (assoc-ref outputs "out")
+                                              "/share/java/")))
+                 ;; Install versioned to avoid collisions.
+                 (install-file (string-append "clojure-" ,version ".jar")
+                               java-dir)
+                 #t)))
+           ;; Needed since no install-doc target is provided.
+           (add-after 'install 'install-doc
+             (lambda* (#:key outputs #:allow-other-keys)
+               (let ((doc-dir (string-append (assoc-ref outputs "out")
+                                             "/share/doc/clojure-"
+                                             ,version "/")))
+                 (copy-recursively "doc/clojure" doc-dir)
+                 (copy-recursively "target/javadoc/"
+                                   (string-append doc-dir "javadoc/"))
+                 (for-each (cut install-file <> doc-dir)
+                           (filter (cut string-match
+                                     ".*\\.(html|markdown|md|txt)"
+                                     <>)
+                                   (scandir "./")))
+                 #t))))))
+      ;; The native-inputs below are needed to run the tests.
+      (native-inputs
+       `(("core-specs-alpha-src"
+          ,(submodule "core.specs.alpha/archive/core.specs.alpha-"
+                      "0.1.24"
+                      "0v2a0svf1ar2y42ajxwsjr7zmm5j7pp2zwrd2jh3k7xzd1p9x1fv"))
+         ("data-generators-src"
+          ,(submodule "data.generators/archive/data.generators-"
+                      "0.1.2"
+                      "0kki093jp4ckwxzfnw8ylflrfqs8b1i1wi9iapmwcsy328dmgzp1"))
+         ("spec-alpha-src"
+          ,(submodule "spec.alpha/archive/spec.alpha-"
+                      "0.1.143"
+                      "00alf0347licdn773w2jarpllyrbl52qz4d8mw61anjksacxylzz"))
+         ("test-check-src"
+          ,(submodule "test.check/archive/test.check-"
+                      "0.9.0"
+                      "0p0mnyhr442bzkz0s4k5ra3i6l5lc7kp6ajaqkkyh4c2k5yck1md"))
+         ("test-generative-src"
+          ,(submodule "test.generative/archive/test.generative-"
+                      "0.5.2"
+                      "1pjafy1i7yblc7ixmcpfq1lfbyf3jaljvkgrajn70sws9xs7a9f8"))
+         ("tools-namespace-src"
+          ,(submodule "tools.namespace/archive/tools.namespace-"
+                      "0.2.11"
+                      "10baak8v0hnwz2hr33bavshm7y49mmn9zsyyms1dwjz45p5ymhy0"))))
+      (home-page "https://clojure.org/")
+      (synopsis "Lisp dialect running on the JVM")
+      (description "Clojure is a dynamic, general-purpose programming language,
+combining the approachability and interactive development of a scripting
+language with an efficient and robust infrastructure for multithreaded
+programming.  Clojure is a compiled language, yet remains completely dynamic
+– every feature supported by Clojure is supported at runtime.  Clojure
+provides easy access to the Java frameworks, with optional type hints and type
+inference, to ensure that calls to Java can avoid reflection.
+
+Clojure is a dialect of Lisp, and shares with Lisp the code-as-data philosophy
+and a powerful macro system.  Clojure is predominantly a functional programming
+language, and features a rich set of immutable, persistent data structures.
+When mutable state is needed, Clojure offers a software transactional memory
+system and reactive Agent system that ensure clean, correct, multithreaded
+designs.")
+      ;; Clojure is licensed under EPL1.0
+      ;; ASM bytecode manipulation library is licensed under BSD-3
+      ;; Guava Murmur3 hash implementation is licensed under APL2.0
+      ;; src/clj/repl.clj is licensed under CPL1.0
+      ;;
+      ;; See readme.html or readme.txt for details.
+      (license (list license:epl1.0
+                     license:bsd-3
+                     license:asl2.0
+                     license:cpl1.0)))))
+
 (define-public femtolisp
   (let ((commit "68c5b1225572ecf2c52baf62f928063e5a30511b")
         (revision "1"))
-- 
2.19.1

[signature.asc (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#33215; Package guix-patches. (Wed, 31 Oct 2018 06:07:02 GMT) Full text and rfc822 format available.

Message #11 received at 33215 <at> debbugs.gnu.org (full text, mbox):

From: Alex Vong <alexvong1995 <at> gmail.com>
To: 33215 <at> debbugs.gnu.org
Cc: alexvong1995 <at> gmail.com
Subject: [PATCH 02/11] gnu: clojure: Remove 'remove-archives' snippet.
Date: Wed, 31 Oct 2018 14:06:35 +0800
[0002-gnu-clojure-Remove-remove-archives-snippet.patch (text/x-diff, inline)]
From aade1b3a84bc1e2cb6ad46b477025cb14daa6080 Mon Sep 17 00:00:00 2001
From: Alex Vong <alexvong1995 <at> gmail.com>
Date: Sat, 13 Oct 2018 18:32:14 +0800
Subject: [PATCH 02/11] gnu: clojure: Remove 'remove-archives' snippet.

This is no longer needed since clojure now makes official source releases
in github.

* gnu/packages/lisp.scm (clojure)[source]: Remove it.
[native-inputs]: Remove it in 'submodule'.
[arguments]: Adjust 'unpack-submodule-sources' phase accordingly.
---
 gnu/packages/lisp.scm | 24 +++++++-----------------
 1 file changed, 7 insertions(+), 17 deletions(-)

diff --git a/gnu/packages/lisp.scm b/gnu/packages/lisp.scm
index 93851c1a8..df0c0a87e 100644
--- a/gnu/packages/lisp.scm
+++ b/gnu/packages/lisp.scm
@@ -562,18 +562,12 @@ interface.")
                    license:clarified-artistic)))) ;TRIVIAL-LDAP package
 
 (define-public clojure
-  (let* ((remove-archives '(begin
-                             (for-each delete-file
-                                       (find-files "." ".*\\.(jar|zip)"))
-                             #t))
-         (submodule (lambda (prefix version hash)
-                      (origin
-                        (method url-fetch)
-                        (uri (string-append "https://github.com/clojure/"
-                                            prefix version ".tar.gz"))
-                        (sha256 (base32 hash))
-                        (modules '((guix build utils)))
-                        (snippet remove-archives)))))
+  (let ((submodule (lambda (prefix version hash)
+                     (origin
+                       (method url-fetch)
+                       (uri (string-append "https://github.com/clojure/"
+                                           prefix version ".tar.gz"))
+                       (sha256 (base32 hash))))))
     (package
       (name "clojure")
       (version "1.9.0")
@@ -584,9 +578,7 @@ interface.")
           (string-append "https://github.com/clojure/clojure/archive/clojure-"
                          version ".tar.gz"))
          (sha256
-          (base32 "0xjbzcw45z32vsn9pifp7ndysjzqswp5ig0jkjpivigh2ckkdzha"))
-         (modules '((guix build utils)))
-         (snippet remove-archives)))
+          (base32 "0xjbzcw45z32vsn9pifp7ndysjzqswp5ig0jkjpivigh2ckkdzha"))))
       (build-system ant-build-system)
       (arguments
        `(#:modules ((guix build ant-build-system)
@@ -605,8 +597,6 @@ interface.")
                   (mkdir-p name)
                   (with-directory-excursion name
                     (invoke "tar"
-                            ;; Use xz for repacked tarball.
-                            "--xz"
                             "--extract"
                             "--verbose"
                             "--file" (assoc-ref inputs name)
-- 
2.19.1

[signature.asc (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#33215; Package guix-patches. (Wed, 31 Oct 2018 06:08:01 GMT) Full text and rfc822 format available.

Message #14 received at 33215 <at> debbugs.gnu.org (full text, mbox):

From: Alex Vong <alexvong1995 <at> gmail.com>
To: 33215 <at> debbugs.gnu.org
Cc: alexvong1995 <at> gmail.com
Subject: [PATCH 03/11] gnu: clojure: Refactor to ensure there's a single list
 of libraries.
Date: Wed, 31 Oct 2018 14:07:22 +0800
[0003-gnu-clojure-Refactor-to-ensure-there-s-a-single-list.patch (text/x-diff, inline)]
From cd355d8cec3c747f58748d5cf750af7d6efd5d5a Mon Sep 17 00:00:00 2001
From: Alex Vong <alexvong1995 <at> gmail.com>
Date: Sun, 14 Oct 2018 00:08:29 +0800
Subject: [PATCH 03/11] gnu: clojure: Refactor to ensure there's a single list
 of libraries.

This avoids having to update multiple lists.

* gnu/packages/lisp.scm (clojure)[native-inputs]: Use new local variable.
[arguments]: Adjust build phases accordingly.
---
 gnu/packages/lisp.scm | 101 ++++++++++++++++++++----------------------
 1 file changed, 49 insertions(+), 52 deletions(-)

diff --git a/gnu/packages/lisp.scm b/gnu/packages/lisp.scm
index df0c0a87e..c42878fd3 100644
--- a/gnu/packages/lisp.scm
+++ b/gnu/packages/lisp.scm
@@ -562,12 +562,40 @@ interface.")
                    license:clarified-artistic)))) ;TRIVIAL-LDAP package
 
 (define-public clojure
-  (let ((submodule (lambda (prefix version hash)
-                     (origin
-                       (method url-fetch)
-                       (uri (string-append "https://github.com/clojure/"
-                                           prefix version ".tar.gz"))
-                       (sha256 (base32 hash))))))
+  (let* ((lib (lambda (prefix version hash)
+                (origin (method url-fetch)
+                        (uri (string-append "https://github.com/clojure/"
+                                            prefix version ".tar.gz"))
+                        (sha256 (base32 hash)))))
+         ;; The libraries below are needed to run the tests.
+         (libraries
+          `(("core-specs-alpha-src"
+             ,(lib "core.specs.alpha/archive/core.specs.alpha-"
+                   "0.1.24"
+                   "0v2a0svf1ar2y42ajxwsjr7zmm5j7pp2zwrd2jh3k7xzd1p9x1fv"))
+            ("data-generators-src"
+             ,(lib "data.generators/archive/data.generators-"
+                   "0.1.2"
+                   "0kki093jp4ckwxzfnw8ylflrfqs8b1i1wi9iapmwcsy328dmgzp1"))
+            ("spec-alpha-src"
+             ,(lib "spec.alpha/archive/spec.alpha-"
+                   "0.1.143"
+                   "00alf0347licdn773w2jarpllyrbl52qz4d8mw61anjksacxylzz"))
+            ("test-check-src"
+             ,(lib "test.check/archive/test.check-"
+                   "0.9.0"
+                   "0p0mnyhr442bzkz0s4k5ra3i6l5lc7kp6ajaqkkyh4c2k5yck1md"))
+            ("test-generative-src"
+             ,(lib "test.generative/archive/test.generative-"
+                   "0.5.2"
+                   "1pjafy1i7yblc7ixmcpfq1lfbyf3jaljvkgrajn70sws9xs7a9f8"))
+            ("tools-namespace-src"
+             ,(lib "tools.namespace/archive/tools.namespace-"
+                   "0.2.11"
+                   "10baak8v0hnwz2hr33bavshm7y49mmn9zsyyms1dwjz45p5ymhy0"))))
+         (library-names (match libraries
+                          (((library-name _) ...)
+                           library-name))))
     (package
       (name "clojure")
       (version "1.9.0")
@@ -590,27 +618,21 @@ interface.")
          #:test-target "test"
          #:phases
          (modify-phases %standard-phases
-           (add-after 'unpack 'unpack-submodule-sources
+           (add-after 'unpack 'unpack-library-sources
              (lambda* (#:key inputs #:allow-other-keys)
-               (for-each
-                (lambda (name)
-                  (mkdir-p name)
-                  (with-directory-excursion name
-                    (invoke "tar"
-                            "--extract"
-                            "--verbose"
-                            "--file" (assoc-ref inputs name)
-                            "--strip-components=1"))
-                  (copy-recursively (string-append name "/src/main/clojure/")
-                                    "src/clj/"))
-                '("core-specs-alpha-src"
-                  "data-generators-src"
-                  "spec-alpha-src"
-                  "test-check-src"
-                  "test-generative-src"
-                  "tools-namespace-src"))
+               (define (extract-library name)
+                 (mkdir-p name)
+                 (with-directory-excursion name
+                   (invoke "tar"
+                           "--extract"
+                           "--verbose"
+                           "--file" (assoc-ref inputs name)
+                           "--strip-components=1"))
+                 (copy-recursively (string-append name "/src/main/clojure/")
+                                   "src/clj/"))
+               (for-each extract-library ',library-names)
                #t))
-           (add-after 'unpack 'fix-manifest-classpath
+           (add-after 'unpack-library-sources 'fix-manifest-classpath
              (lambda _
                (substitute* "build.xml"
                  (("<attribute name=\"Class-Path\" value=\".\"/>") ""))
@@ -643,32 +665,7 @@ interface.")
                                      <>)
                                    (scandir "./")))
                  #t))))))
-      ;; The native-inputs below are needed to run the tests.
-      (native-inputs
-       `(("core-specs-alpha-src"
-          ,(submodule "core.specs.alpha/archive/core.specs.alpha-"
-                      "0.1.24"
-                      "0v2a0svf1ar2y42ajxwsjr7zmm5j7pp2zwrd2jh3k7xzd1p9x1fv"))
-         ("data-generators-src"
-          ,(submodule "data.generators/archive/data.generators-"
-                      "0.1.2"
-                      "0kki093jp4ckwxzfnw8ylflrfqs8b1i1wi9iapmwcsy328dmgzp1"))
-         ("spec-alpha-src"
-          ,(submodule "spec.alpha/archive/spec.alpha-"
-                      "0.1.143"
-                      "00alf0347licdn773w2jarpllyrbl52qz4d8mw61anjksacxylzz"))
-         ("test-check-src"
-          ,(submodule "test.check/archive/test.check-"
-                      "0.9.0"
-                      "0p0mnyhr442bzkz0s4k5ra3i6l5lc7kp6ajaqkkyh4c2k5yck1md"))
-         ("test-generative-src"
-          ,(submodule "test.generative/archive/test.generative-"
-                      "0.5.2"
-                      "1pjafy1i7yblc7ixmcpfq1lfbyf3jaljvkgrajn70sws9xs7a9f8"))
-         ("tools-namespace-src"
-          ,(submodule "tools.namespace/archive/tools.namespace-"
-                      "0.2.11"
-                      "10baak8v0hnwz2hr33bavshm7y49mmn9zsyyms1dwjz45p5ymhy0"))))
+      (native-inputs libraries)
       (home-page "https://clojure.org/")
       (synopsis "Lisp dialect running on the JVM")
       (description "Clojure is a dynamic, general-purpose programming language,
@@ -689,7 +686,7 @@ designs.")
       ;; ASM bytecode manipulation library is licensed under BSD-3
       ;; Guava Murmur3 hash implementation is licensed under APL2.0
       ;; src/clj/repl.clj is licensed under CPL1.0
-      ;;
+
       ;; See readme.html or readme.txt for details.
       (license (list license:epl1.0
                      license:bsd-3
-- 
2.19.1

[signature.asc (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#33215; Package guix-patches. (Wed, 31 Oct 2018 06:09:01 GMT) Full text and rfc822 format available.

Message #17 received at 33215 <at> debbugs.gnu.org (full text, mbox):

From: Alex Vong <alexvong1995 <at> gmail.com>
To: 33215 <at> debbugs.gnu.org
Cc: alexvong1995 <at> gmail.com
Subject: [PATCH 04/11] gnu: clojure: Use (guix build java-utils) to simplify
 build phases.
Date: Wed, 31 Oct 2018 14:08:38 +0800
[0004-gnu-clojure-Use-guix-build-java-utils-to-simplify-bu.patch (text/x-diff, inline)]
From 29b927ed0fc2ed932c37e1fb188e35e300fc3aeb Mon Sep 17 00:00:00 2001
From: Alex Vong <alexvong1995 <at> gmail.com>
Date: Sun, 14 Oct 2018 02:52:41 +0800
Subject: [PATCH 04/11] gnu: clojure: Use (guix build java-utils) to simplify
 build phases.

* gnu/packages/lisp.scm (clojure)[arguments]: Use 'ant-build-javadoc',
'install-jars' and 'install-javadoc' in build phases.
---
 gnu/packages/lisp.scm | 24 ++++++------------------
 1 file changed, 6 insertions(+), 18 deletions(-)

diff --git a/gnu/packages/lisp.scm b/gnu/packages/lisp.scm
index c42878fd3..c451aa4c1 100644
--- a/gnu/packages/lisp.scm
+++ b/gnu/packages/lisp.scm
@@ -610,10 +610,10 @@ interface.")
       (build-system ant-build-system)
       (arguments
        `(#:modules ((guix build ant-build-system)
+                    (guix build java-utils)
                     (guix build utils)
                     (ice-9 ftw)
                     (ice-9 regex)
-                    (srfi srfi-1)
                     (srfi srfi-26))
          #:test-target "test"
          #:phases
@@ -637,34 +637,22 @@ interface.")
                (substitute* "build.xml"
                  (("<attribute name=\"Class-Path\" value=\".\"/>") ""))
                #t))
-           ;; The javadoc target is not built by default.
-           (add-after 'build 'build-doc
-             (lambda _
-               (invoke "ant" "javadoc")))
-           ;; Needed since no install target is provided.
-           (replace 'install
-             (lambda* (#:key outputs #:allow-other-keys)
-               (let ((java-dir (string-append (assoc-ref outputs "out")
-                                              "/share/java/")))
-                 ;; Install versioned to avoid collisions.
-                 (install-file (string-append "clojure-" ,version ".jar")
-                               java-dir)
-                 #t)))
-           ;; Needed since no install-doc target is provided.
+           (add-after 'build 'build-javadoc ant-build-javadoc)
+           (replace 'install (install-jars "./"))
            (add-after 'install 'install-doc
              (lambda* (#:key outputs #:allow-other-keys)
                (let ((doc-dir (string-append (assoc-ref outputs "out")
                                              "/share/doc/clojure-"
                                              ,version "/")))
                  (copy-recursively "doc/clojure" doc-dir)
-                 (copy-recursively "target/javadoc/"
-                                   (string-append doc-dir "javadoc/"))
                  (for-each (cut install-file <> doc-dir)
                            (filter (cut string-match
                                      ".*\\.(html|markdown|md|txt)"
                                      <>)
                                    (scandir "./")))
-                 #t))))))
+                 #t)))
+           (add-after 'install-doc 'install-javadoc
+             (install-javadoc "target/javadoc/")))))
       (native-inputs libraries)
       (home-page "https://clojure.org/")
       (synopsis "Lisp dialect running on the JVM")
-- 
2.19.1

[signature.asc (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#33215; Package guix-patches. (Wed, 31 Oct 2018 06:11:01 GMT) Full text and rfc822 format available.

Message #20 received at 33215 <at> debbugs.gnu.org (full text, mbox):

From: Alex Vong <alexvong1995 <at> gmail.com>
To: 33215 <at> debbugs.gnu.org
Cc: alexvong1995 <at> gmail.com
Subject: [PATCH 05/11] guix: Add clojure-utils.
Date: Wed, 31 Oct 2018 14:09:50 +0800
[0005-guix-Add-clojure-utils.patch (text/x-diff, inline)]
From 857cce37325f01c26f79a6e15e33d7988ea4a0a2 Mon Sep 17 00:00:00 2001
From: Alex Vong <alexvong1995 <at> gmail.com>
Date: Sun, 14 Oct 2018 03:09:48 +0800
Subject: [PATCH 05/11] guix: Add clojure-utils.

* guix/build/clojure-utils.scm: New file.
* gnu/packages/lisp.scm (clojure)[arguments]: Use it.
* Makefile.am (MODULES): Add it.
---
 Makefile.am                  |  2 ++
 gnu/packages/lisp.scm        | 23 +++++--------
 guix/build/clojure-utils.scm | 65 ++++++++++++++++++++++++++++++++++++
 3 files changed, 75 insertions(+), 15 deletions(-)
 create mode 100644 guix/build/clojure-utils.scm

diff --git a/Makefile.am b/Makefile.am
index 8c3df8f39..e2bc4d369 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -12,6 +12,7 @@
 # Copyright © 2018 Nils Gillmann <ng0 <at> n0.is>
 # Copyright © 2018 Julien Lepiller <julien <at> lepiller.eu>
 # Copyright © 2018 Oleg Pykhalov <go.wigust <at> gmail.com>
+# Copyright © 2018 Alex Vong <alexvong1995 <at> gmail.com>
 #
 # This file is part of GNU Guix.
 #
@@ -172,6 +173,7 @@ MODULES =					\
   guix/build/syscalls.scm                       \
   guix/build/gremlin.scm			\
   guix/build/debug-link.scm			\
+  guix/build/clojure-utils.scm			\
   guix/build/emacs-utils.scm			\
   guix/build/java-utils.scm			\
   guix/build/lisp-utils.scm			\
diff --git a/gnu/packages/lisp.scm b/gnu/packages/lisp.scm
index c451aa4c1..ee43e5abf 100644
--- a/gnu/packages/lisp.scm
+++ b/gnu/packages/lisp.scm
@@ -596,6 +596,7 @@ interface.")
          (library-names (match libraries
                           (((library-name _) ...)
                            library-name))))
+
     (package
       (name "clojure")
       (version "1.9.0")
@@ -609,11 +610,13 @@ interface.")
           (base32 "0xjbzcw45z32vsn9pifp7ndysjzqswp5ig0jkjpivigh2ckkdzha"))))
       (build-system ant-build-system)
       (arguments
-       `(#:modules ((guix build ant-build-system)
+       `(#:imported-modules ((guix build clojure-utils)
+                             (guix build guile-build-system)
+                             ,@%ant-build-system-modules)
+         #:modules ((guix build ant-build-system)
+                    (guix build clojure-utils)
                     (guix build java-utils)
                     (guix build utils)
-                    (ice-9 ftw)
-                    (ice-9 regex)
                     (srfi srfi-26))
          #:test-target "test"
          #:phases
@@ -639,18 +642,8 @@ interface.")
                #t))
            (add-after 'build 'build-javadoc ant-build-javadoc)
            (replace 'install (install-jars "./"))
-           (add-after 'install 'install-doc
-             (lambda* (#:key outputs #:allow-other-keys)
-               (let ((doc-dir (string-append (assoc-ref outputs "out")
-                                             "/share/doc/clojure-"
-                                             ,version "/")))
-                 (copy-recursively "doc/clojure" doc-dir)
-                 (for-each (cut install-file <> doc-dir)
-                           (filter (cut string-match
-                                     ".*\\.(html|markdown|md|txt)"
-                                     <>)
-                                   (scandir "./")))
-                 #t)))
+           (add-after 'install-license-files 'install-doc
+             (cut install-doc #:doc-dirs '("doc/clojure/") <...>))
            (add-after 'install-doc 'install-javadoc
              (install-javadoc "target/javadoc/")))))
       (native-inputs libraries)
diff --git a/guix/build/clojure-utils.scm b/guix/build/clojure-utils.scm
new file mode 100644
index 000000000..713dff2d8
--- /dev/null
+++ b/guix/build/clojure-utils.scm
@@ -0,0 +1,65 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2018 Alex Vong <alexvong1995 <at> gmail.com>
+;;;
+;;; This file is part of GNU Guix.
+;;;
+;;; GNU Guix is free software; you can redistribute it and/or modify it
+;;; under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation; either version 3 of the License, or (at
+;;; your option) any later version.
+;;;
+;;; GNU Guix is distributed in the hope that it will be useful, but
+;;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;;; GNU General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
+
+(define-module (guix build clojure-utils)
+  #:use-module (guix build utils)
+  #:use-module (ice-9 ftw)
+  #:use-module (ice-9 regex)
+  #:use-module (srfi srfi-1)
+  #:use-module (srfi srfi-26)
+  #:export (%clojure-regex
+            define-with-docs
+            install-doc))
+
+(define-syntax-rule (define-with-docs name docs val)
+  "Create top-level variable named NAME with doc string DOCS and value VAL."
+  (begin (define name val)
+         (set-object-property! name 'documentation docs)))
+
+(define-with-docs %doc-regex
+  "Default regex for matching the base name of top-level documentation files."
+  (format #f
+          "(~a)|(\\.(html|markdown|md|txt)$)"
+          (@@ (guix build guile-build-system)
+              %documentation-file-regexp)))
+
+(define* (install-doc #:key
+                      doc-dirs
+                      (doc-regex %doc-regex)
+                      outputs
+                      #:allow-other-keys)
+  "Install the following to the default documentation directory:
+
+1. Top-level files with base name matching DOC-REGEX.
+2. All files (recursively) inside DOC-DIRS.
+
+DOC-REGEX can be compiled or uncompiled."
+  (let* ((out (assoc-ref outputs "out"))
+         (doc (assoc-ref outputs "doc"))
+         (name-ver (strip-store-file-name out))
+         (dest-dir (string-append (or doc out) "/share/doc/" name-ver "/"))
+         (doc-regex* (if (string? doc-regex)
+                         (make-regexp doc-regex)
+                         doc-regex)))
+    (for-each (cut install-file <> dest-dir)
+              (remove (compose file-exists?
+                               (cut string-append dest-dir <>))
+                      (scandir "./" (cut regexp-exec doc-regex* <>))))
+    (for-each (cut copy-recursively <> dest-dir)
+              doc-dirs)
+    #t))
-- 
2.19.1

[signature.asc (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#33215; Package guix-patches. (Wed, 31 Oct 2018 06:11:02 GMT) Full text and rfc822 format available.

Message #23 received at 33215 <at> debbugs.gnu.org (full text, mbox):

From: Alex Vong <alexvong1995 <at> gmail.com>
To: 33215 <at> debbugs.gnu.org
Cc: alexvong1995 <at> gmail.com
Subject: [PATCH 06/11] build-system: Add 'clojure-build-system'.
Date: Wed, 31 Oct 2018 14:10:26 +0800
[0006-build-system-Add-clojure-build-system.patch (text/x-diff, inline)]
From c7a763cfa2543119cc707b434efc8680f73f6367 Mon Sep 17 00:00:00 2001
From: Alex Vong <alexvong1995 <at> gmail.com>
Date: Thu, 25 Oct 2018 05:44:01 +0800
Subject: [PATCH 06/11] build-system: Add 'clojure-build-system'.

* guix/build-system/clojure.scm, guix/build/clojure-build-system.scm: New
files.
* guix/build/clojure-utils.scm (@*, @@*): New macros.
(%source-dirs, %test-dirs, %compile-dir, %main-class, %omit-source?,
%aot-include, %aot-exclude, %tests?, %test-include, %test-exclude,
%clojure-regex): New variables.
(package-name->jar-names, canonicalize-relative-path, find-files*,
file-sans-extension, relative-path->clojure-lib-string, find-clojure-libs,
compiled-from?, include-list\exclude-list, eval-with-clojure, create-jar):
New procedures.
* Makefile.am (MODULES): Add them.
* doc/guix.texi (Build Systems): Document 'clojure-build-system'.
---
 Makefile.am                         |   2 +
 doc/guix.texi                       |  58 ++++++++
 guix/build-system/clojure.scm       | 195 ++++++++++++++++++++++++++
 guix/build/clojure-build-system.scm | 110 +++++++++++++++
 guix/build/clojure-utils.scm        | 204 +++++++++++++++++++++++++++-
 5 files changed, 567 insertions(+), 2 deletions(-)
 create mode 100644 guix/build-system/clojure.scm
 create mode 100644 guix/build/clojure-build-system.scm

diff --git a/Makefile.am b/Makefile.am
index e2bc4d369..fce2956b4 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -101,6 +101,7 @@ MODULES =					\
   guix/build-system/android-ndk.scm		\
   guix/build-system/ant.scm			\
   guix/build-system/cargo.scm			\
+  guix/build-system/clojure.scm			\
   guix/build-system/cmake.scm			\
   guix/build-system/dub.scm			\
   guix/build-system/emacs.scm			\
@@ -138,6 +139,7 @@ MODULES =					\
   guix/build/download.scm			\
   guix/build/download-nar.scm			\
   guix/build/cargo-build-system.scm		\
+  guix/build/clojure-build-system.scm		\
   guix/build/cmake-build-system.scm		\
   guix/build/dub-build-system.scm		\
   guix/build/emacs-build-system.scm		\
diff --git a/doc/guix.texi b/doc/guix.texi
index b41af61f1..8b353e166 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -51,6 +51,7 @@ Copyright @copyright{} 2018 Mike Gerwitz@*
 Copyright @copyright{} 2018 Pierre-Antoine Rouby@*
 Copyright @copyright{} 2018 Gábor Boskovits@*
 Copyright @copyright{} 2018 Florian Pelz@*
+Copyright @copyright{} 2018 Alex Vong@*
 
 Permission is granted to copy, distribute and/or modify this document
 under the terms of the GNU Free Documentation License, Version 1.3 or
@@ -4384,6 +4385,63 @@ The @code{install} phase installs the binaries, and it also installs the
 source code and @file{Cargo.toml} file.
 @end defvr
 
+@cindex Clojure (programming language)
+@cindex simple Clojure build system
+@defvr {Scheme Variable} clojure-build-system
+This variable is exported by @code{(guix build-system clojure)}.  It implements
+a simple build procedure for @uref{https://clojure.org/, Clojure} packages
+using plain old @code{compile} in Clojure.  Cross-compilation is not supported
+yet.
+
+It adds @code{clojure}, @code{icedtea} and @code{zip} to the set of inputs.
+Different packages can be specified with the @code{#:clojure}, @code{#:jdk} and
+@code{#:zip} parameters, respectively.
+
+A list of source directories, test directories and jar names can be specified
+with the @code{#:source-dirs}, @code{#:test-dirs} and @code{#:jar-names}
+parameters, respectively.  Compile directory and main class can be specified
+with the @code{#:compile-dir} and @code{#:main-class} parameters, respectively.
+Other parameters are documented below.
+
+This build system is an extension of @var{ant-build-system}, but with the
+following phases changed:
+
+@table @code
+
+@item build
+This phase calls @code{compile} in Clojure to compile source files and runs
+@command{jar} to create jars from both source files and compiled files
+according to the include list and exclude list specified in
+@code{#:aot-include} and @code{#:aot-exclude}, respectively.  The exclude list
+has priority over the include list.  These lists consist of symbols
+representing Clojure libraries or the special keyword @code{#:all} representing
+all Clojure libraries found under the source directories.  The parameter
+@code{#:omit-source?} decides if source should be included into the jars.
+
+@item check
+This phase runs tests according to the include list and exclude list specified
+in @code{#:test-include} and @code{#:test-exclude}, respectively.  Their
+meanings are analogous to that of @code{#:aot-include} and
+@code{#:aot-exclude}, except that the special keyword @code{#:all} now
+stands for all Clojure libraries found under the test directories.  The
+parameter @code{#:tests?} decides if tests should be run.
+
+@item install
+This phase installs all jars built previously.
+@end table
+
+Apart from the above, this build system also contains an additional phase:
+
+@table @code
+
+@item install-doc
+This phase installs all top-level files with base name matching
+@var{%doc-regex}.  A different regex can be specified with the
+@code{#:doc-regex} parameter.  All files (recursively) inside the documentation
+directories specified in @code{#:doc-dirs} are installed as well.
+@end table
+@end defvr
+
 @defvr {Scheme Variable} cmake-build-system
 This variable is exported by @code{(guix build-system cmake)}.  It
 implements the build procedure for packages using the
diff --git a/guix/build-system/clojure.scm b/guix/build-system/clojure.scm
new file mode 100644
index 000000000..5a91bcba0
--- /dev/null
+++ b/guix/build-system/clojure.scm
@@ -0,0 +1,195 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2018 Alex Vong <alexvong1995 <at> gmail.com>
+;;;
+;;; This file is part of GNU Guix.
+;;;
+;;; GNU Guix is free software; you can redistribute it and/or modify it
+;;; under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation; either version 3 of the License, or (at
+;;; your option) any later version.
+;;;
+;;; GNU Guix is distributed in the hope that it will be useful, but
+;;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;;; GNU General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
+
+(define-module (guix build-system clojure)
+  #:use-module (guix build clojure-utils)
+  #:use-module (guix build-system)
+  #:use-module (guix build-system ant)
+  #:use-module ((guix build-system gnu)
+                #:select (standard-packages)
+                #:prefix gnu:)
+
+  #:use-module (guix derivations)
+  #:use-module (guix packages)
+  #:use-module ((guix search-paths)
+                #:select
+                ((search-path-specification->sexp . search-path-spec->sexp)))
+  #:use-module (guix utils)
+
+  #:use-module (ice-9 match)
+  #:export (%clojure-build-system-modules
+            clojure-build
+            clojure-build-system))
+
+;; Commentary:
+;;
+;; Standard build procedure for Clojure packages.
+;;
+;; Code:
+
+(define-with-docs %clojure-build-system-modules
+  "Build-side modules imported and used by default."
+  `((guix build clojure-build-system)
+    (guix build clojure-utils)
+    (guix build guile-build-system)
+    ,@%ant-build-system-modules))
+
+(define-with-docs %default-clojure
+  "The default Clojure package."
+  (delay (@* (gnu packages lisp) clojure)))
+
+(define-with-docs %default-jdk
+  "The default JDK package."
+  (delay (@* (gnu packages java) icedtea)))
+
+(define-with-docs %default-zip
+  "The default ZIP package."
+  (delay (@* (gnu packages compression) zip)))
+
+(define* (lower name
+                #:key
+                source target
+                inputs native-inputs
+                (clojure (force %default-clojure))
+                (jdk (force %default-jdk))
+                (zip (force %default-zip))
+                outputs system
+                #:allow-other-keys
+                #:rest arguments)
+  "Return a bag for NAME."
+  (let ((private-keywords '(#:source #:target
+                            #:inputs #:native-inputs
+                            #:clojure #:jdk #:zip)))
+
+    (if target
+        (error "No cross-compilation for clojure-build-system yet: LOWER"
+               target) ; FIXME
+        (bag (name name)
+             (system system)
+             (host-inputs `(,@(if source
+                                  `(("source" ,source))
+                                  '())
+                            ,@inputs
+                            ,@(gnu:standard-packages)))
+             (build-inputs `(("clojure" ,clojure)
+                             ("jdk" ,jdk "jdk")
+                             ("zip" ,zip)
+                             ,@native-inputs))
+             (outputs outputs)
+             (build clojure-build)
+             (arguments (strip-keyword-arguments private-keywords
+                                                 arguments))))))
+
+(define-with-docs source->output-path
+  "Convert source input to output path."
+  (match-lambda
+    (((? derivation? source))
+     (derivation->output-path source))
+    ((source)
+     source)
+    (source
+     source)))
+
+(define-with-docs maybe-guile->guile
+  "Find the right guile."
+  (match-lambda
+    ((and maybe-guile (? package?))
+     maybe-guile)
+    (#f ; default
+     (@* (gnu packages commencement) guile-final))))
+
+(define* (clojure-build store name inputs
+                        #:key
+                        (source-dirs `',%source-dirs)
+                        (test-dirs `',%test-dirs)
+                        (compile-dir %compile-dir)
+
+                        (jar-names `',(package-name->jar-names name))
+                        (main-class %main-class)
+                        (omit-source? %omit-source?)
+
+                        (aot-include `',%aot-include)
+                        (aot-exclude `',%aot-exclude)
+
+                        doc-dirs ; no sensible default
+                        (doc-regex %doc-regex)
+
+                        (tests? %tests?)
+                        (test-include `',%test-include)
+                        (test-exclude `',%test-exclude)
+
+                        (phases '(@ (guix build clojure-build-system)
+                                    %standard-phases))
+                        (outputs '("out"))
+                        (search-paths '())
+                        (system (%current-system))
+                        (guile #f)
+
+                        (imported-modules %clojure-build-system-modules)
+                        (modules %clojure-build-system-modules))
+  "Build SOURCE with INPUTS."
+  (let ((builder `(begin
+                    (use-modules ,@modules)
+                    (clojure-build #:name ,name
+                                   #:source ,(source->output-path
+                                              (assoc-ref inputs "source"))
+
+                                   #:source-dirs ,source-dirs
+                                   #:test-dirs ,test-dirs
+                                   #:compile-dir ,compile-dir
+
+                                   #:jar-names ,jar-names
+                                   #:main-class ,main-class
+                                   #:omit-source? ,omit-source?
+
+                                   #:aot-include ,aot-include
+                                   #:aot-exclude ,aot-exclude
+
+                                   #:doc-dirs ,doc-dirs
+                                   #:doc-regex ,doc-regex
+
+                                   #:tests? ,tests?
+                                   #:test-include ,test-include
+                                   #:test-exclude ,test-exclude
+
+                                   #:phases ,phases
+                                   #:outputs %outputs
+                                   #:search-paths ',(map search-path-spec->sexp
+                                                         search-paths)
+                                   #:system ,system
+                                   #:inputs %build-inputs)))
+
+        (guile-for-build (package-derivation store
+                                             (maybe-guile->guile guile)
+                                             system
+                                             #:graft? #f)))
+
+    (build-expression->derivation store name builder
+                                  #:inputs inputs
+                                  #:system system
+                                  #:modules imported-modules
+                                  #:outputs outputs
+                                  #:guile-for-build guile-for-build)))
+
+(define clojure-build-system
+  (build-system
+    (name 'clojure)
+    (description "Simple Clojure build system using plain old 'compile'")
+    (lower lower)))
+
+;;; clojure.scm ends here
diff --git a/guix/build/clojure-build-system.scm b/guix/build/clojure-build-system.scm
new file mode 100644
index 000000000..d8f7c89f8
--- /dev/null
+++ b/guix/build/clojure-build-system.scm
@@ -0,0 +1,110 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2018 Alex Vong <alexvong1995 <at> gmail.com>
+;;;
+;;; This file is part of GNU Guix.
+;;;
+;;; GNU Guix is free software; you can redistribute it and/or modify it
+;;; under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation; either version 3 of the License, or (at
+;;; your option) any later version.
+;;;
+;;; GNU Guix is distributed in the hope that it will be useful, but
+;;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;;; GNU General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
+
+(define-module (guix build clojure-build-system)
+  #:use-module ((guix build ant-build-system)
+                #:select ((%standard-phases . %standard-phases <at> ant)
+                          ant-build))
+  #:use-module (guix build clojure-utils)
+  #:use-module (guix build java-utils)
+  #:use-module (guix build utils)
+  #:use-module (srfi srfi-1)
+  #:use-module (srfi srfi-26)
+  #:export (%standard-phases
+            clojure-build))
+
+;; Commentary:
+;;
+;; Builder-side code of the standard build procedure for Clojure packages.
+;;
+;; Code:
+
+(define* (build #:key
+                source-dirs compile-dir
+                jar-names main-class omit-source?
+                aot-include aot-exclude
+                #:allow-other-keys)
+  "Standard 'build' phase for clojure-build-system."
+  (let* ((libs (append-map find-clojure-libs source-dirs))
+         (libs* (include-list\exclude-list aot-include
+                                           aot-exclude
+                                           #:all-list libs)))
+    (mkdir-p compile-dir)
+    (eval-with-clojure `(run! compile ',libs*)
+                       source-dirs)
+    (let ((source-dir-files-alist (map (lambda (dir)
+                                         (cons dir (find-files* dir)))
+                                       source-dirs))
+          ;; workaround transitive compilation in Clojure
+          (classes (filter (lambda (class)
+                             (any (cut compiled-from? class <>)
+                                  libs*))
+                           (find-files* compile-dir))))
+      (for-each (cut create-jar <> (cons (cons compile-dir classes)
+                                         (if omit-source?
+                                             '()
+                                             source-dir-files-alist))
+                     #:main-class main-class)
+                jar-names)
+      #t)))
+
+(define* (check #:key
+                test-dirs
+                jar-names
+                tests? test-include test-exclude
+                #:allow-other-keys)
+  "Standard 'check' phase for clojure-build-system.  Note that TEST-EXCLUDE has
+priority over TEST-INCLUDE."
+  (if tests?
+      (let* ((libs (append-map find-clojure-libs test-dirs))
+             (libs* (include-list\exclude-list test-include
+                                               test-exclude
+                                               #:all-list libs)))
+        (for-each (lambda (jar)
+                    (eval-with-clojure `(do (apply require
+                                                   '(clojure.test ,@libs*))
+                                            (apply clojure.test/run-tests
+                                                   ',libs*))
+                                       (cons jar test-dirs)))
+                  jar-names)))
+  #t)
+
+(define-with-docs install
+  "Standard 'install' phase for clojure-build-system."
+  (install-jars "./"))
+
+(define-with-docs %standard-phases
+  "Standard build phases for clojure-build-system."
+  (modify-phases %standard-phases <at> ant
+    (replace 'build build)
+    (replace 'check check)
+    (replace 'install install)
+    (add-after 'install-license-files 'install-doc install-doc)))
+
+(define* (clojure-build #:key
+                        inputs
+                        (phases %standard-phases)
+                        #:allow-other-keys
+                        #:rest args)
+  "Build the given Clojure package, applying all of PHASES in order."
+  (apply ant-build
+         #:inputs inputs
+         #:phases phases
+         args))
+
+;;; clojure-build-system.scm ends here
diff --git a/guix/build/clojure-utils.scm b/guix/build/clojure-utils.scm
index 713dff2d8..027777b4d 100644
--- a/guix/build/clojure-utils.scm
+++ b/guix/build/clojure-utils.scm
@@ -19,12 +19,48 @@
 (define-module (guix build clojure-utils)
   #:use-module (guix build utils)
   #:use-module (ice-9 ftw)
+  #:use-module (ice-9 match)
   #:use-module (ice-9 regex)
   #:use-module (srfi srfi-1)
+  #:use-module (srfi srfi-8)
   #:use-module (srfi srfi-26)
-  #:export (%clojure-regex
+  #:export (@*
+            @@*
             define-with-docs
-            install-doc))
+
+            %doc-regex
+            install-doc
+
+            %source-dirs
+            %test-dirs
+            %compile-dir
+            package-name->jar-names
+            %main-class
+            %omit-source?
+            %aot-include
+            %aot-exclude
+            %tests?
+            %test-include
+            %test-exclude
+
+            %clojure-regex
+            canonicalize-relative-path
+            find-files*
+            file-sans-extension
+            relative-path->clojure-lib-string
+            find-clojure-libs
+            compiled-from?
+            include-list\exclude-list
+            eval-with-clojure
+            create-jar))
+
+(define-syntax-rule (@* module name)
+  "Like (@ MODULE NAME), but resolves at run time."
+  (module-ref (resolve-interface 'module) 'name))
+
+(define-syntax-rule (@@* module name)
+  "Like (@@ MODULE NAME), but resolves at run time."
+  (module-ref (resolve-module 'module) 'name))
 
 (define-syntax-rule (define-with-docs name docs val)
   "Create top-level variable named NAME with doc string DOCS and value VAL."
@@ -63,3 +99,167 @@ DOC-REGEX can be compiled or uncompiled."
     (for-each (cut copy-recursively <> dest-dir)
               doc-dirs)
     #t))
+
+(define-with-docs %source-dirs
+  "A default list of source directories."
+  '("src/"))
+
+(define-with-docs %test-dirs
+  "A default list of test directories."
+  '("test/"))
+
+(define-with-docs %compile-dir
+  "Default directory for holding class files."
+  "classes/")
+
+(define (package-name->jar-names name)
+  "Given NAME, a package name like \"foo-0.9.1b\",
+return the list of default jar names: (\"foo-0.9.1b.jar\" \"foo.jar\")."
+  (map (cut string-append <> ".jar")
+       (list name
+             (receive (base-name _)
+                 (package-name->name+version name)
+               base-name))))
+
+(define-with-docs %main-class
+  "Default name for main class.  It should be a symbol or #f."
+  #f)
+
+(define-with-docs %omit-source?
+  "Include source in jars by default."
+  #f)
+
+(define-with-docs %aot-include
+  "A default list of symbols deciding what to compile.  Note that the exclude
+list has priority over the include list.  The special keyword #:all represents
+all libraries found under the source directories."
+  '(#:all))
+
+(define-with-docs %aot-exclude
+  "A default list of symbols deciding what not to compile.
+See the doc string of '%aot-include' for more details."
+  '())
+
+(define-with-docs %tests?
+  "Enable tests by default."
+  #t)
+
+(define-with-docs %test-include
+  "A default list of symbols deciding what tests to include.  Note that the
+exclude list has priority over the include list.  The special keyword #:all
+represents all tests found under the test directories."
+  '(#:all))
+
+(define-with-docs %test-exclude
+  "A default list of symbols deciding what tests to exclude.
+See the doc string of '%test-include' for more details."
+  '())
+
+(define-with-docs %clojure-regex
+  "Default regex for matching the base name of clojure source files."
+  "\\.cljc?$")
+
+(define-with-docs canonicalize-relative-path
+  "Like 'canonicalize-path', but for relative paths.
+Canonicalizations requiring the path to exist are omitted."
+  (let ((remove.. (lambda (ls)
+                    (fold-right (match-lambda*
+                                  (((and comp (not "..")) (".." comps ...))
+                                   comps)
+                                  ((comp (comps ...))
+                                   (cons comp comps)))
+                                '()
+                                ls))))
+    (compose (match-lambda
+               (() ".")
+               (ls (string-join ls "/")))
+             remove..
+             (cut remove (cut member <> '("" ".")) <>)
+             (cut string-split <> #\/))))
+
+(define (find-files* base-dir . args)
+  "Similar to 'find-files', but with BASE-DIR stripped and result
+canonicalized."
+  (map canonicalize-relative-path
+       (with-directory-excursion base-dir
+         (apply find-files "./" args))))
+
+;;; FIXME: should be moved to (guix build utils)
+(define-with-docs file-sans-extension
+  "Strip extension from path, if any."
+  (@@ (guix build guile-build-system)
+      file-sans-extension))
+
+(define (relative-path->clojure-lib-string path)
+  "Convert PATH to a clojure library string."
+  (string-map (match-lambda
+                (#\/ #\.)
+                (#\_ #\-)
+                (chr chr))
+              (file-sans-extension path)))
+
+(define* (find-clojure-libs base-dir
+                            #:key (clojure-regex %clojure-regex))
+  "Return the list of clojure libraries found under BASE-DIR.
+
+CLOJURE-REGEX can be compiled or uncompiled."
+  (map (compose string->symbol
+                relative-path->clojure-lib-string)
+       (find-files* base-dir clojure-regex)))
+
+(define (compiled-from? class lib)
+  "Given class file CLASS and clojure library symbol LIB, decide if CLASS
+results from compiling LIB."
+  (string-prefix? (symbol->string lib)
+                  (relative-path->clojure-lib-string class)))
+
+(define* (include-list\exclude-list include-list exclude-list
+                                    #:key all-list)
+  "Given INCLUDE-LIST and EXCLUDE-LIST, replace all occurences of #:all by
+slicing ALL-LIST into them and compute their list difference."
+  (define (replace-#:all ls all-ls)
+    (append-map (match-lambda
+                  (#:all all-ls)
+                  (x (list x)))
+                ls))
+  (let ((include-list* (replace-#:all include-list all-list))
+        (exclude-list* (replace-#:all exclude-list all-list)))
+    (lset-difference equal? include-list* exclude-list*)))
+
+(define (eval-with-clojure expr extra-paths)
+  "Evaluate EXPR with clojure.
+
+EXPR must be a s-expression writable by guile and readable by clojure.
+For examples, '(require '[clojure.string]) will not work,
+because the guile writer converts brackets to parentheses.
+
+EXTRA-PATHS is a list of paths which will be appended to $CLASSPATH."
+  (let* ((classpath (getenv "CLASSPATH"))
+         (classpath* (string-join (cons classpath extra-paths) ":")))
+    (invoke "java"
+            "-classpath" classpath*
+            "clojure.main"
+            "--eval" (object->string expr))))
+
+(define* (create-jar output-jar dir-files-alist
+                     #:key
+                     (verbose? #t)
+                     (compress? #f)
+                     (main-class %main-class))
+  "Given DIR-FILES-ALIST, an alist of the form: ((DIR . FILES) ...)
+Create jar named OUTPUT-JAR from FILES with DIR stripped."
+  (let ((grouped-options (string-append "c"
+                                        (if verbose? "v" "")
+                                        "f"
+                                        (if compress? "" "0")
+                                        (if main-class "e" ""))))
+    (apply invoke `("jar"
+                    ,grouped-options
+                    ,output-jar
+                    ,@(if main-class (list (symbol->string main-class)) '())
+                    ,@(append-map (match-lambda
+                                    ((dir . files)
+                                     (append-map (lambda (file)
+                                                   `("-C" ,dir ,file))
+                                                 files)))
+                                  dir-files-alist)))))
-- 
2.19.1

[signature.asc (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#33215; Package guix-patches. (Wed, 31 Oct 2018 06:12:01 GMT) Full text and rfc822 format available.

Message #26 received at 33215 <at> debbugs.gnu.org (full text, mbox):

From: Alex Vong <alexvong1995 <at> gmail.com>
To: 33215 <at> debbugs.gnu.org
Cc: alexvong1995 <at> gmail.com
Subject: [PATCH 07/11] gnu: Add clojure-instaparse.
Date: Wed, 31 Oct 2018 14:11:03 +0800
[0007-gnu-Add-clojure-instaparse.patch (text/x-diff, inline)]
From 835b431224da203bfefc984019529679495a64b5 Mon Sep 17 00:00:00 2001
From: Alex Vong <alexvong1995 <at> gmail.com>
Date: Sun, 14 Oct 2018 04:17:14 +0800
Subject: [PATCH 07/11] gnu: Add clojure-instaparse.

* gnu/packages/lisp.scm (clojure-instaparse): New public variable.
---
 gnu/packages/lisp.scm | 53 +++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 53 insertions(+)

diff --git a/gnu/packages/lisp.scm b/gnu/packages/lisp.scm
index ee43e5abf..3bb70c692 100644
--- a/gnu/packages/lisp.scm
+++ b/gnu/packages/lisp.scm
@@ -36,6 +36,7 @@
   #:use-module (guix utils)
   #:use-module (guix build-system gnu)
   #:use-module (guix build-system ant)
+  #:use-module (guix build-system clojure)
   #:use-module (guix build-system asdf)
   #:use-module (guix build-system trivial)
   #:use-module (gnu packages admin)
@@ -1603,6 +1604,58 @@ compressor.  It works on data produced by @code{parse-js} to generate a
        ("sbcl-cl-uglify-js" ,sbcl-cl-uglify-js)))
     (synopsis "JavaScript compressor")))
 
+(define-public clojure-instaparse
+  (let ((commit "dcfffad5b065e750f0f5835f017cdd8188b8ca2e")
+        (version "1.4.9")) ; upstream forget to tag this release
+    (package
+      (name "clojure-instaparse")
+      (version version)
+      (source (origin
+                (method git-fetch)
+                (uri (git-reference
+                      (url "https://github.com/Engelberg/instaparse.git")
+                      (commit commit)))
+                (file-name (git-file-name name version))
+                (sha256
+                 (base32
+                  "002mrgin4z3dqy88r1lak7smd0m7x8d22vmliw0m6w6mh5pa17lk"))))
+      (build-system clojure-build-system)
+      (arguments
+       '(#:doc-dirs '("docs/")))
+      (synopsis "No grammar left behind")
+      (description
+       "Instaparse aims to be the simplest way to build parsers in Clojure.
+
+@itemize
+@item Turns @emph{standard EBNF or ABNF notation} for context-free grammars
+into an executable parser that takes a string as an input and produces a parse
+tree for that string.
+
+@item @dfn{No Grammar Left Behind}: Works for @emph{any} context-free grammar,
+including @emph{left-recursive}, @emph{right-recursive}, and @emph{ambiguous}
+grammars.
+
+@item Extends the power of context-free grammars with PEG-like syntax for
+lookahead and negative lookahead.
+
+@item Supports both of Clojure's most popular tree formats (hiccup and enlive)
+as output targets
+
+@item Detailed reporting of parse errors.
+
+@item Optionally produces lazy sequence of all parses (especially useful for
+diagnosing and debugging ambiguous grammars).
+
+@item ``Total parsing'' mode where leftover string is embedded in the parse
+tree.
+
+@item Optional combinator library for building grammars programmatically.
+
+@item Performant.
+@end itemize")
+      (home-page "https://github.com/Engelberg/instaparse")
+      (license license:epl1.0))))
+
 (define-public confusion-mdl
   (let* ((commit "12a055581fc262225272df43287dae48281900f5"))
     (package
-- 
2.19.1

[signature.asc (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#33215; Package guix-patches. (Wed, 31 Oct 2018 06:12:02 GMT) Full text and rfc822 format available.

Message #29 received at 33215 <at> debbugs.gnu.org (full text, mbox):

From: Alex Vong <alexvong1995 <at> gmail.com>
To: 33215 <at> debbugs.gnu.org
Cc: alexvong1995 <at> gmail.com
Subject: [PATCH 08/11] gnu: Add clojure-core-match.
Date: Wed, 31 Oct 2018 14:11:38 +0800
[0008-gnu-Add-clojure-core-match.patch (text/x-diff, inline)]
From d68fa82e88fcb2e382f5b93519dbde4b48d7abe4 Mon Sep 17 00:00:00 2001
From: Alex Vong <alexvong1995 <at> gmail.com>
Date: Sun, 14 Oct 2018 18:08:26 +0800
Subject: [PATCH 08/11] gnu: Add clojure-core-match.

* gnu/packages/lisp.scm (clojure-core-match): New public variable.
---
 gnu/packages/lisp.scm | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

diff --git a/gnu/packages/lisp.scm b/gnu/packages/lisp.scm
index 3bb70c692..db8d0e61a 100644
--- a/gnu/packages/lisp.scm
+++ b/gnu/packages/lisp.scm
@@ -1604,6 +1604,33 @@ compressor.  It works on data produced by @code{parse-js} to generate a
        ("sbcl-cl-uglify-js" ,sbcl-cl-uglify-js)))
     (synopsis "JavaScript compressor")))
 
+(define-public clojure-core-match
+  (let ((commit "1837ffbd4a150e8f3953b2d9ed5cf4a4ad3720a7")
+        (revision "1")) ; this is the 1st commit buildable with clojure 1.9
+    (package
+      (name "clojure-core-match")
+      (version (git-version "0.3.0-alpha5" revision commit))
+      (source (origin
+                (method git-fetch)
+                (uri (git-reference
+                      (url "https://github.com/clojure/core.match.git")
+                      (commit commit)))
+                (file-name (git-file-name name version))
+                (sha256
+                 (base32
+                  "04bdlp5dgkrqzrz0lw3mfwmygj2218qnm1cz3dkb9wy4m0238s4d"))))
+      (build-system clojure-build-system)
+      (arguments
+       '(#:source-dirs '("src/main/clojure")
+         #:test-dirs '("src/test/clojure")
+         #:doc-dirs '()))
+      (synopsis "Optimized pattern matching for Clojure")
+      (description
+       "An optimized pattern matching library for Clojure.
+It supports Clojure 1.5.1 and later as well as ClojureScript.")
+      (home-page "https://github.com/clojure/core.match")
+      (license license:epl1.0))))
+
 (define-public clojure-instaparse
   (let ((commit "dcfffad5b065e750f0f5835f017cdd8188b8ca2e")
         (version "1.4.9")) ; upstream forget to tag this release
-- 
2.19.1

[signature.asc (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#33215; Package guix-patches. (Wed, 31 Oct 2018 06:13:01 GMT) Full text and rfc822 format available.

Message #32 received at 33215 <at> debbugs.gnu.org (full text, mbox):

From: Alex Vong <alexvong1995 <at> gmail.com>
To: 33215 <at> debbugs.gnu.org
Cc: alexvong1995 <at> gmail.com
Subject: [PATCH 09/11] gnu: Add clojure-algo-generic.
Date: Wed, 31 Oct 2018 14:12:30 +0800
[0009-gnu-Add-clojure-algo-generic.patch (text/x-diff, inline)]
From f7228a07fa32fe3c6f4f0808e3112d63888e67cc Mon Sep 17 00:00:00 2001
From: Alex Vong <alexvong1995 <at> gmail.com>
Date: Sun, 14 Oct 2018 19:06:52 +0800
Subject: [PATCH 09/11] gnu: Add clojure-algo-generic.

* gnu/packages/lisp.scm (clojure-algo-generic): New public variable.
---
 gnu/packages/lisp.scm | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/gnu/packages/lisp.scm b/gnu/packages/lisp.scm
index db8d0e61a..78a74e981 100644
--- a/gnu/packages/lisp.scm
+++ b/gnu/packages/lisp.scm
@@ -1604,6 +1604,30 @@ compressor.  It works on data produced by @code{parse-js} to generate a
        ("sbcl-cl-uglify-js" ,sbcl-cl-uglify-js)))
     (synopsis "JavaScript compressor")))
 
+(define-public clojure-algo-generic
+  (package
+    (name "clojure-algo-generic")
+    (version "0.1.3")
+    (source
+     (origin
+       (method url-fetch)
+       (uri
+        (string-append "https://github.com/clojure/algo.generic/archive"
+                       "/algo.generic-" version ".tar.gz"))
+       (sha256
+        (base32 "12w9681i545gp1af4576z1qbixwps1j13c16fmcc7zsb0bd1zr7w"))))
+    (build-system clojure-build-system)
+    (arguments
+     '(#:source-dirs '("src/main/clojure/")
+       #:test-dirs '("src/test/clojure/")
+       #:doc-dirs '()))
+    (synopsis "Generic versions of common functions")
+    (description
+     "Generic versions of commonly used functions, implemented as multimethods
+that can be implemented for any data type.")
+    (home-page "https://github.com/clojure/algo.generic")
+    (license license:epl1.0)))
+
 (define-public clojure-core-match
   (let ((commit "1837ffbd4a150e8f3953b2d9ed5cf4a4ad3720a7")
         (revision "1")) ; this is the 1st commit buildable with clojure 1.9
-- 
2.19.1

[signature.asc (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#33215; Package guix-patches. (Wed, 31 Oct 2018 06:14:02 GMT) Full text and rfc822 format available.

Message #35 received at 33215 <at> debbugs.gnu.org (full text, mbox):

From: Alex Vong <alexvong1995 <at> gmail.com>
To: 33215 <at> debbugs.gnu.org
Cc: alexvong1995 <at> gmail.com
Subject: [PATCH 10/11] gnu: Add clojure-tools-macro.
Date: Wed, 31 Oct 2018 14:13:31 +0800
[0010-gnu-Add-clojure-tools-macro.patch (text/x-diff, inline)]
From 49e2e0297ed26ce7c753d5abd0bcdaf3f636384b Mon Sep 17 00:00:00 2001
From: Alex Vong <alexvong1995 <at> gmail.com>
Date: Sun, 14 Oct 2018 19:37:40 +0800
Subject: [PATCH 10/11] gnu: Add clojure-tools-macro.

* gnu/packages/lisp.scm (clojure-tools-macro): New public variable.
---
 gnu/packages/lisp.scm | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/gnu/packages/lisp.scm b/gnu/packages/lisp.scm
index 78a74e981..9fda122cc 100644
--- a/gnu/packages/lisp.scm
+++ b/gnu/packages/lisp.scm
@@ -1707,6 +1707,28 @@ tree.
       (home-page "https://github.com/Engelberg/instaparse")
       (license license:epl1.0))))
 
+(define-public clojure-tools-macro
+  (package
+    (name "clojure-tools-macro")
+    (version "0.1.5")
+    (source
+     (origin
+       (method url-fetch)
+       (uri
+        (string-append "https://github.com/clojure/tools.macro/archive"
+                       "/tools.macro-" version ".tar.gz"))
+       (sha256
+        (base32 "0fs64a0g63xx6g7sj6vrsqknhl90s0isf6k053nw8vv5prfzc7v6"))))
+    (build-system clojure-build-system)
+    (arguments
+     '(#:source-dirs '("src/main/clojure/")
+       #:test-dirs '("src/test/clojure/")
+       #:doc-dirs '()))
+    (synopsis "Utilities for macro writers")
+    (description "Tools for writing macros.")
+    (home-page "https://github.com/clojure/tools.macro")
+    (license license:epl1.0)))
+
 (define-public confusion-mdl
   (let* ((commit "12a055581fc262225272df43287dae48281900f5"))
     (package
-- 
2.19.1

[signature.asc (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#33215; Package guix-patches. (Wed, 31 Oct 2018 06:15:01 GMT) Full text and rfc822 format available.

Message #38 received at 33215 <at> debbugs.gnu.org (full text, mbox):

From: Alex Vong <alexvong1995 <at> gmail.com>
To: 33215 <at> debbugs.gnu.org
Cc: alexvong1995 <at> gmail.com
Subject: [PATCH 11/11] gnu: Add clojure-algo-monads.
Date: Wed, 31 Oct 2018 14:14:09 +0800
[0011-gnu-Add-clojure-algo-monads.patch (text/x-diff, inline)]
From 71e3bdb546ca258debf56ecdd60df86610a4cadc Mon Sep 17 00:00:00 2001
From: Alex Vong <alexvong1995 <at> gmail.com>
Date: Sun, 14 Oct 2018 20:15:02 +0800
Subject: [PATCH 11/11] gnu: Add clojure-algo-monads.

* gnu/packages/lisp.scm (clojure-algo-monads): New public variable.
---
 gnu/packages/lisp.scm | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

diff --git a/gnu/packages/lisp.scm b/gnu/packages/lisp.scm
index 9fda122cc..aa8963fee 100644
--- a/gnu/packages/lisp.scm
+++ b/gnu/packages/lisp.scm
@@ -1628,6 +1628,33 @@ that can be implemented for any data type.")
     (home-page "https://github.com/clojure/algo.generic")
     (license license:epl1.0)))
 
+(define-public clojure-algo-monads
+  (package
+    (name "clojure-algo-monads")
+    (version "0.1.6")
+    (source
+     (origin
+       (method url-fetch)
+       (uri
+        (string-append "https://github.com/clojure/algo.monads/archive"
+                       "/algo.monads-" version ".tar.gz"))
+       (sha256
+        (base32 "14gbvfgmrda990h45yn7zag83vp1kdkz4f4yzmyvkr0sjihlgdmq"))))
+    (build-system clojure-build-system)
+    (arguments
+     '(#:source-dirs '("src/main/clojure/")
+       #:test-dirs '("src/test/clojure/")
+       #:doc-dirs '()))
+    (native-inputs
+     `(("clojure-tools-macro" ,clojure-tools-macro)))
+    (synopsis
+     "Monad Macros and Definitions")
+    (description
+     "This library contains the most commonly used monads as well as macros for
+defining and using monads and useful monadic functions.")
+    (home-page "https://github.com/clojure/algo.monads")
+    (license license:epl1.0)))
+
 (define-public clojure-core-match
   (let ((commit "1837ffbd4a150e8f3953b2d9ed5cf4a4ad3720a7")
         (revision "1")) ; this is the 1st commit buildable with clojure 1.9
-- 
2.19.1

[signature.asc (application/pgp-signature, inline)]

Reply sent to Danny Milosavljevic <dannym <at> scratchpost.org>:
You have taken responsibility. (Mon, 19 Nov 2018 12:54:02 GMT) Full text and rfc822 format available.

Notification sent to Alex Vong <alexvong1995 <at> gmail.com>:
bug acknowledged by developer. (Mon, 19 Nov 2018 12:54:02 GMT) Full text and rfc822 format available.

Message #43 received at 33215-done <at> debbugs.gnu.org (full text, mbox):

From: Danny Milosavljevic <dannym <at> scratchpost.org>
To: Alex Vong <alexvong1995 <at> gmail.com>
Cc: 33215-done <at> debbugs.gnu.org
Subject: Re: [bug#33215] [PATCH 00/11] build-system: Add
 'clojure-build-system'.
Date: Mon, 19 Nov 2018 13:53:10 +0100
[Message part 1 (text/plain, inline)]
I pushed this patchset to master.
[Message part 2 (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#33215; Package guix-patches. (Tue, 20 Nov 2018 21:56:02 GMT) Full text and rfc822 format available.

Message #46 received at 33215 <at> debbugs.gnu.org (full text, mbox):

From: ludo <at> gnu.org (Ludovic Courtès)
To: Alex Vong <alexvong1995 <at> gmail.com>
Cc: Danny Milosavljevic <dannym <at> scratchpost.org>, 33215 <at> debbugs.gnu.org
Subject: Re: [bug#33215] [PATCH 05/11] guix: Add clojure-utils.
Date: Tue, 20 Nov 2018 22:55:27 +0100
Hello!

I’m late to the party but I think there are things worth discussing
here.  Danny, for non-trivial bits, in particular in the (guix …) name
space, I think we should ping people to get more detailed review before
merging.

Alex Vong <alexvong1995 <at> gmail.com> skribis:

> From 857cce37325f01c26f79a6e15e33d7988ea4a0a2 Mon Sep 17 00:00:00 2001
> From: Alex Vong <alexvong1995 <at> gmail.com>
> Date: Sun, 14 Oct 2018 03:09:48 +0800
> Subject: [PATCH 05/11] guix: Add clojure-utils.
>
> * guix/build/clojure-utils.scm: New file.
> * gnu/packages/lisp.scm (clojure)[arguments]: Use it.
> * Makefile.am (MODULES): Add it.

[...]

> +(define-module (guix build clojure-utils)
> +  #:use-module (guix build utils)
> +  #:use-module (ice-9 ftw)
> +  #:use-module (ice-9 regex)
> +  #:use-module (srfi srfi-1)
> +  #:use-module (srfi srfi-26)
> +  #:export (%clojure-regex
> +            define-with-docs
> +            install-doc))
> +
> +(define-syntax-rule (define-with-docs name docs val)
> +  "Create top-level variable named NAME with doc string DOCS and value VAL."
> +  (begin (define name val)
> +         (set-object-property! name 'documentation docs)))

This is not necessarily a bad idea, but in general I’m very much in
favor of consistency: since we don’t use this anywhere else, I’d rather
not have it here either.  We could discuss it separately, but IMO it
shouldn’t be buried in a Clojure patch.

Thus I’d be in favor of using the same style in this file as in the rest
of Guix.

WDYT?

Thanks,
Ludo’.




Information forwarded to guix-patches <at> gnu.org:
bug#33215; Package guix-patches. (Tue, 20 Nov 2018 22:04:01 GMT) Full text and rfc822 format available.

Message #49 received at 33215 <at> debbugs.gnu.org (full text, mbox):

From: ludo <at> gnu.org (Ludovic Courtès)
To: Alex Vong <alexvong1995 <at> gmail.com>
Cc: 33215 <at> debbugs.gnu.org
Subject: Re: [bug#33215] [PATCH 06/11] build-system: Add
 'clojure-build-system'.
Date: Tue, 20 Nov 2018 23:03:00 +0100
Alex Vong <alexvong1995 <at> gmail.com> skribis:

> From c7a763cfa2543119cc707b434efc8680f73f6367 Mon Sep 17 00:00:00 2001
> From: Alex Vong <alexvong1995 <at> gmail.com>
> Date: Thu, 25 Oct 2018 05:44:01 +0800
> Subject: [PATCH 06/11] build-system: Add 'clojure-build-system'.
>
> * guix/build-system/clojure.scm, guix/build/clojure-build-system.scm: New
> files.
> * guix/build/clojure-utils.scm (@*, @@*): New macros.
> (%source-dirs, %test-dirs, %compile-dir, %main-class, %omit-source?,
> %aot-include, %aot-exclude, %tests?, %test-include, %test-exclude,
> %clojure-regex): New variables.
> (package-name->jar-names, canonicalize-relative-path, find-files*,
> file-sans-extension, relative-path->clojure-lib-string, find-clojure-libs,
> compiled-from?, include-list\exclude-list, eval-with-clojure, create-jar):
> New procedures.
> * Makefile.am (MODULES): Add them.
> * doc/guix.texi (Build Systems): Document 'clojure-build-system'.

[...]

> +(define-with-docs canonicalize-relative-path
> +  "Like 'canonicalize-path', but for relative paths.
> +Canonicalizations requiring the path to exist are omitted."
> +  (let ((remove.. (lambda (ls)
> +                    (fold-right (match-lambda*
> +                                  (((and comp (not "..")) (".." comps ...))
> +                                   comps)
> +                                  ((comp (comps ...))
> +                                   (cons comp comps)))
> +                                '()
> +                                ls))))
> +    (compose (match-lambda
> +               (() ".")
> +               (ls (string-join ls "/")))
> +             remove..
> +             (cut remove (cut member <> '("" ".")) <>)

Guile has built-in “relative file name canonicalization”, see
‘%file-port-name-canonicalization’.  Could it be used here?

I think the use of ‘compose’ above is abusive, as explained at
<http://mumble.net/~campbell/scheme/style.txt> (info "(guix) Formatting
Code").

Also I’m not too keen on identifiers that happen to be recognized but
are not quite R5RS: ‘remove..’, ‘include-list\exclude-list’, etc.  It
would be safer to just stick to the same conventions as elsewhere.

Ludo’.




Information forwarded to guix-patches <at> gnu.org:
bug#33215; Package guix-patches. (Wed, 21 Nov 2018 14:37:02 GMT) Full text and rfc822 format available.

Message #52 received at 33215 <at> debbugs.gnu.org (full text, mbox):

From: Alex Vong <alexvong1995 <at> gmail.com>
To: ludo <at> gnu.org (Ludovic Courtès)
Cc: Danny Milosavljevic <dannym <at> scratchpost.org>, 33215 <at> debbugs.gnu.org,
 alexvong1995 <at> gmail.com
Subject: Re: [bug#33215] [PATCH 05/11] guix: Add clojure-utils.
Date: Wed, 21 Nov 2018 22:35:54 +0800
[Message part 1 (text/plain, inline)]
Hello,

ludo <at> gnu.org (Ludovic Courtès) writes:

> Hello!
>
> I’m late to the party but I think there are things worth discussing
> here.  Danny, for non-trivial bits, in particular in the (guix …) name
> space, I think we should ping people to get more detailed review before
> merging.
>
> Alex Vong <alexvong1995 <at> gmail.com> skribis:
>
>> From 857cce37325f01c26f79a6e15e33d7988ea4a0a2 Mon Sep 17 00:00:00 2001
>> From: Alex Vong <alexvong1995 <at> gmail.com>
>> Date: Sun, 14 Oct 2018 03:09:48 +0800
>> Subject: [PATCH 05/11] guix: Add clojure-utils.
>>
>> * guix/build/clojure-utils.scm: New file.
>> * gnu/packages/lisp.scm (clojure)[arguments]: Use it.
>> * Makefile.am (MODULES): Add it.
>
> [...]
>
>> +(define-module (guix build clojure-utils)
>> +  #:use-module (guix build utils)
>> +  #:use-module (ice-9 ftw)
>> +  #:use-module (ice-9 regex)
>> +  #:use-module (srfi srfi-1)
>> +  #:use-module (srfi srfi-26)
>> +  #:export (%clojure-regex
>> +            define-with-docs
>> +            install-doc))
>> +
>> +(define-syntax-rule (define-with-docs name docs val)
>> +  "Create top-level variable named NAME with doc string DOCS and value VAL."
>> +  (begin (define name val)
>> +         (set-object-property! name 'documentation docs)))
>
> This is not necessarily a bad idea, but in general I’m very much in
> favor of consistency: since we don’t use this anywhere else, I’d rather
> not have it here either.  We could discuss it separately, but IMO it
> shouldn’t be buried in a Clojure patch.
>
> Thus I’d be in favor of using the same style in this file as in the rest
> of Guix.
>
> WDYT?
>
No problem, I am happy to replace the doc string by a comment
instead. IMO, providing doc string for variables in addition to
procedures is more consistent [in a different way :)] since a procedure
is just a special kind of variable. For example, 'defvar' in Emacs
allows one to specify a doc string.

Besides, I thought it is okay to use custom syntactic form within a
module (as long as it doesn't break other's code). However, I can see
that the way I use it can be confusing since everyone are used to
defining variable via 'define'. Is this what you have in mind when you
wrote that you are in favor of consistency?

> Thanks,
> Ludo’.

Cheers,
Alex
[signature.asc (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#33215; Package guix-patches. (Wed, 21 Nov 2018 22:13:01 GMT) Full text and rfc822 format available.

Message #55 received at 33215 <at> debbugs.gnu.org (full text, mbox):

From: ludo <at> gnu.org (Ludovic Courtès)
To: Alex Vong <alexvong1995 <at> gmail.com>
Cc: Danny Milosavljevic <dannym <at> scratchpost.org>, 33215 <at> debbugs.gnu.org
Subject: Re: [bug#33215] [PATCH 05/11] guix: Add clojure-utils.
Date: Wed, 21 Nov 2018 23:12:12 +0100
Hi Alex,

Alex Vong <alexvong1995 <at> gmail.com> skribis:

> ludo <at> gnu.org (Ludovic Courtès) writes:

[...]

>>> +(define-syntax-rule (define-with-docs name docs val)
>>> +  "Create top-level variable named NAME with doc string DOCS and value VAL."
>>> +  (begin (define name val)
>>> +         (set-object-property! name 'documentation docs)))
>>
>> This is not necessarily a bad idea, but in general I’m very much in
>> favor of consistency: since we don’t use this anywhere else, I’d rather
>> not have it here either.  We could discuss it separately, but IMO it
>> shouldn’t be buried in a Clojure patch.
>>
>> Thus I’d be in favor of using the same style in this file as in the rest
>> of Guix.
>>
>> WDYT?
>>
> No problem, I am happy to replace the doc string by a comment
> instead. IMO, providing doc string for variables in addition to
> procedures is more consistent [in a different way :)] since a procedure
> is just a special kind of variable. For example, 'defvar' in Emacs
> allows one to specify a doc string.

Yeah, that’s why I think it’s not necessarily a bad idea in itself, it’s
just something we don’t currently do in Guile Scheme.  :-)

> Besides, I thought it is okay to use custom syntactic form within a
> module (as long as it doesn't break other's code). However, I can see
> that the way I use it can be confusing since everyone are used to
> defining variable via 'define'. Is this what you have in mind when you
> wrote that you are in favor of consistency?

Yes, I think it makes it easier for people to find their way in the code
base and get started hacking it if it has somewhat consistent
conventions.  Of course coding style may vary a bit from module to
module and that’s fine, but overall I think we should try to use the
same “base language” so to speak.

WDYT?

Having said that, I realize I was probably too grumpy when I wrote this,
and I didn’t mention the main point, which is that this Clojure build
system looks really nice to me!  It’ll surely make it easier to add more
Clojure packages—now all we need is an importer to make that even
smoother.  :-)

Thank you,
Ludo’.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Thu, 20 Dec 2018 12:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 5 years and 129 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.