unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Alex Vong <alexvong1995@gmail.com>
To: Federico Beffa <beffa@ieee.org>
Cc: Guix-devel <guix-devel@gnu.org>
Subject: Re: [PATCH] gnu: Add clojure.
Date: Fri, 26 Feb 2016 19:56:08 +0800	[thread overview]
Message-ID: <87h9gvn0rr.fsf@gmail.com> (raw)
In-Reply-To: <CAKrPhPP1uPEq0uX9Q9cbkA9nYgRHiA09tC-qP9A4fYSHtOJk-Q@mail.gmail.com> (Federico Beffa's message of "Wed, 24 Feb 2016 21:46:51 +0100")

[-- 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


  reply	other threads:[~2016-02-26 11:56 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-24 20:46 [PATCH] gnu: Add clojure Federico Beffa
2016-02-26 11:56 ` Alex Vong [this message]
2016-02-27  8:27   ` Federico Beffa
2016-02-27 11:51   ` Ricardo Wurmus
  -- strict thread matches above, loose matches on Subject: below --
2016-07-06 12:54 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
2016-02-24  5:03 Alex Vong
2016-02-24 11:33 ` Ricardo Wurmus
2016-02-24 15:45   ` Alex Vong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87h9gvn0rr.fsf@gmail.com \
    --to=alexvong1995@gmail.com \
    --cc=beffa@ieee.org \
    --cc=guix-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).