projects/guix·blob java-team · refs

357 lines · 14.9 KiB

1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2012 Nikita Karetnikov <[email protected]>
3;;; Copyright © 2014 Mark H Weaver <[email protected]>
4;;; Copyright © 2015, 2017 Ricardo Wurmus <[email protected]>
5;;; Copyright © 2016, 2019, 2022 Efraim Flashner <[email protected]>
6;;; Copyright © 2016 Alex Kost <[email protected]>
7;;; Copyright © 2017, 2019, 2020 Marius Bakke <[email protected]>
8;;; Copyright © 2017 Mathieu Othacehe <[email protected]>
9;;; Copyright © 2017 Eric Bavier <[email protected]>
10;;; Copyright © 2018, 2019, 2020 Tobias Geerinckx-Rice <[email protected]>
11;;; Copyright © 2019 Miguel <[email protected]>
12;;; Copyright © 2020, 2023, 2024, 2025 Janneke Nieuwenhuizen <[email protected]>
13;;; Copyright © 2020 EuAndreh <[email protected]>
14;;; Copyright © 2022, 2024, 2025 gemmaro <[email protected]>
15;;; Copyright © 2023 Maxim Cournoyer [email protected]>
16;;;
17;;; This file is part of GNU Guix.
18;;;
19;;; GNU Guix is free software; you can redistribute it and/or modify it
20;;; under the terms of the GNU General Public License as published by
21;;; the Free Software Foundation; either version 3 of the License, or (at
22;;; your option) any later version.
23;;;
24;;; GNU Guix is distributed in the hope that it will be useful, but
25;;; WITHOUT ANY WARRANTY; without even the implied warranty of
26;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
27;;; GNU General Public License for more details.
28;;;
29;;; You should have received a copy of the GNU General Public License
30;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
31
32(define-module (gnu packages gettext)
33 #:use-module ((guix licenses) #:select (gpl2+ gpl3+ bsd-3))
34 #:use-module (gnu packages)
35 #:use-module (guix packages)
36 #:use-module (guix gexp)
37 #:use-module (guix git-download)
38 #:use-module (guix download)
39 #:use-module (guix build-system gnu)
40 #:use-module (guix build-system perl)
41 #:use-module (guix build-system pyproject)
42 #:use-module (gnu packages bash)
43 #:use-module (gnu packages check)
44 #:use-module (gnu packages docbook)
45 #:use-module (gnu packages emacs)
46 #:use-module (gnu packages libunistring)
47 #:use-module (gnu packages ncurses)
48 #:use-module (gnu packages perl)
49 #:use-module (gnu packages perl-check)
50 #:use-module (gnu packages tex)
51 #:use-module (gnu packages xml)
52 #:use-module (gnu packages python-build)
53 #:use-module (gnu packages python-xyz)
54 #:use-module (gnu packages sphinx)
55 #:use-module (guix utils))
56
57(define-public gettext-minimal
58 (package
59 (name "gettext-minimal")
60 (version "0.23.1")
61 (source (origin
62 (method url-fetch)
63 (uri (string-append "mirror://gnu/gettext/gettext-"
64 version ".tar.gz"))
65 (sha256
66 (base32
67 "0j8fijicvg8jkrisgsqbpnbmfb2mz3gx2p6pcwip82731yb7i9aj"))))
68 (build-system gnu-build-system)
69 (outputs '("out"
70 "doc")) ;9 MiB of HTML
71 (inputs
72 (list libunistring
73 libxml2
74 ;; TODO: ncurses is only needed for the 'libtextstyle' library.
75 ;; The next version of gettext can use a separate libtextstyle,
76 ;; but for now we include it here in 'gettext-minimal'.
77 ncurses))
78 (arguments
79 (list #:configure-flags #~'("--with-included-libunistring=no"
80 "--with-included-libxml=no")
81 #:phases
82 #~(modify-phases %standard-phases
83 (add-before 'patch-source-shebangs 'patch-fixed-paths
84 (lambda _
85 (substitute* '("gettext-tools/config.h.in"
86 "gettext-tools/gnulib-tests/init.sh"
87 "gettext-tools/tests/init.sh"
88 "gettext-tools/system-tests/run-test")
89 (("/bin/sh") "sh"))
90 (substitute* '("gettext-tools/src/project-id"
91 "gettext-tools/projects/KDE/trigger"
92 "gettext-tools/projects/GNOME/trigger")
93 (("/bin/pwd") "pwd"))))
94 (add-before 'check 'patch-tests
95 (lambda* (#:key inputs #:allow-other-keys)
96 ;;libgettextlib-0.23.so => not found
97 (substitute* "gettext-tools/gnulib-tests/test-execute.sh"
98 (("^#!.*" all)
99 (string-append all "exit 77;\n")))
100 (let* ((bash (which "sh")))
101 ;; Some of the files we're patching are
102 ;; ISO-8859-1-encoded, so choose it as the default
103 ;; encoding so the byte encoding is preserved.
104 (with-fluids ((%default-port-encoding #f))
105 (substitute*
106 (find-files "gettext-tools/tests"
107 "^(lang-sh|msg(exec|filter)-[0-9])")
108 (("#![[:blank:]]/bin/sh")
109 (format #f "#!~a" bash)))
110
111 (substitute* (cons "gettext-tools/src/msginit.c"
112 (find-files "gettext-tools/gnulib-tests"
113 "posix_spawn"))
114 (("/bin/sh")
115 bash))
116
117 (substitute* "gettext-tools/src/project-id"
118 (("/bin/pwd")
119 "pwd"))
120
121 #$@(if (target-hurd?)
122 #~((substitute*
123 "gettext-tools/gnulib-tests/Makefile.in"
124 ;; See 'coreutils' for the rationale.
125 ((" test-tls\\$\\(EXEEXT\\) ") " ")))
126 '())))))
127 #$@(if (%current-target-system)
128 #~((add-after 'install 'patch-cross-shebangs
129 (lambda _
130 (let ((path (list (string-append #$bash-minimal "/bin"))))
131 (define (patch-cross-shebang file)
132 (patch-shebang file path))
133 (with-directory-excursion
134 (string-append #$output "/bin")
135 (for-each
136 patch-cross-shebang
137 '("autopoint" "gettext.sh" "gettextize")))))))
138 '()))
139
140 ;; When tests fail, we want to know the details.
141 #:make-flags #~'("VERBOSE=yes")))
142 (home-page "https://www.gnu.org/software/gettext/")
143 (synopsis
144 "Tools and documentation for translation (used to build other packages)")
145 (description
146 "GNU Gettext is a package providing a framework for translating the
147textual output of programs into multiple languages. It provides translators
148with the means to create message catalogs, and a runtime library to load
149translated messages from the catalogs. Nearly all GNU packages use Gettext.")
150 (properties `((upstream-name . "gettext")
151 (cpe-name . "gettext")))
152 (license gpl3+))) ;some files are under GPLv2+
153
154(define-public gettext-minimal-0.21
155 (package/inherit gettext-minimal
156 (version "0.21")
157 (source (origin
158 (method url-fetch)
159 (uri (string-append "mirror://gnu/gettext/gettext-"
160 version ".tar.gz"))
161 (sha256
162 (base32
163 "04kbg1sx0ncfrsbr85ggjslqkzzb243fcw9nyh3rrv1a22ihszf7"))
164 (patches (search-patches "gettext-libunicode-update.patch"))))
165 (arguments
166 (substitute-keyword-arguments arguments
167 ((#:phases phases)
168 #~(modify-phases #$phases
169 (add-after 'unpack 'touch-test
170 (lambda _
171 (with-output-to-file "gettext-tools/gnulib-tests/test-execute.sh"
172 (lambda _ (display "")))))
173 (add-before 'check 'patch-test
174 (lambda _
175 ;; This test fails with ggc-14.
176 (substitute* "gettext-tools/tests/xgettext-javascript-6"
177 (("^#!.*" all) (string-append all "exit 77;\n")))))))))))
178
179;; Use that name to avoid clashes with Guile's 'gettext' procedure.
180;;
181;; We used to resort to #:renamer on the user side, but that prevented
182;; circular dependencies involving (gnu packages gettext). This is because
183;; 'resolve-interface' (as of Guile 2.0.9) iterates eagerly over the used
184;; module when there's a #:renamer, and that module may be empty at that point
185;; in case or circular dependencies.
186(define-public gnu-gettext
187 (package/inherit gettext-minimal
188 (name "gettext")
189 (arguments
190 (substitute-keyword-arguments arguments
191 ((#:phases phases)
192 #~(modify-phases #$phases
193 (add-after 'install 'add-emacs-autoloads
194 (lambda* (#:key outputs #:allow-other-keys)
195 ;; Make 'po-mode' and other things available by default.
196 (with-directory-excursion
197 (string-append (assoc-ref outputs "out")
198 "/share/emacs/site-lisp")
199 (symlink "start-po.el" "gettext-autoloads.el"))))))))
200 (native-inputs (list emacs-minimal)) ;for Emacs tools
201 (synopsis "Tools and documentation for translation")))
202
203(define-public libtextstyle
204 (package
205 (name "libtextstyle")
206 (version "0.21")
207 (source (origin
208 (inherit (package-source gnu-gettext))
209 (uri (string-append "mirror://gnu/gettext/gettext-"
210 version ".tar.gz"))
211 (sha256
212 (base32
213 "04kbg1sx0ncfrsbr85ggjslqkzzb243fcw9nyh3rrv1a22ihszf7"))))
214 (build-system gnu-build-system)
215 (arguments
216 '(#:configure-flags '("--disable-static")
217 #:phases (modify-phases %standard-phases
218 (add-after 'unpack 'chdir
219 (lambda _
220 (chdir "libtextstyle")
221 #t)))))
222 ;; libtextstyle bundles libxml2, glib (a small subset thereof), and
223 ;; libcroco, but it purposefully prevents users from using an external
224 ;; copy, to reduce the startup time of programs using libtextstyle.
225 (home-page "https://www.gnu.org/software/gettext/")
226 (synopsis "Text styling library")
227 (description
228 "GNU libtextstyle is a C library that provides an easy way to add styling
229to programs that produce output to a console or terminal emulator window. It
230allows applications to emit text annotated with styling information, such as
231color, font attributes (weight, posture), or underlining.")
232 (license gpl3+)))
233
234(define-public mdpo
235 (package
236 (name "mdpo")
237 (version "2.1.4")
238 (source
239 (origin
240 (method git-fetch)
241 (uri (git-reference
242 (url "https://github.com/mondeja/mdpo")
243 (commit (string-append "v" version))))
244 (file-name (git-file-name name version))
245 (sha256
246 (base32 "02i17xly3yvfk6lpjl6sc15xzq9s3zc814siag1winyqckzl74gj"))))
247 (build-system pyproject-build-system)
248 (arguments
249 (list
250 #:test-flags
251 #~(list
252 ;; XXX: Most failing test are caused by improper line wrapping.
253 "--ignore=tests/test_unit/test_md2po2md/test_md2po2md_cli.py"
254 "--ignore=tests/test_unit/test_text.py"
255 "--ignore=tests/test_unit/test_command.py"
256 "--ignore=tests/test_unit/test_md2po/test_location.py"
257 "-k" "not test_mark_not_found_as_obsolete")
258 #:phases
259 #~(modify-phases %standard-phases
260 (add-after 'unpack 'relax-requirements
261 (lambda _
262 (substitute* "pyproject.toml"
263 ((".*contextlib-chdir.*") ""))))))) ; Uneeded backport.
264 (native-inputs
265 (list python-hatchling
266 python-pytest
267 python-setuptools))
268 (propagated-inputs
269 (list python-importlib-metadata-argparse-version
270 python-md-ulb-pwrap
271 python-polib
272 python-pymd4c))
273 (home-page "https://github.com/mondeja/mdpo")
274 (synopsis "Markdown file translation utilities using pofiles")
275 (description
276 "The mdpo utility creates pofiles, the format stabilished by GNU Gettext,
277from Markdown files.")
278 (license bsd-3)))
279
280(define-public po4a
281 (package
282 (name "po4a")
283 (version "0.74")
284 (source (origin
285 (method url-fetch)
286 (uri (string-append "https://github.com/mquinson/po4a"
287 "/releases/download/v"
288 version "/po4a-" version ".tar.gz"))
289 (sha256
290 (base32
291 "1hp7iy1rl8ci7rirh7r6d3jb0i16jm4vy3mgqd4bsyx35czk5z15"))))
292 (build-system perl-build-system)
293 (arguments
294 (list
295 #:phases
296 #~(modify-phases %standard-phases
297 (add-after 'install 'wrap-programs
298 (lambda _
299 ;; Make sure all executables in "bin" find the Perl modules
300 ;; required by this package at runtime.
301 (for-each
302 (lambda (file)
303 (wrap-program file
304 (list "PERL5LIB" 'suffix
305 (list (string-append #$output "/lib/perl5/site_perl")
306 (getenv "PERL5LIB")))))
307 (find-files (string-append #$output "/bin/") "\\.*$"))))
308 #$@(if (system-hurd?)
309 #~((add-after 'unpack 'skip-tests/hurd
310 (lambda _
311 (delete-file "t/cfg-multi.t")
312 (delete-file "t/cfg-single.t")
313 (delete-file "t/cfg-split.t"))))
314 #~()))))
315 (native-inputs
316 (list gettext-minimal
317 perl-module-build
318 docbook-xsl
319 libxslt
320 libxml2 ;xmlcatalog
321 ;; For tests.
322 docbook-sgml-4.1
323 docbook-xml-4.5
324 perl-test-pod
325 (texlive-local-tree)))
326 (inputs
327 (list bash-minimal
328 opensp
329 perl-gettext
330 perl-pod-parser
331 perl-pod-simple
332 perl-sgmls
333 perl-syntax-keyword-try
334 perl-xs-parse-keyword
335 perl-term-readkey
336 perl-text-wrapi18n
337 perl-unicode-linebreak
338 perl-yaml-tiny))
339 (home-page "https://po4a.org/")
340 (synopsis "Scripts to ease maintenance of translations")
341 (description
342 "The po4a (PO for anything) project goal is to ease translations (and
343more interestingly, the maintenance of translations) using gettext tools on
344areas where they were not expected like documentation.")
345 (license gpl2+)))
346
347(define-public po4a-minimal
348 (package/inherit po4a
349 (native-inputs
350 ;; Remove test dependencies, primarily to reduce the size of the
351 ;; dependency graph of the ‘guix’ package.
352 (modify-inputs native-inputs
353 (delete "docbook-xml" "perl-test-pod" "texlive-local-tree")))
354 (arguments
355 (substitute-keyword-arguments arguments
356 ((#:tests? _ #t) #f)))
357 (properties '((hidden? . #t)))))