gnu: Add python-keras-preprocessing.
[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>
727bec13 7;;; Copyright © 2017 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>
895789ea 10;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr>
f190f92f 11;;;
233e7676 12;;; This file is part of GNU Guix.
f190f92f 13;;;
233e7676 14;;; GNU Guix is free software; you can redistribute it and/or modify it
f190f92f
NK
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;;;
233e7676 19;;; GNU Guix is distributed in the hope that it will be useful, but
f190f92f
NK
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
233e7676 25;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
f190f92f 26
1ffa7090 27(define-module (gnu packages gettext)
97f70018 28 #:use-module ((guix licenses) #:select (gpl2+ gpl3+))
59a43334 29 #:use-module (gnu packages)
f190f92f
NK
30 #:use-module (guix packages)
31 #:use-module (guix download)
c42a4b76 32 #:use-module (guix build-system gnu)
97f70018
RW
33 #:use-module (guix build-system perl)
34 #:use-module (gnu packages docbook)
9e015894 35 #:use-module (gnu packages emacs)
97f70018 36 #:use-module (gnu packages perl)
8f9ac901 37 #:use-module (gnu packages tex)
9e015894
AK
38 #:use-module (gnu packages xml)
39 #:use-module (guix utils))
f190f92f 40
b94a6ca0 41(define-public gettext-minimal
f190f92f 42 (package
b94a6ca0 43 (name "gettext-minimal")
fba0d4c9 44 (version "0.19.8.1")
2c9143a1
LC
45 (source (origin
46 (method url-fetch)
47 (uri (string-append "mirror://gnu/gettext/gettext-"
48 version ".tar.gz"))
49 (sha256
50 (base32
480da86d 51 "0hsw28f9q9xaggjlsdp2qmbp2rbd1mp0njzan2ld9kiqwkq2m57z"))
acc2dab7
EB
52 (modules '((guix build utils)))
53 (snippet
54 '(begin
55 ;; The gnulib test-lock test is prone to writer starvation
56 ;; with our glibc@2.25, which prefers readers, so disable it.
57 ;; The gnulib commit b20e8afb0b2 should fix this once
58 ;; incorporated here.
59 (substitute* "gettext-runtime/tests/Makefile.in"
60 (("TESTS = test-lock\\$\\(EXEEXT\\)") "TESTS ="))
61 (substitute* "gettext-tools/gnulib-tests/Makefile.in"
62 (("test-lock\\$\\(EXEEXT\\) ") ""))
63 #t))))
f190f92f 64 (build-system gnu-build-system)
d7170f44
LC
65 (outputs '("out"
66 "doc")) ;8 MiB of HTML
c42a4b76
AE
67 (inputs
68 `(("expat" ,expat)))
f190f92f 69 (arguments
e5f03762
EF
70 `(#:phases
71 (modify-phases %standard-phases
72 (add-before 'check 'patch-tests
73 (lambda* (#:key inputs #:allow-other-keys)
74 (let* ((bash (which "sh")))
75 ;; Some of the files we're patching are
76 ;; ISO-8859-1-encoded, so choose it as the default
77 ;; encoding so the byte encoding is preserved.
78 (with-fluids ((%default-port-encoding #f))
79 (substitute*
80 (find-files "gettext-tools/tests"
81 "^(lang-sh|msg(exec|filter)-[0-9])")
82 (("#![[:blank:]]/bin/sh")
83 (format #f "#!~a" bash)))
0e4e4b13 84
e5f03762
EF
85 (substitute* (cons "gettext-tools/src/msginit.c"
86 (find-files "gettext-tools/gnulib-tests"
87 "posix_spawn"))
88 (("/bin/sh")
89 bash))
0e4e4b13 90
e5f03762
EF
91 (substitute* "gettext-tools/src/project-id"
92 (("/bin/pwd")
ae7ba731
MW
93 "pwd"))
94
95 #t))))
e5f03762
EF
96 (add-before 'configure 'link-expat
97 (lambda _
98 ;; Gettext defaults to opening expat via dlopen on
99 ;; "Linux". Change to link directly.
100 (substitute* "gettext-tools/configure"
101 (("LIBEXPAT=\"-ldl\"") "LIBEXPAT=\"-ldl -lexpat\"")
ae7ba731
MW
102 (("LTLIBEXPAT=\"-ldl\"") "LTLIBEXPAT=\"-ldl -lexpat\""))
103 #t)))
0e4e4b13
LC
104
105 ;; When tests fail, we want to know the details.
106 #:make-flags '("VERBOSE=yes")))
6fd52309 107 (home-page "https://www.gnu.org/software/gettext/")
b94a6ca0
AK
108 (synopsis
109 "Tools and documentation for translation (used to build other packages)")
f190f92f 110 (description
79c311b8
LC
111 "GNU Gettext is a package providing a framework for translating the
112textual output of programs into multiple languages. It provides translators
b94a6ca0
AK
113with the means to create message catalogs, and a runtime library to load
114translated messages from the catalogs. Nearly all GNU packages use Gettext.")
69cb225c
LC
115 (properties `((upstream-name . "gettext")
116 (cpe-name . "gettext")))
1c301e48 117 (license gpl3+))) ;some files are under GPLv2+
97f70018 118
b94a6ca0
AK
119;; Use that name to avoid clashes with Guile's 'gettext' procedure.
120;;
121;; We used to resort to #:renamer on the user side, but that prevented
122;; circular dependencies involving (gnu packages gettext). This is because
123;; 'resolve-interface' (as of Guile 2.0.9) iterates eagerly over the used
124;; module when there's a #:renamer, and that module may be empty at that point
125;; in case or circular dependencies.
126(define-public gnu-gettext
127 (package
128 (inherit gettext-minimal)
129 (name "gettext")
9e015894
AK
130 (arguments
131 (substitute-keyword-arguments (package-arguments gettext-minimal)
132 ((#:phases phases)
133 `(modify-phases ,phases
134 (add-after 'install 'add-emacs-autoloads
135 (lambda* (#:key outputs #:allow-other-keys)
136 ;; Make 'po-mode' and other things available by default.
137 (with-directory-excursion
138 (string-append (assoc-ref outputs "out")
139 "/share/emacs/site-lisp")
140 (symlink "start-po.el" "gettext-autoloads.el")
141 #t)))))))
142 (native-inputs `(("emacs" ,emacs-minimal))) ; for Emacs tools
b94a6ca0
AK
143 (synopsis "Tools and documentation for translation")))
144
ea541333
LC
145(define-public libtextstyle
146 (package
147 (name "libtextstyle")
148 (version "0.20.1")
149 (source (origin
150 (inherit (package-source gnu-gettext))
151 (uri (string-append "mirror://gnu/gettext/gettext-"
152 version ".tar.gz"))
153 (sha256
154 (base32
155 "0p3zwkk27wm2m2ccfqm57nj7vqkmfpn7ja1nf65zmhz8qqs5chb6"))))
156 (build-system gnu-build-system)
157 (arguments
158 '(#:configure-flags '("--disable-static")
159 #:phases (modify-phases %standard-phases
160 (add-after 'unpack 'chdir
161 (lambda _
162 (chdir "libtextstyle")
163 #t)))))
164 ;; libtextstyle bundles libxml2, glib (a small subset thereof), and
165 ;; libcroco, but it purposefully prevents users from using an external
166 ;; copy, to reduce the startup time of programs using libtextstyle.
167 (home-page "https://www.gnu.org/software/gettext/")
168 (synopsis "Text styling library")
169 (description
170 "GNU libtextstyle is a C library that provides an easy way to add styling
171to programs that produce output to a console or terminal emulator window. It
172allows applications to emit text annotated with styling information, such as
173color, font attributes (weight, posture), or underlining.")
174 (license gpl3+)))
175
97f70018
RW
176(define-public po4a
177 (package
178 (name "po4a")
04aec35b 179 (version "0.56")
97f70018
RW
180 (source (origin
181 (method url-fetch)
816db966
JL
182 (uri (string-append "https://github.com/mquinson/po4a/releases/download/v"
183 version "/po4a-" version ".tar.gz"))
97f70018
RW
184 (sha256
185 (base32
04aec35b 186 "0kyhww0yw4q0m4vj8vil2wsf6sn4hidh8mqz2gjrq7gpdf83cmnr"))))
97f70018
RW
187 (build-system perl-build-system)
188 (arguments
189 `(#:phases
190 (modify-phases %standard-phases
97f70018
RW
191 (add-after 'install 'wrap-programs
192 (lambda* (#:key outputs #:allow-other-keys)
193 ;; Make sure all executables in "bin" find the Perl modules
194 ;; provided by this package at runtime.
195 (let* ((out (assoc-ref outputs "out"))
196 (bin (string-append out "/bin/"))
197 (path (string-append out "/lib/perl5/site_perl")))
198 (for-each (lambda (file)
199 (wrap-program file
200 `("PERL5LIB" ":" prefix (,path))))
201 (find-files bin "\\.*$"))
727bec13
MB
202 #t)))
203 (add-before 'reset-gzip-timestamps 'make-compressed-files-writable
204 (lambda* (#:key outputs #:allow-other-keys)
205 (for-each make-file-writable
206 (find-files (string-append (assoc-ref outputs "out")
207 "/share/man")
208 ".*\\.gz$"))
895789ea 209 #t))
9350a084
EF
210 (add-after 'unpack 'patch-docbook-xml
211 (lambda* (#:key inputs #:allow-other-keys)
212 (substitute* (find-files "." ".*\\.xml(-good)?")
213 (("http://www.oasis-open.org/docbook/xml/4.1.2/")
214 (string-append (assoc-ref inputs "docbook-xml")
215 "/xml/dtd/docbook/")))
216 #t))
895789ea
TGR
217 (add-before 'check 'disable-failing-tests
218 (lambda _
219 ;; FIXME: ‘Files ../t-03-asciidoc/Titles.po and Titles.po differ’.
220 (delete-file "t/03-asciidoc.t")
221
9350a084
EF
222 ;; FIXME: these tests require SGMLS.pm.
223 (delete-file "t/01-classes.t")
895789ea
TGR
224 (delete-file "t/16-sgml.t")
225
727bec13 226 #t)))))
97f70018 227 (native-inputs
b94a6ca0 228 `(("gettext" ,gettext-minimal)
97f70018
RW
229 ("perl-module-build" ,perl-module-build)
230 ("docbook-xsl" ,docbook-xsl)
97f70018 231 ("libxml2" ,libxml2)
895789ea
TGR
232 ("xsltproc" ,libxslt)
233
234 ;; For tests.
9350a084 235 ("docbook-xml" ,docbook-xml-4.1.2)
895789ea
TGR
236 ("perl-yaml-tiny" ,perl-yaml-tiny)
237 ("texlive" ,texlive-tiny)))
4eb0f5cd 238 (home-page "https://po4a.org/")
97f70018
RW
239 (synopsis "Scripts to ease maintenance of translations")
240 (description
241 "The po4a (PO for anything) project goal is to ease translations (and
242more interestingly, the maintenance of translations) using gettext tools on
243areas where they were not expected like documentation.")
244 (license gpl2+)))