guix-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] gnu: Add xz-java.


From: Ricardo Wurmus
Subject: Re: [PATCH] gnu: Add xz-java.
Date: Fri, 1 Apr 2016 11:42:26 +0200

Hi Roel,

> Along with the library (xz-1.5.jar), the build produces some demos that
> can be run directly with "java -jar <demo-jar-file>".  I didn't include
> those in the build because I believe it's only the library we are
> interested in here.  I don't have any other argument to leave them out,
> so if I should include the demo jar files as well, please let me know.

That’s okay.

> From dc0367cf4e3da72e1b1b68ace26216c31e0c6f6c Mon Sep 17 00:00:00 2001
> From: Roel Janssen <address@hidden>
> Date: Thu, 31 Mar 2016 23:27:26 +0200
> Subject: [PATCH] gnu: Add xz-java.

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

> diff --git a/gnu/packages/java.scm b/gnu/packages/java.scm
> index 9b6a647..be20795 100644
> --- a/gnu/packages/java.scm
> +++ b/gnu/packages/java.scm
> @@ -23,6 +23,7 @@
>    #:use-module (guix download)
>    #:use-module (guix utils)
>    #:use-module (guix build-system gnu)
> +  #:use-module (guix build-system ant)
>    #:use-module (gnu packages)
>    #:use-module (gnu packages attr)
>    #:use-module (gnu packages autotools)
> @@ -742,3 +743,42 @@ build process and its dependencies, whereas Make uses 
> Makefile format.")
>                   '("openjdk6-src")))))))
 
>  (define-public icedtea icedtea-7)
> +
> +(define-public xz-java
> +  (package
> +   (name "xz-java")
> +   (version "1.5")
> +   (source (origin
> +             (method url-fetch)
> +             (uri (string-append "http://tukaani.org/xz/";
> +                                 name "-" version ".zip"))
> +             (sha256
> +              (base32
> +               "0x6vn9dp9kxk83x2fp3394n95dk8fx9yg8jns9371iqsn0vy8ih1"))))
> +   (build-system ant-build-system)
> +   (arguments
> +    `(#:tests? #f ; There are no tests to run.
> +      #:phases
> +      (modify-phases %standard-phases
> +        (replace 'unpack
> +          (lambda _
> +            (mkdir-p "source")
> +            (chdir "source")
> +            (zero? (system* "unzip" (assoc-ref %build-inputs "source")))))

Why is this necessary?  The unpack phase can deal with zip files just
fine.

> +        (replace 'install
> +          (lambda _
> +            (let* ((out (assoc-ref %outputs "out"))
> +                   (bin (string-append out "/share/java/xz/"))
> +                   (out-file (string-append bin ,name "-" ,version ".jar")))
> +              (mkdir-p bin)
> +              (copy-file "build/jar/xz.jar" out-file)))))))

I wonder if maybe it would be better to just use a generated default
build.xml instead of replacing the install phase.

> +   (propagated-inputs
> +    `(("icedtea" ,icedtea "jdk")))

I think we should avoid propagating the JDK (or even the JRE).

> +   (native-inputs
> +    `(("unzip" ,unzip)))
> +   (home-page "http://tukaani.org/xz/java.html";)
> +   (synopsis "Implementation of XZ data compression in pure Java")
> +   (description "This library aims to be a complete implementation of XZ data
> +compression in pure Java.  Single-threaded streamed compression and
> +decompression and random access decompression have been fully implemented.")
> +   (license license:public-domain)))

Okay!

Here’s how I’d do it.  What do you think?


(define-public xz-java
  (package
   (name "xz-java")
   (version "1.5")
   (source (origin
             (method url-fetch)
             (uri (string-append "http://tukaani.org/xz/";
                                 name "-" version ".zip"))
             (sha256
              (base32
               "0x6vn9dp9kxk83x2fp3394n95dk8fx9yg8jns9371iqsn0vy8ih1"))))
   (build-system ant-build-system)
   (arguments
    `(#:tests? #f ; There are no tests to run.
      #:jar-name "xz.jar"
      #:phases
      (modify-phases %standard-phases
        ;; The unpack phase enters the "maven" directory by accident.
        (add-after 'unpack 'chdir
          (lambda _ (chdir "..") #t)))))
   (native-inputs
    `(("unzip" ,unzip)))
   (home-page "http://tukaani.org/xz/java.html";)
   (synopsis "Implementation of XZ data compression in pure Java")
   (description "This library aims to be a complete implementation of XZ data
compression in pure Java.  Single-threaded streamed compression and
decompression and random access decompression have been fully implemented.")
   (license license:public-domain)))


~~ Ricardo



reply via email to

[Prev in Thread] Current Thread [Next in Thread]