afea757

Add java-cup and jflex from binary bootstraps. Fix dependent packages.

more/packages/java.scm

4545
  #:use-module (gnu packages linux)
4646
  #:use-module (gnu packages maven)
4747
  #:use-module (gnu packages perl)
48+
  #:use-module (gnu packages version-control)
4849
  #:use-module (gnu packages web)
4950
  #:use-module (gnu packages xml)
5051
  #:use-module (gnu packages xorg)

16151616
    (native-inputs
16161617
     `(("java-junit" ,java-junit)))))
16171618
1619+
(define-public java-slf4j-jdk14
1620+
  (package
1621+
    (inherit java-slf4j-api)
1622+
    (name "java-slf4j-jdk14")
1623+
    (arguments
1624+
     `(#:jar-name "slf4j-jdk14.jar"
1625+
       #:source-dir "slf4j-jdk14/src/main"
1626+
       #:test-dir "slf4j-jdk14/src/test"
1627+
       ;; Require test files from slf4j-api
1628+
       #:tests? #f))
1629+
    (inputs
1630+
     `(("java-slf4j-api" ,java-slf4j-api)))
1631+
    (native-inputs
1632+
     `(("java-junit" ,java-junit)
1633+
       ("java-hamcrest-core" ,java-hamcrest-core)))
1634+
    (synopsis "")
1635+
    (description "")))
