summary refs log tree commit diff
path: root/gnu/packages/java.scm
diff options
context:
space:
mode:
Diffstat (limited to 'gnu/packages/java.scm')
-rw-r--r--gnu/packages/java.scm79
1 files changed, 50 insertions, 29 deletions
diff --git a/gnu/packages/java.scm b/gnu/packages/java.scm
index 93f5bb6aff..f6d72edeea 100644
--- a/gnu/packages/java.scm
+++ b/gnu/packages/java.scm
@@ -1948,27 +1948,43 @@ designs.")
                      license:asl2.0
                      license:cpl1.0)))))
 
-(define-public javacc
+(define-public javacc-4
   (package
     (name "javacc")
-    (version "7.0.3")
+    (version "4.1")
     (source (origin
-              (method url-fetch)
-              (uri (string-append "https://github.com/javacc/javacc/"
-                                  "archive/" version ".tar.gz"))
-              (file-name (string-append "javacc-" version ".tar.gz"))
+              (method git-fetch)
+              (uri (git-reference
+                    (url "https://github.com/javacc/javacc.git")
+                    (commit "release_41")))
+              (file-name (string-append "javacc-" version "-checkout"))
               (sha256
                (base32
-                "111xc9mnmc5a6qz6x3xbhqc07y1lg2b996ggzw0hrblg42zya9xf"))))
+                "07ysav7j8r1c6h8qxrgqk6lwdp74ly0ad1935lragxml0qqc3ka0"))
+              (modules '((guix build utils)))
+              ;; delete bundled jars
+              (snippet '(begin (delete-file-recursively "lib") #t))))
     (build-system ant-build-system)
+    ;; Tests fail with
+    ;; /tmp/guix-build-javacc-4.1.drv-0/source/test/javacodeLA/build.xml:60:
+    ;; JAVACODE failed
     (arguments
-     `(#:test-target "test"
+     `(#:tests? #f
        #:phases
        (modify-phases %standard-phases
-         (add-after 'unpack 'delete-bundled-libs
+         ;; Delete tests to avoid build failure (we don't run them anyway).
+         (add-after 'unpack 'delete-tests
            (lambda _
-             (delete-file-recursively "lib") #t))
-         (replace 'install (install-jars "target")))))
+             (for-each delete-file
+                       '("src/org/javacc/JavaCCTestCase.java"
+                         "src/org/javacc/parser/ExpansionTest.java"
+                         "src/org/javacc/parser/OptionsTest.java"
+                         "src/org/javacc/jjtree/JJTreeOptionsTest.java"))
+             (for-each delete-file-recursively
+                       '("src/org/javacc/parser/test"
+                         "src/org/javacc/jjdoc/test"))
+             #t))
+         (replace 'install (install-jars "bin/lib")))))
     (home-page "https://javacc.org/")
     (synopsis "Java parser generator")
     (description "Java Compiler Compiler (JavaCC) is the most popular parser
@@ -1980,29 +1996,34 @@ as tree building (via a tool called JJTree included with JavaCC), actions,
 debugging, etc.")
     (license license:bsd-3)))
 
-(define-public javacc-4
-  (package (inherit javacc)
-    (version "4.1")
+(define-public javacc
+  (package
+    (inherit javacc-4)
+    (version "7.0.3")
     (source (origin
-              (method git-fetch)
-              (uri (git-reference
-                    (url "https://github.com/javacc/javacc.git")
-                    (commit "release_41")))
-              (file-name (string-append "javacc-" version "-checkout"))
+              (method url-fetch)
+              (uri (string-append "https://github.com/javacc/javacc/"
+                                  "archive/" version ".tar.gz"))
+              (file-name (string-append "javacc-" version ".tar.gz"))
               (sha256
                (base32
-                "07ysav7j8r1c6h8qxrgqk6lwdp74ly0ad1935lragxml0qqc3ka0"))))
-    ;; Tests fail with
-    ;; /tmp/guix-build-javacc-4.1.drv-0/source/test/javacodeLA/build.xml:60:
-    ;; JAVACODE failed
-    (arguments
-     `(#:tests? #f
+                "111xc9mnmc5a6qz6x3xbhqc07y1lg2b996ggzw0hrblg42zya9xf"))
+              (modules '((guix build utils)))
+              ;; delete bundled jars
+              (snippet '(begin (for-each delete-file-recursively
+                                         '("bootstrap" "lib"))
+                               #t))))
+    (arguments
+     `(#:make-flags ; bootstrap from javacc-4
+       (list (string-append "-Dbootstrap-jar="
+                            (assoc-ref %build-inputs "javacc")
+                            "/share/java/javacc.jar"))
+       #:test-target "test"
        #:phases
        (modify-phases %standard-phases
-         (add-after 'unpack 'delete-bundled-libs
-           (lambda _
-             (delete-file-recursively "lib") #t))
-         (replace 'install (install-jars "bin/lib")))))))
+         (replace 'install (install-jars "target")))))
+    (native-inputs
+     `(("javacc" ,javacc-4)))))
 
 ;; This is the last 3.x release of ECJ
 (define-public java-ecj-3