* Leiningen follow-up
@ 2018-10-29 19:11 Brett Gilio
2018-10-30 13:05 ` Alex Vong
0 siblings, 1 reply; 4+ messages in thread
From: Brett Gilio @ 2018-10-29 19:11 UTC (permalink / raw)
To: guix-devel@gnu.org
Hi all,
I notice that in February 2017 "Alex . ter . weele" attempted to package
Leiningen for Guix. I was wondering if anybody has a latest attempt at
that. I wouldn't mind picking up on it and seeing if we can't get it
added.
--
Brett M. Gilio
Free Software Foundation, Member
https://gnu.org/s/guix | https://emacs.org
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Leiningen follow-up
2018-10-29 19:11 Leiningen follow-up Brett Gilio
@ 2018-10-30 13:05 ` Alex Vong
2018-10-31 13:37 ` A simple Clojure build system is now ready (was Re: Leiningen follow-up) Alex Vong
2020-01-03 8:26 ` Leiningen follow-up Pierre Neidhardt
0 siblings, 2 replies; 4+ messages in thread
From: Alex Vong @ 2018-10-30 13:05 UTC (permalink / raw)
To: Brett Gilio; +Cc: guix-devel@gnu.org
[-- Attachment #1.1: Type: text/plain, Size: 1045 bytes --]
Hello Brett,
Back then, I tried to package leiningen because many clojure libraries
use leiningen as their build systems. However, it turns out that
leiningen depends on leiningen-core[0], which it turns depends on
wagon-http[1], which requires maven. Maven was not packaged then, and if
I recall correctly, it was very tricky to package because it has many
dependencies and it requires itself to build. I gave up after some
time.
Forwarding to the present, thanks to Julien, Gábor and others, we now
have many java packages in guix, including maven. Perhaps it is now
easier to package leiningen (I didn't check).
Earlier this year, I have plan to setup a simple clojure build system
which only use plain old 'compile' in clojure. It is now almost
finish (I was busy at school). I haven't send them to guix-patches yet
because it still lacks accurate documentation and selective compilation
is not working properly yet. The patches are included below for your
reference. I also include 5 packages for testing purpose.
[-- Attachment #1.2: 0001-gnu-clojure-Move-from-java-to-lisp.patch --]
[-- Type: text/x-diff, Size: 16118 bytes --]
From 3e9074b84bbae63c8e4c636257954db59b12279c Mon Sep 17 00:00:00 2001
From: Alex Vong <alexvong1995@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 7964aa307..b3c39a931 100644
--- a/gnu/packages/lisp.scm
+++ b/gnu/packages/lisp.scm
@@ -9,6 +9,7 @@
;;; Copyright © 2017, 2018 Efraim Flashner <efraim@flashner.co.il>
;;; Copyright © 2017 Tobias Geerinckx-Rice <me@tobias.gr>
;;; Copyright © 2018 Benjamin Slade <slade@jnanam.net>
+;;; Copyright © 2018 Alex Vong <alexvong1995@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
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.3: 0002-gnu-clojure-Remove-remove-archives-snippet.patch --]
[-- Type: text/x-diff, Size: 2865 bytes --]
From bec8fa6c227bb3d2fa38a21b45938adfa8ba562f Mon Sep 17 00:00:00 2001
From: Alex Vong <alexvong1995@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 b3c39a931..71e7ddc67 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
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.4: 0003-gnu-clojure-Refactor-to-ensure-there-s-a-single-list.patch --]
[-- Type: text/x-diff, Size: 6991 bytes --]
From 60c7bc92562a6fa6f0219fa41dc2a97e1a566310 Mon Sep 17 00:00:00 2001
From: Alex Vong <alexvong1995@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 71e7ddc67..e7ebc045c 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
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.5: 0004-gnu-clojure-Use-guix-build-java-utils-to-simplify-bu.patch --]
[-- Type: text/x-diff, Size: 3177 bytes --]
From 2d5750d5844a3e608d1577d45a75e3a6c8faa961 Mon Sep 17 00:00:00 2001
From: Alex Vong <alexvong1995@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 e7ebc045c..8a7c8b464 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
[-- Attachment #1.6: 0005-guix-Add-clojure-utils.patch --]
[-- Type: text/x-diff, Size: 6488 bytes --]
From 9696b4909769a54d3add6efccf8be35eee31a745 Mon Sep 17 00:00:00 2001
From: Alex Vong <alexvong1995@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 1acf0b12d..a95d430fa 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -12,6 +12,7 @@
# Copyright © 2018 Nils Gillmann <ng0@n0.is>
# Copyright © 2018 Julien Lepiller <julien@lepiller.eu>
# Copyright © 2018 Oleg Pykhalov <go.wigust@gmail.com>
+# Copyright © 2018 Alex Vong <alexvong1995@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 8a7c8b464..ba7e50152 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@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
[-- Attachment #1.7: 0006-build-system-Add-clojure-build-system.patch --]
[-- Type: text/x-diff, Size: 21434 bytes --]
From 4119eb48864f4dc89e946cefe3ebad50f17f2d88 Mon Sep 17 00:00:00 2001
From: Alex Vong <alexvong1995@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, %tests?, %test-include,
%test-exclude, %clojure-regex): New variables.
(package-name->jar-names, strip-1st-component, find-files*,
find-clojure-libs, 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 | 53 ++++++++
guix/build-system/clojure.scm | 187 ++++++++++++++++++++++++++++
guix/build/clojure-build-system.scm | 96 ++++++++++++++
guix/build/clojure-utils.scm | 125 ++++++++++++++++++-
5 files changed, 461 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 a95d430fa..d79aa897e 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 12346c4b8..329fe0e65 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -50,6 +50,7 @@ Copyright @copyright{} 2018 Oleg Pykhalov@*
Copyright @copyright{} 2018 Mike Gerwitz@*
Copyright @copyright{} 2018 Pierre-Antoine Rouby@*
Copyright @copyright{} 2018 Gábor Boskovits@*
+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
@@ -4376,6 +4377,58 @@ 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 can be specified with the
+@code{#:compile-dir} parameter. 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 first calls @code{compile} in Clojure to compile all source files
+found in the source directories into class files in the compile directory.
+Then, it runs @command{jar} to create jars from both source files and class
+files.
+
+@item check
+This phase runs tests according to the include list and exclude list specified
+in @code{#:test-include} and @code{#:test-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 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..24c422553
--- /dev/null
+++ b/guix/build-system/clojure.scm
@@ -0,0 +1,187 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2018 Alex Vong <alexvong1995@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 (source->output-path source)
+ "Convert SOURCE input to output path."
+ (match source
+ (((? derivation? source))
+ (derivation->output-path source))
+ ((source)
+ source)
+ (source
+ source)))
+
+(define (maybe-guile->guile maybe-guile)
+ "Find the right GUILE."
+ (match 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))
+
+ 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
+
+ #: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..2fb631c58
--- /dev/null
+++ b/guix/build/clojure-build-system.scm
@@ -0,0 +1,96 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2018 Alex Vong <alexvong1995@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@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
+ #:allow-other-keys)
+ "Standard 'build' phase for clojure-build-system."
+ (let ((clojure-libs (append-map find-clojure-libs source-dirs)))
+ (mkdir compile-dir)
+ (eval-with-clojure `(run! compile ',clojure-libs)
+ source-dirs)
+ (for-each (cut apply create-jar <> compile-dir source-dirs)
+ 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-found (append-map find-clojure-libs test-dirs))
+ (libs-included (if (memq #:all test-include)
+ libs-found
+ test-include))
+ (libs-excluded (if (memq #:all test-exclude)
+ libs-found
+ test-exclude))
+ (libs (lset-difference eq? libs-included libs-excluded)))
+ (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@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..6ff28950d 100644
--- a/guix/build/clojure-utils.scm
+++ b/guix/build/clojure-utils.scm
@@ -21,10 +21,37 @@
#:use-module (ice-9 ftw)
#: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
+ %tests?
+ %test-include
+ %test-exclude
+
+ strip-1st-component
+ %clojure-regex
+ find-files*
+ find-clojure-libs
+ 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 +90,97 @@ 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 %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 strip-1st-component
+ "Similar to 'dirname', but strip the 1st component from path instead."
+ (compose string-reverse dirname string-reverse))
+
+(define-with-docs %clojure-regex
+ "Default regex for matching the base name of clojure source files."
+ "\\.cljc?$")
+
+(define (find-files* base-dir . args)
+ "Similar to 'find-files', but with BASE-DIR stripped."
+ (map strip-1st-component
+ (with-directory-excursion base-dir
+ (apply find-files "./" args))))
+
+(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."
+ (define (relative-path->clojure-libs path)
+ ;; FIXME: 'file-sans-extension' should be moved to (guix build utils)
+ (let ((file-sans-extension (@@ (guix build guile-build-system)
+ file-sans-extension)))
+ (string->symbol (string-map (lambda (chr)
+ (case chr
+ ((#\/) #\.)
+ ((#\_) #\-)
+ (else chr)))
+ (file-sans-extension path)))))
+ (map relative-path->clojure-libs
+ (find-files* base-dir clojure-regex)))
+
+(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 . dirs)
+ "Create jar named OUTPUT-JAR from files found in DIRS."
+ (apply invoke
+ "jar"
+ "cvf0M" output-jar
+ (append-map (lambda (dir)
+ (append-map (lambda (file)
+ `("-C" ,dir ,file))
+ (find-files* dir)))
+ dirs)))
--
2.19.1
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.8: 0007-gnu-Add-clojure-instaparse.patch --]
[-- Type: text/x-diff, Size: 3149 bytes --]
From 3c36d896d3d2a111c64a315da1679c1577c29295 Mon Sep 17 00:00:00 2001
From: Alex Vong <alexvong1995@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 ba7e50152..9d1c27288 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 "Simple way to build parsers in Clojure")
+ (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
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.9: 0008-gnu-Add-clojure-core-match.patch --]
[-- Type: text/x-diff, Size: 2088 bytes --]
From ff1d6416caec8f20af64adb1bd776b76d4a6089d Mon Sep 17 00:00:00 2001
From: Alex Vong <alexvong1995@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 9d1c27288..771a52fa8 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 "Pattern match and predicate dispatch")
+ (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
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.10: 0009-gnu-Add-clojure-algo-generic.patch --]
[-- Type: text/x-diff, Size: 1801 bytes --]
From da65fc17d7593bfe15a70b38a99e4e11d163fb5e Mon Sep 17 00:00:00 2001
From: Alex Vong <alexvong1995@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 771a52fa8..a23319d38 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
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.11: 0010-gnu-Add-clojure-tools-macro.patch --]
[-- Type: text/x-diff, Size: 1555 bytes --]
From d65e5e4216f770a629e8136412615998bb7e42c6 Mon Sep 17 00:00:00 2001
From: Alex Vong <alexvong1995@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 a23319d38..d95815cf8 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
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.12: 0011-gnu-Add-clojure-algo-monads.patch --]
[-- Type: text/x-diff, Size: 1858 bytes --]
From 9a9f56ff2a7817479cb1548cc3561584ae3ad827 Mon Sep 17 00:00:00 2001
From: Alex Vong <alexvong1995@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 d95815cf8..470ded788 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
[-- Attachment #1.13: Type: text/plain, Size: 296 bytes --]
Cheers,
Alex
Brett Gilio <brettg@posteo.net> writes:
> Hi all,
>
> I notice that in February 2017 "Alex . ter . weele" attempted to package
> Leiningen for Guix. I was wondering if anybody has a latest attempt at
> that. I wouldn't mind picking up on it and seeing if we can't get it
> added.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 227 bytes --]
^ permalink raw reply related [flat|nested] 4+ messages in thread
* A simple Clojure build system is now ready (was Re: Leiningen follow-up)
2018-10-30 13:05 ` Alex Vong
@ 2018-10-31 13:37 ` Alex Vong
2020-01-03 8:26 ` Leiningen follow-up Pierre Neidhardt
1 sibling, 0 replies; 4+ messages in thread
From: Alex Vong @ 2018-10-31 13:37 UTC (permalink / raw)
To: Brett Gilio; +Cc: guix-devel@gnu.org
[-- Attachment #1: Type: text/plain, Size: 367 bytes --]
Hello everyone,
The simple build system for Clojure is finally ready (simple in the
sense that it uses plain old 'compile' in Clojure). The patches have
been sent to guix-patches for review:
https://issues.guix.info/issue/33215.
So feel free to ignore the patches from my last reply.
Cheers,
Alex
Alex Vong <alexvong1995@gmail.com> writes:
> Hello Brett,
>
[...]
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 227 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Leiningen follow-up
2018-10-30 13:05 ` Alex Vong
2018-10-31 13:37 ` A simple Clojure build system is now ready (was Re: Leiningen follow-up) Alex Vong
@ 2020-01-03 8:26 ` Pierre Neidhardt
1 sibling, 0 replies; 4+ messages in thread
From: Pierre Neidhardt @ 2020-01-03 8:26 UTC (permalink / raw)
To: Alex Vong, Brett Gilio; +Cc: guix-devel@gnu.org
[-- Attachment #1: Type: text/plain, Size: 286 bytes --]
Hi Alex, hi Brett,
This is an exciting patch, I'd love to see it merged! Any news on this?
We could finally get started with adding more Clojure libs to Guix!
Note that now Clojure is in its separate clojure.scm file.
Cheers!
--
Pierre Neidhardt
https://ambrevar.xyz/
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-01-03 8:26 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-10-29 19:11 Leiningen follow-up Brett Gilio
2018-10-30 13:05 ` Alex Vong
2018-10-31 13:37 ` A simple Clojure build system is now ready (was Re: Leiningen follow-up) Alex Vong
2020-01-03 8:26 ` Leiningen follow-up Pierre Neidhardt
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/guix.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.