gnu: libretro-lowresnx: Update to 1.2.
[jackhill/guix/guix.git] / gnu / packages / gettext.scm
CommitLineData
233e7676
LC
1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2012 Nikita Karetnikov <nikita@karetnikov.org>
c57a6e4c 3;;; Copyright © 2014 Mark H Weaver <mhw@netris.org>
84889519 4;;; Copyright © 2015, 2017 Ricardo Wurmus <rekado@elephly.net>
9350a084 5;;; Copyright © 2016, 2019 Efraim Flashner <efraim@flashner.co.il>
9e015894 6;;; Copyright © 2016 Alex Kost <alezost@gmail.com>
3730e3c6 7;;; Copyright © 2017, 2019 Marius Bakke <mbakke@fastmail.com>
480da86d 8;;; Copyright © 2017 Mathieu Othacehe <m.othacehe@gmail.com>
acc2dab7 9;;; Copyright © 2017 Eric Bavier <bavier@member.fsf.org>
e51101ec 10;;; Copyright © 2018, 2019, 2020 Tobias Geerinckx-Rice <me@tobias.gr>
3730e3c6 11;;; Copyright © 2019 Miguel <rosen644835@gmail.com>
2fc298d1 12;;; Copyright © 2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
625708b0 13;;; Copyright © 2020 EuAndreh <eu@euandre.org>
f190f92f 14;;;
233e7676 15;;; This file is part of GNU Guix.
f190f92f 16;;;
233e7676 17;;; GNU Guix is free software; you can redistribute it and/or modify it
f190f92f
NK
18;;; under the terms of the GNU General Public License as published by
19;;; the Free Software Foundation; either version 3 of the License, or (at
20;;; your option) any later version.
21;;;
233e7676 22;;; GNU Guix is distributed in the hope that it will be useful, but
f190f92f
NK
23;;; WITHOUT ANY WARRANTY; without even the implied warranty of
24;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25;;; GNU General Public License for more details.
26;;;
27;;; You should have received a copy of the GNU General Public License
233e7676 28;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
f190f92f 29
1ffa7090 30(define-module (gnu packages gettext)
625708b0 31 #:use-module ((guix licenses) #:select (gpl2+ gpl3+ bsd-3))
59a43334 32 #:use-module (gnu packages)
f190f92f
NK
33 #:use-module (guix packages)
34 #:use-module (guix download)
c42a4b76 35 #:use-module (guix build-system gnu)
97f70018 36 #:use-module (guix build-system perl)
625708b0
E
37 #:use-module (guix build-system python)
38 #:use-module (gnu packages check)
97f70018 39 #:use-module (gnu packages docbook)
9e015894 40 #:use-module (gnu packages emacs)
2fc298d1 41 #:use-module (gnu packages hurd)
3730e3c6
MB
42 #:use-module (gnu packages libunistring)
43 #:use-module (gnu packages ncurses)
97f70018 44 #:use-module (gnu packages perl)
d343c12b 45 #:use-module (gnu packages perl-check)
8f9ac901 46 #:use-module (gnu packages tex)
9e015894 47 #:use-module (gnu packages xml)
625708b0
E
48 #:use-module (gnu packages python-xyz)
49 #:use-module (gnu packages sphinx)
9e015894 50 #:use-module (guix utils))
f190f92f 51
b94a6ca0 52(define-public gettext-minimal
f190f92f 53 (package
b94a6ca0 54 (name "gettext-minimal")
3730e3c6 55 (version "0.20.1")
2c9143a1 56 (source (origin
3730e3c6
MB
57 (method url-fetch)
58 (uri (string-append "mirror://gnu/gettext/gettext-"
59 version ".tar.gz"))
60 (sha256
61 (base32
62 "0p3zwkk27wm2m2ccfqm57nj7vqkmfpn7ja1nf65zmhz8qqs5chb6"))))
f190f92f 63 (build-system gnu-build-system)
d7170f44 64 (outputs '("out"
3730e3c6 65 "doc")) ;9 MiB of HTML
c42a4b76 66 (inputs
3730e3c6
MB
67 `(("libunistring" ,libunistring)
68 ("libxml2" ,libxml2)
69
70 ;; TODO: ncurses is only needed for the 'libtextstyle' library.
71 ;; The next version of gettext can use a separate libtextstyle,
72 ;; but for now we include it here in 'gettext-minimal'.
73 ("ncurses" ,ncurses)))
f190f92f 74 (arguments
3730e3c6
MB
75 `(#:configure-flags '("--with-included-libunistring=no"
76 "--with-included-libxml=no")
77 #:phases
e5f03762 78 (modify-phases %standard-phases
3730e3c6
MB
79 (add-before 'patch-source-shebangs 'patch-fixed-paths
80 (lambda _
81 (substitute* '("gettext-tools/config.h.in"
82 "gettext-tools/gnulib-tests/init.sh"
83 "gettext-tools/tests/init.sh"
84 "gettext-tools/system-tests/run-test")
85 (("/bin/sh") "sh"))
86 (substitute* '("gettext-tools/src/project-id"
87 "gettext-tools/projects/KDE/trigger"
88 "gettext-tools/projects/GNOME/trigger")
89 (("/bin/pwd") "pwd"))
90 #t))
e5f03762
EF
91 (add-before 'check 'patch-tests
92 (lambda* (#:key inputs #:allow-other-keys)
93 (let* ((bash (which "sh")))
94 ;; Some of the files we're patching are
95 ;; ISO-8859-1-encoded, so choose it as the default
96 ;; encoding so the byte encoding is preserved.
97 (with-fluids ((%default-port-encoding #f))
98 (substitute*
99 (find-files "gettext-tools/tests"
100 "^(lang-sh|msg(exec|filter)-[0-9])")
101 (("#![[:blank:]]/bin/sh")
102 (format #f "#!~a" bash)))
0e4e4b13 103
e5f03762
EF
104 (substitute* (cons "gettext-tools/src/msginit.c"
105 (find-files "gettext-tools/gnulib-tests"
106 "posix_spawn"))
107 (("/bin/sh")
108 bash))
0e4e4b13 109
e5f03762
EF
110 (substitute* "gettext-tools/src/project-id"
111 (("/bin/pwd")
ae7ba731
MW
112 "pwd"))
113
3730e3c6 114 #t)))))
0e4e4b13
LC
115
116 ;; When tests fail, we want to know the details.
2fc298d1
JN
117 #:make-flags '("VERBOSE=yes"
118 ,@(if (hurd-target?)
119 ;; Linking to libgettextlib.so makes test-raise fail
120 '("XFAIL_TESTS=test-raise")
121 '()))))
6fd52309 122 (home-page "https://www.gnu.org/software/gettext/")
b94a6ca0
AK
123 (synopsis
124 "Tools and documentation for translation (used to build other packages)")
f190f92f 125 (description
79c311b8
LC
126 "GNU Gettext is a package providing a framework for translating the
127textual output of programs into multiple languages. It provides translators
b94a6ca0
AK
128with the means to create message catalogs, and a runtime library to load
129translated messages from the catalogs. Nearly all GNU packages use Gettext.")
69cb225c
LC
130 (properties `((upstream-name . "gettext")
131 (cpe-name . "gettext")))
1c301e48 132 (license gpl3+))) ;some files are under GPLv2+
97f70018 133
b94a6ca0
AK
134;; Use that name to avoid clashes with Guile's 'gettext' procedure.
135;;
136;; We used to resort to #:renamer on the user side, but that prevented
137;; circular dependencies involving (gnu packages gettext). This is because
138;; 'resolve-interface' (as of Guile 2.0.9) iterates eagerly over the used
139;; module when there's a #:renamer, and that module may be empty at that point
140;; in case or circular dependencies.
141(define-public gnu-gettext
1a265842 142 (package/inherit gettext-minimal
b94a6ca0 143 (name "gettext")
9e015894
AK
144 (arguments
145 (substitute-keyword-arguments (package-arguments gettext-minimal)
146 ((#:phases phases)
147 `(modify-phases ,phases
148 (add-after 'install 'add-emacs-autoloads
149 (lambda* (#:key outputs #:allow-other-keys)
150 ;; Make 'po-mode' and other things available by default.
151 (with-directory-excursion
152 (string-append (assoc-ref outputs "out")
153 "/share/emacs/site-lisp")
154 (symlink "start-po.el" "gettext-autoloads.el")
155 #t)))))))
156 (native-inputs `(("emacs" ,emacs-minimal))) ; for Emacs tools
b94a6ca0
AK
157 (synopsis "Tools and documentation for translation")))
158
ea541333
LC
159(define-public libtextstyle
160 (package
161 (name "libtextstyle")
7b58d009 162 (version "0.21")
ea541333
LC
163 (source (origin
164 (inherit (package-source gnu-gettext))
165 (uri (string-append "mirror://gnu/gettext/gettext-"
166 version ".tar.gz"))
167 (sha256
168 (base32
7b58d009 169 "04kbg1sx0ncfrsbr85ggjslqkzzb243fcw9nyh3rrv1a22ihszf7"))))
ea541333
LC
170 (build-system gnu-build-system)
171 (arguments
172 '(#:configure-flags '("--disable-static")
173 #:phases (modify-phases %standard-phases
174 (add-after 'unpack 'chdir
175 (lambda _
176 (chdir "libtextstyle")
177 #t)))))
178 ;; libtextstyle bundles libxml2, glib (a small subset thereof), and
179 ;; libcroco, but it purposefully prevents users from using an external
180 ;; copy, to reduce the startup time of programs using libtextstyle.
181 (home-page "https://www.gnu.org/software/gettext/")
182 (synopsis "Text styling library")
183 (description
184 "GNU libtextstyle is a C library that provides an easy way to add styling
185to programs that produce output to a console or terminal emulator window. It
186allows applications to emit text annotated with styling information, such as
187color, font attributes (weight, posture), or underlining.")
188 (license gpl3+)))
189
625708b0
E
190(define-public mdpo
191 (package
192 (name "mdpo")
193 (version "0.3.6")
194 (source
195 (origin
196 (method url-fetch)
197 (uri (pypi-uri "mdpo" version))
198 (sha256
199 (base32 "0kgbm0af7jwpfspa2xxiy9nc2l1r2s1rhbhz4r229zcqv49ak6sq"))))
200 (build-system python-build-system)
201 (native-inputs
202 `(("python-bump2version" ,python-bump2version)
203 ("python-flake8" ,python-flake8)
204 ("python-flake8-implicit-str-concat" ,python-flake8-implicit-str-concat)
205 ("python-flake8-print" ,python-flake8-print)
206 ("python-isort" ,python-isort)
207 ("python-pre-commit" ,python-pre-commit)
208 ("python-pytest" ,python-pytest)
209 ("python-pytest-cov" ,python-pytest-cov)
210 ("python-sphinx" ,python-sphinx)
211 ("python-sphinx-argparse" ,python-sphinx-argparse)
212 ("python-sphinx-rtd-theme" ,python-sphinx-rtd-theme)
213 ("python-twine" ,python-twine)
214 ("python-yamllint" ,python-yamllint)))
215 (propagated-inputs
216 `(("python-polib" ,python-polib)
217 ("python-pymd4c" ,python-pymd4c)))
218 (home-page "https://github.com/mondeja/mdpo")
219 (synopsis "Markdown file translation utilities using pofiles")
220 (description
221 "The mdpo utility creates pofiles, the format stabilished by GNU Gettext,
222from Markdown files.")
223 (license bsd-3)))
224
97f70018
RW
225(define-public po4a
226 (package
227 (name "po4a")
d343c12b 228 (version "0.61")
97f70018
RW
229 (source (origin
230 (method url-fetch)
816db966
JL
231 (uri (string-append "https://github.com/mquinson/po4a/releases/download/v"
232 version "/po4a-" version ".tar.gz"))
97f70018
RW
233 (sha256
234 (base32
d343c12b 235 "1nw61dj7ymrsjps79vvfdzp549drwd51kyj598937zvyafq4r5b2"))))
97f70018
RW
236 (build-system perl-build-system)
237 (arguments
238 `(#:phases
239 (modify-phases %standard-phases
97f70018
RW
240 (add-after 'install 'wrap-programs
241 (lambda* (#:key outputs #:allow-other-keys)
242 ;; Make sure all executables in "bin" find the Perl modules
243 ;; provided by this package at runtime.
244 (let* ((out (assoc-ref outputs "out"))
245 (bin (string-append out "/bin/"))
246 (path (string-append out "/lib/perl5/site_perl")))
247 (for-each (lambda (file)
248 (wrap-program file
249 `("PERL5LIB" ":" prefix (,path))))
250 (find-files bin "\\.*$"))
727bec13
MB
251 #t)))
252 (add-before 'reset-gzip-timestamps 'make-compressed-files-writable
253 (lambda* (#:key outputs #:allow-other-keys)
254 (for-each make-file-writable
255 (find-files (string-append (assoc-ref outputs "out")
256 "/share/man")
257 ".*\\.gz$"))
895789ea 258 #t))
9350a084
EF
259 (add-after 'unpack 'patch-docbook-xml
260 (lambda* (#:key inputs #:allow-other-keys)
261 (substitute* (find-files "." ".*\\.xml(-good)?")
262 (("http://www.oasis-open.org/docbook/xml/4.1.2/")
263 (string-append (assoc-ref inputs "docbook-xml")
264 "/xml/dtd/docbook/")))
265 #t))
895789ea
TGR
266 (add-before 'check 'disable-failing-tests
267 (lambda _
9350a084
EF
268 ;; FIXME: these tests require SGMLS.pm.
269 (delete-file "t/01-classes.t")
d343c12b
JL
270
271 (delete-file "t/add.t")
272 (delete-file "t/core-porefs.t")
273 (delete-file "t/fmt-asciidoc.t")
274 (delete-file "t/fmt-sgml.t")
895789ea 275
727bec13 276 #t)))))
97f70018 277 (native-inputs
b94a6ca0 278 `(("gettext" ,gettext-minimal)
97f70018
RW
279 ("perl-module-build" ,perl-module-build)
280 ("docbook-xsl" ,docbook-xsl)
97f70018 281 ("libxml2" ,libxml2)
895789ea
TGR
282 ("xsltproc" ,libxslt)
283
284 ;; For tests.
9350a084 285 ("docbook-xml" ,docbook-xml-4.1.2)
d343c12b 286 ("perl-test-pod" ,perl-test-pod)
895789ea
TGR
287 ("perl-yaml-tiny" ,perl-yaml-tiny)
288 ("texlive" ,texlive-tiny)))
4eb0f5cd 289 (home-page "https://po4a.org/")
97f70018
RW
290 (synopsis "Scripts to ease maintenance of translations")
291 (description
292 "The po4a (PO for anything) project goal is to ease translations (and
293more interestingly, the maintenance of translations) using gettext tools on
294areas where they were not expected like documentation.")
295 (license gpl2+)))