guix-more/more/packages/java.scm

java.scm

1
;;; GNU Guix --- Functional package management for GNU
2
;;; Copyright © 2017 Julien Lepiller <julien@lepiller.eu>
3
;;;
4
;;; This file is part of GNU Guix.
5
;;;
6
;;; GNU Guix is free software; you can redistribute it and/or modify it
7
;;; under the terms of the GNU General Public License as published by
8
;;; the Free Software Foundation; either version 3 of the License, or (at
9
;;; your option) any later version.
10
;;;
11
;;; GNU Guix is distributed in the hope that it will be useful, but
12
;;; WITHOUT ANY WARRANTY; without even the implied warranty of
13
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
;;; GNU General Public License for more details.
15
;;;
16
;;; You should have received a copy of the GNU General Public License
17
;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
18
19
(define-module (more packages java)
20
  #:use-module ((guix licenses) #:prefix license:)
21
  #:use-module (gnu packages)
22
  #:use-module (guix packages)
23
  #:use-module (guix download)
24
  #:use-module (guix git-download)
25
  #:use-module (guix utils)
26
  #:use-module (guix build-system ant)
27
  #:use-module (guix build-system gnu)
28
  #:use-module (guix build-system trivial)
29
  #:use-module (gnu packages base)
30
  #:use-module (gnu packages zip)
31
  #:use-module (gnu packages java))
32
33
(define-public josm
34
  (package
35
    (name "josm")
36
    (version "c86ae64ca82a5bb9dd1972c7023797eb9a2577f5")
37
    (source (origin
38
              (method git-fetch)
39
              (uri (git-reference
40
                    (url "https://github.com/openstreetmap/josm.git")
41
                    (commit version)))
42
              (sha256
43
               (base32
44
                "07z2q4csq9gdpg4lp1zpvcl5z5sqn0fnqah94ya3sirm6bh4k74j"))
45
              (file-name (string-append name "-" version))))
46
    (build-system ant-build-system)
47
    (arguments
48
     `(#:build-target "dist"
49
       #:tests? #f
50
       #:jdk ,icedtea-8
51
       #:phases
52
       (modify-phases %standard-phases
53
         (add-before 'build 'fix-compiler
54
           (lambda* _
55
             (substitute* "build.xml"
56
               (("UNKNOWN") "11639")
57
               ((".*com.google.errorprone.ErrorProneAntCompilerAdapter.*") "")
58
               (("compiler=\"[^\"]*\" ") ""))))
59
         (replace 'install
60
           (lambda* (#:key outputs #:allow-other-keys)
61
             (let* ((out (assoc-ref outputs "out"))
62
                    (bin (string-append out "/bin"))
63
                    (lib (string-append out "/lib/josm")))
64
               (mkdir-p bin)
65
               (mkdir-p lib)
66
               (copy-file "dist/josm-custom.jar"
67
                          (string-append lib "/josm.jar"))
68
               (with-output-to-file (string-append bin "/josm")
69
                 (lambda _
70
                   (display
71
                     (string-append "#!/bin/sh\n"
72
                                    "java -jar " lib "/josm.jar"))))
73
               (chmod (string-append bin "/josm") #o755)))))))
74
    (home-page "https://josm.openstreetmap.de")
75
    (synopsis "OSM editor")
76
    (description "OSM editor.")
77
    (license license:gpl2+)))
78
79
(define-public java-icu4j
80
  (package
81
    (name "java-icu4j")
82
    (version "58.2")
83
    (source (origin
84
              (method url-fetch)
85
              (uri (string-append 
86
                     "http://download.icu-project.org/files/icu4j/" version
87
                     "/icu4j-"
88
                     (string-map (lambda (x) (if (char=? x #\.) #\_ x)) version)
89
                     ".tgz"))
90
              (sha256
91
               (base32
92
                "1mvqjlc3cbaraa0bv0vyl44xf0x6n81inqsh69bl7f88iycfpns9"))))
93
    (build-system ant-build-system)
94
    (arguments
95
     `(#:tests? #f ; Requires java-ivy that we don't have yet.
96
       #:phases
97
       (modify-phases %standard-phases
98
         ;; icu4j archive contains its sources directly at the top, not in
99
         ;; a subdirectory as usual.
100
         (add-after 'unpack 'chdir
101
           (lambda _
102
             (chdir "..")))
103
         (replace 'install
104
           (lambda* (#:key outputs #:allow-other-keys)
105
             (let ((share (string-append (assoc-ref outputs "out") "/share/java")))
106
               (mkdir-p share)
107
               (copy-file "icu4j-charset.jar" (string-append share "/icu4j-charset.jar"))
108
               (copy-file "icu4j.jar" (string-append share "/icu4j.jar"))))))))
109
    (home-page "http://site.icu-project.org/")
110
    (synopsis "")
111
    (description "")
112
    (license license:x11)))
113
114
(define-public java-treelayout
115
  (package
116
    (name "java-treelayout")
117
    (version "1.0.3")
118
    (source (origin
119
              (method url-fetch)
120
              (uri (string-append 
121
                     "https://github.com/abego/treelayout/archive/v" version
122
                     ".tar.gz"))
123
              (file-name (string-append name "-" version ".tar.gz"))
124
              (sha256
125
               (base32
126
                "0djdw7j66lqjx8bx9zja0hsx10c6nsj3z0z20jmavwfr6bpp0345"))))
127
    (build-system ant-build-system)
128
    (arguments
129
     `(#:jar-name (string-append ,name "-" ,version ".jar")
130
       #:tests? #f
131
       #:phases
132
       (modify-phases %standard-phases
133
         ;; icu4j archive contains its sources directly at the top, not in
134
         ;; a subdirectory as usual.
135
         (add-after 'unpack 'chdir
136
           (lambda _
137
             (chdir "org.abego.treelayout"))))))
138
    (inputs
139
     `(("junit" ,java-junit)))
140
    (home-page "http://treelayout.sourceforge.net")
141
    (synopsis "")
142
    (description "")
143
    (license license:bsd-3)))
144
145
(define-public java-commons-cli
146
  (package
147
    (name "java-commons-cli")
148
    (version "1.4")
149
    (source (origin
150
              (method url-fetch)
151
              (uri (string-append "http://mirrors.ircam.fr/pub/apache/commons/"
152
                                  "cli/source/commons-cli-" version "-src.tar.gz"))
153
              (file-name (string-append name "-" version ".tar.gz"))
154
              (sha256
155
               (base32
156
                "05hgi2z01fqz374y719gl1dxzqvzci5af071zm7vxrjg9vczipm1"))))
157
    (build-system ant-build-system)
158
    (arguments
159
     `(#:jar-name "commons-cli-1.4.jar"
160
       #:tests? #f))
161
    (native-inputs
162
     `(("junit" ,java-junit)))
163
    (home-page "https://commons.apache.org/proper/commons-cli")
164
    (synopsis "Java API for parsing command line options passed to programs")
165
    (description "Apache Commons CLI library provides an API for parsing command
166
line options passed to programs. It's also able to print help messages detailing
167
the options available for a command line tool.")
168
    (license license:asl2.0)))
169
170
(define-public java-asm
171
  (package
172
    (name "java-asm")
173
    (version "5.2")
174
    (source (origin
175
              (method url-fetch)
176
              (uri (string-append "http://download.forge.ow2.org/asm/asm-"
177
                                  version ".tar.gz"))
178
              (file-name (string-append name "-" version ".tar.gz"))
179
              (sha256
180
               (base32
181
                "0kxvmv5275rnjl7jv0442k3wjnq03ngkb7sghs78avf45pzm4qgr"))))
182
    (build-system ant-build-system)
183
    (arguments
184
     `(#:jar-name "asm-5.2.jar"
185
       #:tests? #f))
186
    (native-inputs
187
     `(("junit" ,java-junit)))
188
    (home-page "")
189
    (synopsis "")
190
    (description "")
191
    (license license:asl2.0)))
192
193
(define-public java-jsr305
194
  (package
195
    (name "java-jsr305")
196
    (version "3.0.2")
197
    (source (origin
198
              (method git-fetch)
199
              (uri (git-reference
200
                     (url "https://github.com/amaembo/jsr-305.git")
201
                     (commit "d7734b13c61492982784560ed5b4f4bd6cf9bb2c")))
202
              (file-name (string-append name "-" version))
203
              (sha256
204
               (base32
205
                "1wk159136pgc6i54drbq2whazfmdilvfqlxj3k19s9dfwbayf621"))))
206
    (build-system ant-build-system)
207
    (arguments
208
     `(#:jar-name (string-append ,name "-" ,version ".jar")
209
       #:src-dir "ri/src/main/java"
210
       #:tests? #f))
211
    (home-page "https://github.com/amaembo/jsr-305")
212
    (synopsis "")
213
    (description "")
214
    (license license:bsd-3)))
215
216
(define-public java-checker-framework
217
  (package
218
    (name "java-checker-framework")
219
    (version "2.1.10")
220
    (source (origin
221
              (method url-fetch)
222
              (uri (string-append "https://github.com/typetools/checker-framework/"
223
                                  "archive/checker-framework-" version ".tar.gz"))
224
              (file-name (string-append name "-" version ".tar.gz"))
225
              (sha256
226
               (base32
227
                "1infq1hr53zi9bd81v90rn3iripbinb3w145m3xblq8yvnfrxy20"))))
228
    (build-system ant-build-system)
229
    (arguments
230
     `(#:jar-name (string-append ,name "-" ,version ".jar")
231
       #:src-dir "dataflow/src:javacutil/src"
232
       #:jdk ,icedtea-8
233
       #:tests? #f))
234
    (home-page "https://checkerframework.org")
235
    (synopsis "")
236
    (description "")
237
    (license license:gpl2))); with classpath exception
238
239
(define-public java-javapoet
240
  (package
241
    (name "java-javapoet")
242
    (version "1.8.0")
243
    (source (origin
244
              (method url-fetch)
245
              (uri (string-append "https://github.com/square/javapoet/archive/javapoet-"
246
                                  version ".tar.gz"))
247
              (file-name (string-append name "-" version ".tar.gz"))
248
              (sha256
249
               (base32
250
                "0xpjbh8wcyj9yd9hb936ia5g6l2q1jlyqjvwcc290cwjrz7crb93"))))
251
    (build-system ant-build-system)
252
    (arguments
253
     `(#:jar-name (string-append ,name "-" ,version ".jar")
254
       #:src-dir "src/main/java"
255
       #:jdk ,icedtea-8
256
       #:tests? #f))
257
    (home-page "https://github.com/square/javapoet")
258
    (synopsis "")
259
    (description "")
260
    (license license:asl2.0)))
261
262
(define-public java-auto-value
263
  (package
264
    (name "java-auto-value")
265
    (version "1.4.1")
266
    (source (origin
267
              (method url-fetch)
268
              (uri (string-append "https://github.com/google/auto/archive/auto-value-"
269
                                  version ".tar.gz"))
270
              (file-name (string-append name "-" version ".tar.gz"))
271
              (sha256
272
               (base32
273
                "1qd59bwa56bynsdxfbgm40i7ndrj599wflza214kzigk16nprc1m"))))
274
    (build-system ant-build-system)
275
    (arguments
276
     `(#:jar-name (string-append ,name "-" ,version ".jar")
277
       #:src-dir "value/src/main/java:common/src/main/java:service/src/main/java"
278
       #:jdk ,icedtea-8
279
       #:tests? #f))
280
    (inputs
281
     `(("guava" ,java-guava)
282
       ("javapoet" ,java-javapoet)))
283
    (home-page "https://github.com/google/auto/tree/master/value")
284
    (synopsis "")
285
    (description "")
286
    (license license:asl2.0)))
287
288
;; https://github.com/KengoTODA/java-diff-utils ?
289
;; com.sun.tools.javac.code.Scope.LookupKind.NON_RECURSIVE
290
;; com.sun.source.tree.PackageTree
291
;; com.sun.tools.javac.tree.JCTree.JCPackageDecl
292
(define-public java-error-prone
293
  (package
294
    (name "java-error-prone")
295
    (version "2.0.19")
296
    (source (origin
297
              (method url-fetch)
298
              (uri (string-append "https://github.com/google/error-prone/archive/v"
299
                                  version ".tar.gz"))
300
              (file-name (string-append name "-" version ".tar.gz"))
301
              (patches (search-patches "java-error-prone-add-build.xml.patch"))
302
              (sha256
303
               (base32
304
                "00igy7a6aylswxdcklj9021g2s8bvsvrysagqyd8cibm4pimxrnk"))))
305
    (build-system ant-build-system)
306
    (arguments
307
     `(#:tests? #f
308
       #:jdk ,icedtea-8
309
       #:phases
310
       (modify-phases %standard-phases
311
         (add-before 'build 'copy-internal
312
           (lambda _
313
             (mkdir-p "ant/src/main/java/com/google/errorprone/internal")
314
             (copy-file
315
               "core/src/main/java/com/google/errorprone/internal/NonDelegatingClassLoader.java"
316
               "ant/src/main/java/com/google/errorprone/internal/NonDelegatingClassLoader.java"))))))
317
    (inputs
318
     `(("java-jsr305" ,java-jsr305)
319
       ("java-auto-value" ,java-auto-value)
320
       ("java-checker-framework" ,java-checker-framework)
321
       ("java-guava" ,java-guava)))
322
    (home-page "https://github.com/google/guava")
323
    (synopsis "")
324
    (description "")
325
    (license license:asl2.0)))
326
327
(define-public java-error-prone-annotations
328
  (package
329
    (inherit java-error-prone)
330
    (name "java-error-prone-annotations")
331
    (version "2.0.19")
332
    (arguments
333
     `(#:tests? #f
334
       #:jar-name (string-append ,name "-" ,version ".jar")
335
       #:src-dir "annotations/src"))
336
    (inputs
337
     `(("java-jsr305" ,java-jsr305)))))
338
339
(define-public java-j2objc
340
  (package
341
    (name "java-j2objc")
342
    (version "1.3.1")
343
    (source (origin
344
              (method url-fetch)
345
              (uri (string-append "https://github.com/google/j2objc/archive/"
346
                                  version ".tar.gz"))
347
              (file-name (string-append name "-" version ".tar.gz"))
348
              (patches (search-patches "java-j2objc-add-build.xml.patch"))
349
              (sha256
350
               (base32
351
                "0d5spbr1whw2afg6mknyr7ifm6xivn3bbvnzjxva2zzkyq944hv0"))))
352
    (build-system ant-build-system)
353
    (arguments
354
     `(#:tests? #f))
355
    (home-page "http://j2objc.org")
356
    (synopsis "")
357
    (description "")
358
    (license license:asl2.0)))
359
360
(define-public java-j2objc-annotations
361
  (package
362
    (inherit java-j2objc)
363
    (name "java-j2objc-annotations")
364
    (version "1.3.1")
365
    (arguments
366
     `(#:tests? #f
367
       #:jar-name (string-append ,name "-" ,version ".jar")
368
       #:src-dir "annotations/src/main/java"))))
369
370
(define-public java-animal-sniffer
371
  (package
372
    (name "java-animal-sniffer")
373
    (version "1.15")
374
    (source (origin
375
              (method url-fetch)
376
              (uri (string-append "https://github.com/mojohaus/animal-sniffer/"
377
                                  "archive/animal-sniffer-parent-"
378
                                  version ".tar.gz"))
379
              (patches (search-patches "java-animal-sniffer-add-build.xml.patch"))
380
              (file-name (string-append name "-" version ".tar.gz"))
381
              (sha256
382
               (base32
383
                "1350yl003y1fjzdwis0dg5jhi5kggk2sxnkv9821z5janw4p986m"))))
384
    (build-system ant-build-system)
385
    (arguments
386
     `(#:tests? #f))
387
    (home-page "http://www.mojohaus.org/animal-sniffer")
388
    (synopsis "")
389
    (description "")
390
    (license license:asl2.0)))
391
392
(define-public java-animal-sniffer-annotations
393
  (package
394
    (inherit java-animal-sniffer)
395
    (name "java-animal-sniffer-annotations")
396
    (version "1.15")
397
    (arguments
398
     `(#:tests? #f
399
       #:jar-name (string-append ,name "-" ,version ".jar")
400
       #:src-dir "animal-sniffer-annotations/src/main/java"))))
401
402
(define-public java-guava
403
  (package
404
    (name "java-guava")
405
    (version "20.0")
406
    (source (origin
407
              (method url-fetch)
408
              (uri (string-append "https://github.com/google/guava/archive/v"
409
                                  version ".tar.gz"))
410
              (file-name (string-append name "-" version ".tar.gz"))
411
              (sha256
412
               (base32
413
                "1kasavj973iblj1fj35gzbywhkljrnbjpymgqyqaibbbmmbzff8s"))))
414
    (build-system ant-build-system)
415
    (arguments
416
     `(#:jar-name (string-append ,name "-" ,version ".jar")
417
       #:src-dir "guava/src"
418
       #:tests? #f))
419
    (inputs
420
     `(("java-jsr305" ,java-jsr305)
421
       ("java-j2objc-annotations" ,java-j2objc-annotations)
422
       ("java-animal-sniffer-annotations" ,java-animal-sniffer-annotations)
423
       ("java-error-prone-annotations" ,java-error-prone-annotations)))
424
    (home-page "https://github.com/google/guava")
425
    (synopsis "")
426
    (description "")
427
    (license license:asl2.0)))
428
429
(define-public java-joda-convert
430
  (package
431
    (name "java-joda-convert")
432
    (version "1.8.1")
433
    (source (origin
434
              (method url-fetch)
435
              (uri (string-append "https://github.com/JodaOrg/joda-convert/archive/v"
436
                                  version ".tar.gz"))
437
              (file-name (string-append name "-" version ".tar.gz"))
438
              (sha256
439
               (base32
440
                "1di9chp0pgvd2gxsmdaxhldwns9a2ss9705jmn97mdd69cg5zcnc"))))
441
    (build-system ant-build-system)
442
    (arguments
443
     `(#:jar-name (string-append ,name "-" ,version ".jar")
444
       #:src-dir "src/main/java"
445
       #:tests? #f))
446
    (inputs
447
     `(("java-google-collect" ,java-google-collect)))
448
    (native-inputs
449
     `(("junit" ,java-junit)))
450
    (home-page "")
451
    (synopsis "")
452
    (description "")
453
    (license license:asl2.0)))
454
455
(define-public java-joda-time
456
  (package
457
    (name "java-joda-time")
458
    (version "2.9.9")
459
    (source (origin
460
              (method url-fetch)
461
              (uri (string-append "https://github.com/JodaOrg/joda-time/archive/v"
462
                                  version ".tar.gz"))
463
              (file-name (string-append name "-" version ".tar.gz"))
464
              (sha256
465
               (base32
466
                "1i9x91mi7yg2pasl0k3912f1pg46n37sps6rdb0v1gs8hj9ppwc1"))))
467
    (build-system ant-build-system)
468
    (arguments
469
     `(#:jar-name (string-append ,name "-" ,version ".jar")
470
       #:src-dir "src/main/java"
471
       #:tests? #f))
472
    (inputs
473
     `(("java-joda-convert" ,java-joda-convert)))
474
    (native-inputs
475
     `(("junit" ,java-junit)))
476
    (home-page "")
477
    (synopsis "")
478
    (description "")
479
    (license license:asl2.0)))
480
481
(define-public java-xstream
482
  (package
483
    (name "java-xstream")
484
    (version "1.4.9")
485
    (source (origin
486
              (method url-fetch)
487
              (uri (string-append "https://repo1.maven.org/maven2/com/thoughtworks"
488
                                  "/xstream/xstream-distribution/" version
489
                                  "/xstream-distribution-" version "-src.zip"))
490
              (file-name (string-append name "-" version ".zip"))
491
              (sha256
492
               (base32
493
                "1cq9j9h839wc6pkrgd9bd7y94a3zrj1j741i134izqs9xx2b54fi"))))
494
    (build-system ant-build-system)
495
    (arguments
496
     `(#:jar-name (string-append ,name "-" ,version ".jar")
497
       #:tests? #f
498
       #:src-dir "xstream/src/java"))
499
    (native-inputs
500
     `(("unzip" ,unzip)))
501
    (home-page "https://x-stream.github.io")
502
    (synopsis "")
503
    (description "")
504
    (license license:x11)))
505
506
(define-public java-jsonp
507
  (package
508
    (name "java-jsonp")
509
    (version "1.0.4")
510
    (source (origin
511
              (method git-fetch)
512
              (uri (git-reference
513
                     (url "git://java.net/jsonp~git")
514
                     (commit "a586e706aea82dc80fb05bdf59f2a25150ee1801")))
515
              (file-name (string-append name "-" version))
516
              (sha256
517
               (base32
518
                "01r4syivcywpvxkr1hn0az9316pr7qpnx154zzzw0nijfmdlbw7n"))))
519
    (build-system ant-build-system)
520
    (arguments
521
     `(#:jar-name (string-append ,name "-" ,version ".jar")
522
       #:tests? #f
523
       #:src-dir "api/src"))
524
    (home-page "https://jsonp.java.net")
525
    (synopsis "")
526
    (description "")
527
    (license (list license:gpl2
528
                   ;; actually CDDL 1.1
529
                   license:cddl1.0))))
530
531
;; Can only be built with gradle.
532
(define-public groovy
533
  (package
534
    (name "groovy")
535
    (version "2.4.10")
536
    (source (origin
537
              (method url-fetch)
538
              (uri (string-append "https://github.com/apache/groovy/archive/GROOVY_"
539
                                  "2_4_10.tar.gz"))
540
              (file-name (string-append name "-" version ".tar.gz"))
541
              (sha256
542
               (base32
543
                "0wapzqwpx4bh2fsqpzf3haakjz6wvfjx1vd9a4spavhlrjqk2pbb"))))
544
    (build-system ant-build-system)
545
    (arguments
546
     `(#:jar-name "groovy.jar"
547
       #:tests? #f))
548
    (native-inputs
549
     `(("junit" ,java-junit)))
550
    (inputs
551
     `(("commons-cli" ,java-commons-cli)
552
       ("antlr" ,antlr3)
553
       ("asm" ,java-asm)))
554
    (home-page "")
555
    (synopsis "")
556
    (description "")
557
    (license license:asl2.0)))
558
559
;; requires jline, javax.servlet, org.fusesource.jansi, org.livetribe,
560
;;   com.thoughtworks.xstream, org.apache.ivy, bsf
561
;;   antlr
562
(define-public groovy-1.8.9
563
  (package
564
    (inherit groovy)
565
    (name "groovy")
566
    (version "1.8.9")
567
    (source (origin
568
              (method url-fetch)
569
              (uri (string-append "https://github.com/apache/groovy/archive/GROOVY_"
570
                                  "1_8_9.tar.gz"))
571
              (file-name (string-append name "-" version ".tar.gz"))
572
              (sha256
573
               (base32
574
                "16z3jv5yw11wwwzbs6x41g83gqazhngg30ys2kpy7cpfm3rsqi71"))))
575
    (arguments
576
     `(#:jar-name (string-append ,name "-" ,version ".jar")
577
       #:tests? #f
578
       #:src-dir "src/main"))))
579
580
581
;; antlr2 is used to generate some java files in other packages. This is an old
582
;; package, it is not maintained anymore. It also contains the definition
583
;; for CommonTree and maybe other classes, so it is still required by more
584
;; recent antlr versions.
585
;;
586
;; antlr3.5 requires an antlr3 generator and ST4. Unfortunately, ST4 requires
587
;; an antlr3 generator. We use antlr3-3.1 that can be built with ST3 and antlr2
588
;; to build the intermediate antlr3-3.3 that requires only an antlr3 generator.
589
;; This intermediate antlr3 is used to build a version of ST4 that do not depend
590
;; on recent antlr3. Then this version is used to build the latest antlr3,
591
;; which is used to build the latest ST4, which is used as a dependency of the
592
;; latest antlr3.
593
;;
594
;; Then we can use the latest versions of ST4 and antlr3 to build antlr4.
595
(define-public antlr2
596
  (package
597
    (name "antlr2")
598
    (version "2.7.7")
599
    (source (origin
600
              (method url-fetch)
601
              (uri (string-append "http://www.antlr2.org/download/antlr-"
602
                                  version ".tar.gz"))
603
              (sha256
604
               (base32
605
                "1ffvcwdw73id0dk6pj2mlxjvbg0662qacx4ylayqcxgg381fnfl5"))
606
              (modules '((guix build utils)))
607
              (snippet
608
               '(begin
609
                  (delete-file "antlr.jar")
610
                  (substitute* "configure"
611
                    (("/bin/sh") "sh"))))))
612
    (build-system gnu-build-system)
613
    (arguments
614
     `(#:tests? #f
615
       #:phases
616
       (modify-phases %standard-phases
617
         (add-after 'configure 'fix-bin-ls
618
           (lambda _
619
             (for-each (lambda (file)
620
                         (substitute* file
621
                          (("/bin/ls") "ls")))
622
               (find-files "Makefile")))))))
623
    (native-inputs
624
     `(("which" ,which)
625
       ("java" ,icedtea "jdk")))
626
    (inputs
627
     `(("java" ,icedtea)))
628
    (home-page "http://www.antlr2.org")
629
    (synopsis "")
630
    (description "")
631
    (license license:public-domain)))
632
633
(define-public stringtemplate3
634
  (package
635
    (name "stringtemplate3")
636
    (version "3.2.1")
637
    (source (origin
638
              (method url-fetch)
639
              (uri (string-append "https://github.com/antlr/website-st4/raw/"
640
                                  "gh-pages/download/stringtemplate-"
641
                                  version ".tar.gz"))
642
              (sha256
643
               (base32
644
                "086yj68np1vqhkj7483diz3km6s6y4gmwqswa7524a0ca6vxn2is"))))
645
    (build-system ant-build-system)
646
    (arguments
647
     `(#:jar-name "stringtemplate-3.2.1.jar"
648
       #:tests? #f
649
       #:phases
650
       (modify-phases %standard-phases
651
         (add-before 'build 'generate-grammar
652
           (lambda _
653
             (let ((dir "src/org/antlr/stringtemplate/language/"))
654
               (for-each (lambda (file)
655
                           (display file)
656
                           (newline)
657
                           (system* "antlr" "-o" dir (string-append dir file)))
658
                         '("template.g" "angle.bracket.template.g" "action.g"
659
                           "eval.g" "group.g" "interface.g"))))))))
660
    (native-inputs
661
     `(("antlr" ,antlr2)))
662
    (home-page "http://www.stringtemplate.org")
663
    (synopsis "")
664
    (description "")
665
    (license license:bsd-3)))
666
667
(define-public antlr3-temp
668
  (package
669
    (name "antlr3-temp")
670
    (version "3.5.2")
671
    (source (origin
672
              (method url-fetch)
673
              (uri (string-append "https://github.com/antlr/antlr3/archive/"
674
                                  version ".tar.gz"))
675
              (file-name (string-append name "-" version ".tar.gz"))
676
              (sha256
677
               (base32
678
                "07zff5frmjd53rnqdx31h0pmswz1lv0p2lp28cspfszh25ysz6sj"))))
679
    (build-system ant-build-system)
680
    (arguments
681
     `(#:jar-name (string-append ,name "-" ,version ".jar")
682
       #:src-dir "tool/src/main/java:runtime/Java/src/main/java:tool/src/main/antlr3"
683
       #:tests? #f
684
       #:phases
685
       (modify-phases %standard-phases
686
         (add-after 'install 'bin-install
687
           (lambda* (#:key inputs outputs #:allow-other-keys)
688
             (let ((jar (string-append (assoc-ref outputs "out") "/share/java"))
689
                   (bin (string-append (assoc-ref outputs "out") "/bin")))
690
               (mkdir-p bin)
691
               (with-output-to-file (string-append bin "/antlr3")
692
                 (lambda _
693
                   (display
694
                     (string-append "#!/bin/sh\n"
695
                                    "java -cp " jar "/" ,name "-" ,version ".jar:"
696
                                    (string-concatenate
697
                                      (find-files (assoc-ref inputs "stringtemplate")
698
                                                  ".*\\.jar"))
699
                                    ":"
700
                                    (string-concatenate
701
                                      (find-files (assoc-ref inputs "stringtemplate4")
702
                                                  ".*\\.jar"))
703
                                    ":"
704
                                    (string-concatenate
705
                                      (find-files (string-append (assoc-ref inputs "antlr") "/lib")
706
                                                  ".*\\.jar"))
707
                                    " org.antlr.Tool $*"))))
708
               (chmod (string-append bin "/antlr3") #o755))))
709
         (add-before 'build 'generate-grammar
710
           (lambda _
711
             (chdir "tool/src/main/antlr3/org/antlr/grammar/v3/")
712
             (for-each (lambda (file)
713
                         (display file)
714
                         (newline)
715
                         (system* "antlr3" file))
716
                       '("ANTLR.g" "ANTLRTreePrinter.g" "ActionAnalysis.g"
717
                         "AssignTokenTypesWalker.g"
718
                         "ActionTranslator.g" "TreeToNFAConverter.g"
719
                         "ANTLRv3.g" "ANTLRv3Tree.g" "LeftRecursiveRuleWalker.g"
720
                         "CodeGenTreeWalker.g" "DefineGrammarItemsWalker.g"))
721
             (chdir "../../../../../../../..")
722
             (system* "antlr" "-o" "tool/src/main/java/org/antlr/tool"
723
                      "tool/src/main/java/org/antlr/tool/serialize.g")
724
             (substitute* "tool/src/main/java/org/antlr/tool/LeftRecursiveRuleAnalyzer.java"
725
               (("import org.antlr.grammar.v3.\\*;") "import org.antlr.grammar.v3.*;
726
import org.antlr.grammar.v3.ANTLRTreePrinter;"))
727
             (substitute* "tool/src/main/java/org/antlr/tool/ErrorManager.java"
728
               (("case NO_SUCH_ATTRIBUTE_PASS_THROUGH:") ""))
729
             (substitute* "tool/src/main/antlr3/org/antlr/grammar/v3/ANTLRParser.java"
730
               (("public Object getTree") "public GrammarAST getTree"))
731
             (substitute* "tool/src/main/antlr3/org/antlr/grammar/v3/ANTLRv3Parser.java"
732
               (("public Object getTree") "public CommonTree getTree"))))
733
         (add-before 'build 'fix-build-xml
734
           (lambda _
735
             (substitute* "build.xml"
736
               (("<exec") "<copy todir=\"${classes.dir}\">
737
<fileset dir=\"tool/src/main/resources\">
738
<include name=\"**/*.stg\"/>
739
<include name=\"**/*.st\"/>
740
<include name=\"**/*.sti\"/>
741
<include name=\"**/STLexer.tokens\"/>
742
</fileset>
743
</copy><exec")))))))
744
    (native-inputs
745
     `(("antlr" ,antlr2)
746
       ("antlr3" ,antlr3-3.3)))
747
    (inputs
748
     `(("junit" ,java-junit)))
749
    (propagated-inputs
750
     `(("stringtemplate" ,stringtemplate3)
751
       ("antlr" ,antlr2)
752
       ("stringtemplate4" ,stringtemplate4-4.0.6)))
753
    (home-page "http://www.stringtemplate.org")
754
    (synopsis "")
755
    (description "")
756
    (license license:bsd-3)))
757
758
(define-public antlr3
759
  (package
760
    (inherit antlr3-temp)
761
    (name "antlr3")
762
    (native-inputs
763
     `(("antlr" ,antlr2)
764
       ("antlr3" ,antlr3-temp)))
765
    (inputs
766
     `(("junit" ,java-junit)
767
       ("stringtemplate" ,stringtemplate3)
768
       ("stringtemplate4" ,stringtemplate4)))))
769
770
(define-public antlr3-3.3
771
  (package
772
    (name "antlr3")
773
    (version "3.3")
774
    (source (origin
775
              (method url-fetch)
776
              (uri (string-append "https://github.com/antlr/website-antlr3/raw/"
777
                                  "gh-pages/download/antlr-"
778
                                  version ".tar.gz"))
779
              (sha256
780
               (base32
781
                "0qgg5vgsm4l1d6dj9pfbaa25dpv2ry2gny8ajy4vvgvfklw97b3m"))))
782
    (build-system ant-build-system)
783
    (arguments
784
     `(#:jar-name (string-append ,name "-" ,version ".jar")
785
       #:src-dir "tool/src/main/java:runtime/Java/src/main/java:tool/src/main/antlr2:tool/src/main/antlr3"
786
       #:tests? #f
787
       #:phases
788
       (modify-phases %standard-phases
789
         (add-after 'install 'bin-install
790
           (lambda* (#:key inputs outputs #:allow-other-keys)
791
             (let ((jar (string-append (assoc-ref outputs "out") "/share/java"))
792
                   (bin (string-append (assoc-ref outputs "out") "/bin")))
793
               (mkdir-p bin)
794
               (with-output-to-file (string-append bin "/antlr3")
795
                 (lambda _
796
                   (display
797
                     (string-append "#!/bin/sh\n"
798
                                    "java -cp " jar "/antlr3-3.3.jar:"
799
                                    (string-concatenate
800
                                      (find-files (assoc-ref inputs "stringtemplate")
801
                                                  ".*\\.jar"))
802
                                    ":"
803
                                    (string-concatenate
804
                                      (find-files (string-append (assoc-ref inputs "antlr") "/lib")
805
                                                  ".*\\.jar"))
806
                                    " org.antlr.Tool $*"))))
807
               (chmod (string-append bin "/antlr3") #o755))))
808
         (add-before 'build 'generate-grammar
809
           (lambda _
810
             (let ((dir "tool/src/main/antlr2/org/antlr/grammar/v2/"))
811
               (for-each (lambda (file)
812
                           (display file)
813
                           (newline)
814
                           (system* "antlr" "-o" dir (string-append dir file)))
815
                         '("antlr.g" "antlr.print.g" "assign.types.g"
816
                           "buildnfa.g" "codegen.g" "define.g")))
817
             (chdir "tool/src/main/antlr3/org/antlr/grammar/v3/")
818
             (for-each (lambda (file)
819
                         (display file)
820
                         (newline)
821
                         (system* "antlr3" file))
822
                       '("ActionAnalysis.g" "ActionTranslator.g" "ANTLRv3.g"
823
                         "ANTLRv3Tree.g"))
824
             (chdir "../../../../../../../..")
825
             (substitute* "tool/src/main/java/org/antlr/tool/Grammar.java"
826
               (("import org.antlr.grammar.v2.\\*;")
827
                "import org.antlr.grammar.v2.*;\n
828
import org.antlr.grammar.v2.TreeToNFAConverter;\n
829
import org.antlr.grammar.v2.DefineGrammarItemsWalker;\n
830
import org.antlr.grammar.v2.ANTLRTreePrinter;"))))
831
         (add-before 'build 'fix-build-xml
832
           (lambda _
833
             (substitute* "build.xml"
834
               (("<exec") "<copy todir=\"${classes.dir}\">
835
<fileset dir=\"tool/src/main/resources\">
836
<include name=\"**/*.stg\"/>
837
<include name=\"**/*.st\"/>
838
<include name=\"**/*.sti\"/>
839
<include name=\"**/STLexer.tokens\"/>
840
</fileset>
841
</copy><exec")))))))
842
    (native-inputs
843
     `(("antlr" ,antlr2)
844
       ("antlr3" ,antlr3-3.1)))
845
    (inputs
846
     `(("junit" ,java-junit)))
847
    (propagated-inputs
848
     `(("stringtemplate" ,stringtemplate3)
849
       ("antlr" ,antlr2)
850
       ("antlr3" ,antlr3-3.1)))
851
    (home-page "http://www.stringtemplate.org")
852
    (synopsis "")
853
    (description "")
854
    (license license:bsd-3)))
855
856
(define-public antlr3-3.1
857
  (package
858
    (name "antlr3-3.1")
859
    (version "3.1")
860
    (source (origin
861
              (method url-fetch)
862
              (uri (string-append "https://github.com/antlr/website-antlr3/raw/"
863
                                  "gh-pages/download/antlr-"
864
                                  version ".tar.gz"))
865
              (sha256
866
               (base32
867
                "0sfimc9cpbgrihz4giyygc8afgpma2c93yqpwb951giriri6x66z"))))
868
    (build-system ant-build-system)
869
    (arguments
870
     `(#:jar-name (string-append ,name "-" ,version ".jar")
871
       #:src-dir "src:runtime/Java/src"
872
       #:tests? #f
873
       #:phases
874
       (modify-phases %standard-phases
875
         (add-after 'install 'bin-install
876
           (lambda* (#:key inputs outputs #:allow-other-keys)
877
             (let ((jar (string-append (assoc-ref outputs "out") "/share/java"))
878
                   (bin (string-append (assoc-ref outputs "out") "/bin")))
879
               (mkdir-p bin)
880
               (with-output-to-file (string-append bin "/antlr3")
881
                 (lambda _
882
                   (display
883
                     (string-append "#!/bin/sh\n"
884
                                    "java -cp " jar "/antlr3-3.1-3.1.jar:"
885
                                    (string-concatenate
886
                                      (find-files (assoc-ref inputs "stringtemplate")
887
                                                  ".*\\.jar"))
888
                                    ":"
889
                                    (string-concatenate
890
                                      (find-files (string-append (assoc-ref inputs "antlr") "/lib")
891
                                                  ".*\\.jar"))
892
                                    " org.antlr.Tool $*"))))
893
               (chmod (string-append bin "/antlr3") #o755))))
894
         (add-before 'build 'generate-grammar
895
           (lambda _
896
             (let ((dir "src/org/antlr/tool/"))
897
               (for-each (lambda (file)
898
                           (display file)
899
                           (newline)
900
                           (system* "antlr" "-o" dir (string-append dir file)))
901
                         '("antlr.g" "antlr.print.g" "assign.types.g"
902
                           "buildnfa.g" "define.g")))
903
             (format #t "codegen.g\n")
904
             (system* "antlr" "-o" "src/org/antlr/codegen"
905
                      "src/org/antlr/codegen/codegen.g")))
906
         (add-before 'build 'fix-build-xml
907
           (lambda _
908
             (substitute* "build.xml"
909
               (("<exec") "<copy todir=\"${classes.dir}\">
910
<fileset dir=\"src\">
911
<include name=\"**/*.stg\"/>
912
<include name=\"**/*.st\"/>
913
<include name=\"**/*.sti\"/>
914
<include name=\"**/STLexer.tokens\"/>
915
</fileset>
916
</copy><exec")))))))
917
    (native-inputs
918
     `(("antlr" ,antlr2)))
919
    (inputs
920
     `(("junit" ,java-junit)))
921
    (propagated-inputs
922
     `(("stringtemplate" ,stringtemplate3)))
923
    (home-page "http://www.stringtemplate.org")
924
    (synopsis "")
925
    (description "")
926
    (license license:bsd-3)))
927
928
(define-public stringtemplate4-4.0.6
929
  (package
930
    (name "stringtemplate4")
931
    (version "4.0.6")
932
    (source (origin
933
              (method url-fetch)
934
              (uri (string-append "https://github.com/antlr/stringtemplate4/archive/ST-"
935
                                  version ".tar.gz"))
936
              (file-name (string-append name "-" version ".tar.gz"))
937
              (sha256
938
               (base32
939
                "0hjmh1ahdsh3w825i67mli9l4nncc4l6hdbf9ma91jvlj590sljp"))))
940
    (build-system ant-build-system)
941
    (arguments
942
     `(#:tests? #f
943
       #:jar-name (string-append ,name "-" ,version ".jar")
944
       #:phases
945
       (modify-phases %standard-phases
946
         (add-before 'build 'generate-grammar
947
           (lambda* (#:key inputs #:allow-other-keys)
948
             (chdir "src/org/stringtemplate/v4/compiler/")
949
             (for-each (lambda (file)
950
                         (display file)
951
                         (newline)
952
                         (system* "antlr3" file))
953
                       '("STParser.g" "Group.g" "CodeGenerator.g"))
954
             (chdir "../../../../.."))))))
955
    (inputs
956
     `(("antlr3" ,antlr3-3.3)
957
       ("antlr2" ,antlr2)
958
       ("stringtemplate" ,stringtemplate3)))
959
    (home-page "http://www.stringtemplate.org")
960
    (synopsis "")
961
    (description "")
962
    (license license:bsd-3)))
963
964
(define-public stringtemplate4
965
  (package
966
    (inherit stringtemplate4-4.0.6)
967
    (name "stringtemplate4")
968
    (version "4.0.8")
969
    (source (origin
970
              (method url-fetch)
971
              (uri (string-append "https://github.com/antlr/stringtemplate4/archive/"
972
                                  version ".tar.gz"))
973
              (file-name (string-append name "-" version ".tar.gz"))
974
              (sha256
975
               (base32
976
                "1pri8hqa95rfdkjy55icl5q1m09zwp5k67ib14abas39s4v3w087"))))
977
    (inputs
978
     `(("antlr3" ,antlr3-temp)
979
       ("antlr2" ,antlr2)
980
       ("stringtemplate" ,stringtemplate3)))))
981
982
;; javax.json.*
983
;; org.abego.treelayout.*
984
;; com.ibm.icu.* 
985
(define-public antlr4
986
  (package
987
    (name "antlr4")
988
    (version "4.7")
989
    (source (origin
990
              (method url-fetch)
991
              (uri (string-append "https://github.com/antlr/antlr4/archive/"
992
                                  version ".tar.gz"))
993
              (file-name (string-append name "-" version ".tar.gz"))
994
              (sha256
995
               (base32
996
                "0y7lzkvx9wbbmwg45mb4icx7i66z6894qfygrbbs26sr5xxyml9h"))))
997
    (build-system ant-build-system)
998
    (arguments
999
     `(#:jar-name (string-append ,name "-" ,version ".jar")
1000
       #:src-dir "runtime/Java/src:tool/src"
1001
       #:phases
1002
       (modify-phases %standard-phases
1003
         (add-before 'build 'generate-grammar
1004
           (lambda* (#:key inputs #:allow-other-keys)
1005
             (chdir "tool/src/org/antlr/v4/parse")
1006
             (for-each (lambda (file)
1007
                         (format #t "~a\n" file)
1008
                         (system* "antlr3" file))
1009
                       '("ANTLRLexer.g" "ANTLRParser.g" "BlockSetTransformer.g"
1010
                         "GrammarTreeVisitor.g" "ATNBuilder.g"
1011
                         "ActionSplitter.g" "LeftRecursiveRuleWalker.g"))
1012
             (chdir "../codegen")
1013
             (copy-file "../parse/ANTLRParser.tokens" "ANTLRParser.tokens")
1014
             (format #t "SourceGenTriggers.g\n")
1015
             (system* "antlr3" "SourceGenTriggers.g")
1016
             (chdir "../../../../../.."))))))
1017
    (inputs
1018
     `(("antlr3" ,antlr3)
1019
       ("icu4j" ,java-icu4j)
1020
       ("java-jsonp" ,java-jsonp)
1021
       ("treelayout" ,java-treelayout)
1022
       ("stringtemplate4" ,stringtemplate4)))
1023
    (home-page "https://antlr.org")
1024
    (synopsis "")
1025
    (description "")
1026
    (license license:bsd-3)))
1027
    
1028
1029
;; requires groovy 2.4.7.
1030
;(define-public gradle
1031
;  (package
1032
;    (name "gradle")
1033
;    (version "3.4.1")
1034
;    (source (origin
1035
;              (method url-fetch)
1036
;              (uri (string-append "https://github.com/gradle/gradle/archive/v"
1037
;                                  version ".tar.gz"))
1038
;              (file-name (string-append name "-" version ".tar.gz"))
1039
;              (sha256
1040
;               (base32 "0fq30k51mkixg31z3d4fjq3zbnyjml4i530px6n1n947mqk3rgyl"))))
1041
;    (build-system ant-build-system)
1042
;    (arguments
1043
;     `(#:phases
1044
;       (modify-phases %standard-phases
1045
;         (replace 'build
1046
;           (lambda* _
1047
;             (system* "sh" "-x" "gradlew" "prBuild" "-x" "integTest" "--continue"
1048
;                      "--stacktrace"))))))
1049
;             ;(system* "sh" "-x" "travisci_build.sh"))))))
1050
;    (home-page "")
1051
;    (synopsis "Build system")
1052
;    (description "Build system")
1053
;    (license license:asl2.0)))
1054
;
1055
;;; Requires gradle.
1056
;(define-public android-anysoft-keyboard
1057
;  (package
1058
;    (name "android-anysoft-keyboard")
1059
;    (version "1.8-r9")
1060
;    (source (origin
1061
;              (method url-fetch)
1062
;              (uri (string-append "https://github.com/AnySoftKeyboard/"
1063
;                                  "AnySoftKeyboard/archive/" version ".tar.gz"))
1064
;              (file-name (string-append name "-" version ".tar.gz"))
1065
;              (sha256
1066
;               (base32
1067
;                "1mrin9mw1rs23d25v8yx4jprx7j05zir6756sqvk4myxbkcp8mag"))))
1068
;    (build-system ant-build-system)
1069
;    (home-page "https://anysoftkeyboard.github.io/")
1070
;    (synopsis "Alternative on-screen keyboard for multiple languages")
1071
;    (description "Alternative on-screen keyboard for multiple languages.")
1072
;    (license license:asl2.0)))
1073