gnu: ungoogled-chromium: Install icons.
[jackhill/guix/guix.git] / gnu / packages / gettext.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2012 Nikita Karetnikov <nikita@karetnikov.org>
3 ;;; Copyright © 2014 Mark H Weaver <mhw@netris.org>
4 ;;; Copyright © 2015, 2017 Ricardo Wurmus <rekado@elephly.net>
5 ;;; Copyright © 2016, 2019 Efraim Flashner <efraim@flashner.co.il>
6 ;;; Copyright © 2016 Alex Kost <alezost@gmail.com>
7 ;;; Copyright © 2017 Marius Bakke <mbakke@fastmail.com>
8 ;;; Copyright © 2017 Mathieu Othacehe <m.othacehe@gmail.com>
9 ;;; Copyright © 2017 Eric Bavier <bavier@member.fsf.org>
10 ;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr>
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 gettext)
28 #:use-module ((guix licenses) #:select (gpl2+ gpl3+))
29 #:use-module (gnu packages)
30 #:use-module (guix packages)
31 #:use-module (guix download)
32 #:use-module (guix build-system gnu)
33 #:use-module (guix build-system perl)
34 #:use-module (gnu packages docbook)
35 #:use-module (gnu packages emacs)
36 #:use-module (gnu packages perl)
37 #:use-module (gnu packages tex)
38 #:use-module (gnu packages xml)
39 #:use-module (guix utils))
40
41 (define-public gettext-minimal
42 (package
43 (name "gettext-minimal")
44 (version "0.19.8.1")
45 (source (origin
46 (method url-fetch)
47 (uri (string-append "mirror://gnu/gettext/gettext-"
48 version ".tar.gz"))
49 (sha256
50 (base32
51 "0hsw28f9q9xaggjlsdp2qmbp2rbd1mp0njzan2ld9kiqwkq2m57z"))
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))))
64 (build-system gnu-build-system)
65 (outputs '("out"
66 "doc")) ;8 MiB of HTML
67 (inputs
68 `(("expat" ,expat)))
69 (arguments
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)))
84
85 (substitute* (cons "gettext-tools/src/msginit.c"
86 (find-files "gettext-tools/gnulib-tests"
87 "posix_spawn"))
88 (("/bin/sh")
89 bash))
90
91 (substitute* "gettext-tools/src/project-id"
92 (("/bin/pwd")
93 "pwd"))
94
95 #t))))
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\"")
102 (("LTLIBEXPAT=\"-ldl\"") "LTLIBEXPAT=\"-ldl -lexpat\""))
103 #t)))
104
105 ;; When tests fail, we want to know the details.
106 #:make-flags '("VERBOSE=yes")))
107 (home-page "https://www.gnu.org/software/gettext/")
108 (synopsis
109 "Tools and documentation for translation (used to build other packages)")
110 (description
111 "GNU Gettext is a package providing a framework for translating the
112 textual output of programs into multiple languages. It provides translators
113 with the means to create message catalogs, and a runtime library to load
114 translated messages from the catalogs. Nearly all GNU packages use Gettext.")
115 (properties `((upstream-name . "gettext")
116 (cpe-name . "gettext")))
117 (license gpl3+))) ;some files are under GPLv2+
118
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")
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
143 (synopsis "Tools and documentation for translation")))
144
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
171 to programs that produce output to a console or terminal emulator window. It
172 allows applications to emit text annotated with styling information, such as
173 color, font attributes (weight, posture), or underlining.")
174 (license gpl3+)))
175
176 (define-public po4a
177 (package
178 (name "po4a")
179 (version "0.56")
180 (source (origin
181 (method url-fetch)
182 (uri (string-append "https://github.com/mquinson/po4a/releases/download/v"
183 version "/po4a-" version ".tar.gz"))
184 (sha256
185 (base32
186 "0kyhww0yw4q0m4vj8vil2wsf6sn4hidh8mqz2gjrq7gpdf83cmnr"))))
187 (build-system perl-build-system)
188 (arguments
189 `(#:phases
190 (modify-phases %standard-phases
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 "\\.*$"))
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$"))
209 #t))
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))
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
222 ;; FIXME: these tests require SGMLS.pm.
223 (delete-file "t/01-classes.t")
224 (delete-file "t/16-sgml.t")
225
226 #t)))))
227 (native-inputs
228 `(("gettext" ,gettext-minimal)
229 ("perl-module-build" ,perl-module-build)
230 ("docbook-xsl" ,docbook-xsl)
231 ("libxml2" ,libxml2)
232 ("xsltproc" ,libxslt)
233
234 ;; For tests.
235 ("docbook-xml" ,docbook-xml-4.1.2)
236 ("perl-yaml-tiny" ,perl-yaml-tiny)
237 ("texlive" ,texlive-tiny)))
238 (home-page "https://po4a.org/")
239 (synopsis "Scripts to ease maintenance of translations")
240 (description
241 "The po4a (PO for anything) project goal is to ease translations (and
242 more interestingly, the maintenance of translations) using gettext tools on
243 areas where they were not expected like documentation.")
244 (license gpl2+)))