(use-modules (guix) (guix build-system ant) (guix licenses) (gnu packages base) (gnu packages java)) (define (apache-commons-url projname version) ; todo: add option for passing the archive basename (default: projname) (let ((basename projname)) (string-append "https://archive.apache.org/dist/commons/" projname "/source/" "commons-" basename "-" version "-src.tar.gz"))) ; todo: how to use these as a phase, like ; (replace 'install install-jars) ; (add-after 'build build-javadoc) (define* (install-jars #:key outputs #:allow-other-keys) (let ((share (string-append (assoc-ref outputs "out") "/share/java"))) (for-each (λ (f) (install-file f share)) (find-files "." "\\.jar2$")))) (define* (build-javadoc #:key (make-flags '()) #:allow-other-keys) (zero? (apply system* `("ant" "javadoc" ,@make-flags)))) ;(define* (install-javadoc #:key outputs #:allow-other-keys) ; (let ((docs (string-append (assoc-ref outputs "doc") ; "/share/doc/" ,name "-" ,version "/"))) ; (mkdir-p docs) ; (copy-recursively "target/apidocs" docs) ; )) ;(define-public java-commons-io-2.5 (package (name "java-commons-io") (version "2.5") (source (origin (method url-fetch) (uri (apache-commons-url "io" version)) (sha256 (base32 "0q5y41jrcjvx9hzs47x5kdhnasdy6rm4bzqd2jxl02w717m7a7v3")))) (build-system ant-build-system) (outputs '("out" "doc")) (arguments `(#:test-target "test" #:phases (modify-phases %standard-phases (add-after 'unpack 'symlink-junit.jar (lambda* (#:key inputs #:allow-other-keys) (let ((junit (assoc-ref inputs "java-junit")) (junit-version "4.12")) ; from build.xml (mkdir-p "lib") (symlink (string-append junit "/share/java/junit.jar") (string-append "lib/junit-" junit-version ".jar"))) )) (add-after 'build 'build-javadoc ;build-javadoc) (lambda* (#:key (make-flags '()) #:allow-other-keys) (zero? (apply system* `("ant" "javadoc" ,@make-flags))))) (replace 'install ;install-jars) (lambda* (#:key outputs #:allow-other-keys) (let ((share (string-append (assoc-ref outputs "out") "/share/java"))) (for-each (λ (f) (install-file f share)) (find-files "target" "\\.jar$"))))) ; todo: install poms for maven (add-after 'install 'install-doc ;install-javadoc) (lambda* (#:key outputs #:allow-other-keys) (let ((docs (string-append (assoc-ref outputs "doc") "/share/doc/" ,name "-" ,version "/"))) (mkdir-p docs) (copy-recursively "target/apidocs" docs) ))) ))) (native-inputs `(("java-junit" ,java-junit) ("(java-hamcrest-core" ,java-hamcrest-core))) (home-page "http://commons.apache.org/io/") (synopsis "Common useful IO related classes") (description "Commons-IO contains utility classes, stream implementations, file filters and endian classes.") (license asl2.0) );) ;(define-public java-commons-cli-2.5 (package (name "java-commons-cli") (version "1.3.1") (source (origin (method url-fetch) (uri (apache-commons-url "cli" version)) (sha256 (base32 "1fkjn552i12vp3xxk21ws4p70fi0lyjm004vzxsdaz7gdpgyxxyl")))) (build-system ant-build-system) ; todo: javadoc (arguments ; commons-cli does not provida a proper build.xml but seems to require ; maven for building `(#:jar-name (string-append "commons-cli-" ,version ".jar") #:phases (modify-phases %standard-phases ; todo: install poms for maven (delete 'check)))) (native-inputs `(("java-junit" ,java-junit))) (home-page "http://commons.apache.org/cli/") (synopsis "parsing command line options") (description "Commons-CLI library provides an API for parsing command line options passed to programs. It's also able to print help messages detailing the options available for a command line tool.") (license asl2.0) );) (package (name "java-commons-codec") (version "1.10") (source (origin (method url-fetch) (uri (apache-commons-url "codec" version)) (sha256 (base32 "1w9qg30y4s0x8gnmr2fgj4lyplfn788jqxbcz27lf5kbr6n8xr65")))) (build-system ant-build-system) (outputs '("out" "doc")) (arguments ; commons-cli does not provida a proper build.xml but seems to require ; maven for building `(#:test-target "test" #:phases (modify-phases %standard-phases (delete 'check) (add-after 'build 'build-javadoc ;build-javadoc) (lambda* (#:key (make-flags '()) #:allow-other-keys) (zero? (apply system* `("ant" "javadoc" ,@make-flags))))) (replace 'install ;install-jars) (lambda* (#:key outputs #:allow-other-keys) (let ((share (string-append (assoc-ref outputs "out") "/share/java"))) (for-each (λ (f) (install-file f share)) (find-files "dist" "\\.jar$"))))) ; todo: install poms for maven (add-after 'install 'install-doc ;install-javadoc) (lambda* (#:key outputs #:allow-other-keys) (let ((docs (string-append (assoc-ref outputs "doc") "/share/doc/" ,name "-" ,version "/"))) (mkdir-p docs) (copy-recursively "dist/docs/api" docs) ))) ))) (native-inputs `(("java-junit" ,java-junit))) (home-page "http://commons.apache.org/codec/") (synopsis "Common encoders and decoders such as Base64, Hex, Phonetic and URLs") (description "") (license asl2.0) );) ;(define-public java-commons-lang-2.6 (package (name "java-commons-lang") ; note: current release is lang3-3.4 (mind the different archive name) (version "2.6") (source (origin (method url-fetch) (uri (apache-commons-url "lang" version)) (sha256 (base32 "1mxwagqadzx1b2al7i0z1v0r235aj2njdyijf02szq0vhmqrfiq5")))) (build-system ant-build-system) (outputs '("out" "doc")) (arguments `(#:test-target "test" #:phases (modify-phases %standard-phases (delete 'check) ; todo: make tests work (add-after 'unpack 'symlink-junit.jar (lambda* (#:key inputs #:allow-other-keys) (let ((junit (assoc-ref inputs "java-junit")) (junit-version "4.12")) ; from build.xml (mkdir-p "lib") (symlink (string-append junit "/share/java/junit.jar") (string-append "lib/junit-" junit-version ".jar"))) )) (add-before 'check 'set-tzdir (lambda* (#:key inputs #:allow-other-keys) (setenv "TZDIR" (string-append (assoc-ref inputs "tzdata") "/share/zoneinfo")) #t)) (add-after 'build 'build-javadoc ;build-javadoc) (lambda* (#:key (make-flags '()) #:allow-other-keys) (zero? (apply system* `("ant" "javadoc" ,@make-flags))))) (replace 'install ;install-jars) (lambda* (#:key outputs #:allow-other-keys) (let ((share (string-append (assoc-ref outputs "out") "/share/java"))) (for-each (λ (f) (install-file f share)) (find-files "target" "\\.jar$"))))) ; todo: install poms for maven (add-after 'install 'install-doc ;install-javadoc) (lambda* (#:key outputs #:allow-other-keys) (let ((docs (string-append (assoc-ref outputs "doc") "/share/doc/" ,name "-" ,version "/"))) (mkdir-p docs) (copy-recursively "target/apidocs" docs) ))) ))) (native-inputs `(("java-junit" ,java-junit) ; The test-suite tests some timezone dependant functions, ; thus tzdata needs to be installed. ("tzdata", tzdata) ;("(java-hamcrest-core" ,java-hamcrest-core) )) (home-page "http://commons.apache.org/lang/") (synopsis "Common useful IO related classes") (description "Commons-IO contains utility classes, stream implementations, file filters and endian classes.") (license asl2.0) );) ;(define-public java-commons-logging-2.6 (package (name "java-commons-logging") (version "1.2") (source (origin (method url-fetch) (uri (apache-commons-url "logging" version)) (sha256 (base32 "10bwcy5w8d7y39n0krlwhnp8ds3kj5zhmzj0zxnkw0qdlsjmsrj9")))) (build-system ant-build-system) (outputs '("out" "doc")) (arguments `(#:test-target "test" #:build-target "compile" #:phases (modify-phases %standard-phases (delete 'check) ; todo: make tests work (add-after 'unpack 'symlink-junit.jar (lambda* (#:key inputs #:allow-other-keys) (let ((junit (assoc-ref inputs "java-junit")) (junit-version "4.12")) ; from build.xml (mkdir-p "lib") (symlink (string-append junit "/share/java/junit.jar") (string-append "lib/junit-" junit-version ".jar"))) )) (add-after 'build 'build-javadoc ;build-javadoc) (lambda* (#:key (make-flags '()) #:allow-other-keys) (zero? (apply system* `("ant" "javadoc" ,@make-flags))))) (replace 'install ;install-jars) (lambda* (#:key outputs #:allow-other-keys) (let ((share (string-append (assoc-ref outputs "out") "/share/java"))) (for-each (λ (f) (install-file f share)) (find-files "target" "\\.jar$"))))) ; todo: install poms for maven (add-after 'install 'install-doc ;install-javadoc) (lambda* (#:key outputs #:allow-other-keys) (let ((docs (string-append (assoc-ref outputs "doc") "/share/doc/" ,name "-" ,version "/"))) (mkdir-p docs) (copy-recursively "target/apidocs" docs) ))) ))) (native-inputs `(("java-junit" ,java-junit) ;avalon, ;("(java-hamcrest-core" ,java-hamcrest-core) )) (home-page "http://commons.apache.org/logging/") (synopsis "Common useful IO related classes") (description "Commons-IO contains utility classes, stream implementations, file filters and endian classes.") (license asl2.0) );)