From mboxrd@z Thu Jan 1 00:00:00 1970 From: Roel Janssen Subject: Re: [PATCH] gnu: Add xz-java. Date: Fri, 01 Apr 2016 13:25:52 +0200 Message-ID: <87wpoh1sfz.fsf@gnu.org> References: <87y48yxrew.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:35196) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1alxD0-0004Ia-BW for guix-devel@gnu.org; Fri, 01 Apr 2016 07:25:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1alxCv-0003jy-G0 for guix-devel@gnu.org; Fri, 01 Apr 2016 07:25:46 -0400 In-reply-to: List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org To: Ricardo Wurmus Cc: guix-devel@gnu.org --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-gnu-Add-xz-java.patch >From eb4c2cd850626aa6fc88f355964ec4b7f74a2add Mon Sep 17 00:00:00 2001 From: Roel Janssen Date: Fri, 1 Apr 2016 13:06:21 +0200 Subject: [PATCH] gnu: Add xz-java. * gnu/packages/java.scm (xz-java): New variable. --- gnu/packages/java.scm | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/gnu/packages/java.scm b/gnu/packages/java.scm index 9b6a647..8df1b73 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,32 @@ 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. + #:jar-name "xz-1.5.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))) -- 2.5.5 --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Hello Ricardo, Ricardo Wurmus writes: >> (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. I wanted to unpack in a subdirectory ("source"). I see your solution leaves the unpack phase alone and simply backs up a directory so the next phase will work well. Your solution seems better than mine, so thanks for the suggestion! I applied your solution in the new version of the patch. >> + (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. I agree. >> + (propagated-inputs >> + `(("icedtea" ,icedtea "jdk"))) > > I think we should avoid propagating the JDK (or even the JRE). Err, you are right. This was probably a leftover from pre-ant-build-system. >> + (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))) Your version doesn't override the unpack and install phases. That's really good. One minor detail is the filename of the jar. I renamed it to "xz-1.5.jar", which I think is the "standard" file naming scheme for our Java packages. Thank you for providing the practical example of how to package more efficiently. I tested your version with the file naming change, and it works (as expected). I attached the new version of this patch, which is your provided example, with a minor change in #:jar-name. Thanks! Kind regards, Roel --=-=-=--