diff options
Diffstat (limited to 'gnu/packages/java.scm')
-rw-r--r-- | gnu/packages/java.scm | 95 |
1 files changed, 77 insertions, 18 deletions
diff --git a/gnu/packages/java.scm b/gnu/packages/java.scm index f23572a55a..f48305132a 100644 --- a/gnu/packages/java.scm +++ b/gnu/packages/java.scm @@ -9,6 +9,7 @@ ;;; Copyright © 2017 Tobias Geerinckx-Rice <me@tobias.gr> ;;; Copyright © 2018 Gábor Boskovits <boskovits@gmail.com> ;;; Copyright © 2018 Chris Marusich <cmmarusich@gmail.com> +;;; Copyright © 2018 Efraim Flashner <efraim@flashner.co.il> ;;; ;;; This file is part of GNU Guix. ;;; @@ -150,7 +151,7 @@ and binary format defined in The Java Virtual Machine Specification.") #:phases (modify-phases %standard-phases (add-after 'install 'install-data - (lambda _ (zero? (system* "make" "install-data"))))))) + (lambda _ (invoke "make" "install-data")))))) (native-inputs `(("jikes" ,jikes) ("fastjar" ,fastjar) @@ -175,6 +176,7 @@ language.") (uri (string-append "mirror://sourceforge/jamvm/jamvm/" "JamVM%20" version "/jamvm-" version ".tar.gz")) + (patches (search-patches "jamvm-arm.patch")) (sha256 (base32 "06lhi03l3b0h48pc7x58bk9my2nrcf1flpmglvys3wyad6yraf36")))) @@ -212,7 +214,13 @@ JNI.") "1cg0lga887qz5iizh6mlkxp01lciymrhmp7wzxpl6zpnldxmzrjx")))) (build-system gnu-build-system) (arguments - `(#:tests? #f ; no "check" target + `(#:imported-modules ((guix build syscalls) + ,@%gnu-build-system-modules) + #:modules ((srfi srfi-1) + (guix build gnu-build-system) + (guix build utils) + (guix build syscalls)) + #:tests? #f ; no "check" target #:phases (modify-phases %standard-phases (delete 'bootstrap) @@ -245,19 +253,54 @@ JNI.") ;; Without these JamVM options the build may freeze. (substitute* "bootstrap.sh" (("^\"\\$\\{JAVACMD\\}\" " m) - (string-append m "-Xnocompact -Xnoinlining "))) + ,@(if (string-prefix? "armhf" (or (%current-system) + (%current-target-system))) + `((string-append m "-Xnocompact ")) + `((string-append m "-Xnocompact -Xnoinlining "))))) ;; Disable tests because we are bootstrapping and thus don't have ;; any of the dependencies required to build and run the tests. (substitute* "build.xml" (("depends=\"jars,test-jar\"") "depends=\"jars\"")) - (zero? (system* "bash" "bootstrap.sh" - (string-append "-Ddist.dir=" - (assoc-ref %outputs "out")))))) + (invoke "bash" "bootstrap.sh" + (string-append "-Ddist.dir=" + (assoc-ref %outputs "out"))))) + (add-after 'build 'strip-jar-timestamps ;based on ant-build-system + (lambda* (#:key outputs #:allow-other-keys) + (define (repack-archive jar) + (let* ((dir (mkdtemp! "jar-contents.XXXXXX")) + (manifest (string-append dir "/META-INF/MANIFESTS.MF"))) + (with-directory-excursion dir + (invoke "unzip" jar)) + (delete-file jar) + ;; XXX: copied from (gnu build install) + (for-each (lambda (file) + (let ((s (lstat file))) + (unless (eq? (stat:type s) 'symlink) + (utime file 0 0 0 0)))) + (find-files dir #:directories? #t)) + ;; It is important that the manifest appears first. + (with-directory-excursion dir + (let* ((files (find-files "." ".*" #:directories? #t)) + ;; To ensure that the reference scanner can + ;; detect all store references in the jars + ;; we disable compression with the "-0" option. + (command (if (file-exists? manifest) + `("zip" "-0" "-X" ,jar ,manifest + ,@files) + `("zip" "-0" "-X" ,jar ,@files)))) + (apply invoke command))))) + (for-each repack-archive + (find-files + (string-append (assoc-ref %outputs "out") "/lib") + "\\.jar$")) + #t)) (delete 'install)))) (native-inputs `(("jikes" ,jikes) - ("jamvm" ,jamvm-1-bootstrap))) + ("jamvm" ,jamvm-1-bootstrap) + ("unzip" ,unzip) + ("zip", zip))) (home-page "http://ant.apache.org") (synopsis "Build tool for Java") (description @@ -316,10 +359,10 @@ build process and its dependencies, whereas Make uses Makefile format.") Main-Class: org.eclipse.jdt.internal.compiler.batch.Main\n"))) ;; Compile it all! - (and (zero? (apply system* "jikes" - (find-files "." "\\.java$"))) - (zero? (system* "fastjar" "cvfm" - "ecj-bootstrap.jar" "manifest" "."))))) + (and (apply invoke "jikes" + (find-files "." "\\.java$")) + (invoke "fastjar" "cvfm" + "ecj-bootstrap.jar" "manifest" ".")))) (replace 'install (lambda* (#:key outputs #:allow-other-keys) (let ((share (string-append (assoc-ref outputs "out") @@ -394,7 +437,11 @@ requirement for all GNU Classpath releases after version 0.93.") args defaults)) (apply system* ,java (append - (list "-Xnocompact" "-Xnoinlining") + (list "-Xnocompact") + ,,@(if (string-prefix? "armhf" (or (%current-system) + (%current-target-system))) + '() + `((list "-Xnoinlining"))) ;; Remove "-J" prefix (map (cut string-drop <> 2) vm-args) '("org.eclipse.jdt.internal.compiler.batch.Main") @@ -453,7 +500,7 @@ the standard javac executable."))) #:phases (modify-phases %standard-phases (add-after 'install 'install-data - (lambda _ (zero? (system* "make" "install-data"))))))) + (lambda _ (invoke "make" "install-data")))))) (native-inputs `(("ecj-bootstrap" ,ecj-bootstrap) ("ecj-javac-wrapper" ,ecj-javac-wrapper) @@ -484,12 +531,20 @@ the standard javac executable."))) (for-each (lambda (tool) (with-output-to-file (string-append bin tool) (lambda _ - (format #t "#!~a/bin/sh + ,@(if (string-prefix? "armhf" (or (%current-system) + (%current-target-system))) + `((format #t "#!~a/bin/sh +~a/bin/jamvm -Xnocompact -classpath ~a/share/classpath/tools.zip \ +gnu.classpath.tools.~a.~a $@" + bash jamvm classpath tool + (if (string=? "native2ascii" tool) + "Native2ASCII" "Main"))) + `((format #t "#!~a/bin/sh ~a/bin/jamvm -Xnocompact -Xnoinlining -classpath ~a/share/classpath/tools.zip \ gnu.classpath.tools.~a.~a $@" bash jamvm classpath tool (if (string=? "native2ascii" tool) - "Native2ASCII" "Main")))) + "Native2ASCII" "Main")))))) (chmod (string-append bin tool) #o755)) (list "javah" "rmic" @@ -562,7 +617,7 @@ machine."))) (("@Override") "")) #t)) (add-after 'install 'install-data - (lambda _ (zero? (system* "make" "install-data"))))))) + (lambda _ (invoke "make" "install-data")))))) (native-inputs `(("autoconf" ,autoconf) ("automake" ,automake) @@ -1649,7 +1704,9 @@ new Date();")) (string-append "-Ddist.dir=" (assoc-ref outputs "out")))))))))) (native-inputs - `(("jdk" ,icedtea-8 "jdk"))))) + `(("jdk" ,icedtea-8 "jdk") + ("zip" ,zip) + ("unzip" ,unzip))))) ;; The 1.9.x series is the last that can be built with GCJ. The 1.10.x series ;; requires Java 8. @@ -1664,7 +1721,9 @@ new Date();")) (base32 "1k28mka0m3isy9yr8gz84kz1f3f879rwaxrd44vdn9xbfwvwk86n")))) (native-inputs - `(("jdk" ,icedtea-7 "jdk"))))) + `(("jdk" ,icedtea-7 "jdk") + ("zip" ,zip) + ("unzip" ,unzip))))) (define-public ant-apache-bcel (package |