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,