From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alex Vong Subject: Re: Leiningen follow-up Date: Tue, 30 Oct 2018 21:05:35 +0800 Message-ID: <87y3afh9eo.fsf@gmail.com> References: <87efc8zhym.fsf@posteo.net> Mime-Version: 1.0 Content-Type: multipart/signed; boundary="==-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:42725) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gHTij-0006ys-7U for guix-devel@gnu.org; Tue, 30 Oct 2018 09:06:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gHTid-0007Hq-Ve for guix-devel@gnu.org; Tue, 30 Oct 2018 09:06:09 -0400 Received: from mail-pg1-x530.google.com ([2607:f8b0:4864:20::530]:44352) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gHTid-0007Gs-46 for guix-devel@gnu.org; Tue, 30 Oct 2018 09:06:03 -0400 Received: by mail-pg1-x530.google.com with SMTP id w3-v6so5607867pgs.11 for ; Tue, 30 Oct 2018 06:06:02 -0700 (PDT) In-Reply-To: <87efc8zhym.fsf@posteo.net> (Brett Gilio's message of "Mon, 29 Oct 2018 14:11:13 -0500") List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: "Guix-devel" To: Brett Gilio Cc: "guix-devel@gnu.org" --==-=-= Content-Type: multipart/mixed; boundary="=-=-=" --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable 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=C3=A1bor 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. --=-=-= Content-Type: text/x-diff; charset=utf-8 Content-Disposition: inline; filename=0001-gnu-clojure-Move-from-java-to-lisp.patch Content-Transfer-Encoding: quoted-printable From=203e9074b84bbae63c8e4c636257954db59b12279c Mon Sep 17 00:00:00 2001 From: Alex Vong 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. =2D-- 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 =2D-- a/gnu/packages/java.scm +++ b/gnu/packages/java.scm @@ -1803,151 +1803,6 @@ new Date();")) `(("java-junit" ,java-junit) ,@(package-inputs ant/java8))))) =20 =2D(define-public clojure =2D (let* ((remove-archives '(begin =2D (for-each delete-file =2D (find-files "." ".*\\.(jar|zip)")) =2D #t)) =2D (submodule (lambda (prefix version hash) =2D (origin =2D (method url-fetch) =2D (uri (string-append "https://github.com/clojure/" =2D prefix version ".tar.gz")) =2D (sha256 (base32 hash)) =2D (modules '((guix build utils))) =2D (snippet remove-archives))))) =2D (package =2D (name "clojure") =2D (version "1.9.0") =2D (source =2D (origin =2D (method url-fetch) =2D (uri =2D (string-append "https://github.com/clojure/clojure/archive/clo= jure-" =2D version ".tar.gz")) =2D (sha256 =2D (base32 "0xjbzcw45z32vsn9pifp7ndysjzqswp5ig0jkjpivigh2ckkdzha"= )) =2D (modules '((guix build utils))) =2D (snippet remove-archives))) =2D (build-system ant-build-system) =2D (arguments =2D `(#:modules ((guix build ant-build-system) =2D (guix build utils) =2D (ice-9 ftw) =2D (ice-9 regex) =2D (srfi srfi-1) =2D (srfi srfi-26)) =2D #:test-target "test" =2D #:phases =2D (modify-phases %standard-phases =2D (add-after 'unpack 'unpack-submodule-sources =2D (lambda* (#:key inputs #:allow-other-keys) =2D (for-each =2D (lambda (name) =2D (mkdir-p name) =2D (with-directory-excursion name =2D (invoke "tar" =2D ;; Use xz for repacked tarball. =2D "--xz" =2D "--extract" =2D "--verbose" =2D "--file" (assoc-ref inputs name) =2D "--strip-components=3D1")) =2D (copy-recursively (string-append name "/src/main/cloju= re/") =2D "src/clj/")) =2D '("core-specs-alpha-src" =2D "data-generators-src" =2D "spec-alpha-src" =2D "test-check-src" =2D "test-generative-src" =2D "tools-namespace-src")) =2D #t)) =2D (add-after 'unpack 'fix-manifest-classpath =2D (lambda _ =2D (substitute* "build.xml" =2D (("") "= ")) =2D #t)) =2D ;; The javadoc target is not built by default. =2D (add-after 'build 'build-doc =2D (lambda _ =2D (invoke "ant" "javadoc"))) =2D ;; Needed since no install target is provided. =2D (replace 'install =2D (lambda* (#:key outputs #:allow-other-keys) =2D (let ((java-dir (string-append (assoc-ref outputs "out") =2D "/share/java/"))) =2D ;; Install versioned to avoid collisions. =2D (install-file (string-append "clojure-" ,version ".jar") =2D java-dir) =2D #t))) =2D ;; Needed since no install-doc target is provided. =2D (add-after 'install 'install-doc =2D (lambda* (#:key outputs #:allow-other-keys) =2D (let ((doc-dir (string-append (assoc-ref outputs "out") =2D "/share/doc/clojure-" =2D ,version "/"))) =2D (copy-recursively "doc/clojure" doc-dir) =2D (copy-recursively "target/javadoc/" =2D (string-append doc-dir "javadoc/")) =2D (for-each (cut install-file <> doc-dir) =2D (filter (cut string-match =2D ".*\\.(html|markdown|md|txt)" =2D <>) =2D (scandir "./"))) =2D #t)))))) =2D ;; The native-inputs below are needed to run the tests. =2D (native-inputs =2D `(("core-specs-alpha-src" =2D ,(submodule "core.specs.alpha/archive/core.specs.alpha-" =2D "0.1.24" =2D "0v2a0svf1ar2y42ajxwsjr7zmm5j7pp2zwrd2jh3k7xzd1p9x= 1fv")) =2D ("data-generators-src" =2D ,(submodule "data.generators/archive/data.generators-" =2D "0.1.2" =2D "0kki093jp4ckwxzfnw8ylflrfqs8b1i1wi9iapmwcsy328dmg= zp1")) =2D ("spec-alpha-src" =2D ,(submodule "spec.alpha/archive/spec.alpha-" =2D "0.1.143" =2D "00alf0347licdn773w2jarpllyrbl52qz4d8mw61anjksacxy= lzz")) =2D ("test-check-src" =2D ,(submodule "test.check/archive/test.check-" =2D "0.9.0" =2D "0p0mnyhr442bzkz0s4k5ra3i6l5lc7kp6ajaqkkyh4c2k5yck= 1md")) =2D ("test-generative-src" =2D ,(submodule "test.generative/archive/test.generative-" =2D "0.5.2" =2D "1pjafy1i7yblc7ixmcpfq1lfbyf3jaljvkgrajn70sws9xs7a= 9f8")) =2D ("tools-namespace-src" =2D ,(submodule "tools.namespace/archive/tools.namespace-" =2D "0.2.11" =2D "10baak8v0hnwz2hr33bavshm7y49mmn9zsyyms1dwjz45p5ym= hy0")))) =2D (home-page "https://clojure.org/") =2D (synopsis "Lisp dialect running on the JVM") =2D (description "Clojure is a dynamic, general-purpose programming la= nguage, =2Dcombining the approachability and interactive development of a scripting =2Dlanguage with an efficient and robust infrastructure for multithreaded =2Dprogramming. Clojure is a compiled language, yet remains completely dyn= amic =2D=E2=80=93 every feature supported by Clojure is supported at runtime. C= lojure =2Dprovides easy access to the Java frameworks, with optional type hints an= d type =2Dinference, to ensure that calls to Java can avoid reflection. =2D =2DClojure is a dialect of Lisp, and shares with Lisp the code-as-data phil= osophy =2Dand a powerful macro system. Clojure is predominantly a functional prog= ramming =2Dlanguage, and features a rich set of immutable, persistent data structur= es. =2DWhen mutable state is needed, Clojure offers a software transactional me= mory =2Dsystem and reactive Agent system that ensure clean, correct, multithread= ed =2Ddesigns.") =2D ;; Clojure is licensed under EPL1.0 =2D ;; ASM bytecode manipulation library is licensed under BSD-3 =2D ;; Guava Murmur3 hash implementation is licensed under APL2.0 =2D ;; src/clj/repl.clj is licensed under CPL1.0 =2D ;; =2D ;; See readme.html or readme.txt for details. =2D (license (list license:epl1.0 =2D license:bsd-3 =2D license:asl2.0 =2D license:cpl1.0))))) =2D (define-public javacc-4 (package (name "javacc") diff --git a/gnu/packages/lisp.scm b/gnu/packages/lisp.scm index 7964aa307..b3c39a931 100644 =2D-- a/gnu/packages/lisp.scm +++ b/gnu/packages/lisp.scm @@ -9,6 +9,7 @@ ;;; Copyright =C2=A9 2017, 2018 Efraim Flashner ;;; Copyright =C2=A9 2017 Tobias Geerinckx-Rice ;;; Copyright =C2=A9 2018 Benjamin Slade +;;; Copyright =C2=A9 2018 Alex Vong ;;; ;;; 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 =20 +(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/cloju= re-" + 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=3D1")) + (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" + (("") "")) + #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" + "0v2a0svf1ar2y42ajxwsjr7zmm5j7pp2zwrd2jh3k7xzd1p9x1f= v")) + ("data-generators-src" + ,(submodule "data.generators/archive/data.generators-" + "0.1.2" + "0kki093jp4ckwxzfnw8ylflrfqs8b1i1wi9iapmwcsy328dmgzp= 1")) + ("spec-alpha-src" + ,(submodule "spec.alpha/archive/spec.alpha-" + "0.1.143" + "00alf0347licdn773w2jarpllyrbl52qz4d8mw61anjksacxylz= z")) + ("test-check-src" + ,(submodule "test.check/archive/test.check-" + "0.9.0" + "0p0mnyhr442bzkz0s4k5ra3i6l5lc7kp6ajaqkkyh4c2k5yck1m= d")) + ("test-generative-src" + ,(submodule "test.generative/archive/test.generative-" + "0.5.2" + "1pjafy1i7yblc7ixmcpfq1lfbyf3jaljvkgrajn70sws9xs7a9f= 8")) + ("tools-namespace-src" + ,(submodule "tools.namespace/archive/tools.namespace-" + "0.2.11" + "10baak8v0hnwz2hr33bavshm7y49mmn9zsyyms1dwjz45p5ymhy= 0")))) + (home-page "https://clojure.org/") + (synopsis "Lisp dialect running on the JVM") + (description "Clojure is a dynamic, general-purpose programming lang= uage, +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 dynam= ic +=E2=80=93 every feature supported by Clojure is supported at runtime. Clo= jure +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 philos= ophy +and a powerful macro system. Clojure is predominantly a functional progra= mming +language, and features a rich set of immutable, persistent data structures. +When mutable state is needed, Clojure offers a software transactional memo= ry +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")) =2D-=20 2.19.1 --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0002-gnu-clojure-Remove-remove-archives-snippet.patch Content-Transfer-Encoding: quoted-printable From=20bec8fa6c227bb3d2fa38a21b45938adfa8ba562f Mon Sep 17 00:00:00 2001 From: Alex Vong 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. =2D-- 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 =2D-- a/gnu/packages/lisp.scm +++ b/gnu/packages/lisp.scm @@ -562,18 +562,12 @@ interface.") license:clarified-artistic)))) ;TRIVIAL-LDAP package =20 (define-public clojure =2D (let* ((remove-archives '(begin =2D (for-each delete-file =2D (find-files "." ".*\\.(jar|zip)")) =2D #t)) =2D (submodule (lambda (prefix version hash) =2D (origin =2D (method url-fetch) =2D (uri (string-append "https://github.com/clojure/" =2D prefix version ".tar.gz")) =2D (sha256 (base32 hash)) =2D (modules '((guix build utils))) =2D (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/cloju= re-" version ".tar.gz")) (sha256 =2D (base32 "0xjbzcw45z32vsn9pifp7ndysjzqswp5ig0jkjpivigh2ckkdzha"= )) =2D (modules '((guix build utils))) =2D (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" =2D ;; Use xz for repacked tarball. =2D "--xz" "--extract" "--verbose" "--file" (assoc-ref inputs name) =2D-=20 2.19.1 --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0003-gnu-clojure-Refactor-to-ensure-there-s-a-single-list.patch Content-Transfer-Encoding: quoted-printable From=2060c7bc92562a6fa6f0219fa41dc2a97e1a566310 Mon Sep 17 00:00:00 2001 From: Alex Vong Date: Sun, 14 Oct 2018 00:08:29 +0800 Subject: [PATCH 03/11] gnu: clojure: Refactor to ensure there's a single li= st 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. =2D-- 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 =2D-- a/gnu/packages/lisp.scm +++ b/gnu/packages/lisp.scm @@ -562,12 +562,40 @@ interface.") license:clarified-artistic)))) ;TRIVIAL-LDAP package =20 (define-public clojure =2D (let ((submodule (lambda (prefix version hash) =2D (origin =2D (method url-fetch) =2D (uri (string-append "https://github.com/clojure/" =2D prefix version ".tar.gz")) =2D (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 =2D (add-after 'unpack 'unpack-submodule-sources + (add-after 'unpack 'unpack-library-sources (lambda* (#:key inputs #:allow-other-keys) =2D (for-each =2D (lambda (name) =2D (mkdir-p name) =2D (with-directory-excursion name =2D (invoke "tar" =2D "--extract" =2D "--verbose" =2D "--file" (assoc-ref inputs name) =2D "--strip-components=3D1")) =2D (copy-recursively (string-append name "/src/main/cloju= re/") =2D "src/clj/")) =2D '("core-specs-alpha-src" =2D "data-generators-src" =2D "spec-alpha-src" =2D "test-check-src" =2D "test-generative-src" =2D "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=3D1")) + (copy-recursively (string-append name "/src/main/clojure/= ") + "src/clj/")) + (for-each extract-library ',library-names) #t)) =2D (add-after 'unpack 'fix-manifest-classpath + (add-after 'unpack-library-sources 'fix-manifest-classpath (lambda _ (substitute* "build.xml" (("") "")) @@ -643,32 +665,7 @@ interface.") <>) (scandir "./"))) #t)))))) =2D ;; The native-inputs below are needed to run the tests. =2D (native-inputs =2D `(("core-specs-alpha-src" =2D ,(submodule "core.specs.alpha/archive/core.specs.alpha-" =2D "0.1.24" =2D "0v2a0svf1ar2y42ajxwsjr7zmm5j7pp2zwrd2jh3k7xzd1p9x= 1fv")) =2D ("data-generators-src" =2D ,(submodule "data.generators/archive/data.generators-" =2D "0.1.2" =2D "0kki093jp4ckwxzfnw8ylflrfqs8b1i1wi9iapmwcsy328dmg= zp1")) =2D ("spec-alpha-src" =2D ,(submodule "spec.alpha/archive/spec.alpha-" =2D "0.1.143" =2D "00alf0347licdn773w2jarpllyrbl52qz4d8mw61anjksacxy= lzz")) =2D ("test-check-src" =2D ,(submodule "test.check/archive/test.check-" =2D "0.9.0" =2D "0p0mnyhr442bzkz0s4k5ra3i6l5lc7kp6ajaqkkyh4c2k5yck= 1md")) =2D ("test-generative-src" =2D ,(submodule "test.generative/archive/test.generative-" =2D "0.5.2" =2D "1pjafy1i7yblc7ixmcpfq1lfbyf3jaljvkgrajn70sws9xs7a= 9f8")) =2D ("tools-namespace-src" =2D ,(submodule "tools.namespace/archive/tools.namespace-" =2D "0.2.11" =2D "10baak8v0hnwz2hr33bavshm7y49mmn9zsyyms1dwjz45p5ym= hy0")))) + (native-inputs libraries) (home-page "https://clojure.org/") (synopsis "Lisp dialect running on the JVM") (description "Clojure is a dynamic, general-purpose programming lang= uage, @@ -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 =2D ;; + ;; See readme.html or readme.txt for details. (license (list license:epl1.0 license:bsd-3 =2D-=20 2.19.1 --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0004-gnu-clojure-Use-guix-build-java-utils-to-simplify-bu.patch Content-Transfer-Encoding: quoted-printable From=202d5750d5844a3e608d1577d45a75e3a6c8faa961 Mon Sep 17 00:00:00 2001 From: Alex Vong 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. =2D-- 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 =2D-- 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) =2D (srfi srfi-1) (srfi srfi-26)) #:test-target "test" #:phases @@ -637,34 +637,22 @@ interface.") (substitute* "build.xml" (("") "")) #t)) =2D ;; The javadoc target is not built by default. =2D (add-after 'build 'build-doc =2D (lambda _ =2D (invoke "ant" "javadoc"))) =2D ;; Needed since no install target is provided. =2D (replace 'install =2D (lambda* (#:key outputs #:allow-other-keys) =2D (let ((java-dir (string-append (assoc-ref outputs "out") =2D "/share/java/"))) =2D ;; Install versioned to avoid collisions. =2D (install-file (string-append "clojure-" ,version ".jar") =2D java-dir) =2D #t))) =2D ;; 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) =2D (copy-recursively "target/javadoc/" =2D (string-append doc-dir "javadoc/")) (for-each (cut install-file <> doc-dir) (filter (cut string-match ".*\\.(html|markdown|md|txt)" <>) (scandir "./"))) =2D #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") =2D-=20 2.19.1 --=-=-= Content-Type: text/x-diff; charset=utf-8 Content-Disposition: inline; filename=0005-guix-Add-clojure-utils.patch Content-Transfer-Encoding: quoted-printable From=209696b4909769a54d3add6efccf8be35eee31a745 Mon Sep 17 00:00:00 2001 From: Alex Vong 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. =2D-- 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 =2D-- a/Makefile.am +++ b/Makefile.am @@ -12,6 +12,7 @@ # Copyright =C2=A9 2018 Nils Gillmann # Copyright =C2=A9 2018 Julien Lepiller # Copyright =C2=A9 2018 Oleg Pykhalov +# Copyright =C2=A9 2018 Alex Vong # # This file is part of GNU Guix. # @@ -172,6 +173,7 @@ MODULES =3D \ 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 =2D-- 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 =2D `(#: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) =2D (ice-9 ftw) =2D (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 "./")) =2D (add-after 'install 'install-doc =2D (lambda* (#:key outputs #:allow-other-keys) =2D (let ((doc-dir (string-append (assoc-ref outputs "out") =2D "/share/doc/clojure-" =2D ,version "/"))) =2D (copy-recursively "doc/clojure" doc-dir) =2D (for-each (cut install-file <> doc-dir) =2D (filter (cut string-match =2D ".*\\.(html|markdown|md|txt)" =2D <>) =2D (scandir "./"))) =2D #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 =2D-- /dev/null +++ b/guix/build/clojure-utils.scm @@ -0,0 +1,65 @@ +;;; GNU Guix --- Functional package management for GNU +;;; Copyright =C2=A9 2018 Alex Vong +;;; +;;; 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 . + +(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 fil= es." + (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)) =2D-=20 2.19.1 --=-=-= Content-Type: text/x-diff; charset=utf-8 Content-Disposition: inline; filename=0006-build-system-Add-clojure-build-system.patch Content-Transfer-Encoding: quoted-printable From=204119eb48864f4dc89e946cefe3ebad50f17f2d88 Mon Sep 17 00:00:00 2001 From: Alex Vong 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'. =2D-- 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 =2D-- a/Makefile.am +++ b/Makefile.am @@ -101,6 +101,7 @@ MODULES =3D \ 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 =3D \ 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 =2D-- 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=C3=A1bor Boskovits@* +Copyright @copyright{} 2018 Alex Vong@* =20 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 =20 +@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 imple= ments +a simple build procedure for @uref{https://clojure.org/, Clojure} packages +using plain old @code{compile} in Clojure. Cross-compilation is not suppo= rted +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 specif= ied +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 fil= es +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 speci= fied +in @code{#:test-include} and @code{#:test-exclude}, respectively. The exc= lude +list has priority over the include list. These lists consist of symbols +representing Clojure libraries or the special keyword @code{#:all} represe= nting +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 document= ation +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 =2D-- /dev/null +++ b/guix/build-system/clojure.scm @@ -0,0 +1,187 @@ +;;; GNU Guix --- Functional package management for GNU +;;; Copyright =C2=A9 2018 Alex Vong +;;; +;;; 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 . + +(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 =2D-- /dev/null +++ b/guix/build/clojure-build-system.scm @@ -0,0 +1,96 @@ +;;; GNU Guix --- Functional package management for GNU +;;; Copyright =C2=A9 2018 Alex Vong +;;; +;;; 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 . + +(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-EXCLUD= E 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 =2D-- 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) =2D #:export (%clojure-regex + #:export (@* + @@* define-with-docs =2D 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)) =20 (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))) =2D-=20 2.19.1 --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0007-gnu-Add-clojure-instaparse.patch Content-Transfer-Encoding: quoted-printable From=203c36d896d3d2a111c64a315da1679c1577c29295 Mon Sep 17 00:00:00 2001 From: Alex Vong 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. =2D-- 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 =2D-- 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{pars= e-js} to generate a ("sbcl-cl-uglify-js" ,sbcl-cl-uglify-js))) (synopsis "JavaScript compressor"))) =20 +(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 p= arse +tree for that string. + +@item @dfn{No Grammar Left Behind}: Works for @emph{any} context-free gram= mar, +including @emph{left-recursive}, @emph{right-recursive}, and @emph{ambiguo= us} +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 enl= ive) +as output targets + +@item Detailed reporting of parse errors. + +@item Optionally produces lazy sequence of all parses (especially useful f= or +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 =2D-=20 2.19.1 --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0008-gnu-Add-clojure-core-match.patch Content-Transfer-Encoding: quoted-printable From=20ff1d6416caec8f20af64adb1bd776b76d4a6089d Mon Sep 17 00:00:00 2001 From: Alex Vong 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. =2D-- 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 =2D-- a/gnu/packages/lisp.scm +++ b/gnu/packages/lisp.scm @@ -1604,6 +1604,33 @@ compressor. It works on data produced by @code{pars= e-js} to generate a ("sbcl-cl-uglify-js" ,sbcl-cl-uglify-js))) (synopsis "JavaScript compressor"))) =20 +(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 =2D-=20 2.19.1 --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0009-gnu-Add-clojure-algo-generic.patch Content-Transfer-Encoding: quoted-printable From=20da65fc17d7593bfe15a70b38a99e4e11d163fb5e Mon Sep 17 00:00:00 2001 From: Alex Vong 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. =2D-- 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 =2D-- a/gnu/packages/lisp.scm +++ b/gnu/packages/lisp.scm @@ -1604,6 +1604,30 @@ compressor. It works on data produced by @code{pars= e-js} to generate a ("sbcl-cl-uglify-js" ,sbcl-cl-uglify-js))) (synopsis "JavaScript compressor"))) =20 +(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 multimet= hods +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 =2D-=20 2.19.1 --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0010-gnu-Add-clojure-tools-macro.patch Content-Transfer-Encoding: quoted-printable From=20d65e5e4216f770a629e8136412615998bb7e42c6 Mon Sep 17 00:00:00 2001 From: Alex Vong 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. =2D-- 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 =2D-- 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)))) =20 +(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 =2D-=20 2.19.1 --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0011-gnu-Add-clojure-algo-monads.patch Content-Transfer-Encoding: quoted-printable From=209a9f56ff2a7817479cb1548cc3561584ae3ad827 Mon Sep 17 00:00:00 2001 From: Alex Vong 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. =2D-- 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 =2D-- 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))) =20 +(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 macro= s 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 =2D-=20 2.19.1 --=-=-= Content-Type: text/plain Cheers, Alex Brett Gilio 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. --=-=-=-- --==-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEARYIAB0WIQSof2ZdXkE0FM5aU4XzrkvbI+zaGwUCW9hXHwAKCRDzrkvbI+za G8H/AQC43CY7lEXLoWP/WeOVlT8OpNsRMzULu7cwQ/RQzaPkMgD+KOegoLgnLKQU WWWloRlQOoCpjttPAEJNORGt8YcJ7gc= =UGT0 -----END PGP SIGNATURE----- --==-=-=--