unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
* [PATCH] gnu: Add clojure.
@ 2016-02-24  5:03 Alex Vong
  2016-02-24 11:33 ` Ricardo Wurmus
  0 siblings, 1 reply; 18+ messages in thread
From: Alex Vong @ 2016-02-24  5:03 UTC (permalink / raw)
  To: guix-devel

[-- Attachment #1: Type: text/plain, Size: 904 bytes --]

Hi everyone,

This patch adds clojure to guix. I have been interested in clojure's
syntax for vector [] and hash-map {} for a while, after watching the
introduction of clojure to lisper video. So, I decide to package it for
guix! Note that I follow the example in ldc and download tarballs needed
to run the tests. I have also used pandoc to build markdown files to
html.


Things I want to do but don't know if I should:

Should I add old version of clojure as well? Also, I have tried further
compile the jar to native executable using gcj. I think it works
although offically gcj supports up to java 1.5 while clojure is written
using java 1.6. The native executable takes 0.5s to 0.6s to start while
  time java -cp "$HOME/.guix-profile/share/java/clojure-1.8.0.jar" \    
            clojure.main --help'
takes 1 to 1.2 s to start on my laptop. Should we provide clojure-gcj
package?

Cheers,
Alex


[-- Attachment #2: 0001-gnu-Add-clojure.patch --]
[-- Type: text/x-diff, Size: 10620 bytes --]

From 4afe3af6cbc36956a6c9c16d76b52499ffc4a8c2 Mon Sep 17 00:00:00 2001
From: Alex Vong <alexvong1995@gmail.com>
Date: Wed, 24 Feb 2016 12:43:36 +0800
Subject: [PATCH] gnu: Add clojure.

* gnu/packages/java.scm (clojure): New variable.
---
 gnu/packages/java.scm | 202 ++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 202 insertions(+)

diff --git a/gnu/packages/java.scm b/gnu/packages/java.scm
index ee987fc..367e392 100644
--- a/gnu/packages/java.scm
+++ b/gnu/packages/java.scm
@@ -1,6 +1,7 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2015 Ricardo Wurmus <rekado@elephly.net>
 ;;; Copyright © 2016 Leo Famulari <leo@famulari.name>
+;;; Copyright © 2016 Alex Vong <alexvong1995@gmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -39,6 +40,7 @@
   #:use-module (gnu packages ghostscript) ;lcms
   #:use-module (gnu packages gnome)
   #:use-module (gnu packages gtk)
+  #:use-module (gnu packages haskell)
   #:use-module (gnu packages image)
   #:use-module (gnu packages linux) ;alsa
   #:use-module (gnu packages wget)
@@ -133,6 +135,206 @@ is implemented.")
               license:mpl2.0
               license:lgpl2.1+))))
 
+(define-public clojure-1.8
+  (package
+    (name "clojure")
+    (version "1.8.0")
+    (source
+     (origin
+       (method url-fetch)
+       (uri
+        (string-append "http://repo1.maven.org/maven2/org/clojure/clojure/"
+                       version "/clojure-" version ".zip"))
+       (sha256
+        (base32 "1nip095fz5c492sw15skril60i1vd21ibg6szin4jcvyy3xr6cym"))))
+    (build-system gnu-build-system)
+    (arguments
+     `(#:modules
+       ((guix build gnu-build-system)
+        (guix build utils)
+        (ice-9 ftw)
+        (ice-9 regex)
+        (srfi srfi-1)
+        (srfi srfi-26))
+       #:phases
+       (modify-phases %standard-phases
+         (delete 'configure)
+         (replace 'unpack
+           (lambda _
+             (and (mkdir "clojure/")
+                  (zero? (system* "unzip"
+                                  "-d" "clojure/"
+                                  (assoc-ref %build-inputs "source")))
+                  (chdir "clojure/"))))
+         (add-after 'unpack 'remove-jar
+           ;; Remove the distributed jar binaries.
+           (lambda _
+             (for-each delete-file
+                       (find-files "./" ".*\\.jar"))
+             #t))
+         (add-after 'remove-jar 'unpack-submodule-sources
+           (lambda* (#:key inputs #:allow-other-keys)
+             (let ((unpack
+                    (lambda (src-name)
+                      (and (mkdir src-name)
+                           (with-directory-excursion src-name
+                             (zero? (system* "tar"
+                                             "zxvf"
+                                             (assoc-ref inputs src-name)
+                                             "--strip-components=1"))))))
+                   (copy (lambda (src-name)
+                           (copy-recursively
+                            (string-append src-name "/src/main/clojure/")
+                            (string-append "clojure-" ,version "/src/clj/")))))
+               (every (lambda (src)
+                        (begin (unpack src)
+                               (copy src)))
+                      '("data-generators-src" "java-classpath-src"
+                        "test-check-src" "test-generative-src"
+                        "tools-namespace-src" "tools-reader-src")))))
+         (replace 'build
+           (lambda* (#:key inputs outputs #:allow-other-keys)
+             (setenv "JAVA_HOME" (assoc-ref inputs "jdk"))
+             (chdir (string-append "clojure-" ,version))
+             (zero? (system* "ant" "jar"))))
+         (add-after 'build 'build-doc
+           (lambda* (#:key inputs outputs #:allow-other-keys)
+             (let* ((markdown-ext-regex "(.*)\\.(md|markdown|txt)")
+                    (markdown->html (lambda (src-name)
+                                      (zero? (system*
+                                              "pandoc"
+                                              "-o" (regexp-substitute/global
+                                                    #f
+                                                    markdown-ext-regex
+                                                    src-name
+                                                    1 ".html")
+                                              "-f" "markdown_github"
+                                              "-t" "html"
+                                              src-name)))))
+               (every markdown->html (find-files "./" markdown-ext-regex)))))
+         (replace 'check
+           (lambda* (#:key inputs outputs #:allow-other-keys)
+             (setenv "JAVA_HOME" (assoc-ref inputs "jdk"))
+             (zero? (system* "ant" "test"))))
+         (replace 'install
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let ((java-dir (string-append (assoc-ref outputs "out")
+                                            "/share/java/")))
+               ;; Do not install clojure.jar to avoid collisions.
+               (install-file (string-append "clojure-" ,version ".jar")
+                             java-dir)
+               #t)))
+         (add-after 'install 'install-doc
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let ((doc-dir (string-append (assoc-ref outputs "out")
+                                           "/share/doc/clojure/"))
+                   (copy-file-to-dir (lambda (file dir)
+                                       (copy-file file (string-append dir
+                                                                      file)))))
+               (for-each delete-file
+                         (find-files "doc/clojure/" ".*\\.(md|markdown|txt)"))
+               (copy-recursively "doc/clojure/" doc-dir)
+               (for-each (cut copy-file-to-dir <> doc-dir)
+                         (filter (cut string-match ".*\\.(html|txt)" <>)
+                                 (scandir "./")))
+               #t))))))
+    (native-inputs
+     `(("ant" ,ant)
+       ("ghc-pandoc" ,ghc-pandoc)
+       ("jdk" ,icedtea "jdk")
+       ("unzip" ,unzip)
+       ("data-generators-src"
+        ;; The native-inputs below are needed to run the tests.
+        ,(let ((version "0.1.2"))
+           (origin
+             (method url-fetch)
+             (uri (string-append
+                   "https://github.com"
+                   "/clojure/data.generators/archive/data.generators-"
+                   version ".tar.gz"))
+             (sha256
+              (base32
+               "0kki093jp4ckwxzfnw8ylflrfqs8b1i1wi9iapmwcsy328dmgzp1")))))
+       ("java-classpath-src"
+        ,(let ((version "0.2.3"))
+           (origin
+             (method url-fetch)
+             (uri
+              (string-append "https://github.com"
+                             "/clojure/java.classpath/archive/java.classpath-"
+                             version ".tar.gz"))
+             (sha256
+              (base32
+               "0sjymly9xh1lkvwn5ygygpsfwz4dabblnlq0c9bx76rkvq62fyng")))))
+       ("test-check-src"
+        ,(let ((version "0.9.0"))
+           (origin
+             (method url-fetch)
+             (uri
+              (string-append "https://github.com"
+                             "/clojure/test.check/archive/test.check-"
+                             version ".tar.gz"))
+             (sha256
+              (base32
+               "0p0mnyhr442bzkz0s4k5ra3i6l5lc7kp6ajaqkkyh4c2k5yck1md")))))
+       ("test-generative-src"
+        ,(let ((version "0.5.2"))
+           (origin
+             (method url-fetch)
+             (uri (string-append
+                   "https://github.com"
+                   "/clojure/test.generative/archive/test.generative-"
+                   version ".tar.gz"))
+             (sha256
+              (base32
+               "1pjafy1i7yblc7ixmcpfq1lfbyf3jaljvkgrajn70sws9xs7a9f8")))))
+       ("tools-namespace-src"
+        ,(let ((version "0.2.11"))
+           (origin
+             (method url-fetch)
+             (uri (string-append
+                   "https://github.com"
+                   "/clojure/tools.namespace/archive/tools.namespace-"
+                   version ".tar.gz"))
+             (sha256
+              (base32
+               "10baak8v0hnwz2hr33bavshm7y49mmn9zsyyms1dwjz45p5ymhy0")))))
+       ("tools-reader-src"
+        ,(let ((version "0.10.0"))
+           (origin
+             (method url-fetch)
+             (uri
+              (string-append "https://github.com"
+                             "/clojure/tools.reader/archive/tools.reader-"
+                             version ".tar.gz"))
+             (sha256
+              (base32
+               "09i3lzbhr608h76mhdjm3932gg9xi8sflscla3c5f0v1nkc28cnr")))))))
+    (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 under APL2.0
+    ;;
+    ;; See readme.html or readme.txt for details.
+    (license (list license:epl1.0
+                   license:bsd-3
+                   license:asl2.0))))
+
 (define-public ant
   (package
     (name "ant")
-- 
2.6.3


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* Re: [PATCH] gnu: Add clojure.
  2016-02-24  5:03 Alex Vong
@ 2016-02-24 11:33 ` Ricardo Wurmus
  2016-02-24 15:45   ` Alex Vong
  0 siblings, 1 reply; 18+ messages in thread
From: Ricardo Wurmus @ 2016-02-24 11:33 UTC (permalink / raw)
  To: Alex Vong; +Cc: guix-devel


Alex Vong <alexvong1995@gmail.com> writes:

> Hi everyone,
>
> This patch adds clojure to guix. I have been interested in clojure's
> syntax for vector [] and hash-map {} for a while, after watching the
> introduction of clojure to lisper video. So, I decide to package it for
> guix! Note that I follow the example in ldc and download tarballs needed
> to run the tests. I have also used pandoc to build markdown files to
> html.

That’s great!  I thought it would take a lot more work.  Have you made
sure that we’re actually building clojure *including* all dependent
libraries from source without having to rely on bundled jar archives?

~~ Ricardo

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH] gnu: Add clojure.
  2016-02-24 11:33 ` Ricardo Wurmus
@ 2016-02-24 15:45   ` Alex Vong
  0 siblings, 0 replies; 18+ messages in thread
From: Alex Vong @ 2016-02-24 15:45 UTC (permalink / raw)
  To: Ricardo Wurmus; +Cc: guix-devel

Ricardo Wurmus <ricardo.wurmus@mdc-berlin.de> writes:

> Alex Vong <alexvong1995@gmail.com> writes:
>
>> Hi everyone,
>>
>> This patch adds clojure to guix. I have been interested in clojure's
>> syntax for vector [] and hash-map {} for a while, after watching the
>> introduction of clojure to lisper video. So, I decide to package it for
>> guix! Note that I follow the example in ldc and download tarballs needed
>> to run the tests. I have also used pandoc to build markdown files to
>> html.
>
> That’s great!  I thought it would take a lot more work.  Have you made
> sure that we’re actually building clojure *including* all dependent
> libraries from source without having to rely on bundled jar archives?
>
Yes, I think running `ant jar' also triggers `ant clean', which looks like this:

  <target name="clean"
          description="Remove autogenerated files and directories.">
    <delete dir="${target}"/>
    <delete verbose="true">
      <fileset dir="${basedir}" includes="*.jar"/>
      <fileset dir="${basedir}" includes="*.zip"/>
    </delete>
  </target>

To be safe, we also have the 'remove-jar phase, which removes all jar
files recursively. 

However, looking at the debian package
<https://packages.debian.org/sid/clojure1.6>, clojure does contains
bundled dependencies. Should we package them seperately?

Also, looking at the debian copyright file
<http://metadata.ftp-master.debian.org/changelogs/main/c/clojure1.6/clojure1.6_1.6.0+dfsg-1_copyright>,
it seems there is 1 file licenses under CPL1.0 which is unmentioned in
the README. Are EPL and CPL compatible?

> ~~ Ricardo

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [PATCH] gnu: Add clojure.
@ 2016-02-24 20:46 Federico Beffa
  2016-02-26 11:56 ` Alex Vong
  0 siblings, 1 reply; 18+ messages in thread
From: Federico Beffa @ 2016-02-24 20:46 UTC (permalink / raw)
  To: alexvong1995; +Cc: Guix-devel

Alex Vong <alexvong1995@gmail.com> writes:

> +       #:phases
> +       (modify-phases %standard-phases
> +         (delete 'configure)
> +         (replace 'unpack
> +           (lambda _
> +             (and (mkdir "clojure/")
> +                  (zero? (system* "unzip"
> +                                  "-d" "clojure/"
> +                                  (assoc-ref %build-inputs "source")))
> +                  (chdir "clojure/"))))

The return value of 'mkdir' and 'chdir' is unspecified.  Therefore it
should not be used.

> +         (add-after 'remove-jar 'unpack-submodule-sources
> +           (lambda* (#:key inputs #:allow-other-keys)
> +             (let ((unpack
> +                    (lambda (src-name)
> +                      (and (mkdir src-name)
> +                           (with-directory-excursion src-name
> +                             (zero? (system* "tar"
> +                                             "zxvf"
> +                                             (assoc-ref inputs src-name)
> +                                             "--strip-components=1"))))))
> +                   (copy (lambda (src-name)
> +                           (copy-recursively
> +                            (string-append src-name "/src/main/clojure/")
> +                            (string-append "clojure-" ,version "/src/clj/")))))
> +               (every (lambda (src)
> +                        (begin (unpack src)
> +                               (copy src)))
> +                      '("data-generators-src" "java-classpath-src"
> +                        "test-check-src" "test-generative-src"
> +                        "tools-namespace-src" "tools-reader-src")))))

Same.

Regards,
Fede

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH] gnu: Add clojure.
  2016-02-24 20:46 Federico Beffa
@ 2016-02-26 11:56 ` Alex Vong
  2016-02-27  8:27   ` Federico Beffa
  2016-02-27 11:51   ` Ricardo Wurmus
  0 siblings, 2 replies; 18+ messages in thread
From: Alex Vong @ 2016-02-26 11:56 UTC (permalink / raw)
  To: Federico Beffa; +Cc: Guix-devel

[-- Attachment #1: Type: text/plain, Size: 1947 bytes --]

Federico Beffa <beffa@ieee.org> writes:

> Alex Vong <alexvong1995@gmail.com> writes:
>
>> +       #:phases
>> +       (modify-phases %standard-phases
>> +         (delete 'configure)
>> +         (replace 'unpack
>> +           (lambda _
>> +             (and (mkdir "clojure/")
>> +                  (zero? (system* "unzip"
>> +                                  "-d" "clojure/"
>> +                                  (assoc-ref %build-inputs "source")))
>> +                  (chdir "clojure/"))))
>
> The return value of 'mkdir' and 'chdir' is unspecified.  Therefore it
> should not be used.
>
>> +         (add-after 'remove-jar 'unpack-submodule-sources
>> +           (lambda* (#:key inputs #:allow-other-keys)
>> +             (let ((unpack
>> +                    (lambda (src-name)
>> +                      (and (mkdir src-name)
>> +                           (with-directory-excursion src-name
>> +                             (zero? (system* "tar"
>> +                                             "zxvf"
>> +                                             (assoc-ref inputs src-name)
>> +                                             "--strip-components=1"))))))
>> +                   (copy (lambda (src-name)
>> +                           (copy-recursively
>> +                            (string-append src-name "/src/main/clojure/")
>> + (string-append "clojure-" ,version "/src/clj/")))))
>> +               (every (lambda (src)
>> +                        (begin (unpack src)
>> +                               (copy src)))
>> +                      '("data-generators-src" "java-classpath-src"
>> +                        "test-check-src" "test-generative-src"
>> +                        "tools-namespace-src" "tools-reader-src")))))
>
> Same.
>

Fixed!

In addition, I've made some minor changes, including adding CPL1.0 to
the license list and removing zip archives in the 'remove-binaries phase
and so on...

> Regards,
> Fede

[-- Attachment #2: 0001-gnu-Add-clojure.patch --]
[-- Type: text/x-diff, Size: 11019 bytes --]

From d6eba1769e1ba493ede5f9fc5f2b2e0b965086c6 Mon Sep 17 00:00:00 2001
From: Alex Vong <alexvong1995@gmail.com>
Date: Wed, 24 Feb 2016 12:43:36 +0800
Subject: [PATCH] gnu: Add clojure.

* gnu/packages/java.scm (clojure): New variable.
---
 gnu/packages/java.scm | 207 ++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 207 insertions(+)

diff --git a/gnu/packages/java.scm b/gnu/packages/java.scm
index ee987fc..30ff27e 100644
--- a/gnu/packages/java.scm
+++ b/gnu/packages/java.scm
@@ -1,6 +1,7 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2015 Ricardo Wurmus <rekado@elephly.net>
 ;;; Copyright © 2016 Leo Famulari <leo@famulari.name>
+;;; Copyright © 2016 Alex Vong <alexvong1995@gmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -39,6 +40,7 @@
   #:use-module (gnu packages ghostscript) ;lcms
   #:use-module (gnu packages gnome)
   #:use-module (gnu packages gtk)
+  #:use-module (gnu packages haskell)
   #:use-module (gnu packages image)
   #:use-module (gnu packages linux) ;alsa
   #:use-module (gnu packages wget)
@@ -133,6 +135,211 @@ is implemented.")
               license:mpl2.0
               license:lgpl2.1+))))
 
+(define-public clojure-1.8
+  (package
+    (name "clojure")
+    (version "1.8.0")
+    (source
+     (origin
+       (method url-fetch)
+       (uri
+        (string-append "http://repo1.maven.org/maven2/org/clojure/clojure/"
+                       version "/clojure-" version ".zip"))
+       (sha256
+        (base32 "1nip095fz5c492sw15skril60i1vd21ibg6szin4jcvyy3xr6cym"))))
+    (build-system gnu-build-system)
+    (arguments
+     `(#:modules
+       ((guix build gnu-build-system)
+        (guix build utils)
+        (ice-9 ftw)
+        (ice-9 regex)
+        (srfi srfi-1)
+        (srfi srfi-26))
+       #:phases
+       (modify-phases %standard-phases
+         (delete 'configure)
+         (replace 'unpack
+           (lambda _
+             (zero? (system* "unzip"
+                             (assoc-ref %build-inputs "source")))))
+         (add-after 'unpack 'remove-binaries
+           ;; Remove any jar or zip archives.
+           (lambda _
+             (for-each delete-file
+                       (find-files "./" ".*\\.(jar|zip)"))
+             #t))
+         (add-after 'remove-binaries 'unpack-submodule-sources
+           (lambda* (#:key inputs #:allow-other-keys)
+             (let ((unpack
+                    (lambda (src-name)
+                      (and (mkdir-p src-name)
+                           (with-directory-excursion src-name
+                             (zero? (system* "tar"
+                                             "zxvf"
+                                             (assoc-ref inputs src-name)
+                                             "--strip-components=1"))))))
+                   (copy (lambda (src-name)
+                           (copy-recursively
+                            (string-append src-name "/src/main/clojure/")
+                            (string-append "clojure-" ,version "/src/clj/")))))
+               (every (lambda (src)
+                        (begin (unpack src)
+                               (copy src)))
+                      '("data-generators-src" "java-classpath-src"
+                        "test-check-src" "test-generative-src"
+                        "tools-namespace-src" "tools-reader-src")))))
+         (replace 'build
+           (lambda* (#:key inputs outputs #:allow-other-keys)
+             (setenv "JAVA_HOME" (assoc-ref inputs "jdk"))
+             (with-directory-excursion (string-append "clojure-" ,version)
+               (zero? (system* "ant" "jar")))))
+         (add-after 'build 'build-doc
+           (lambda* (#:key inputs outputs #:allow-other-keys)
+             (let* ((markdown-ext-regex "(.*)\\.(md|markdown|txt)")
+                    (markdown->html (lambda (src-name)
+                                      (zero? (system*
+                                              "pandoc"
+                                              "-o" (regexp-substitute/global
+                                                    #f
+                                                    markdown-ext-regex
+                                                    src-name
+                                                    1 ".html")
+                                              "-f" "markdown_github"
+                                              "-t" "html"
+                                              src-name)))))
+               (with-directory-excursion (string-append "clojure-" ,version)
+                 (every markdown->html
+                        (find-files "./" markdown-ext-regex))))))
+         (replace 'check
+           (lambda* (#:key inputs outputs #:allow-other-keys)
+             (with-directory-excursion (string-append "clojure-" ,version)
+               (setenv "JAVA_HOME" (assoc-ref inputs "jdk"))
+               (zero? (system* "ant" "test")))))
+         (replace 'install
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let ((java-dir (string-append (assoc-ref outputs "out")
+                                            "/share/java/")))
+               (with-directory-excursion (string-append "clojure-" ,version)
+                 ;; Do not install clojure.jar to avoid collisions.
+                 (install-file (string-append "clojure-" ,version ".jar")
+                               java-dir)
+                 #t))))
+         (add-after 'install 'install-doc
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let ((doc-dir (string-append (assoc-ref outputs "out")
+                                           "/share/doc/clojure/"))
+                   (copy-file-to-dir (lambda (file dir)
+                                       (copy-file file (string-append dir
+                                                                      file)))))
+               (with-directory-excursion (string-append "clojure-" ,version)
+                 (for-each delete-file
+                           (find-files "doc/clojure/"
+                                       ".*\\.(md|markdown|txt)"))
+                 (copy-recursively "doc/clojure/" doc-dir)
+                 (for-each (cut copy-file-to-dir <> doc-dir)
+                           (filter (cut string-match ".*\\.(html|txt)" <>)
+                                   (scandir "./")))
+                 #t)))))))
+    (native-inputs
+     `(("ant" ,ant)
+       ("ghc-pandoc" ,ghc-pandoc)
+       ("jdk" ,icedtea "jdk")
+       ("unzip" ,unzip)
+       ("data-generators-src"
+        ;; The native-inputs below are needed to run the tests.
+        ,(let ((version "0.1.2"))
+           (origin
+             (method url-fetch)
+             (uri (string-append
+                   "https://github.com"
+                   "/clojure/data.generators/archive/data.generators-"
+                   version ".tar.gz"))
+             (sha256
+              (base32
+               "0kki093jp4ckwxzfnw8ylflrfqs8b1i1wi9iapmwcsy328dmgzp1")))))
+       ("java-classpath-src"
+        ,(let ((version "0.2.3"))
+           (origin
+             (method url-fetch)
+             (uri
+              (string-append "https://github.com"
+                             "/clojure/java.classpath/archive/java.classpath-"
+                             version ".tar.gz"))
+             (sha256
+              (base32
+               "0sjymly9xh1lkvwn5ygygpsfwz4dabblnlq0c9bx76rkvq62fyng")))))
+       ("test-check-src"
+        ,(let ((version "0.9.0"))
+           (origin
+             (method url-fetch)
+             (uri
+              (string-append "https://github.com"
+                             "/clojure/test.check/archive/test.check-"
+                             version ".tar.gz"))
+             (sha256
+              (base32
+               "0p0mnyhr442bzkz0s4k5ra3i6l5lc7kp6ajaqkkyh4c2k5yck1md")))))
+       ("test-generative-src"
+        ,(let ((version "0.5.2"))
+           (origin
+             (method url-fetch)
+             (uri (string-append
+                   "https://github.com"
+                   "/clojure/test.generative/archive/test.generative-"
+                   version ".tar.gz"))
+             (sha256
+              (base32
+               "1pjafy1i7yblc7ixmcpfq1lfbyf3jaljvkgrajn70sws9xs7a9f8")))))
+       ("tools-namespace-src"
+        ,(let ((version "0.2.11"))
+           (origin
+             (method url-fetch)
+             (uri (string-append
+                   "https://github.com"
+                   "/clojure/tools.namespace/archive/tools.namespace-"
+                   version ".tar.gz"))
+             (sha256
+              (base32
+               "10baak8v0hnwz2hr33bavshm7y49mmn9zsyyms1dwjz45p5ymhy0")))))
+       ("tools-reader-src"
+        ,(let ((version "0.10.0"))
+           (origin
+             (method url-fetch)
+             (uri
+              (string-append "https://github.com"
+                             "/clojure/tools.reader/archive/tools.reader-"
+                             version ".tar.gz"))
+             (sha256
+              (base32
+               "09i3lzbhr608h76mhdjm3932gg9xi8sflscla3c5f0v1nkc28cnr")))))))
+    (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 under APL2.0
+    ;; src/clj/repl.clj is licensed under 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 ant
   (package
     (name "ant")
-- 
2.6.3


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* Re: [PATCH] gnu: Add clojure.
  2016-02-26 11:56 ` Alex Vong
@ 2016-02-27  8:27   ` Federico Beffa
  2016-02-27 11:51   ` Ricardo Wurmus
  1 sibling, 0 replies; 18+ messages in thread
From: Federico Beffa @ 2016-02-27  8:27 UTC (permalink / raw)
  To: Alex Vong; +Cc: Guix-devel

Alex Vong <alexvong1995@gmail.com> writes:

> +               (every (lambda (src)
> +                        (begin (unpack src)
> +                               (copy src)))
> +                      '("data-generators-src" "java-classpath-src"
> +                        "test-check-src" "test-generative-src"
> +                        "tools-namespace-src" "tools-reader-src")))))

I missed another small detail:

'begin' in the body of 'lambda' is implicit. You don't need to add it
explicitly.

Looking forward to play with it.
Regards,
Fede

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH] gnu: Add clojure.
  2016-02-26 11:56 ` Alex Vong
  2016-02-27  8:27   ` Federico Beffa
@ 2016-02-27 11:51   ` Ricardo Wurmus
  1 sibling, 0 replies; 18+ messages in thread
From: Ricardo Wurmus @ 2016-02-27 11:51 UTC (permalink / raw)
  To: Alex Vong; +Cc: Guix-devel, Federico Beffa


Alex Vong <alexvong1995@gmail.com> writes:

> Federico Beffa <beffa@ieee.org> writes:
>
>> Alex Vong <alexvong1995@gmail.com> writes:
>>
>>> +       #:phases
>>> +       (modify-phases %standard-phases
>>> +         (delete 'configure)
>>> +         (replace 'unpack
>>> +           (lambda _
>>> +             (and (mkdir "clojure/")
>>> +                  (zero? (system* "unzip"
>>> +                                  "-d" "clojure/"
>>> +                                  (assoc-ref %build-inputs "source")))
>>> +                  (chdir "clojure/"))))
>>
>> The return value of 'mkdir' and 'chdir' is unspecified.  Therefore it
>> should not be used.
>>
>>> +         (add-after 'remove-jar 'unpack-submodule-sources
>>> +           (lambda* (#:key inputs #:allow-other-keys)
>>> +             (let ((unpack
>>> +                    (lambda (src-name)
>>> +                      (and (mkdir src-name)
>>> +                           (with-directory-excursion src-name
>>> +                             (zero? (system* "tar"
>>> +                                             "zxvf"
>>> +                                             (assoc-ref inputs src-name)
>>> +                                             "--strip-components=1"))))))
>>> +                   (copy (lambda (src-name)
>>> +                           (copy-recursively
>>> +                            (string-append src-name "/src/main/clojure/")
>>> + (string-append "clojure-" ,version "/src/clj/")))))
>>> +               (every (lambda (src)
>>> +                        (begin (unpack src)
>>> +                               (copy src)))
>>> +                      '("data-generators-src" "java-classpath-src"
>>> +                        "test-check-src" "test-generative-src"
>>> +                        "tools-namespace-src" "tools-reader-src")))))
>>
>> Same.
>>
>
> Fixed!
>
> In addition, I've made some minor changes, including adding CPL1.0 to
> the license list and removing zip archives in the 'remove-binaries phase
> and so on...

Actually, I think it would be better to remove the archives in a snippet
instead of doing this in a build phase.  For the additional origins
snippets may also be used to remove binaries (if necessary).

(It looks like this could be simplified with the “ant-build-system”,
which is almost ready.  This is not a blocker, of course — I just want
to warn you that I might submit patches to change your clojure recipe
once the “ant-build-system” is merged.)

~~ Ricardo

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [PATCH] gnu: Add clojure.
@ 2016-07-06 12:54 Alex Vong
  2016-07-13 15:49 ` Ricardo Wurmus
  0 siblings, 1 reply; 18+ messages in thread
From: Alex Vong @ 2016-07-06 12:54 UTC (permalink / raw)
  To: guix-devel

[-- Attachment #1: Type: text/plain, Size: 1493 bytes --]

Hi guix,

This patch adds clojure 1.6 to 1.8.


Changes made since last email (comments appreciated):

Include clojure from 1.6 to 1.8 instead of just 1.8 because I think we
should provide all stable versions and allowed them to be
co-installed. From https://clojure.github.io/clojure/, version 1.6 to
1.8 is considered stable.

Use ant build system, this save a lot of typing, thanks Ricardo for
writing it!

Provide a native executable. It is a bit of a hack. First, the clojure
jar is compiled with gcj. Then a c++ wrapper is compiled. Finally, they
are linked together. The native executable takes half the time to start
than loading the jar using java.


There is a slight problem when inheriting package. Let's say in one of
the build phases of package A, I want to eval this expression:
  (compile-jar (string-append "clojure-" ,version ".jar"))

Then I define package B which is inherited from package A, like this:
  (define-public B
    (package
      (inherit A)
      (version "2")
      ...
      ))

Now the build phases of package B still refer to the old version of
package A, in other words, the version being substitute into the build
phases is not being inherited. Any idea on how to fix this? Right now, I
resort to adding the following build phase:
  (add-after 'unpack-submodule-sources 'set-clojure-version
    (lambda _
      (setenv "CLOJURE_VERSION" ,version)))

and replace the build phase in the inherited package. But this looks a
bit ugly to me.


Thanks.
Alex



[-- Attachment #2: 0001-gnu-Add-clojure.patch --]
[-- Type: text/x-diff, Size: 36035 bytes --]

From 5b275a8ac0209316b89a3c35f6c76740b0ba245f Mon Sep 17 00:00:00 2001
From: Alex Vong <alexvong1995@gmail.com>
Date: Tue, 5 Jul 2016 16:24:20 +0800
Subject: [PATCH] gnu: Add clojure.

* gnu/packages/java.scm
(remove-archives, clojure-1.6, clojure-1.7, clojure-1.8): New variables.
* gnu/packages/patches/clojure-native-executable.patch: New patch.
---
 gnu/packages/java.scm                              | 292 ++++++++++
 .../patches/clojure-native-executable.patch        | 621 +++++++++++++++++++++
 2 files changed, 913 insertions(+)
 create mode 100644 gnu/packages/patches/clojure-native-executable.patch

diff --git a/gnu/packages/java.scm b/gnu/packages/java.scm
index 753fb77..92c70a3 100644
--- a/gnu/packages/java.scm
+++ b/gnu/packages/java.scm
@@ -41,6 +41,7 @@
   #:use-module (gnu packages ghostscript) ;lcms
   #:use-module (gnu packages gnome)
   #:use-module (gnu packages gtk)
+  #:use-module (gnu packages haskell)
   #:use-module (gnu packages image)
   #:use-module (gnu packages linux) ;alsa
   #:use-module (gnu packages wget)
@@ -141,6 +142,297 @@ is implemented.")
               license:mpl2.0
               license:lgpl2.1+))))
 
+(define remove-archives
+  '(begin
+     (for-each delete-file
+               (find-files "./" ".*\\.(jar|zip)"))
+     #t))
+
+(define-public clojure-1.6
+  (let ((get-version '(getenv "CLOJURE_VERSION")))
+    (package
+      (name "clojure")
+      (version "1.6.0")
+      (source
+       (origin
+         (method url-fetch)
+         (uri
+          (string-append "http://repo1.maven.org/maven2/org/clojure/clojure/"
+                         version "/clojure-" version ".zip"))
+         (sha256
+          (base32 "0yv67gackrzlwn9f8cnpw14y2hwspklxhy1450rl71vdrqjahlwq"))
+         (modules '((guix build utils)))
+         (snippet remove-archives)
+         (patches (search-patches "clojure-native-executable.patch"))))
+      (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)
+               (let ((unpack
+                      (lambda (src-name)
+                        (and (mkdir-p src-name)
+                             (with-directory-excursion src-name
+                               (zero? (system* "tar"
+                                               ;; Use xz as src are repacked.
+                                               "--xz"
+                                               "--extract"
+                                               "--verbose"
+                                               "--file" (assoc-ref inputs
+                                                                   src-name)
+                                               "--strip-components=1"))))))
+                     (copy (lambda (src-name)
+                             (copy-recursively
+                              (string-append src-name "/src/main/clojure/")
+                              "src/clj/"))))
+                 (every (lambda (src)
+                          (unpack src)
+                          (copy src))
+                        '("data-generators-src" "java-classpath-src"
+                          "test-check-src" "test-generative-src"
+                          "tools-namespace-src" "tools-reader-src")))))
+           (add-after 'unpack-submodule-sources 'set-clojure-version
+             (lambda _
+               (setenv "CLOJURE_VERSION" ,version)))
+           (add-after 'build 'build-native
+             (lambda _
+               (let* ((compile-jar (lambda (src-name)
+                                     (zero? (system* "gcj"
+                                                     "-c" "-v" "-O1"
+                                                     "-findirect-dispatch"
+                                                     "-fbootstrap-classes"
+                                                     src-name))))
+                      (compile-cxx (lambda (src-name)
+                                     (zero?
+                                      (system* "g++"
+                                               "-c" "-v" "-O3"
+                                               "--std=gnu++14" "-pedantic"
+                                               "-Wall" "-Wextra" "-Werror"
+                                               src-name))))
+                      (link-o (lambda (target-name . object-names)
+                                (zero? (apply system*
+                                              `("gcj"
+                                                "-o" ,target-name
+                                                "-v"
+                                                "-Wl,--wrap,main"
+                                                ,@object-names
+                                                "-lstdc++" "-lgij"))))))
+                 (and (compile-jar (string-append "clojure-" ,get-version ".jar"))
+                      (compile-cxx "wrap.cxx")
+                      (link-o (string-append "clojure-" ,get-version)
+                              (string-append "clojure-" ,get-version ".o")
+                              "wrap.o")))))
+           (add-after 'build-native 'build-doc
+             (lambda _
+               (let* ((markdown-regex "(.*)\\.(md|markdown|txt)")
+                      (gsub regexp-substitute/global)
+                      (markdown->html (lambda (src-name)
+                                        (zero? (system*
+                                                "pandoc"
+                                                "--output" (gsub #f
+                                                                 markdown-regex
+                                                                 src-name
+                                                                 1 ".html")
+                                                "--verbose"
+                                                "--from" "markdown_github"
+                                                "--to" "html"
+                                                src-name)))))
+                 (every markdown->html
+                        (find-files "./" markdown-regex)))))
+           (replace 'install
+             (lambda* (#:key outputs #:allow-other-keys)
+               (let ((java-dir (string-append (assoc-ref outputs "out")
+                                              "/share/java/")))
+                 ;; Do not install clojure.jar to avoid collisions.
+                 (install-file (string-append "clojure-" ,get-version ".jar")
+                               java-dir)
+                 #t)))
+           (add-after 'install 'install-native
+             (lambda* (#:key outputs #:allow-other-keys)
+               (let ((bin-dir (string-append (assoc-ref outputs "out")
+                                             "/bin/")))
+                 (install-file (string-append "clojure-" ,get-version)
+                               bin-dir)
+                 #t)))
+           (add-after 'install-native 'install-doc
+             (lambda* (#:key outputs #:allow-other-keys)
+               (let ((doc-dir (string-append (assoc-ref outputs "out")
+                                             "/share/doc/clojure-"
+                                             ,get-version "/"))
+                     (copy-file-to-dir (lambda (file dir)
+                                         (copy-file file
+                                                    (string-append dir
+                                                                   file)))))
+                 (for-each delete-file
+                           (find-files "doc/clojure/"
+                                       ".*\\.(md|markdown|txt)"))
+                 (copy-recursively "doc/clojure/" doc-dir)
+                 (for-each (cut copy-file-to-dir <> doc-dir)
+                           (filter (cut string-match ".*\\.(html|txt)" <>)
+                                   (scandir "./")))
+                 #t))))))
+      (native-inputs
+       `(("gcj" ,gcj)
+         ("ghc-pandoc" ,ghc-pandoc)
+         ("zlib" ,zlib)
+         ;; The native-inputs below are needed to run the tests.
+         ("data-generators-src"
+          ,(let ((version "0.1.2"))
+             (origin
+               (method url-fetch)
+               (uri (string-append "https://github.com/clojure"
+                                   "/data.generators/archive/data.generators-"
+                                   version ".tar.gz"))
+               (sha256
+                (base32
+                 "0kki093jp4ckwxzfnw8ylflrfqs8b1i1wi9iapmwcsy328dmgzp1"))
+               (modules '((guix build utils)
+                          (ice-9 ftw)))
+               (snippet remove-archives))))
+         ("java-classpath-src"
+          ,(let ((version "0.2.3"))
+             (origin
+               (method url-fetch)
+               (uri
+                (string-append "https://github.com/clojure"
+                               "/java.classpath/archive/java.classpath-"
+                               version ".tar.gz"))
+               (sha256
+                (base32
+                 "0sjymly9xh1lkvwn5ygygpsfwz4dabblnlq0c9bx76rkvq62fyng"))
+               (modules '((guix build utils)))
+               (snippet remove-archives))))
+         ("test-check-src"
+          ,(let ((version "0.9.0"))
+             (origin
+               (method url-fetch)
+               (uri
+                (string-append "https://github.com/clojure"
+                               "/test.check/archive/test.check-"
+                               version ".tar.gz"))
+               (sha256
+                (base32
+                 "0p0mnyhr442bzkz0s4k5ra3i6l5lc7kp6ajaqkkyh4c2k5yck1md"))
+               (modules '((guix build utils)))
+               (snippet remove-archives))))
+         ("test-generative-src"
+          ,(let ((version "0.5.2"))
+             (origin
+               (method url-fetch)
+               (uri (string-append "https://github.com/clojure"
+                                   "/test.generative/archive/test.generative-"
+                                   version ".tar.gz"))
+               (sha256
+                (base32
+                 "1pjafy1i7yblc7ixmcpfq1lfbyf3jaljvkgrajn70sws9xs7a9f8"))
+               (modules '((guix build utils)))
+               (snippet remove-archives))))
+         ("tools-namespace-src"
+          ,(let ((version "0.2.11"))
+             (origin
+               (method url-fetch)
+               (uri (string-append "https://github.com/clojure"
+                                   "/tools.namespace/archive/tools.namespace-"
+                                   version ".tar.gz"))
+               (sha256
+                (base32
+                 "10baak8v0hnwz2hr33bavshm7y49mmn9zsyyms1dwjz45p5ymhy0"))
+               (modules '((guix build utils)))
+               (snippet remove-archives))))
+         ("tools-reader-src"
+          ,(let ((version "0.10.0"))
+             (origin
+               (method url-fetch)
+               (uri
+                (string-append "https://github.com/clojure"
+                               "/tools.reader/archive/tools.reader-"
+                               version ".tar.gz"))
+               (sha256
+                (base32
+                 "09i3lzbhr608h76mhdjm3932gg9xi8sflscla3c5f0v1nkc28cnr"))
+               (modules '((guix build utils)))
+               (snippet remove-archives))))))
+      (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 under APL2.0
+      ;; src/clj/repl.clj is licensed under 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 clojure-1.7
+  (package
+    (inherit clojure-1.6)
+    (version "1.7.0")
+    (source
+     (origin
+       (method url-fetch)
+       (uri
+        (string-append "http://repo1.maven.org/maven2/org/clojure/clojure/"
+                       version "/clojure-" version ".zip"))
+       (sha256
+        (base32 "14yg0g6vpzxjwlvs5anq9jfz9zdbd3rsl6qsgxa6qxm19mwh7qsd"))
+       (modules '((guix build utils)))
+       (snippet remove-archives)
+       (patches (search-patches "clojure-native-executable.patch"))))
+    (arguments
+     `(,@(substitute-keyword-arguments (package-arguments clojure-1.6)
+           ((#:phases phases)
+            `(modify-phases ,phases
+               (replace 'set-clojure-version
+                 (lambda _
+                   (setenv "CLOJURE_VERSION" ,version))))))))))
+
+(define-public clojure-1.8
+  (package
+    (inherit clojure-1.6)
+    (version "1.8.0")
+    (source
+     (origin
+       (method url-fetch)
+       (uri
+        (string-append "http://repo1.maven.org/maven2/org/clojure/clojure/"
+                       version "/clojure-" version ".zip"))
+       (sha256
+        (base32 "1nip095fz5c492sw15skril60i1vd21ibg6szin4jcvyy3xr6cym"))
+       (modules '((guix build utils)))
+       (snippet remove-archives)
+       (patches (search-patches "clojure-native-executable.patch"))))
+    (arguments
+     `(,@(substitute-keyword-arguments (package-arguments clojure-1.6)
+           ((#:phases phases)
+            `(modify-phases ,phases
+               (replace 'set-clojure-version
+                 (lambda _
+                   (setenv "CLOJURE_VERSION" ,version))))))))))
+
 (define-public ant
   (package
     (name "ant")
diff --git a/gnu/packages/patches/clojure-native-executable.patch b/gnu/packages/patches/clojure-native-executable.patch
new file mode 100644
index 0000000..9503ca0
--- /dev/null
+++ b/gnu/packages/patches/clojure-native-executable.patch
@@ -0,0 +1,621 @@
+From b17453777a81e605134bbc80dd19fd6e756aeed6 Mon Sep 17 00:00:00 2001
+From: Alex Vong <alexvong1995@gmail.com>
+Date: Sat, 25 Jun 2016 01:39:53 +0800
+Subject: [PATCH] clojure: native executable
+
+This patch wraps the main function generated by gcj to allow clojure to
+be compiled as native executable. The executable should take half the
+time to start, when compared to loading the clojure jar with java.
+---
+ args.hxx   |  60 +++++++++++++++++++++++++++++++
+ base.hxx   | 116 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ macro.hxx  |  35 ++++++++++++++++++
+ param.hxx  |  49 +++++++++++++++++++++++++
+ string.hxx |  58 ++++++++++++++++++++++++++++++
+ sys.hxx    | 118 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ wrap.cxx   | 115 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ 7 files changed, 551 insertions(+)
+ create mode 100644 args.hxx
+ create mode 100644 base.hxx
+ create mode 100644 macro.hxx
+ create mode 100644 param.hxx
+ create mode 100644 string.hxx
+ create mode 100644 sys.hxx
+ create mode 100644 wrap.cxx
+
+diff --git a/args.hxx b/args.hxx
+new file mode 100644
+index 0000000..8fb421f
+--- /dev/null
++++ b/args.hxx
+@@ -0,0 +1,60 @@
++/* Struct for managing argument list
++   Copyright 2016 Alex Vong
++
++   Licensed under the Apache License, Version 2.0 (the "License");
++   you may not use this file except in compliance with the License.
++   You may obtain a copy of the License at
++
++   http://www.apache.org/licenses/LICENSE-2.0
++
++   Unless required by applicable law or agreed to in writing, software
++   distributed under the License is distributed on an "AS IS" BASIS,
++   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
++   See the License for the specific language governing permissions and
++   limitations under the License.  */
++
++
++#pragma once
++
++#include <algorithm>
++#include <iterator>
++#include <string.h>
++#include "base.hxx"
++
++
++struct Args
++{ int argc = 0;
++  char** argv = nullptr;
++
++  Args() {}
++  template <typename A>
++  Args(A ls)
++  {
++    argc = length(ls);
++    argv = new char*[argc + 1];
++    std::transform(std::begin(ls), std::end(ls),
++                   argv,
++                   lambda((auto str), return strdup(str.c_str())));
++    argv[argc] = nullptr;
++  }
++  ~Args()
++  {
++    std::for_each(argv, argv + argc,
++                  lambda((auto str), free(str)));
++    delete[] argv;
++  }
++  Args(Args& args) = delete;
++  Args& operator=(Args& args) = delete;
++  Args(Args&& args) = delete;
++  Args& operator=(Args&& args)
++  {
++    std::for_each(argv, argv + argc,
++                  lambda((auto ptr), free(ptr)));
++    delete[] argv;
++    argc = args.argc;
++    argv = args.argv;
++    args.argc = 0;
++    args.argv = nullptr;
++    return *this;
++  }
++};
+diff --git a/base.hxx b/base.hxx
+new file mode 100644
+index 0000000..f7773bb
+--- /dev/null
++++ b/base.hxx
+@@ -0,0 +1,116 @@
++/* Basic utilities commonly found in scheme, with function composition operator
++   Copyright 2016 Alex Vong
++
++   Licensed under the Apache License, Version 2.0 (the "License");
++   you may not use this file except in compliance with the License.
++   You may obtain a copy of the License at
++
++   http://www.apache.org/licenses/LICENSE-2.0
++
++   Unless required by applicable law or agreed to in writing, software
++   distributed under the License is distributed on an "AS IS" BASIS,
++   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
++   See the License for the specific language governing permissions and
++   limitations under the License.  */
++
++
++#pragma once
++
++#include <iostream>
++#include <deque>
++#include <iterator>
++#include <numeric>
++#include <algorithm>
++#include <functional>
++#include "param.hxx"
++
++
++extern "C" int
++__real_main(int argc, char** argv);
++
++
++defun(display, (auto obj),
++      std::cout << obj);
++
++defun(display_error, (auto obj),
++      std::cerr << obj);
++
++defun(newline, (),
++      using namespace std::string_literals;
++      display("\n"s));
++
++template <typename B_to_C, typename A_to_B>
++defsubst(operator*, (B_to_C g, A_to_B f),
++         return lambda((auto x),
++                       return g(f(x))));
++
++defalias(cut, std::bind);
++
++defun(null_p, (auto ls),
++      return ls.empty());
++
++defun(car, (auto ls),
++      return ls[0]);
++
++defun(cdr, (auto ls),
++      ls.pop_front();
++      return ls);
++
++defun(drop, (auto ls, auto k),
++      ls.erase(std::begin(ls), std::begin(ls) + k);
++      return ls);
++
++defun(length, (auto ls),
++      return ls.size());
++
++defun(reverse, (auto ls),
++      std::reverse(std::begin(ls), std::end(ls));
++      return ls);
++
++defun(append, (auto ls1, auto... rest),
++      decltype(ls1) nil;
++      defun(append2, (auto ls1, auto ls2),
++            decltype(ls1) ls;
++            std::move(std::begin(ls2), std::end(ls2),
++                      std::back_inserter(ls1));
++            return ls1);
++      return param::fold_right(append2, nil, ls1, rest...));
++
++defun(fold, (auto proc, auto init, auto... ls),
++      using namespace std::placeholders;
++      auto ls2 = append(ls...);
++      return std::accumulate(std::begin(ls2), std::end(ls2),
++                             init,
++                             cut(proc, _2, _1)));
++
++defun(fold_right, (auto proc, auto init, auto... ls),
++      auto ls2 = append(ls...);
++      return fold(proc, init, reverse(ls2)));
++
++defun(concatenate, (auto ls_of_ls),
++      decltype(car(ls_of_ls)) nil;
++      return fold_right(append, nil, ls_of_ls));
++
++template <typename A_to_B, template <typename...> class List, typename A>
++defsubst(map, (A_to_B proc, List<A> ls),
++         List<decltype(proc(car(ls)))> ls2;
++         std::transform(std::begin(ls), std::end(ls),
++                        std::back_inserter(ls2),
++                        proc);
++         return ls2);
++
++defun(for_each, (auto proc, auto ls),
++      return std::for_each(std::begin(ls), std::end(ls), proc));
++
++defun(any, (auto pred, auto ls),
++      return std::any_of(std::begin(ls), std::end(ls), pred));
++
++template <typename A_to_Bool, template <typename...> class List, typename A>
++defsubst(partition, (A_to_Bool pred, List<A> ls),
++         List<A> ls1;
++         List<A> ls2;
++         std::partition_copy(std::begin(ls), std::end(ls),
++                             std::back_inserter(ls1),
++                             std::back_inserter(ls2),
++                             pred);
++         return List<List<A>>({ls1, ls2}));
+diff --git a/macro.hxx b/macro.hxx
+new file mode 100644
+index 0000000..deb3b36
+--- /dev/null
++++ b/macro.hxx
+@@ -0,0 +1,35 @@
++/* Macros for reassembling the syntax of various lisps
++   Copyright 2016 Alex Vong
++
++   Licensed under the Apache License, Version 2.0 (the "License");
++   you may not use this file except in compliance with the License.
++   You may obtain a copy of the License at
++
++   http://www.apache.org/licenses/LICENSE-2.0
++
++   Unless required by applicable law or agreed to in writing, software
++   distributed under the License is distributed on an "AS IS" BASIS,
++   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
++   See the License for the specific language governing permissions and
++   limitations under the License.  */
++
++
++#pragma once
++
++#define lambda(arg_ls, body)                    \
++  [=] arg_ls {body;}
++
++#define define(id, val)                         \
++  const auto id = val
++
++#define defun(id, arg_ls, body)                 \
++  constexpr define(id, lambda(arg_ls, body))
++
++#define defsubst(id, arg_ls, body)                      \
++  constexpr auto id arg_ls {body;} struct swallow
++
++#define defalias(id, fun)                               \
++  defun(id, (auto ...args), return fun(args...))
++
++#define ns(id, ...)                             \
++  namespace id {__VA_ARGS__;} struct swallow
+diff --git a/param.hxx b/param.hxx
+new file mode 100644
+index 0000000..9625016
+--- /dev/null
++++ b/param.hxx
+@@ -0,0 +1,49 @@
++/* Parameter pack (right-)folding over binary functions
++   Copyright 2016 Alex Vong
++
++   Licensed under the Apache License, Version 2.0 (the "License");
++   you may not use this file except in compliance with the License.
++   You may obtain a copy of the License at
++
++   http://www.apache.org/licenses/LICENSE-2.0
++
++   Unless required by applicable law or agreed to in writing, software
++   distributed under the License is distributed on an "AS IS" BASIS,
++   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
++   See the License for the specific language governing permissions and
++   limitations under the License.  */
++
++
++#pragma once
++
++#include "macro.hxx"
++
++
++ns(param,
++   ns(tmpl,
++      template <typename A_to_B_to_B, typename B>
++      defsubst(fold, (A_to_B_to_B proc, B init),
++               return init);
++      template <typename A_to_B_to_B, typename B, typename A>
++      defsubst(fold, (A_to_B_to_B proc, B init, A e),
++               return proc(e, init));
++      template <typename A_to_B_to_B, typename B, typename A, typename... As>
++      defsubst(fold, (A_to_B_to_B proc, B init, A e, As... es),
++               return fold(proc,
++                           proc(e,init),
++                           es...)));
++   defalias(fold, tmpl::fold);
++
++   ns(tmpl,
++      template <typename A_to_B_to_B, typename B>
++      defsubst(fold_right, (A_to_B_to_B proc, B init),
++               return init);
++      template <typename A_to_B_to_B, typename B, typename A>
++      defsubst(fold_right, (A_to_B_to_B proc, B init, A e),
++               return proc(e, init));
++      template <typename A_to_B_to_B, typename B, typename A, typename... As>
++      defsubst(fold_right, (A_to_B_to_B proc, B init, A e, As... es),
++               return proc(e, fold_right(proc,
++                                         init,
++                                         es...))));
++   defalias(fold_right, tmpl::fold_right));
+diff --git a/string.hxx b/string.hxx
+new file mode 100644
+index 0000000..36116dd
+--- /dev/null
++++ b/string.hxx
+@@ -0,0 +1,58 @@
++/* String utilities commonly found in scheme, with string append operator
++   Copyright 2016 Alex Vong
++
++   Licensed under the Apache License, Version 2.0 (the "License");
++   you may not use this file except in compliance with the License.
++   You may obtain a copy of the License at
++
++   http://www.apache.org/licenses/LICENSE-2.0
++
++   Unless required by applicable law or agreed to in writing, software
++   distributed under the License is distributed on an "AS IS" BASIS,
++   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
++   See the License for the specific language governing permissions and
++   limitations under the License.  */
++
++
++#pragma once
++
++#include <string>
++#include <sstream>
++#include "base.hxx"
++
++
++template <typename String>
++defsubst(operator*, (String str1, String str2),
++         str1.append(str2);
++         return str1);
++
++ns(string,
++   defun(length, (auto str),
++         return str.length());
++
++   defun(eq_p, (auto str1, auto str2),
++         return str1 == str2);
++
++   defun(eq_any_p, (auto str, auto str_ls),
++         using namespace std::placeholders;
++         return any(cut(eq_p, str, _1), str_ls));
++
++   defun(prefix_p, (auto prefix, auto str),
++         return !str.compare(0, length(prefix), prefix));
++
++   defun(drop, (auto str, auto n),
++         return str.erase(0, n));
++
++   template <typename A, typename String, typename Char>
++   defsubst(split, (String str, Char delim),
++            String tok;
++            std::istringstream sstream(str);
++            A accum;
++            while (std::getline(sstream, tok, delim)) accum.push_back(tok);
++            return accum);
++
++   defun(contains, (auto str1, auto str2),
++         return str1.find(str2));
++
++   defun(contains_p, (auto str1, auto str2),
++         return contains(str1, str2) != std::string::npos));
+diff --git a/sys.hxx b/sys.hxx
+new file mode 100644
+index 0000000..de698b5
+--- /dev/null
++++ b/sys.hxx
+@@ -0,0 +1,118 @@
++/* Structs for managing files desciptor and pipe, with utilities
++   Copyright 2016 Alex Vong
++
++   Licensed under the Apache License, Version 2.0 (the "License");
++   you may not use this file except in compliance with the License.
++   You may obtain a copy of the License at
++
++   http://www.apache.org/licenses/LICENSE-2.0
++
++   Unless required by applicable law or agreed to in writing, software
++   distributed under the License is distributed on an "AS IS" BASIS,
++   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
++   See the License for the specific language governing permissions and
++   limitations under the License.  */
++
++
++#pragma once
++
++#include <cerrno>
++#include <iostream>
++#include <fstream>
++#include <sstream>
++#include <string>
++#include <ext/stdio_filebuf.h>
++#include <algorithm>
++#include <system_error>
++#include <unistd.h>
++#include "base.hxx"
++
++
++ns(sys,
++   defun(error, (auto errnum, auto msg),
++         throw std::system_error(errnum,
++                                 std::system_category(),
++                                 msg)));
++
++
++namespace file_and_pipe
++{ using namespace std::string_literals;
++
++  struct File
++  { int fd = -1;
++
++    File() {}
++    File(int a_fd)
++    {
++      fd = a_fd;
++    }
++    ~File()
++    {
++      if (fd >= 0) close(fd);
++    }
++    File(File& file) = delete;
++    File& operator=(File& file) = delete;
++    File(File&& file)
++    {
++      fd = file.fd;
++      file.fd = -1;
++    }
++    File& operator=(File&& file)
++    {
++      fd = file.fd;
++      file.fd = -1;
++      return *this;
++    }
++  };
++
++
++  struct Pipe
++  { int pipefd[2];
++
++    Pipe() {if(pipe(pipefd)) sys::error(errno, "cannot create pipe"s);}
++    ~Pipe()
++    {
++      std::for_each(pipefd, pipefd + 2,
++                    lambda((auto fd), if (fd >= 0) close(fd)));
++    }
++    Pipe(Pipe& pipe) = delete;
++    Pipe& operator=(Pipe& pipe) = delete;
++    Pipe(Pipe&& pipe) = delete;
++    Pipe& operator=(Pipe&& pipe) = delete;
++  };
++
++
++  inline File operator>(File& file, Pipe& pipe)
++  { File file_sv(dup(file.fd));
++
++    if (file_sv.fd < 0) sys::error(errno, "cannot duplicate file descriptor"s);
++    if (dup2(pipe.pipefd[1], file.fd) < 0)
++      sys::error(errno, "cannot redirect file descriptor to pipe"s);
++
++    return file_sv;
++  }
++
++
++  inline void operator>(File& file, File& file_sv)
++  {
++    if (dup2(file_sv.fd, file.fd) < 0)
++      sys::error(errno, "cannot restore file descriptor"s);
++
++    file.fd = -1;
++  }
++}
++using namespace file_and_pipe;
++
++
++defun(read_from_pipe, (auto& pipe),
++      if (pipe.pipefd[1] >= 0)
++        {
++          close(pipe.pipefd[1]);
++          pipe.pipefd[1] = -1;
++        }
++
++      __gnu_cxx::stdio_filebuf<char> fstream(pipe.pipefd[0], std::ios::in);
++      std::istream istream(&fstream);
++      std::stringstream sstream;
++      sstream << istream.rdbuf();
++      return sstream.str());
+diff --git a/wrap.cxx b/wrap.cxx
+new file mode 100644
+index 0000000..e3dde32
+--- /dev/null
++++ b/wrap.cxx
+@@ -0,0 +1,115 @@
++/* Wraps main function generated by gcj to allow compiled as native executable
++   Copyright 2016 Alex Vong
++
++   Licensed under the Apache License, Version 2.0 (the "License");
++   you may not use this file except in compliance with the License.
++   You may obtain a copy of the License at
++
++   http://www.apache.org/licenses/LICENSE-2.0
++
++   Unless required by applicable law or agreed to in writing, software
++   distributed under the License is distributed on an "AS IS" BASIS,
++   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
++   See the License for the specific language governing permissions and
++   limitations under the License.  */
++
++
++#include <cstdlib>
++#include <deque>
++#include <string>
++#include "base.hxx"
++#include "args.hxx"
++#include "string.hxx"
++#include "sys.hxx"
++
++#define ARGS_TYPE std::deque<std::string>
++
++
++Args ARGS;
++File STDOUT_FILE(STDOUT_FILENO);
++File STDERR_FILE(STDERR_FILENO);
++File STDOUT_FILE_SV;
++File STDERR_FILE_SV;
++Pipe STDOUT_PIPE;
++Pipe STDERR_PIPE;
++
++
++extern "C" int
++__wrap_main(int argc, char** argv)
++{ using namespace std::string_literals;
++  using namespace std::placeholders;
++
++  ARGS_TYPE args(argv, argv + argc);
++
++  define(subopt_prefix, "-Wi,"s);
++  define(subopt_p, cut(string::prefix_p, subopt_prefix, _1));
++  defun(remove_prefix, (auto prefix, auto str),
++        return string::drop(str, string::length(prefix)));
++  define(remove_subopt_prefix, cut(remove_prefix, subopt_prefix, _1));
++  defun(split_subopt, (auto str),
++        return string::split<ARGS_TYPE>(str, ','));
++  define(help_string_p, cut(string::eq_any_p, _1,
++                            ARGS_TYPE({"-h"s, "-?"s, "--help"s})));
++  defun(print_help, (auto prog_name),
++        display("Usage: "s *
++                prog_name *
++                " [gij-opt*] [init-opt*] [main-opt] [arg*]\n"s *
++
++                "\n"s *
++
++                "  Start a read–eval–print loop by default\n"s *
++
++                "\n"s *
++
++                "  gij options:\n"s *
++
++                "    -Wi,<op1>,<op2>...  "s *
++                "Pass comma-separated options on to gij\n"s *
++
++                "    -Wi,-?\n"s *
++
++                "    -Wi,--help          "s *
++                "Print help for gij, then exit\n"s));
++
++  define(prog_name, car(args));
++  define(rest_args, cdr(args));
++  define(opts, partition(subopt_p, cdr(args)));
++  define(subopts, opts[0]);
++  define(otheropts, opts[1]);
++  ARGS = Args(append(ARGS_TYPE({prog_name, "-noverify"s}),
++                     concatenate(map(split_subopt * remove_subopt_prefix,
++                                     subopts)),
++                     ARGS_TYPE({"clojure.main"s}),
++                     otheropts));
++
++  if(!null_p(otheropts)
++     && help_string_p(car(otheropts)))
++    {
++      STDOUT_FILE_SV = STDOUT_FILE > STDOUT_PIPE;
++      STDERR_FILE_SV = STDERR_FILE > STDERR_PIPE;
++      std::atexit(lambda((),
++                         STDOUT_FILE > STDOUT_FILE_SV;
++                         STDERR_FILE > STDERR_FILE_SV;
++
++                         define(stdout_str, read_from_pipe(STDOUT_PIPE));
++                         define(stderr_str, read_from_pipe(STDERR_PIPE));
++                         if (string::contains_p(stdout_str, "clojure.main"s))
++                           {
++                             print_help(decltype(prog_name)(ARGS.argv[0]));
++
++                             for_each(lambda((auto str),
++                                             display(str);
++                                             display("\n"s)),
++                                      drop(string::split<ARGS_TYPE>(stdout_str,
++                                                                    '\n'),
++                                           3));
++                           }
++                         else
++                           {
++                             display(stdout_str);
++                           }
++                         display_error(stderr_str)));
++    }
++
++  return __real_main(ARGS.argc, ARGS.argv);
++}
+-- 
+2.9.0
+
-- 
2.9.0


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* Re: [PATCH] gnu: Add clojure.
  2016-07-06 12:54 [PATCH] gnu: Add clojure Alex Vong
@ 2016-07-13 15:49 ` Ricardo Wurmus
  2016-07-14 13:22   ` Alex Vong
  0 siblings, 1 reply; 18+ messages in thread
From: Ricardo Wurmus @ 2016-07-13 15:49 UTC (permalink / raw)
  To: Alex Vong; +Cc: guix-devel


Hi Alex,

> This patch adds clojure 1.6 to 1.8.

Wow.  Thanks!

> Changes made since last email (comments appreciated):
>
> Include clojure from 1.6 to 1.8 instead of just 1.8 because I think we
> should provide all stable versions and allowed them to be
> co-installed. From https://clojure.github.io/clojure/, version 1.6 to
> 1.8 is considered stable.

Usually, we just keep the latest version unless there are packages that
dependend on an older version.  In the case of the IcedTea packages, for
example, we need version 6 to be able to bootstrap the others.

In my opinion we should just add Clojure version 1.8 for now.  In any
case (if other people decide that we should have more than one version)
please only add one package per patch.  It’s a little tedious to split
stuff up, I know, but it makes handling repository history and partial
reverts much easier. 

> Use ant build system, this save a lot of typing, thanks Ricardo for
> writing it!

Yay, I’m glad it’s useful!

> Provide a native executable. It is a bit of a hack. First, the clojure
> jar is compiled with gcj. Then a c++ wrapper is compiled. Finally, they
> are linked together. The native executable takes half the time to start
> than loading the jar using java.

I see that you added a very large patch to make this work.  In Guix we
usually avoid patching upstream software unless it’s absolutely
necessary.  Have you thought about submitting your patch upstream to
enable compilation with GCJ?  I think we should not add extensive
patches like that unless they are considered by the upstream developers.

It’s also not so pretty that you have to call “gcj” and “g++” in a
somewhat complicated build phase “build-native”.  If you can get
upstream to accept your patches to build with GCJ maybe you can slip in
a patch to add a new Makefile target as well?  This would greatly
simplify the build phases.

> There is a slight problem when inheriting package. Let's say in one of
> the build phases of package A, I want to eval this expression:
>   (compile-jar (string-append "clojure-" ,version ".jar"))
>
> Then I define package B which is inherited from package A, like this:
>   (define-public B
>     (package
>       (inherit A)
>       (version "2")
>       ...
>       ))
>
> Now the build phases of package B still refer to the old version of
> package A, in other words, the version being substitute into the build
> phases is not being inherited. Any idea on how to fix this? Right now, I
> resort to adding the following build phase:
>   (add-after 'unpack-submodule-sources 'set-clojure-version
>     (lambda _
>       (setenv "CLOJURE_VERSION" ,version)))
>
> and replace the build phase in the inherited package. But this looks a
> bit ugly to me.

Mmyeah… this is really not pretty.  Also: wrapping the whole package
expression in this “get-version” let-binding is not nice.

Have you thought of instead writing a procedure that produces a Clojure
package given a particular version?  Similar to the “custom-gcc”
procedure maybe?

Again, thanks a lot for the effort!  I really hope we can add Clojure to
Guix soon.

~~ Ricardo

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH] gnu: Add clojure.
  2016-07-13 15:49 ` Ricardo Wurmus
@ 2016-07-14 13:22   ` Alex Vong
  2016-07-24 21:15     ` Ricardo Wurmus
  0 siblings, 1 reply; 18+ messages in thread
From: Alex Vong @ 2016-07-14 13:22 UTC (permalink / raw)
  To: Ricardo Wurmus; +Cc: guix-devel

[-- Attachment #1: Type: text/plain, Size: 2353 bytes --]

Ricardo Wurmus <rekado@elephly.net> writes:

> Hi Alex,
>
>> This patch adds clojure 1.6 to 1.8.
>
> Wow.  Thanks!
>
Thanks for the review too!

> Usually, we just keep the latest version unless there are packages that
> dependend on an older version.  In the case of the IcedTea packages, for
> example, we need version 6 to be able to bootstrap the others.
>
> In my opinion we should just add Clojure version 1.8 for now.  In any
> case (if other people decide that we should have more than one version)
> please only add one package per patch.  It’s a little tedious to split
> stuff up, I know, but it makes handling repository history and partial
> reverts much easier. 
>
I see. So the general policy here is to be lazy and packaged by need :)
This time only version 1.8 is added. Does this apply to splitting
bundled libraries as well? I see clojure has some java libraries bundled
such as ASM. Currently, I suppose no other packages depend on it.

> I see that you added a very large patch to make this work.  In Guix we
> usually avoid patching upstream software unless it’s absolutely
> necessary.  Have you thought about submitting your patch upstream to
> enable compilation with GCJ?  I think we should not add extensive
> patches like that unless they are considered by the upstream developers.
>
> It’s also not so pretty that you have to call “gcj” and “g++” in a
> somewhat complicated build phase “build-native”.  If you can get
> upstream to accept your patches to build with GCJ maybe you can slip in
> a patch to add a new Makefile target as well?  This would greatly
> simplify the build phases.
>
I see clojure is written only in java and clojure. I will ask for
upstream advice on this one.

> Mmyeah… this is really not pretty.  Also: wrapping the whole package
> expression in this “get-version” let-binding is not nice.
>
> Have you thought of instead writing a procedure that produces a Clojure
> package given a particular version?  Similar to the “custom-gcc”
> procedure maybe?
>
Now only version 1.8 is added, the problem has gone temporarily. But it
is interesting to know how the gcc package solves this problem.

> Again, thanks a lot for the effort!  I really hope we can add Clojure to
> Guix soon.
>
> ~~ Ricardo

Thanks,
Alex


[-- Attachment #2: 0001-gnu-Add-clojure.patch --]
[-- Type: text/x-diff, Size: 11031 bytes --]

From 69cb51c65014083a5838238bff688d7652e862a2 Mon Sep 17 00:00:00 2001
From: Alex Vong <alexvong1995@gmail.com>
Date: Tue, 5 Jul 2016 16:24:20 +0800
Subject: [PATCH] gnu: Add clojure.

* gnu/packages/java.scm (clojure): New variables.
---
 gnu/packages/java.scm | 202 ++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 202 insertions(+)

diff --git a/gnu/packages/java.scm b/gnu/packages/java.scm
index 753fb77..0a8956b 100644
--- a/gnu/packages/java.scm
+++ b/gnu/packages/java.scm
@@ -41,6 +41,7 @@
   #:use-module (gnu packages ghostscript) ;lcms
   #:use-module (gnu packages gnome)
   #:use-module (gnu packages gtk)
+  #:use-module (gnu packages haskell)
   #:use-module (gnu packages image)
   #:use-module (gnu packages linux) ;alsa
   #:use-module (gnu packages wget)
@@ -141,6 +142,207 @@ is implemented.")
               license:mpl2.0
               license:lgpl2.1+))))
 
+(define-public clojure
+  (let ((remove-archives '(begin
+                            (for-each delete-file
+                                      (find-files "./" ".*\\.(jar|zip)"))
+                            #t)))
+    (package
+      (name "clojure")
+      (version "1.8.0")
+      (source
+       (origin
+         (method url-fetch)
+         (uri
+          (string-append "http://repo1.maven.org/maven2/org/clojure/clojure/"
+                         version "/clojure-" version ".zip"))
+         (sha256
+          (base32 "1nip095fz5c492sw15skril60i1vd21ibg6szin4jcvyy3xr6cym"))
+         (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)
+               (let ((unpack
+                      (lambda (src-name)
+                        (and (mkdir-p src-name)
+                             (with-directory-excursion src-name
+                               (zero? (system* "tar"
+                                               ;; Use xz since tarball is repacked.
+                                               "--xz"
+                                               "--extract"
+                                               "--verbose"
+                                               "--file" (assoc-ref inputs
+                                                                   src-name)
+                                               "--strip-components=1"))))))
+                     (copy (lambda (src-name)
+                             (copy-recursively
+                              (string-append src-name "/src/main/clojure/")
+                              "src/clj/"))))
+                 (every (lambda (src)
+                          (unpack src)
+                          (copy src))
+                        '("data-generators-src" "java-classpath-src"
+                          "test-check-src" "test-generative-src"
+                          "tools-namespace-src" "tools-reader-src")))))
+           (add-after 'build 'build-doc
+             (lambda _
+               (let* ((markdown-regex "(.*)\\.(md|markdown|txt)")
+                      (gsub regexp-substitute/global)
+                      (markdown->html (lambda (src-name)
+                                        (zero? (system*
+                                                "pandoc"
+                                                "--output" (gsub #f
+                                                                 markdown-regex
+                                                                 src-name
+                                                                 1 ".html")
+                                                "--verbose"
+                                                "--from" "markdown_github"
+                                                "--to" "html"
+                                                src-name)))))
+                 (every markdown->html
+                        (find-files "./" markdown-regex)))))
+           (replace 'install
+             (lambda* (#:key outputs #:allow-other-keys)
+               (let ((java-dir (string-append (assoc-ref outputs "out")
+                                              "/share/java/")))
+                 ;; Do not install clojure.jar to avoid collisions.
+                 (install-file (string-append "clojure-" ,version ".jar")
+                               java-dir)
+                 #t)))
+           (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-file-to-dir (lambda (file dir)
+                                         (copy-file file
+                                                    (string-append dir
+                                                                   file)))))
+                 (for-each delete-file
+                           (find-files "doc/clojure/"
+                                       ".*\\.(md|markdown|txt)"))
+                 (copy-recursively "doc/clojure/" doc-dir)
+                 (for-each (cut copy-file-to-dir <> doc-dir)
+                           (filter (cut string-match ".*\\.(html|txt)" <>)
+                                   (scandir "./")))
+                 #t))))))
+      (native-inputs
+       `(("ghc-pandoc" ,ghc-pandoc)
+         ;; The native-inputs below are needed to run the tests.
+         ("data-generators-src"
+          ,(let ((version "0.1.2"))
+             (origin
+               (method url-fetch)
+               (uri (string-append "https://github.com/clojure"
+                                   "/data.generators/archive/data.generators-"
+                                   version ".tar.gz"))
+               (sha256
+                (base32
+                 "0kki093jp4ckwxzfnw8ylflrfqs8b1i1wi9iapmwcsy328dmgzp1"))
+               (modules '((guix build utils)
+                          (ice-9 ftw)))
+               (snippet remove-archives))))
+         ("java-classpath-src"
+          ,(let ((version "0.2.3"))
+             (origin
+               (method url-fetch)
+               (uri
+                (string-append "https://github.com/clojure"
+                               "/java.classpath/archive/java.classpath-"
+                               version ".tar.gz"))
+               (sha256
+                (base32
+                 "0sjymly9xh1lkvwn5ygygpsfwz4dabblnlq0c9bx76rkvq62fyng"))
+               (modules '((guix build utils)))
+               (snippet remove-archives))))
+         ("test-check-src"
+          ,(let ((version "0.9.0"))
+             (origin
+               (method url-fetch)
+               (uri
+                (string-append "https://github.com/clojure"
+                               "/test.check/archive/test.check-"
+                               version ".tar.gz"))
+               (sha256
+                (base32
+                 "0p0mnyhr442bzkz0s4k5ra3i6l5lc7kp6ajaqkkyh4c2k5yck1md"))
+               (modules '((guix build utils)))
+               (snippet remove-archives))))
+         ("test-generative-src"
+          ,(let ((version "0.5.2"))
+             (origin
+               (method url-fetch)
+               (uri (string-append "https://github.com/clojure"
+                                   "/test.generative/archive/test.generative-"
+                                   version ".tar.gz"))
+               (sha256
+                (base32
+                 "1pjafy1i7yblc7ixmcpfq1lfbyf3jaljvkgrajn70sws9xs7a9f8"))
+               (modules '((guix build utils)))
+               (snippet remove-archives))))
+         ("tools-namespace-src"
+          ,(let ((version "0.2.11"))
+             (origin
+               (method url-fetch)
+               (uri (string-append "https://github.com/clojure"
+                                   "/tools.namespace/archive/tools.namespace-"
+                                   version ".tar.gz"))
+               (sha256
+                (base32
+                 "10baak8v0hnwz2hr33bavshm7y49mmn9zsyyms1dwjz45p5ymhy0"))
+               (modules '((guix build utils)))
+               (snippet remove-archives))))
+         ("tools-reader-src"
+          ,(let ((version "0.10.0"))
+             (origin
+               (method url-fetch)
+               (uri
+                (string-append "https://github.com/clojure"
+                               "/tools.reader/archive/tools.reader-"
+                               version ".tar.gz"))
+               (sha256
+                (base32
+                 "09i3lzbhr608h76mhdjm3932gg9xi8sflscla3c5f0v1nkc28cnr"))
+               (modules '((guix build utils)))
+               (snippet remove-archives))))))
+      (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 under APL2.0
+      ;; src/clj/repl.clj is licensed under 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 ant
   (package
     (name "ant")
-- 
2.9.0


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* Re: [PATCH] gnu: Add clojure.
  2016-07-14 13:22   ` Alex Vong
@ 2016-07-24 21:15     ` Ricardo Wurmus
  2016-07-26 12:45       ` Alex Vong
  0 siblings, 1 reply; 18+ messages in thread
From: Ricardo Wurmus @ 2016-07-24 21:15 UTC (permalink / raw)
  To: Alex Vong; +Cc: guix-devel


Hi Alex,

> I see. So the general policy here is to be lazy and packaged by need :)
> This time only version 1.8 is added. Does this apply to splitting
> bundled libraries as well? I see clojure has some java libraries bundled
> such as ASM. Currently, I suppose no other packages depend on it.

Usually, we will split bundled libraries.  For bundled “jar” archives
this is necessary in any case as a “jar” file is a binary.

If the libraries are bundled in source form (not as “jar” archives) and
if they are closely tied to clojure (or if they were forked from
upstream libraries to better fit clojure), we could make an exception.

Packaging Java libraries for Guix still isn’t very easy as we lack a
bootstrapped set of core libraries, but you might be able to use the
“ant-build-system” to get closer to that goal.  I also have a couple of
packages for Java core libraries that haven’t yet been pushed.  If you
intend to work on this I can share my current work in progress.

>> I see that you added a very large patch to make this work.  In Guix we
>> usually avoid patching upstream software unless it’s absolutely
>> necessary.  Have you thought about submitting your patch upstream to
>> enable compilation with GCJ?  I think we should not add extensive
>> patches like that unless they are considered by the upstream developers.
>>
>> It’s also not so pretty that you have to call “gcj” and “g++” in a
>> somewhat complicated build phase “build-native”.  If you can get
>> upstream to accept your patches to build with GCJ maybe you can slip in
>> a patch to add a new Makefile target as well?  This would greatly
>> simplify the build phases.
>>
> I see clojure is written only in java and clojure. I will ask for
> upstream advice on this one.

Thank you.  Please let us know when a decision has been reached.

Here are some more comments about the patch you sent:

> +           (replace 'install
> +             (lambda* (#:key outputs #:allow-other-keys)
> +               (let ((java-dir (string-append (assoc-ref outputs "out")
> +                                              "/share/java/")))
> +                 ;; Do not install clojure.jar to avoid collisions.
> +                 (install-file (string-append "clojure-" ,version ".jar")
> +                               java-dir)
> +                 #t)))

You don’t need this.  The “ant-build-system” allows you to override the
name of the “jar” archive.  You can change the name to “(string-append
"clojure-" ,version ".jar")” there without needing to override the
install phase.

> +           (add-after 'build 'build-doc
> +             (lambda _
> +               (let* ((markdown-regex "(.*)\\.(md|markdown|txt)")
> +                      (gsub regexp-substitute/global)
> +                      (markdown->html (lambda (src-name)
> +                                        (zero? (system*
> +                                                "pandoc"
> +                                                "--output" (gsub #f
> +                                                                 markdown-regex
> +                                                                 src-name
> +                                                                 1 ".html")
> +                                                "--verbose"
> +                                                "--from" "markdown_github"
> +                                                "--to" "html"
> +                                                src-name)))))
> +                 (every markdown->html
> +                        (find-files "./" markdown-regex)))))

Why is this needed?  Is there no target for building the documentation?
If you added “pandoc” to the inputs only for building the documentation
please reconsider this decision.  The closure of the “pandoc” package is
*massive* as it depends on countless Haskell packages.  You would make
the “clojure” package dependent on both Java (which is large) and an
even larger set of packages consisting of GHC and numerous packages.

Couldn’t you just install the markdown files as they are?

> +           (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-file-to-dir (lambda (file dir)
> +                                         (copy-file file
> +                                                    (string-append dir
> +                                                                   file)))))
> +                 (for-each delete-file
> +                           (find-files "doc/clojure/"
> +                                       ".*\\.(md|markdown|txt)"))
> +                 (copy-recursively "doc/clojure/" doc-dir)
> +                 (for-each (cut copy-file-to-dir <> doc-dir)
> +                           (filter (cut string-match ".*\\.(html|txt)" <>)
> +                                   (scandir "./")))
> +                 #t))))))

Similar comments here.  Why delete the markdown documentation?  I’d much
prefer to have the original plain text files.

What do you think?

~~ Ricardo

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH] gnu: Add clojure.
  2016-07-24 21:15     ` Ricardo Wurmus
@ 2016-07-26 12:45       ` Alex Vong
  2016-07-26 20:00         ` Ricardo Wurmus
  0 siblings, 1 reply; 18+ messages in thread
From: Alex Vong @ 2016-07-26 12:45 UTC (permalink / raw)
  To: Ricardo Wurmus; +Cc: guix-devel

[-- Attachment #1: Type: text/plain, Size: 5816 bytes --]

Hi Ricardo,

Thanks for the review again, the package definition is now simplier.

Ricardo Wurmus <rekado@elephly.net> writes:

> Hi Alex,
>
> Usually, we will split bundled libraries.  For bundled “jar” archives
> this is necessary in any case as a “jar” file is a binary.
>
> If the libraries are bundled in source form (not as “jar” archives) and
> if they are closely tied to clojure (or if they were forked from
> upstream libraries to better fit clojure), we could make an exception.
>
> Packaging Java libraries for Guix still isn’t very easy as we lack a
> bootstrapped set of core libraries, but you might be able to use the
> “ant-build-system” to get closer to that goal.  I also have a couple of
> packages for Java core libraries that haven’t yet been pushed.  If you
> intend to work on this I can share my current work in progress.
>
Yes, the ASM library is included as source (not jar) and is one majar
version behind upstream (4 vs 5). Also, this SO question says it is indeed a
fork (https://stackoverflow.com/questions/21642115/how-does-the-clojure-compiler-generates-jvm-bytecode).

> Here are some more comments about the patch you sent:
>
>> +           (replace 'install
>> +             (lambda* (#:key outputs #:allow-other-keys)
>> +               (let ((java-dir (string-append (assoc-ref outputs "out")
>> +                                              "/share/java/")))
>> +                 ;; Do not install clojure.jar to avoid collisions.
>> +                 (install-file (string-append "clojure-" ,version ".jar")
>> +                               java-dir)
>> +                 #t)))
>
> You don’t need this.  The “ant-build-system” allows you to override the
> name of the “jar” archive.  You can change the name to “(string-append
> "clojure-" ,version ".jar")” there without needing to override the
> install phase.
>
Actually, build.xml does not provide any install target, so we have to
roll our own. I should have made this clear. I've added a comment to
clarify this point.

>> +           (add-after 'build 'build-doc
>> +             (lambda _
>> +               (let* ((markdown-regex "(.*)\\.(md|markdown|txt)")
>> +                      (gsub regexp-substitute/global)
>> +                      (markdown->html (lambda (src-name)
>> +                                        (zero? (system*
>> +                                                "pandoc"
>> +                                                "--output" (gsub #f
>> + markdown-regex
>> +                                                                 src-name
>> +                                                                 1 ".html")
>> +                                                "--verbose"
>> +                                                "--from" "markdown_github"
>> +                                                "--to" "html"
>> +                                                src-name)))))
>> +                 (every markdown->html
>> +                        (find-files "./" markdown-regex)))))
>
> Why is this needed?  Is there no target for building the documentation?
> If you added “pandoc” to the inputs only for building the documentation
> please reconsider this decision.  The closure of the “pandoc” package is
> *massive* as it depends on countless Haskell packages.  You would make
> the “clojure” package dependent on both Java (which is large) and an
> even larger set of packages consisting of GHC and numerous packages.
>
> Couldn’t you just install the markdown files as they are?
>
Sure, we could just install the markdown files as it. Though I am
curious to know what do you mean the closure is massive. Isn't pandoc
only needed at build-time, so the user doesn't need to download the
ghc-pandoc substitute? Also, I realize I over look the `javadoc' target,
which builds documentations in addition to those markdown file. So, I
change the target to the following:

;;; The javadoc target is not built by default.
(add-after 'build 'build-doc
  (lambda _
    (system* "ant" "javadoc")))

>> +           (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-file-to-dir (lambda (file dir)
>> +                                         (copy-file file
>> +                                                    (string-append dir
>> +                                                                   file)))))
>> +                 (for-each delete-file
>> +                           (find-files "doc/clojure/"
>> +                                       ".*\\.(md|markdown|txt)"))
>> +                 (copy-recursively "doc/clojure/" doc-dir)
>> +                 (for-each (cut copy-file-to-dir <> doc-dir)
>> +                           (filter (cut string-match ".*\\.(html|txt)" <>)
>> +                                   (scandir "./")))
>> +                 #t))))))
>
> Similar comments here.  Why delete the markdown documentation?  I’d much
> prefer to have the original plain text files.
>
With the new build-doc target, we now only need to copy
`doc/' to `share/doc/'
`target/javadoc/' to `share/doc/javadoc/' and
other top-level markdown/html files to `doc/',
another simplification.

> What do you think?
>
Finally, I want to ask do I need to sign my commit? I sign my commit and
do a `magit-format-patch', but it seems the patch does not contain info
of the signature.

> ~~ Ricardo

Thanks,
Alex


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-fix-gcj-build.patch --]
[-- Type: text/x-diff, Size: 9227 bytes --]

From b4094a8acf9f7b41085f5c3aa0d548638ea8cb48 Mon Sep 17 00:00:00 2001
From: Alex Vong <alexvong1995@gmail.com>
Date: Tue, 22 Dec 2015 01:06:33 +0800
Subject: [PATCH] fix gcj build

---
 build.xml                          | 29 ++++++++++++++++++++++-------
 src/jvm/clojure/lang/Compiler.java | 26 +++++++++++++-------------
 src/jvm/clojure/lang/Numbers.java  | 35 ++++++++++++++++++++++++-----------
 src/jvm/clojure/lang/Ratio.java    | 22 ++++++++++++++++++++--
 4 files changed, 79 insertions(+), 33 deletions(-)

diff --git a/build.xml b/build.xml
index cae30b2..2427d68 100644
--- a/build.xml
+++ b/build.xml
@@ -40,8 +40,10 @@
   <target name="compile-java" depends="init"
           description="Compile Java sources.">
     <javac srcdir="${jsrc}" destdir="${build}" includeJavaRuntime="yes"
-           includeAntRuntime="false"
-           debug="true" source="1.6" target="1.6"/>
+           includeAntRuntime="false" compiler="gcj"
+           debug="true" source="1.6" target="1.6">
+      <compilerarg value="-O3"/>
+    </javac>
   </target>
 
   <target name="compile-clojure"
@@ -49,7 +51,9 @@
     <java classname="clojure.lang.Compile"
           classpath="${maven.compile.classpath}:${build}:${cljsrc}"
           failonerror="true"
+          jvm="gij"
           fork="true">
+      <jvmarg value="-noverify"/>
       <sysproperty key="clojure.compile.path" value="${build}"/>
          <!--<sysproperty key="clojure.compiler.elide-meta" value="[:doc :file :line :added]"/>-->
          <!--<sysproperty key="clojure.compiler.disable-locals-clearing" value="true"/>-->
@@ -88,13 +92,18 @@
           description="Compile the subset of tests that require compilation."
           unless="maven.test.skip">
     <mkdir dir="${test-classes}"/>
-    <javac srcdir="${jtestsrc}" destdir="${test-classes}" includeJavaRuntime="yes"
-           debug="true" source="1.6" target="1.6" includeantruntime="no"/>
+    <javac srcdir="${jtestsrc}" destdir="${test-classes}"
+           includeJavaRuntime="yes" compiler="gcj"
+           debug="true" source="1.6" target="1.6" includeantruntime="no">
+      <compilerarg value="-O3"/>
+    </javac>
     <echo>Direct linking = ${directlinking}</echo>
     <java classname="clojure.lang.Compile"
           classpath="${test-classes}:${test}:${build}:${cljsrc}"
           failonerror="true"
-	  fork="true">
+          jvm="gij"
+          fork="true">
+      <jvmarg value="-noverify"/>
       <sysproperty key="clojure.compile.path" value="${test-classes}"/>
         <!--<sysproperty key="clojure.compiler.elide-meta" value="[:doc]"/>-->
         <!--<sysproperty key="clojure.compiler.disable-locals-clearing" value="true"/>-->
@@ -110,7 +119,10 @@
           description="Run clojure tests without recompiling clojure."
           depends="compile-tests"
           unless="maven.test.skip">
-    <java classname="clojure.main" failonerror="true" fork="true">
+    <java classname="clojure.main" failonerror="true"
+          jvm="gij"
+          fork="true">
+      <jvmarg value="-noverify"/>
       <sysproperty key="clojure.test-clojure.exclude-namespaces"
                    value="#{clojure.test-clojure.compilation.load-ns}"/>
       <sysproperty key="clojure.compiler.direct-linking" value="${directlinking}"/>
@@ -129,7 +141,10 @@
           description="Run test generative tests without recompiling clojure."
           depends="compile-tests"
           unless="maven.test.skip">
-    <java classname="clojure.main" failonerror="true" fork="true">
+    <java classname="clojure.main" failonerror="true"
+          jvm="gij"
+          fork="true">
+      <jvmarg value="-noverify"/>
       <sysproperty key="clojure.compiler.direct-linking" value="${directlinking}"/>
       <classpath>
         <pathelement path="${maven.test.classpath}"/>
diff --git a/src/jvm/clojure/lang/Compiler.java b/src/jvm/clojure/lang/Compiler.java
index 6066825..d40099b 100644
--- a/src/jvm/clojure/lang/Compiler.java
+++ b/src/jvm/clojure/lang/Compiler.java
@@ -5347,19 +5347,19 @@ public static class FnMethod extends ObjMethod{
 					                  registerLocal(p, null, new MethodParamExpr(pc), true)
 					                           : registerLocal(p, state == PSTATE.REST ? ISEQ : tagOf(p), null, true);
 					argLocals = argLocals.cons(lb);
-					switch(state)
-						{
-						case REQ:
-							method.reqParms = method.reqParms.cons(lb);
-							break;
-						case REST:
-							method.restParm = lb;
-							state = PSTATE.DONE;
-							break;
-
-						default:
-							throw Util.runtimeException("Unexpected parameter");
-						}
+					if (state == PSTATE.REQ)
+                                            {
+                                                method.reqParms = method.reqParms.cons(lb);
+                                            }
+                                        else if (state == PSTATE.REST)
+                                            {
+                                                method.restParm = lb;
+                                                state = PSTATE.DONE;
+                                            }
+                                        else
+                                            {
+                                                throw Util.runtimeException("Unexpected parameter");
+                                            }
 					}
 				}
 			if(method.reqParms.count() > MAX_POSITIONAL_ARITY)
diff --git a/src/jvm/clojure/lang/Numbers.java b/src/jvm/clojure/lang/Numbers.java
index 623743b..9b828de 100644
--- a/src/jvm/clojure/lang/Numbers.java
+++ b/src/jvm/clojure/lang/Numbers.java
@@ -15,6 +15,7 @@ package clojure.lang;
 import java.math.BigInteger;
 import java.math.BigDecimal;
 import java.math.MathContext;
+import java.math.RoundingMode;
 
 public class Numbers{
 
@@ -941,23 +942,35 @@ final static class BigDecimalOps extends OpsP{
 
 	public Number divide(Number x, Number y){
 		MathContext mc = (MathContext) MATH_CONTEXT.deref();
-		return mc == null
-		       ? toBigDecimal(x).divide(toBigDecimal(y))
-		       : toBigDecimal(x).divide(toBigDecimal(y), mc);
+                RoundingMode mode = mc.getRoundingMode();
+                int vals[] =
+                    {
+                        BigDecimal.ROUND_UP,
+                        BigDecimal.ROUND_DOWN,
+                        BigDecimal.ROUND_CEILING,
+                        BigDecimal.ROUND_FLOOR,
+                        BigDecimal.ROUND_HALF_UP,
+                        BigDecimal.ROUND_HALF_DOWN,
+                        BigDecimal.ROUND_HALF_EVEN,
+                        BigDecimal.ROUND_UNNECESSARY
+                    };
+                int i;
+
+                for (i = 0; i < vals.length; ++i)
+                    if (mode == RoundingMode.valueOf(vals[i]))
+                        return mc == null
+                            ? toBigDecimal(x).divide(toBigDecimal(y))
+                            : toBigDecimal(x).divide(toBigDecimal(y), vals[i]);
+
+                throw new IllegalArgumentException("invalid rounding mode");
 	}
 
 	public Number quotient(Number x, Number y){
-		MathContext mc = (MathContext) MATH_CONTEXT.deref();
-		return mc == null
-		       ? toBigDecimal(x).divideToIntegralValue(toBigDecimal(y))
-		       : toBigDecimal(x).divideToIntegralValue(toBigDecimal(y), mc);
+		return toBigDecimal(x).divideToIntegralValue(toBigDecimal(y));
 	}
 
 	public Number remainder(Number x, Number y){
-		MathContext mc = (MathContext) MATH_CONTEXT.deref();
-		return mc == null
-		       ? toBigDecimal(x).remainder(toBigDecimal(y))
-		       : toBigDecimal(x).remainder(toBigDecimal(y), mc);
+		return toBigDecimal(x).remainder(toBigDecimal(y));
 	}
 
 	public boolean equiv(Number x, Number y){
diff --git a/src/jvm/clojure/lang/Ratio.java b/src/jvm/clojure/lang/Ratio.java
index 6c7a9bb..c7d2ff5 100644
--- a/src/jvm/clojure/lang/Ratio.java
+++ b/src/jvm/clojure/lang/Ratio.java
@@ -15,6 +15,7 @@ package clojure.lang;
 import java.math.BigInteger;
 import java.math.BigDecimal;
 import java.math.MathContext;
+import java.math.RoundingMode;
 
 public class Ratio extends Number implements Comparable{
 final public BigInteger numerator;
@@ -63,8 +64,25 @@ public BigDecimal decimalValue(){
 public BigDecimal decimalValue(MathContext mc){
 	BigDecimal numerator = new BigDecimal(this.numerator);
 	BigDecimal denominator = new BigDecimal(this.denominator);
-
-	return numerator.divide(denominator, mc);
+        RoundingMode mode = mc.getRoundingMode();
+        int vals[] =
+            {
+                BigDecimal.ROUND_UP,
+                BigDecimal.ROUND_DOWN,
+                BigDecimal.ROUND_CEILING,
+                BigDecimal.ROUND_FLOOR,
+                BigDecimal.ROUND_HALF_UP,
+                BigDecimal.ROUND_HALF_DOWN,
+                BigDecimal.ROUND_HALF_EVEN,
+                BigDecimal.ROUND_UNNECESSARY
+            };
+        int i;
+
+        for (i = 0; i < vals.length; ++i)
+            if (mode == RoundingMode.valueOf(vals[i]))
+                return numerator.divide(denominator, vals[i]);
+
+        throw new IllegalArgumentException("invalid rounding mode");
 }
 
 public BigInteger bigIntegerValue(){
-- 
2.6.3


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* Re: [PATCH] gnu: Add clojure.
  2016-07-26 12:45       ` Alex Vong
@ 2016-07-26 20:00         ` Ricardo Wurmus
  2016-07-27  6:47           ` Alex Vong
  0 siblings, 1 reply; 18+ messages in thread
From: Ricardo Wurmus @ 2016-07-26 20:00 UTC (permalink / raw)
  To: Alex Vong; +Cc: guix-devel


Hi Alex,

> Thanks for the review again, the package definition is now simplier.

You only attached the patch to the Clojure sources.  Could you please
also attach the latest patch to add the clojure package?

> Yes, the ASM library is included as source (not jar) and is one majar
> version behind upstream (4 vs 5). Also, this SO question says it is indeed a
> fork (https://stackoverflow.com/questions/21642115/how-does-the-clojure-compiler-generates-jvm-bytecode).

In this case I think it’s okay to not carve it out of the Clojure source
archive.  Once we need an ASM package in the future we can revisit this
decision and see if we can express one in terms of the other.

>> Here are some more comments about the patch you sent:
>>
>>> +           (replace 'install
>>> +             (lambda* (#:key outputs #:allow-other-keys)
>>> +               (let ((java-dir (string-append (assoc-ref outputs "out")
>>> +                                              "/share/java/")))
>>> +                 ;; Do not install clojure.jar to avoid collisions.
>>> +                 (install-file (string-append "clojure-" ,version ".jar")
>>> +                               java-dir)
>>> +                 #t)))
>>
>> You don’t need this.  The “ant-build-system” allows you to override the
>> name of the “jar” archive.  You can change the name to “(string-append
>> "clojure-" ,version ".jar")” there without needing to override the
>> install phase.
>>
> Actually, build.xml does not provide any install target, so we have to
> roll our own. I should have made this clear. I've added a comment to
> clarify this point.

Ah, that’s because you are not using the “build.xml” file that the
“ant-build-system” would generate for you.  That’s correct — we only let
the “ant-build-system” generate a “build.xml” file with standard targets
when there is none or when the provided file cannot be used.

Adding a comment to explain why the install phase needs to be replaced
is sufficient in this case.

>>> +           (add-after 'build 'build-doc
>>> +             (lambda _
>>> +               (let* ((markdown-regex "(.*)\\.(md|markdown|txt)")
>>> +                      (gsub regexp-substitute/global)
>>> +                      (markdown->html (lambda (src-name)
>>> +                                        (zero? (system*
>>> +                                                "pandoc"
>>> +                                                "--output" (gsub #f
>>> + markdown-regex
>>> +                                                                 src-name
>>> +                                                                 1 ".html")
>>> +                                                "--verbose"
>>> +                                                "--from" "markdown_github"
>>> +                                                "--to" "html"
>>> +                                                src-name)))))
>>> +                 (every markdown->html
>>> +                        (find-files "./" markdown-regex)))))
>>
>> Why is this needed?  Is there no target for building the documentation?
>> If you added “pandoc” to the inputs only for building the documentation
>> please reconsider this decision.  The closure of the “pandoc” package is
>> *massive* as it depends on countless Haskell packages.  You would make
>> the “clojure” package dependent on both Java (which is large) and an
>> even larger set of packages consisting of GHC and numerous packages.
>>
>> Couldn’t you just install the markdown files as they are?
>>
> Sure, we could just install the markdown files as it. Though I am
> curious to know what do you mean the closure is massive. Isn't pandoc
> only needed at build-time, so the user doesn't need to download the
> ghc-pandoc substitute?

I mean that the closure of the “ghc-pandoc” package is big.  Few
markdown files *actually* need the features of the markdown
implementation provided by pandoc; in many cases one of the simpler
implementations can be used.  Especially for packages that provide
programming languages I have a preference for keeping the list of
build-time inputs reasonably small.

> Also, I realize I over look the `javadoc' target,
> which builds documentations in addition to those markdown file. So, I
> change the target to the following:
>
> ;;; The javadoc target is not built by default.
> (add-after 'build 'build-doc
>   (lambda _
>     (system* "ant" "javadoc")))
>

Good catch!  Please use “(zero? (system* …))” to make sure that the
phase fails when the ant target fails.

>>> +           (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-file-to-dir (lambda (file dir)
>>> +                                         (copy-file file
>>> +                                                    (string-append dir
>>> +                                                                   file)))))
>>> +                 (for-each delete-file
>>> +                           (find-files "doc/clojure/"
>>> +                                       ".*\\.(md|markdown|txt)"))
>>> +                 (copy-recursively "doc/clojure/" doc-dir)
>>> +                 (for-each (cut copy-file-to-dir <> doc-dir)
>>> +                           (filter (cut string-match ".*\\.(html|txt)" <>)
>>> +                                   (scandir "./")))
>>> +                 #t))))))
>>
>> Similar comments here.  Why delete the markdown documentation?  I’d much
>> prefer to have the original plain text files.
>>
> With the new build-doc target, we now only need to copy
> `doc/' to `share/doc/'
> `target/javadoc/' to `share/doc/javadoc/' and
> other top-level markdown/html files to `doc/',
> another simplification.

Great!

>> What do you think?
>>
> Finally, I want to ask do I need to sign my commit? I sign my commit and
> do a `magit-format-patch', but it seems the patch does not contain info
> of the signature.

The signature would not make it into the repository if you sent the
commit as a patch.  The committer to the central repository at Savannah
is the one who signs the commit — this does not mean that the committer
claims authorship, of course.

Thanks again for your work.  Please send the missing patch some time :)

~~ Ricardo

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH] gnu: Add clojure.
  2016-07-26 20:00         ` Ricardo Wurmus
@ 2016-07-27  6:47           ` Alex Vong
  2016-08-15 12:20             ` Ricardo Wurmus
  0 siblings, 1 reply; 18+ messages in thread
From: Alex Vong @ 2016-07-27  6:47 UTC (permalink / raw)
  To: Ricardo Wurmus; +Cc: guix-devel

[-- Attachment #1: Type: text/plain, Size: 1570 bytes --]

Hi Ricardo,

Ricardo Wurmus <rekado@elephly.net> writes:

> Hi Alex,
>
>> Thanks for the review again, the package definition is now simplier.
>
> You only attached the patch to the Clojure sources.  Could you please
> also attach the latest patch to add the clojure package?
>
Ahhh, I think I formatted the wrong patch (I am a new user of
magit). This time the correct one is attached.

>> Yes, the ASM library is included as source (not jar) and is one majar
>> version behind upstream (4 vs 5). Also, this SO question says it is indeed a
>> fork
>> (https://stackoverflow.com/questions/21642115/how-does-the-clojure-compiler-generates-jvm-bytecode).
>
> In this case I think it’s okay to not carve it out of the Clojure source
> archive.  Once we need an ASM package in the future we can revisit this
> decision and see if we can express one in terms of the other.
>
Agreed, I see debian make the split, but it is because they have
multiple packages build-depend on it.

[...]

>> Finally, I want to ask do I need to sign my commit? I sign my commit and
>> do a `magit-format-patch', but it seems the patch does not contain info
>> of the signature.
>
> The signature would not make it into the repository if you sent the
> commit as a patch.  The committer to the central repository at Savannah
> is the one who signs the commit — this does not mean that the committer
> claims authorship, of course.
>
Got it!

> Thanks again for your work.  Please send the missing patch some time :)
>
> ~~ Ricardo

Cheers,
Alex


[-- Attachment #2: 0001-gnu-Add-clojure.patch --]
[-- Type: text/x-diff, Size: 9742 bytes --]

From 420ca3add28cb493f69bff44f461b870f6546b51 Mon Sep 17 00:00:00 2001
From: Alex Vong <alexvong1995@gmail.com>
Date: Tue, 5 Jul 2016 16:24:20 +0800
Subject: [PATCH] gnu: Add clojure.

* gnu/packages/java.scm (clojure): New variables.
---
 gnu/packages/java.scm | 186 ++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 186 insertions(+)

diff --git a/gnu/packages/java.scm b/gnu/packages/java.scm
index 83ffba4..293490a 100644
--- a/gnu/packages/java.scm
+++ b/gnu/packages/java.scm
@@ -142,6 +142,192 @@ is implemented.")
               license:mpl2.0
               license:lgpl2.1+))))
 
+(define-public clojure
+  (let ((remove-archives '(begin
+                            (for-each delete-file
+                                      (find-files "./" ".*\\.(jar|zip)"))
+                            #t)))
+    (package
+      (name "clojure")
+      (version "1.8.0")
+      (source
+       (origin
+         (method url-fetch)
+         (uri
+          (string-append "http://repo1.maven.org/maven2/org/clojure/clojure/"
+                         version "/clojure-" version ".zip"))
+         (sha256
+          (base32 "1nip095fz5c492sw15skril60i1vd21ibg6szin4jcvyy3xr6cym"))
+         (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)
+               (let ((unpack
+                      (lambda (src-name)
+                        (and (mkdir-p src-name)
+                             (with-directory-excursion src-name
+                               (zero? (system* "tar"
+                                               ;; Use xz for repacked tarball.
+                                               "--xz"
+                                               "--extract"
+                                               "--verbose"
+                                               "--file" (assoc-ref inputs
+                                                                   src-name)
+                                               "--strip-components=1"))))))
+                     (copy (lambda (src-name)
+                             (copy-recursively
+                              (string-append src-name "/src/main/clojure/")
+                              "src/clj/"))))
+                 (every (lambda (src)
+                          (unpack src)
+                          (copy src))
+                        '("data-generators-src" "java-classpath-src"
+                          "test-check-src" "test-generative-src"
+                          "tools-namespace-src" "tools-reader-src")))))
+           ;;; The javadoc target is not built by default.
+           (add-after 'build 'build-doc
+             (lambda _
+               (zero? (system* "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/")))
+                 ;; Do not install clojure.jar 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 "/")))
+                 (and (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
+       `(("data-generators-src"
+          ,(let ((version "0.1.2"))
+             (origin
+               (method url-fetch)
+               (uri (string-append "https://github.com/clojure"
+                                   "/data.generators/archive/data.generators-"
+                                   version ".tar.gz"))
+               (sha256
+                (base32
+                 "0kki093jp4ckwxzfnw8ylflrfqs8b1i1wi9iapmwcsy328dmgzp1"))
+               (modules '((guix build utils)
+                          (ice-9 ftw)))
+               (snippet remove-archives))))
+         ("java-classpath-src"
+          ,(let ((version "0.2.3"))
+             (origin
+               (method url-fetch)
+               (uri
+                (string-append "https://github.com/clojure"
+                               "/java.classpath/archive/java.classpath-"
+                               version ".tar.gz"))
+               (sha256
+                (base32
+                 "0sjymly9xh1lkvwn5ygygpsfwz4dabblnlq0c9bx76rkvq62fyng"))
+               (modules '((guix build utils)))
+               (snippet remove-archives))))
+         ("test-check-src"
+          ,(let ((version "0.9.0"))
+             (origin
+               (method url-fetch)
+               (uri
+                (string-append "https://github.com/clojure"
+                               "/test.check/archive/test.check-"
+                               version ".tar.gz"))
+               (sha256
+                (base32
+                 "0p0mnyhr442bzkz0s4k5ra3i6l5lc7kp6ajaqkkyh4c2k5yck1md"))
+               (modules '((guix build utils)))
+               (snippet remove-archives))))
+         ("test-generative-src"
+          ,(let ((version "0.5.2"))
+             (origin
+               (method url-fetch)
+               (uri (string-append "https://github.com/clojure"
+                                   "/test.generative/archive/test.generative-"
+                                   version ".tar.gz"))
+               (sha256
+                (base32
+                 "1pjafy1i7yblc7ixmcpfq1lfbyf3jaljvkgrajn70sws9xs7a9f8"))
+               (modules '((guix build utils)))
+               (snippet remove-archives))))
+         ("tools-namespace-src"
+          ,(let ((version "0.2.11"))
+             (origin
+               (method url-fetch)
+               (uri (string-append "https://github.com/clojure"
+                                   "/tools.namespace/archive/tools.namespace-"
+                                   version ".tar.gz"))
+               (sha256
+                (base32
+                 "10baak8v0hnwz2hr33bavshm7y49mmn9zsyyms1dwjz45p5ymhy0"))
+               (modules '((guix build utils)))
+               (snippet remove-archives))))
+         ("tools-reader-src"
+          ,(let ((version "0.10.0"))
+             (origin
+               (method url-fetch)
+               (uri
+                (string-append "https://github.com/clojure"
+                               "/tools.reader/archive/tools.reader-"
+                               version ".tar.gz"))
+               (sha256
+                (base32
+                 "09i3lzbhr608h76mhdjm3932gg9xi8sflscla3c5f0v1nkc28cnr"))
+               (modules '((guix build utils)))
+               (snippet remove-archives))))))
+      (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 under APL2.0
+      ;; src/clj/repl.clj is licensed under 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 ant
   (package
     (name "ant")
-- 
2.9.2


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* Re: [PATCH] gnu: Add clojure.
  2016-07-27  6:47           ` Alex Vong
@ 2016-08-15 12:20             ` Ricardo Wurmus
  2016-08-16 13:28               ` Alex Vong
  0 siblings, 1 reply; 18+ messages in thread
From: Ricardo Wurmus @ 2016-08-15 12:20 UTC (permalink / raw)
  To: Alex Vong; +Cc: guix-devel

[-- Attachment #1: Type: text/plain, Size: 283 bytes --]


Thanks for the patch.  I went through it and tried to simplify it where
possible.

- removed unused module imports
- merged some procedures
- wrote an abstraction for submodules
- changed comment style where necessary

All proposed changes relative to your patch can be seen here:


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: clojure-changes.diff --]
[-- Type: text/x-patch, Size: 10600 bytes --]

diff --git a/gnu/packages/java.scm b/gnu/packages/java.scm
index 5d36574..2f6d297 100644
--- a/gnu/packages/java.scm
+++ b/gnu/packages/java.scm
@@ -143,10 +143,18 @@ is implemented.")
               license:lgpl2.1+))))
 
 (define-public clojure
-  (let ((remove-archives '(begin
-                            (for-each delete-file
-                                      (find-files "./" ".*\\.(jar|zip)"))
-                            #t)))
+  (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.8.0")
@@ -164,8 +172,6 @@ is implemented.")
       (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"
@@ -173,134 +179,78 @@ is implemented.")
          (modify-phases %standard-phases
            (add-after 'unpack 'unpack-submodule-sources
              (lambda* (#:key inputs #:allow-other-keys)
-               (let ((unpack
-                      (lambda (src-name)
-                        (and (mkdir-p src-name)
-                             (with-directory-excursion src-name
-                               (zero? (system* "tar"
-                                               ;; Use xz for repacked tarball.
-                                               "--xz"
-                                               "--extract"
-                                               "--verbose"
-                                               "--file" (assoc-ref inputs
-                                                                   src-name)
-                                               "--strip-components=1"))))))
-                     (copy (lambda (src-name)
-                             (copy-recursively
-                              (string-append src-name "/src/main/clojure/")
-                              "src/clj/"))))
-                 (every (lambda (src)
-                          (unpack src)
-                          (copy src))
-                        '("data-generators-src" "java-classpath-src"
-                          "test-check-src" "test-generative-src"
-                          "tools-namespace-src" "tools-reader-src")))))
-           ;;; The javadoc target is not built by default.
+               (for-each
+                (lambda (name)
+                  (mkdir-p name)
+                  (with-directory-excursion name
+                    (or (zero? (system* "tar"
+                                        ;; Use xz for repacked tarball.
+                                        "--xz"
+                                        "--extract"
+                                        "--verbose"
+                                        "--file" (assoc-ref inputs name)
+                                        "--strip-components=1"))
+                        (error "failed to unpack tarball" name)))
+                  (copy-recursively (string-append name "/src/main/clojure/")
+                                    "src/clj/"))
+                '("data-generators-src"
+                  "java-classpath-src"
+                  "test-check-src"
+                  "test-generative-src"
+                  "tools-namespace-src"
+                  "tools-reader-src"))
+               #t))
+           ;; The javadoc target is not built by default.
            (add-after 'build 'build-doc
              (lambda _
                (zero? (system* "ant" "javadoc"))))
-           ;;; Needed since no install target is provided.
+           ;; 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/")))
-                 ;; Do not install clojure.jar to avoid collisions.
+                 ;; Install versioned to avoid collisions.
                  (install-file (string-append "clojure-" ,version ".jar")
                                java-dir)
                  #t)))
-           ;;; Needed since no install-doc target is provided.
+           ;; 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 "/")))
-                 (and (copy-recursively "doc/clojure" doc-dir)
-                      (copy-recursively "target/javadoc/"
-                                        (string-append doc-dir "javadoc/")))
+                 (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 "./")))
+                           (find-files "." ".*\\.(html|markdown|md|txt)"))
                  #t))))))
       ;; The native-inputs below are needed to run the tests.
       (native-inputs
        `(("data-generators-src"
-          ,(let ((version "0.1.2"))
-             (origin
-               (method url-fetch)
-               (uri (string-append "https://github.com/clojure"
-                                   "/data.generators/archive/data.generators-"
-                                   version ".tar.gz"))
-               (sha256
-                (base32
-                 "0kki093jp4ckwxzfnw8ylflrfqs8b1i1wi9iapmwcsy328dmgzp1"))
-               (modules '((guix build utils)
-                          (ice-9 ftw)))
-               (snippet remove-archives))))
+          ,(submodule "data.generators/archive/data.generators-"
+                      "0.1.2"
+                      "0kki093jp4ckwxzfnw8ylflrfqs8b1i1wi9iapmwcsy328dmgzp1"))
          ("java-classpath-src"
-          ,(let ((version "0.2.3"))
-             (origin
-               (method url-fetch)
-               (uri
-                (string-append "https://github.com/clojure"
-                               "/java.classpath/archive/java.classpath-"
-                               version ".tar.gz"))
-               (sha256
-                (base32
-                 "0sjymly9xh1lkvwn5ygygpsfwz4dabblnlq0c9bx76rkvq62fyng"))
-               (modules '((guix build utils)))
-               (snippet remove-archives))))
+          ,(submodule "java.classpath/archive/java.classpath-"
+                      "0.2.3"
+                      "0sjymly9xh1lkvwn5ygygpsfwz4dabblnlq0c9bx76rkvq62fyng"))
          ("test-check-src"
-          ,(let ((version "0.9.0"))
-             (origin
-               (method url-fetch)
-               (uri
-                (string-append "https://github.com/clojure"
-                               "/test.check/archive/test.check-"
-                               version ".tar.gz"))
-               (sha256
-                (base32
-                 "0p0mnyhr442bzkz0s4k5ra3i6l5lc7kp6ajaqkkyh4c2k5yck1md"))
-               (modules '((guix build utils)))
-               (snippet remove-archives))))
+          ,(submodule "test.check/archive/test.check-"
+                      "0.9.0"
+                      "0p0mnyhr442bzkz0s4k5ra3i6l5lc7kp6ajaqkkyh4c2k5yck1md"))
          ("test-generative-src"
-          ,(let ((version "0.5.2"))
-             (origin
-               (method url-fetch)
-               (uri (string-append "https://github.com/clojure"
-                                   "/test.generative/archive/test.generative-"
-                                   version ".tar.gz"))
-               (sha256
-                (base32
-                 "1pjafy1i7yblc7ixmcpfq1lfbyf3jaljvkgrajn70sws9xs7a9f8"))
-               (modules '((guix build utils)))
-               (snippet remove-archives))))
+          ,(submodule "test.generative/archive/test.generative-"
+                      "0.5.2"
+                      "1pjafy1i7yblc7ixmcpfq1lfbyf3jaljvkgrajn70sws9xs7a9f8"))
          ("tools-namespace-src"
-          ,(let ((version "0.2.11"))
-             (origin
-               (method url-fetch)
-               (uri (string-append "https://github.com/clojure"
-                                   "/tools.namespace/archive/tools.namespace-"
-                                   version ".tar.gz"))
-               (sha256
-                (base32
-                 "10baak8v0hnwz2hr33bavshm7y49mmn9zsyyms1dwjz45p5ymhy0"))
-               (modules '((guix build utils)))
-               (snippet remove-archives))))
+          ,(submodule "tools.namespace/archive/tools.namespace-"
+                      "0.2.11"
+                      "10baak8v0hnwz2hr33bavshm7y49mmn9zsyyms1dwjz45p5ymhy0"))
          ("tools-reader-src"
-          ,(let ((version "0.10.0"))
-             (origin
-               (method url-fetch)
-               (uri
-                (string-append "https://github.com/clojure"
-                               "/tools.reader/archive/tools.reader-"
-                               version ".tar.gz"))
-               (sha256
-                (base32
-                 "09i3lzbhr608h76mhdjm3932gg9xi8sflscla3c5f0v1nkc28cnr"))
-               (modules '((guix build utils)))
-               (snippet remove-archives))))))
+          ,(submodule "tools.reader/archive/tools.reader-"
+                      "0.10.0"
+                      "09i3lzbhr608h76mhdjm3932gg9xi8sflscla3c5f0v1nkc28cnr"))))
       (home-page "https://clojure.org/")
       (synopsis "Lisp dialect running on the JVM")
       (description "Clojure is a dynamic, general-purpose programming language,

[-- Attachment #3: Type: text/plain, Size: 50 bytes --]


Here’s a new patch incorporating the changes:


[-- Attachment #4: 0001-gnu-Add-clojure.patch --]
[-- Type: text/x-patch, Size: 7395 bytes --]

From f5d1a26196c1599647f85768b46a53a64eb0f45c Mon Sep 17 00:00:00 2001
From: Alex Vong <alexvong1995@gmail.com>
Date: Tue, 5 Jul 2016 16:24:20 +0800
Subject: [PATCH] gnu: Add clojure.

* gnu/packages/java.scm (clojure): New variable.
---
 gnu/packages/java.scm | 136 ++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 136 insertions(+)

diff --git a/gnu/packages/java.scm b/gnu/packages/java.scm
index e821607..2f6d297 100644
--- a/gnu/packages/java.scm
+++ b/gnu/packages/java.scm
@@ -142,6 +142,142 @@ is implemented.")
               license:mpl2.0
               license:lgpl2.1+))))
 
+(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.8.0")
+      (source
+       (origin
+         (method url-fetch)
+         (uri
+          (string-append "http://repo1.maven.org/maven2/org/clojure/clojure/"
+                         version "/clojure-" version ".zip"))
+         (sha256
+          (base32 "1nip095fz5c492sw15skril60i1vd21ibg6szin4jcvyy3xr6cym"))
+         (modules '((guix build utils)))
+         (snippet remove-archives)))
+      (build-system ant-build-system)
+      (arguments
+       `(#:modules ((guix build ant-build-system)
+                    (guix build utils)
+                    (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
+                    (or (zero? (system* "tar"
+                                        ;; Use xz for repacked tarball.
+                                        "--xz"
+                                        "--extract"
+                                        "--verbose"
+                                        "--file" (assoc-ref inputs name)
+                                        "--strip-components=1"))
+                        (error "failed to unpack tarball" name)))
+                  (copy-recursively (string-append name "/src/main/clojure/")
+                                    "src/clj/"))
+                '("data-generators-src"
+                  "java-classpath-src"
+                  "test-check-src"
+                  "test-generative-src"
+                  "tools-namespace-src"
+                  "tools-reader-src"))
+               #t))
+           ;; The javadoc target is not built by default.
+           (add-after 'build 'build-doc
+             (lambda _
+               (zero? (system* "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)
+                           (find-files "." ".*\\.(html|markdown|md|txt)"))
+                 #t))))))
+      ;; The native-inputs below are needed to run the tests.
+      (native-inputs
+       `(("data-generators-src"
+          ,(submodule "data.generators/archive/data.generators-"
+                      "0.1.2"
+                      "0kki093jp4ckwxzfnw8ylflrfqs8b1i1wi9iapmwcsy328dmgzp1"))
+         ("java-classpath-src"
+          ,(submodule "java.classpath/archive/java.classpath-"
+                      "0.2.3"
+                      "0sjymly9xh1lkvwn5ygygpsfwz4dabblnlq0c9bx76rkvq62fyng"))
+         ("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"))
+         ("tools-reader-src"
+          ,(submodule "tools.reader/archive/tools.reader-"
+                      "0.10.0"
+                      "09i3lzbhr608h76mhdjm3932gg9xi8sflscla3c5f0v1nkc28cnr"))))
+      (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 under APL2.0
+      ;; src/clj/repl.clj is licensed under 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 ant
   (package
     (name "ant")
-- 
2.9.2


[-- Attachment #5: Type: text/plain, Size: 32 bytes --]


What do you think?

~~ Ricardo

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* Re: [PATCH] gnu: Add clojure.
  2016-08-15 12:20             ` Ricardo Wurmus
@ 2016-08-16 13:28               ` Alex Vong
  2016-08-16 18:45                 ` Ricardo Wurmus
  0 siblings, 1 reply; 18+ messages in thread
From: Alex Vong @ 2016-08-16 13:28 UTC (permalink / raw)
  To: Ricardo Wurmus; +Cc: guix-devel

[-- Attachment #1: Type: text/plain, Size: 2117 bytes --]

Hi Ricardo,

Thanks for the review too. The changes looks good to me, excepts that it
seems 'find-files' will find all files with name matching the regex
recursively, but `scandir' will only list the files on the 1st
level. Should we change 'find-files so that it supports the concept of
depth as well?

Also, I realize there is a typo in my original patch. It should be
'under' instead of 'under under' in the comment.

Here is the changes I make:

1 file changed, 8 insertions(+), 3 deletions(-)
gnu/packages/java.scm | 11 ++++++++---

modified   gnu/packages/java.scm
@@ -172,6 +172,8 @@ is implemented.")
       (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"
@@ -223,7 +225,10 @@ is implemented.")
                  (copy-recursively "target/javadoc/"
                                    (string-append doc-dir "javadoc/"))
                  (for-each (cut install-file <> doc-dir)
-                           (find-files "." ".*\\.(html|markdown|md|txt)"))
+                           (filter (cut string-match
+                                     ".*\\.(html|markdown|md|txt)"
+                                     <>)
+                                   (scandir "./")))
                  #t))))))
       ;; The native-inputs below are needed to run the tests.
       (native-inputs
@@ -269,8 +274,8 @@ 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 under APL2.0
-      ;; src/clj/repl.clj is licensed under under CPL1.0
+      ;; 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


Here is the whole patch:


[-- Attachment #2: 0001-gnu-Add-clojure.patch --]
[-- Type: text/x-diff, Size: 7757 bytes --]

From 8c0bdc35a168d6c1102ba81a6f26c847bb47c47e Mon Sep 17 00:00:00 2001
From: Alex Vong <alexvong1995@gmail.com>
Date: Tue, 5 Jul 2016 16:24:20 +0800
Subject: [PATCH] gnu: Add clojure.

* gnu/packages/java.scm (clojure): New variable.
---
 gnu/packages/java.scm | 141 ++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 141 insertions(+)

diff --git a/gnu/packages/java.scm b/gnu/packages/java.scm
index e821607..3e0b034 100644
--- a/gnu/packages/java.scm
+++ b/gnu/packages/java.scm
@@ -142,6 +142,147 @@ is implemented.")
               license:mpl2.0
               license:lgpl2.1+))))
 
+(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.8.0")
+      (source
+       (origin
+         (method url-fetch)
+         (uri
+          (string-append "http://repo1.maven.org/maven2/org/clojure/clojure/"
+                         version "/clojure-" version ".zip"))
+         (sha256
+          (base32 "1nip095fz5c492sw15skril60i1vd21ibg6szin4jcvyy3xr6cym"))
+         (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
+                    (or (zero? (system* "tar"
+                                        ;; Use xz for repacked tarball.
+                                        "--xz"
+                                        "--extract"
+                                        "--verbose"
+                                        "--file" (assoc-ref inputs name)
+                                        "--strip-components=1"))
+                        (error "failed to unpack tarball" name)))
+                  (copy-recursively (string-append name "/src/main/clojure/")
+                                    "src/clj/"))
+                '("data-generators-src"
+                  "java-classpath-src"
+                  "test-check-src"
+                  "test-generative-src"
+                  "tools-namespace-src"
+                  "tools-reader-src"))
+               #t))
+           ;; The javadoc target is not built by default.
+           (add-after 'build 'build-doc
+             (lambda _
+               (zero? (system* "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
+       `(("data-generators-src"
+          ,(submodule "data.generators/archive/data.generators-"
+                      "0.1.2"
+                      "0kki093jp4ckwxzfnw8ylflrfqs8b1i1wi9iapmwcsy328dmgzp1"))
+         ("java-classpath-src"
+          ,(submodule "java.classpath/archive/java.classpath-"
+                      "0.2.3"
+                      "0sjymly9xh1lkvwn5ygygpsfwz4dabblnlq0c9bx76rkvq62fyng"))
+         ("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"))
+         ("tools-reader-src"
+          ,(submodule "tools.reader/archive/tools.reader-"
+                      "0.10.0"
+                      "09i3lzbhr608h76mhdjm3932gg9xi8sflscla3c5f0v1nkc28cnr"))))
+      (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 ant
   (package
     (name "ant")
-- 
2.9.2


[-- Attachment #3: Type: text/plain, Size: 14 bytes --]


Cheers,
Alex

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* Re: [PATCH] gnu: Add clojure.
  2016-08-16 13:28               ` Alex Vong
@ 2016-08-16 18:45                 ` Ricardo Wurmus
  2016-08-16 18:56                   ` Pjotr Prins
  0 siblings, 1 reply; 18+ messages in thread
From: Ricardo Wurmus @ 2016-08-16 18:45 UTC (permalink / raw)
  To: Alex Vong; +Cc: guix-devel


Alex Vong <alexvong1995@gmail.com> writes:

> Thanks for the review too. The changes looks good to me, excepts that it
> seems 'find-files' will find all files with name matching the regex
> recursively, but `scandir' will only list the files on the 1st
> level.

Ah, I didn’t notice that this is what you were trying to do there.
Using “scandir” is fine then.

> Also, I realize there is a typo in my original patch. It should be
> 'under' instead of 'under under' in the comment.

Excellent!  Pushed to master as
8293b116e64f543848f4845723208973aeb993f9.  Thank you for your
perseverance!

~~ Ricardo

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH] gnu: Add clojure.
  2016-08-16 18:45                 ` Ricardo Wurmus
@ 2016-08-16 18:56                   ` Pjotr Prins
  0 siblings, 0 replies; 18+ messages in thread
From: Pjotr Prins @ 2016-08-16 18:56 UTC (permalink / raw)
  To: Ricardo Wurmus; +Cc: guix-devel

On Tue, Aug 16, 2016 at 08:45:17PM +0200, Ricardo Wurmus wrote:
> 
> Alex Vong <alexvong1995@gmail.com> writes:
> 
> > Thanks for the review too. The changes looks good to me, excepts that it
> > seems 'find-files' will find all files with name matching the regex
> > recursively, but `scandir' will only list the files on the 1st
> > level.
> 
> Ah, I didn’t notice that this is what you were trying to do there.
> Using “scandir” is fine then.
> 
> > Also, I realize there is a typo in my original patch. It should be
> > 'under' instead of 'under under' in the comment.
> 
> Excellent!  Pushed to master as
> 8293b116e64f543848f4845723208973aeb993f9.  Thank you for your
> perseverance!

Awesome. Another compiler gone in!

-- 

^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2016-08-16 18:57 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-06 12:54 [PATCH] gnu: Add clojure Alex Vong
2016-07-13 15:49 ` Ricardo Wurmus
2016-07-14 13:22   ` Alex Vong
2016-07-24 21:15     ` Ricardo Wurmus
2016-07-26 12:45       ` Alex Vong
2016-07-26 20:00         ` Ricardo Wurmus
2016-07-27  6:47           ` Alex Vong
2016-08-15 12:20             ` Ricardo Wurmus
2016-08-16 13:28               ` Alex Vong
2016-08-16 18:45                 ` Ricardo Wurmus
2016-08-16 18:56                   ` Pjotr Prins
  -- strict thread matches above, loose matches on Subject: below --
2016-02-24 20:46 Federico Beffa
2016-02-26 11:56 ` Alex Vong
2016-02-27  8:27   ` Federico Beffa
2016-02-27 11:51   ` Ricardo Wurmus
2016-02-24  5:03 Alex Vong
2016-02-24 11:33 ` Ricardo Wurmus
2016-02-24 15:45   ` Alex Vong

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).