projects/guix·blob java-team · refs

437 lines · 16.1 KiB

1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2012-2014, 2019, 2021-2022 Ludovic Courtès <[email protected]>
3;;; Copyright © 2016, 2022, 2024-2025 Efraim Flashner <[email protected]>
4;;; Copyright © 2017, 2020, 2021 Sergei Trofimovich <[email protected]>
5;;; Copyright © 2018, 2022 Tobias Geerinckx-Rice <[email protected]>
6;;; Copyright © 2020-2021 Marius Bakke <[email protected]>
7;;; Copyright © 2021 Foo Chuan Wei <[email protected]>
8;;; Copyright © 2024-2025 Janneke Nieuwenhuizen <[email protected]>
9;;; Copyright © 2025 Alexey Abramov <[email protected]>
10;;; Copyright © 2025 Anderson Torres <[email protected]>
11;;;
12;;; This file is part of GNU Guix.
13;;;
14;;; GNU Guix is free software; you can redistribute it and/or modify it
15;;; under the terms of the GNU General Public License as published by
16;;; the Free Software Foundation; either version 3 of the License, or (at
17;;; your option) any later version.
18;;;
19;;; GNU Guix is distributed in the hope that it will be useful, but
20;;; WITHOUT ANY WARRANTY; without even the implied warranty of
21;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22;;; GNU General Public License for more details.
23;;;
24;;; You should have received a copy of the GNU General Public License
25;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
26
27(define-module (gnu packages compiler-tools)
28 #:use-module (gnu packages autotools)
29 #:use-module (gnu packages bash)
30 #:use-module (gnu packages bison)
31 #:use-module (gnu packages check)
32 #:use-module (gnu packages gawk)
33 #:use-module (gnu packages m4)
34 #:use-module (gnu packages man)
35 #:use-module (gnu packages python)
36 #:use-module (gnu packages)
37 #:use-module (guix build-system cmake)
38 #:use-module (guix build-system gnu)
39 #:use-module (guix build-system trivial)
40 #:use-module (guix download)
41 #:use-module (guix gexp)
42 #:use-module (guix git-download)
43 #:use-module ((guix licenses) #:prefix license:)
44 #:use-module (guix packages)
45 #:use-module (guix utils)
46 #:use-module (srfi srfi-1))
47
48(define-public byacc
49 (package
50 (name "byacc")
51 (version "20240109")
52 (source
53 (origin
54 (method url-fetch)
55 (uri (string-append
56 "https://invisible-mirror.net/archives/byacc/byacc-"
57 version ".tgz"))
58 (sha256
59 (base32
60 "0il4w1vwbglayakywyghiqhcjpg1yvv5ww2p8ylz32bi05wpg2gj"))
61 (snippet
62 #~(begin
63 ;; Remove machine-generated files
64 (for-each delete-file
65 (list "configure"
66 "btyaccpar.c"
67 "yaccpar.c"))))))
68 (build-system gnu-build-system)
69 (native-inputs
70 (list autoconf
71 automake
72 gawk))
73 (home-page "https://invisible-island.net/byacc/byacc.html")
74 (synopsis "Berkeley Yacc LALR parser generator")
75 (description
76 "Berkeley Yacc is an LALR(1) parser generator. Yacc reads the grammar
77specification from a file and generates an LALR(1) parser for it. The parsers
78consist of a set of LALR(1) parsing tables and a driver routine written in the
79C programming language.")
80 (license license:public-domain)))
81
82(define-public dparser
83 (package
84 (name "dparser")
85 (version "1.33a")
86 (source
87 (origin
88 (method git-fetch)
89 (uri (git-reference
90 (url "https://github.com/jplevyak/dparser/")
91 (commit (string-append "v" version))))
92 (file-name (git-file-name name version))
93 (sha256
94 (base32
95 "0vzfi7d573qsmfxkgnzqkalhv06i2zc8hm0pwcgrgj8382g01zg1"))))
96 (build-system gnu-build-system)
97 (arguments
98 (list
99 #:test-target "test"
100 #:make-flags
101 #~(list
102 (string-append "CC=" #$(cc-for-target))
103 (string-append "PREFIX=" #$output))
104 #:phases
105 #~(modify-phases %standard-phases
106 (delete 'configure))))
107 (home-page "https://dparser.sourceforge.net/")
108 (synopsis "Scannerless GLR parser generator")
109 (description
110 "DParser is scannerless GLR parser generator. The form of the text to be
111parsed can be specified using a combination of regular expressions and grammar
112productions. Because of the parsing technique, a scannerless GLR parser based
113on the Tomita algorithm the grammar can be ambiguous, right or left recursive,
114have any number of null productions, and because there is no separate
115tokenizer, can include whitespace in terminals and have terminals which are
116prefixes of other terminals.")
117 (license (list license:bsd-3))))
118
119(define-public flex
120 (package
121 (name "flex")
122 (version "2.6.4")
123 (source
124 (origin
125 (method url-fetch)
126 (uri (string-append
127 "https://github.com/westes/flex"
128 "/releases/download/v" version "/"
129 "flex-" version ".tar.gz"))
130 (sha256
131 (base32
132 "15g9bv236nzi665p9ggqjlfn4dwck5835vf0bbw2cz7h5c1swyp8"))))
133 (build-system gnu-build-system)
134 (arguments
135 (if (%current-target-system)
136 (list #:configure-flags
137 #~'("ac_cv_func_malloc_0_nonnull=yes"
138 "ac_cv_func_realloc_0_nonnull=yes"))
139 '()))
140 (native-inputs
141 (list help2man
142 ;; m4 is not present in PATH when cross-building
143 m4))
144 (inputs
145 (list
146 (package
147 (inherit bison)
148 (arguments
149 ;; Disable tests, since they require flex.
150 (substitute-keyword-arguments arguments
151 ((#:tests? _ #f) #f)))
152 (inputs (modify-inputs inputs
153 (delete "flex"))))))
154 (propagated-inputs (list m4))
155 (home-page "https://github.com/westes/flex")
156 (synopsis "Fast lexical analyser generator")
157 (description
158 "Flex is a tool for generating scanners. A scanner, sometimes
159called a tokenizer, is a program which recognizes lexical patterns in
160text. The flex program reads user-specified input files, or its standard
161input if no file names are given, for a description of a scanner to
162generate. The description is in the form of pairs of regular expressions
163and C code, called rules. Flex generates a C source file named,
164\"lex.yy.c\", which defines the function yylex(). The file \"lex.yy.c\"
165can be compiled and linked to produce an executable. When the executable
166is run, it analyzes its input for occurrences of text matching the
167regular expressions for each rule. Whenever it finds a match, it
168executes the corresponding C code.")
169 (license (license:non-copyleft "file://COPYING"
170 "See COPYING in the distribution."))))
171
172;;; The package is named orangeduck-mpc to differentiate it from GNU mpc.
173(define-public orangeduck-mpc
174 ;; The last release lacks an 'install' target.
175 (let ((commit "1049534fc56b1971345c7aaa792dea55d6f9b7bc")
176 (revision "1"))
177 (package
178 (name "orangeduck-mpc")
179 (version (git-version "0.9.0" revision commit))
180 (source (origin
181 (method git-fetch)
182 (uri (git-reference
183 (url "https://github.com/orangeduck/mpc")
184 (commit commit)))
185 (file-name (git-file-name name version))
186 (sha256
187 (base32
188 "1wpxchbjxsyksr8il9pvg195nvqzsjdshzyzwikxda0fss0p7aap"))))
189 (build-system gnu-build-system)
190 (arguments
191 (list #:make-flags #~(list (string-append "CC=" #$(cc-for-target))
192 (string-append "PREFIX=" #$output))
193 #:phases #~(modify-phases %standard-phases
194 (add-after 'unpack 'patch-Makefile
195 (lambda _
196 (substitute* "Makefile"
197 ;; Do not attempt to alter the permissions,
198 ;; otherwise 'install' would error with
199 ;; "cannot stat [...] Permission denied"
200 ;; errors.
201 (("\\s\\-m[0-9]{3}\\s")
202 " "))))
203 (delete 'configure))))
204 (home-page "https://github.com/orangeduck/mpc")
205 (synopsis "Parser Combinator library for C")
206 (description "@code{mpc} is a lightweight Parser Combinator library for C.
207@code{mpc} can help with tasks such as:
208@itemize
209@item Building a new programming language
210@item Building a new data format
211@item Parsing an existing programming language
212@item Parsing an existing data format
213@item Embedding a Domain Specific Language
214@item Implementing Greenspun's Tenth Rule.
215@end itemize")
216 (license license:bsd-2))))
217
218(define-public lexy
219 (package
220 (name "lexy")
221 (version "2025.05.0")
222 (source
223 (origin
224 (method git-fetch)
225 (uri (git-reference
226 (url "https://github.com/foonathan/lexy")
227 (commit (string-append "v" version))))
228 (file-name (git-file-name name version))
229 (sha256
230 (base32 "14j2z7x2l65q95j5br5nw7awgd87p9m2xw7mma4qspiricd0rniq"))))
231 (build-system cmake-build-system)
232 (arguments
233 (list
234 #:configure-flags
235 #~(list "-DLEXY_BUILD_DOCS=OFF") ; needs Hugo
236 #:phases
237 #~(modify-phases %standard-phases
238 (add-after 'unpack 'fix-dependencies
239 (lambda _
240 (substitute* "tests/CMakeLists.txt"
241 (("^message\\(STATUS \"Fetching doctest\"\\).*") "")
242 (("^include\\(FetchContent\\).*") "")
243 (("^FetchContent_Declare\\(doctest .*") "")
244 (("^FetchContent_MakeAvailable\\(doctest\\)")
245 "find_package(doctest REQUIRED)")
246 (("^(target_link_libraries\\(lexy_test_base .*) doctest\\)"
247 _ prefix)
248 (string-append prefix ")"))))))))
249 (native-inputs (list doctest))
250 (home-page "https://lexy.foonathan.net/")
251 (synopsis "C++ parser combinator library")
252 (description
253 "lexy is a parser combinator library for C++17 and later.")
254 (license license:boost1.0)))
255
256(define-public oyacc
257 (package
258 (name "oyacc")
259 (version "6.6")
260 (source
261 (origin
262 (method git-fetch)
263 (uri (git-reference
264 (url "https://github.com/ibara/yacc")
265 (commit (string-append name "-" version))))
266 (file-name (git-file-name name version))
267 (sha256
268 (base32 "1a2nyg2nnh1las40klnp037sapaaph86kjx258cpqcwnk4cv3rnx"))))
269 (build-system gnu-build-system)
270 (arguments
271 (list
272 #:test-target "test"
273 #:make-flags
274 #~(list (string-append "BINDIR=" #$output "/bin")
275 (string-append "MANDIR=" #$output "/share/man/man1"))))
276 (home-page "https://github.com/ibara/yacc")
277 (synopsis "Portable YACC from OpenBSD")
278 (description
279 "@command{oyacc} is a portable version of the OpenBSD's
280@acronym{yacc, Yet Another Compiler Compiler} program, with no dependencies
281besides libc.")
282 (license license:bsd-2)))
283
284(define-public oyacc-as-yacc-wrapper
285 (package/inherit oyacc
286 (name "oyacc-as-yacc-wrapper")
287 (build-system trivial-build-system)
288 (arguments
289 (list
290 #:builder
291 (with-imported-modules '((guix build utils))
292 #~(begin
293 (use-modules (guix build utils))
294 (let ((bindir (string-append #$output "/bin"))
295 (oyacc (string-append #$(this-package-input "oyacc")
296 "/bin/oyacc")))
297 (mkdir-p bindir)
298 (symlink oyacc (string-append bindir "/yacc")))))))
299 (inputs (list oyacc))
300 (description
301 "This package provides the @command{yacc} command, implemented as a
302symbolic link to the @command{oyacc} command from the same-named package.")))
303
304(define-public packcc
305 (package
306 (name "packcc")
307 (version "3.1.0")
308 (source
309 (origin
310 (method git-fetch)
311 (uri (git-reference
312 (url "https://github.com/arithy/packcc")
313 (commit (string-append "v" version))))
314 (file-name (git-file-name name version))
315 (sha256
316 (base32
317 "00aad9hx9kks2wyba8m2gb1pgsc1sxfpgndnfqhs7jswzks6455w"))))
318 (build-system cmake-build-system)
319 (arguments
320 (list
321 #:modules
322 '((guix build cmake-build-system)
323 ((guix build gnu-build-system) #:prefix gnu:)
324 (guix build utils))
325 #:phases
326 #~(modify-phases %standard-phases
327 ;; INFO: This project does not use ctest.
328 (replace 'check
329 (assoc-ref gnu:%standard-phases 'check)))))
330 (native-inputs
331 (list bats python))
332 (home-page "https://github.com/arithy/packcc")
333 (synopsis "Packrat parser generator for C")
334 (description
335 "PackCC is a @url{https://arxiv.org/abs/cs/0603077, packrat}
336parser generator for the C programming language. Its main features are:
337@itemize
338@item Generates a parser in C from a grammar described in a PEG.
339@item Gives your parser great efficiency by packrat parsing.
340@item Supports direct and indirect left-recursive grammar rules.
341@end itemize
342The grammar of your parser can be described in a @acronym{PEG, Parsing
343Expression Grammar}. The PEG is a top-down parsing language, and is similar
344to the regular-expression grammar. The PEG does not require tokenization to
345be a separate step, and tokenization rules can be written in the same way as
346any other grammar rules.")
347 (license license:expat)))
348
349(define-public pegtl
350 (package
351 (name "pegtl")
352 (version "3.2.7")
353 (source
354 (origin
355 (method git-fetch)
356 (uri (git-reference
357 (url "https://github.com/taocpp/PEGTL")
358 (commit version)))
359 (file-name (git-file-name name version))
360 (sha256
361 (base32
362 "01adjqqdr9yf4h379jl1x0526kvixfpqk4hdk9mna49qc4s5hpi1"))))
363 (build-system cmake-build-system)
364 (home-page "https://github.com/taocpp/PEGTL")
365 (synopsis "Parsing Expression Grammar template library")
366 (description
367 "The @acronym{PEGTL, Parsing Expression Grammar Template Library} is a
368zero-dependency C++ header-only parser combinator library for creating parsers
369according to a @acronym{PEG, Parsing Expression Grammar}.")
370 (license license:expat)))
371
372(define-public re2c
373 (package
374 (name "re2c")
375 (version "4.2")
376 (source
377 (origin
378 (method url-fetch)
379 (uri (string-append "https://github.com/skvadrik/" name
380 "/releases/download/" version "/"
381 name "-" version ".tar.xz"))
382 (sha256
383 (base32
384 "07ysqgdm0h566a8lwnpdgycp93vz7zskzihsgah3bla0ycj2pp69"))))
385 (build-system gnu-build-system)
386 (arguments
387 (list
388 #:tests?
389 (not (or (%current-target-system)
390 ;; TODO: run_tests.py hangs
391 (system-hurd?)))
392 #:phases
393 (if (target-arm32?)
394 #~(modify-phases %standard-phases
395 (add-after 'unpack 'patch-sources
396 (lambda _
397 (invoke "patch" "-p1" "--force" "--input"
398 #$(local-file (search-patch
399 "re2c-Use-maximum-alignment.patch"))))))
400 #~%standard-phases)))
401 (native-inputs
402 (list python)) ; for the test driver
403 (home-page "https://re2c.org/")
404 (synopsis "Lexer generator")
405 (description
406 "@code{re2c, Regular Expressions to Code} is a flexible lexical analyser.
407Instead of using traditional table-driven approaches, it encodes a finite
408state machine directly in the code in the form of jumps and comparisons.")
409 (license license:public-domain)))
410
411(define-public reflex
412 (package
413 (name "reflex")
414 (version "20260131")
415 (source
416 (origin
417 (method url-fetch)
418 (uri (string-append
419 "https://invisible-island.net/archives/reflex/reflex-"
420 version ".tgz"))
421 (sha256
422 (base32 "1ga82ycrfmfq6g3r8b8ixlhj82wnlwf9kibzhyivjfv26dgscldb"))
423 (snippet
424 #~(begin
425 (delete-file "configure")))))
426 (build-system gnu-build-system)
427 (native-inputs
428 (list autoconf
429 automake
430 ;; Works with any POSIX yacc, but let's use a non-self-hosted one.
431 oyacc-as-yacc-wrapper))
432 (home-page "https://invisible-island.net/reflex/reflex.html")
433 (synopsis "Variant of flex lexical scanner")
434 (description
435 "Reflex is a POSIX-compatible variant of the @command{flex} lexical scanner
436generator.")
437 (license license:bsd-2)))