1636+
1637+
(define-public java-log4j-over-slf4j
1638+
  (package
1639+
    (inherit java-slf4j-api)
1640+
    (name "java-log4j-over-slf4j")
1641+
    (arguments
1642+
     `(#:jar-name "log4j-over-slf4j.jar"
1643+
       #:source-dir "log4j-over-slf4j/src/main"
1644+
       #:test-dir "log4j-over-slf4j/src/test"))
1645+
    (inputs
1646+
     `(("java-slf4j-api" ,java-slf4j-api)))
1647+
    (native-inputs
1648+
     `(("java-junit" ,java-junit)
1649+
       ("java-hamcrest-core" ,java-hamcrest-core)
1650+
       ("java-slf4j-jdk14" ,java-slf4j-jdk14)))
1651+
    (synopsis "")
1652+
    (description "")))
1653+
1654+
(define-public java-jdom-for-freemarker
1655+
  (package
1656+
    (inherit java-jdom)
1657+
    (version "1.0b8")
1658+
    (source (origin
1659+
              (method url-fetch)
1660+
              (uri "http://jdom.org/dist/binary/archive/jdom-b8.tar.gz")
1661+
              (sha256
1662+
               (base32
1663+
                "1y26baiamx67zl2lkqrjd19my3vz4xbjhv9l1iylirq0fcr9v7a1"))))
1664+
    (arguments
1665+
     `(#:build-target "package"
1666+
       #:tests? #f; tests are part of the package target
1667+
       #:phases
1668+
       (modify-phases %standard-phases
1669+
         ;(add-before 'build 'remove-collections
1670+
         ;  (lambda _
1671+
         ;    (delete-file "lib/collections.jar")
1672+
         ;    #t))
1673+
         (replace 'install
1674+
           (lambda* (#:key outputs #:allow-other-keys)
1675+
             (let ((jar-dir (string-append (assoc-ref outputs "out") "/share/java")))
1676+
               (mkdir-p jar-dir)
1677+
               (install-file "build/jdom.jar" jar-dir)
1678+
               #t))))))))
1679+
16181680
(define-public java-apache-freemarker
16191681
  (package
16201682
    (name "java-apache-freemarker")

16311693
     `(#:jar-name "java-apache-freemarker.jar"
16321694
       #:source-dir "src/main/java"
16331695
       #:test-dir "src/test"
1696+
       #:tests? #f; TODO: require spring-framework-test.
16341697
       #:jdk ,icedtea-8
1698+
       ;#:test-target "test"
16351699
       #:phases
16361700
       (modify-phases %standard-phases
16371701
         (add-before 'build 'remove-unpackaged-dependencies
16381702
	   ;; TODO: package these dependencies
16391703
	   (lambda _
16401704
	     (delete-file-recursively "src/main/java/freemarker/ext/jython")
1705+
         (delete-file "src/test/java/freemarker/core/ObjectBuilderSettingsTest.java")
16411706
	     (delete-file-recursively "src/main/java/freemarker/ext/rhino")
16421707
	     ;; This class depends on javareble, a non-free package
16431708
	     (delete-file "src/main/java/freemarker/ext/beans/JRebelClassChangeNotifier.java")
16441709
	     (delete-file "src/main/java/freemarker/ext/ant/UnlinkedJythonOperationsImpl.java")
16451710
	     (delete-file "src/main/java/freemarker/template/utility/JythonRuntime.java")
16461711
	     #t))
1712+
     (add-before 'build 'update-jsp
1713+
       (lambda _
1714+
         (substitute* "src/main/java/freemarker/ext/jsp/FreeMarkerJspFactory.java"
1715+
           (("^}$")
1716+
            "@Override
1717+
public JspApplicationContext getJspApplicationContext(ServletContext c) {
1718+
  throw new UnsupportedOperationException();
1719+
}
1720+
}")
1721+
           (("package freemarker.ext.jsp;")
1722+
            "package freemarker.ext.jsp;
1723+
1724+
import javax.servlet.ServletContext;
1725+
import javax.servlet.jsp.JspApplicationContext;"))
1726+
         (substitute* "src/main/java/freemarker/ext/jsp/_FreeMarkerPageContext2.java"
1727+
           (("^}")
1728+
            "@Override
1729+
public ELContext getELContext() {
1730+
  throw new UnsupportedOperationException();
1731+
}
1732+
}")
1733+
           (("package freemarker.ext.jsp;")
1734+
            "package freemarker.ext.jsp;
1735+
1736+
import javax.el.ELContext;"))
1737+
         #t))
16471738
	 (add-before 'build 'run-javacc
16481739
	   (lambda _
16491740
	     (invoke "java" "-cp" (getenv "CLASSPATH") "javacc"

16561747
       ("java-commons-logging-minimal" ,java-commons-logging-minimal)
16571748
       ("java-dom4j" ,java-dom4j)
16581749
       ("java-jaxen" ,java-jaxen)
1659-
       ("java-jdom" ,java-jdom)
1660-
       ("java-log4j-api" ,java-log4j-api)
1750+
       ("java-jdom" ,java-jdom-for-freemarker)
1751+
       ("java-log4j-over-slf4j" ,java-log4j-over-slf4j)
16611752
       ("java-slf4j-api" ,java-slf4j-api)
16621753
       ("java-spotbugs-annotations" ,java-spotbugs-annotations)
16631754
       ("java-tomcat" ,java-tomcat)
16641755
       ("java-xalan" ,java-xalan)))
16651756
    (native-inputs
1666-
     `(("javacc" ,javacc-6)))
1757+
     `(("javacc" ,javacc-6)
1758+
       ("java-commons-collections" ,java-commons-collections)
1759+
       ("java-commons-io" ,java-commons-io)
1760+
       ("java-commons-lang" ,java-commons-lang)
1761+
       ("java-guava" ,java-guava)
1762+
       ("java-hamcrest-all" ,java-hamcrest-all)
1763+
       ("java-eclipse-jetty-server" ,java-eclipse-jetty-server)
1764+
       ("java-eclipse-jetty-webapp" ,java-eclipse-jetty-webapp)
1765+
       ("java-junit" ,java-junit)))
16671766
    (home-page "https://github.com/ralfstx/minimal-json")
16681767
    (synopsis "")
16691768
    (description "")

17021801
    (arguments
17031802
     `(#:jar-name "java-hazelcast-code-generator.jar"
17041803
       #:source-dir "hazelcast-code-generator/src/main/java"
1705-
       #:test-dir "hazelcast-core-generator/src/test"
1804+
       #:tests? #f; no tests
17061805
       #:phases
17071806
       (modify-phases %standard-phases
17081807
         (add-before 'build 'copy-resources

17101809
             (copy-recursively "hazelcast-core-generator/src/main/resources"
17111810
                               "build/classes")
17121811
             #t)))))
1812+
    (inputs
1813+
     `(("java-apache-freemarker" ,java-apache-freemarker)))
17131814
    (home-page "https://hazelcast.org")
17141815
    (synopsis "")
17151816
    (description "")

17251826
     `(#:jar-name "java-hazelcast-client-protocol.jar"
17261827
       #:source-dir "hazelcast/src/main/java"
17271828
       #:test-dir "hazelcast/src/test"))
1829+
    (inputs
1830+
     `(("java-hazelcast-code-generator" ,java-hazelcast-code-generator)))
17281831
    (home-page "https://hazelcast.org")
17291832
    (synopsis "")
17301833
    (description "")

17561859
             (for-each delete-file (find-files "." "package-info.java"))
17571860
             #t)))))
17581861
    (inputs
1759-
     `(("java-jsr107" ,java-jsr107)
1862+
     `(("java-findbugs" ,java-findbugs)
1863+
       ("java-jsr107" ,java-jsr107)
17601864
       ("java-jsr305" ,java-jsr305)
17611865
       ("java-minimal-json" ,java-minimal-json)
17621866
       ("java-hazelcast-client-protocol-source" ,java-hazelcast-client-protocol-source)))

21232227
       ("java-tomcat" ,java-tomcat)))
21242228
    (description "")))
21252229
2230+
(define-public java-spring-framework-test
2231+
  (package
2232+
    (inherit java-spring-framework-core)
2233+
    (name "java-spring-framework-test")
2234+
    (arguments
2235+
     `(#:jar-name "java-spring-framework-test.jar"
2236+
       #:jdk ,icedtea-8
2237+
       #:source-dir "src/main/java"
2238+
       #:test-dir "src/test"
2239+
       #:phases
2240+
       (modify-phases %standard-phases
2241+
         (add-before 'configure 'chdir
2242+
           (lambda _
2243+
             ;; Needed because tests look for data in src/... directly.
2244+
             (chdir "spring-test")
2245+
             #t))
2246+
         (add-before 'build 'copy-resources
2247+
           (lambda _
2248+
             (copy-recursively "src/main/resources" "build/classes")
2249+
             #t))
2250+
         (add-before 'check 'copy-test-resources
2251+
           (lambda* (#:key inputs #:allow-other-keys)
2252+
             (copy-recursively "src/test/resources"
2253+
                               "build/test-classes")
2254+
             #t)))))
2255+
    (inputs
2256+
     `(("java-spring-framework-core" ,java-spring-framework-core)
2257+
       ("java-spring-framework-web" ,java-spring-framework-web)))
2258+
    (description "")))
2259+
21262260
(define-public java-lucene-core
21272261
  (package
21282262
    (name "java-lucene-core")

37093843
    (description "")
37103844
    (license license:bsd-3)))
37113845
3712-
(define-public java-jflex
3846+
(define %java-jflex-bootstrap
37133847
  (package
37143848
    (name "java-jflex")
37153849
    (version "1.6.1")
37163850
    (source (origin
37173851
              (method url-fetch)
3718-
	      ; https://github.com/jflex-de/jflex/releases/download/v1.6.1/jflex-1.6.1.tar.gz
3719-
	      (uri (string-append "https://github.com/jflex-de/jflex/releases/"
3720-
				  "download/v" version "/jflex-" version ".tar.gz"))
3852+
              (uri (string-append "http://www.jflex.de/release/jflex-" version
3853+
                                  ".tar.gz"))
37213854
              (sha256
37223855
               (base32
37233856
                "1h7q2vhb4s42g4pqz5xxxliagprray7i9krr6hyaz1mjlx7gnycq"))))
3857+
    (build-system trivial-build-system)
3858+
    ;(arguments
3859+
    ; `(#:tests? #f
3860+
    ;   #:phases
3861+
    ;   (modify-phases %standard-phases
3862+
    ;     (delete 'build)
3863+
    ;     (replace 'install
3864+
    ;       (lambda* (#:key outputs #:allow-other-keys)
3865+
    ;         (let ((java-dir (string-append (assoc-ref outputs "out") "/share/java")))
3866+
    ;           (install-file (string-append "lib/jflex-" ,version ".jar")
3867+
    ;                         java-dir)
3868+
    ;           (install-file (string-append "lib/java-cup-11a.jar")
3869+
    ;                         java-dir))
3870+
    ;         #t)))))
3871+
    (arguments
3872+
     `(#:modules ((guix build utils))
3873+
       #:builder (begin
3874+
                   (use-modules (guix build utils))
3875+
                   (let* ((source (assoc-ref %build-inputs "source"))
3876+
                          (tar (string-append
3877+
                                 (assoc-ref %build-inputs "tar")
3878+
                                 "/bin/tar"))
3879+
                          (gzip (assoc-ref %build-inputs "gzip"))
3880+
                          (output (assoc-ref %outputs "out"))
3881+
                          (java-dir (string-append output "/share/java")))
3882+
                     (mkdir-p java-dir)
3883+
                     (setenv "PATH" (string-append (getenv "PATH") ":" gzip "/bin"))
3884+
                     (invoke tar "xf" source)
3885+
                     (install-file "jflex-1.6.1/lib/jflex-1.6.1.jar" java-dir)
3886+
                     (install-file "jflex-1.6.1/lib/java-cup-11a.jar" java-dir)
3887+
                     #t))))
3888+
    (native-inputs
3889+
     `(("tar" ,tar)
3890+
       ("gzip" ,gzip)))
3891+
    (home-page "http://www.jflex.de")
3892+
    (synopsis "")
3893+
    (description "")
3894+
    (license license:bsd-3)))
3895+
3896+
(define %java-cup-bootstrap
3897+
  (package
3898+
    (name "java-cup")
3899+
    (version "11b-20160615")
3900+
    (source (origin
3901+
              (method url-fetch)
3902+
              (uri (string-append "http://www2.cs.tum.edu/projects/cup/"
3903+
                                  "releases/java-cup-bin-" version ".tar.gz"))
3904+
              (sha256
3905+
               (base32
3906+
                "1k6ycm5bpg7r2z2jprdp54s8bvaxggdxk4qmvkjw3013i1bxc09z"))))
3907+
    (build-system trivial-build-system)
3908+
    (arguments
3909+
     `(#:modules ((guix build utils))
3910+
       #:builder (begin
3911+
                   (use-modules (guix build utils))
3912+
                   (let* ((source (assoc-ref %build-inputs "source"))
3913+
                          (tar (string-append
3914+
                                 (assoc-ref %build-inputs "tar")
3915+
                                 "/bin/tar"))
3916+
                          (gzip (assoc-ref %build-inputs "gzip"))
3917+
                          (output (assoc-ref %outputs "out"))
3918+
                          (java-dir (string-append output "/share/java")))
3919+
                     (mkdir-p java-dir)
3920+
                     (chdir java-dir)
3921+
                     (setenv "PATH" (string-append (getenv "PATH") ":" gzip "/bin"))
3922+
                     (invoke tar "xf" source)))))
3923+
    (native-inputs
3924+
     `(("tar" ,tar)
3925+
       ("gzip" ,gzip)))
3926+
    (home-page "http://www2.cs.tum.edu/projects/cup/")
3927+
    (synopsis "")
3928+
    (description "")
3929+
    (license license:expat)))
3930+
3931+
(define-public java-jflex
3932+
  (package
3933+
    (name "java-jflex")
3934+
    (version "1.6.1")
3935+
    (source (origin
3936+
              (method url-fetch)
3937+
              (uri (string-append "http://www.jflex.de/release/jflex-" version
3938+
                                  ".tar.gz"))
3939+
              (sha256
3940+
               (base32
3941+
                "1h7q2vhb4s42g4pqz5xxxliagprray7i9krr6hyaz1mjlx7gnycq"))
3942+
              (modules '((guix build utils)))
3943+
              (snippet
3944+
                `(begin
3945+
                   ;; The first entry is a symlink to jflex-version
3946+
                   (delete-file "../jflex")
3947+
                   ;; Delete bundled jar archives.
3948+
                   (for-each delete-file (find-files "." ".*\\.jar"))
3949+
                   (chdir "..")
3950+
                   (rename-file "jflex-1.6.1" "jflex")
3951+
                   (chdir "jflex")
3952+
                   #t))))
37243953
    (build-system ant-build-system)
37253954
    (arguments
3726-
     `(#:jar-name "jflex.jar"
3727-
       #:jdk ,icedtea-8
3728-
       #:source-dir "src/main/java"
3729-
       #:test-dir "src/test"
3955+
     `(#:jdk ,icedtea-8
3956+
       #:test-target "test"
37303957
       #:phases
37313958
       (modify-phases %standard-phases
3732-
	 (add-before 'build 'generate-lex
3733-
	   (lambda _
3734-
	     (substitute* "src/main/jflex/LexScan.flex"
3735-
	       (("^%final.*") "")
3736-
	       (("^%column.*") "")
3737-
	       (("^%inputstream.*") "")
3738-
	       (("^//.*") "")
3739-
	       (("^/\\*.*\\*/") "")
3740-
	       (("^%eofclose.*") ""))
3741-
	     (invoke "java" "JLex.Main" "src/main/jflex/LexScan.flex")
3742-
	     (copy-file "src/main/jflex/LexScan.flex.java"
3743-
			"src/main/java/jflex/LexScan.java")
3744-
	     #t)))))
3959+
         (replace 'install
3960+
           (install-jars ".")))))
37453961
    (native-inputs
3746-
     `(("java-jlex" ,java-jlex)))
3962+
     `(("%java-jflex-bootstrap" ,%java-jflex-bootstrap)
3963+
       ("java-junit" ,java-junit)))
37473964
    (home-page "https://jflex.de")
37483965
    (synopsis "")
37493966
    (description "")

37844001
37854002
(define-public java-cup
37864003
  (package
4004+
    (inherit java-cup-runtime)
37874005
    (name "java-cup")
3788-
    (version "11b")
3789-
    (source (origin
3790-
	      (method url-fetch)
3791-
	      (uri "http://www2.cs.tum.edu/projects/cup/releases/java-cup-src-11b-20160615.tar.gz")
3792-
              (sha256
3793-
               (base32
3794-
                "09xigxm7b44hz79xhqpfykvjrk4q90p33j2l07w69izx9sn0y42b"))
3795-
              ;(method git-fetch)
3796-
              ;(uri (git-reference
3797-
              ;       (url "https://versioncontrolseidl.in.tum.de/parsergenerators/cup")
3798-
              ;       (commit "fe729fe8c27441f046dab19135a38b9dde4c4e5e")))
3799-
              ;(sha256
3800-
              ; (base32
3801-
              ;  "09xigxm7b44hz79xhqpfykvjrk4q90p33j2l07w69izx9sn0y42b"))
3802-
              (modules '((guix build utils)))
3803-
              (snippet
3804-
                '(begin
3805-
		   ;; Delete bundled archives.
3806-
                   (for-each delete-file (find-files "." ".*\\.jar"))
3807-
                   (for-each delete-file (find-files "." ".*\\.tar.gz"))
3808-
                   #t))))
3809-
    (build-system ant-build-system)
38104006
    (arguments
3811-
     `(#:jar-name "cup-runtime.jar"
3812-
       #:source-dir "src/java/java_cup/runtime"
3813-
       #:tests? #f; no tests for runtime
4007+
     `(#:jdk ,icedtea-8
4008+
       #:build-target "dist"
4009+
       #:tests? #f; no test target
38144010
       #:phases
38154011
       (modify-phases %standard-phases
3816-
         (add-before 'configure 'remove-build-xml
4012+
         (add-before 'build 'fix-jflex
38174013
           (lambda _
3818-
             (delete-file "build.xml"))))))
4014+
             (substitute* "build.xml"
4015+
               (("JFlex.ant") "jflex.ant"))
4016+
             #t))
4017+
         (add-before 'build 'add-lib
4018+
           (lambda _
4019+
             (mkdir-p "lib")))
4020+
         (replace 'install
4021+
           (install-jars ".")))))
4022+
    (native-inputs
4023+
     `(("%java-jflex-bootstrap" ,%java-jflex-bootstrap)
4024+
       ("git" ,git)))
38194025
    (home-page "http://www2.cs.tum.edu/projects/cup")
38204026
    (synopsis "")
38214027
    (description "")
38224028
    (license license:expat))); http://www2.cs.tum.edu/projects/cup/licence.html
38234029
3824-
;; Requires java-cup, but it requires jflex which in turn requires java-cup.
38254030
(define-public java-xalan
38264031
  (package
38274032
    (name "java-xalan")

38484053
    (inputs
38494054
     `(("java-commons-bcel" ,java-commons-bcel)
38504055
       ("java-xerces" ,java-xerces)))
4056+
    (native-inputs
4057+
     `(("java-cup" ,java-cup)))
38514058
    (home-page "")
38524059
    (synopsis "")
38534060
    (description "")