gnu: sbcl-postmodern: Update to 1.32.6.
[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, 2019 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, 2019, 2020 Tobias Geerinckx-Rice <me@tobias.gr>
11 ;;; Copyright © 2019 Miguel <rosen644835@gmail.com>
12 ;;; Copyright © 2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
13 ;;;
14 ;;; This file is part of GNU Guix.
15 ;;;
16 ;;; GNU Guix is free software; you can redistribute it and/or modify it
17 ;;; under the terms of the GNU General Public License as published by
18 ;;; the Free Software Foundation; either version 3 of the License, or (at
19 ;;; your option) any later version.
20 ;;;
21 ;;; GNU Guix is distributed in the hope that it will be useful, but
22 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
23 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 ;;; GNU General Public License for more details.
25 ;;;
26 ;;; You should have received a copy of the GNU General Public License
27 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
28
29 (define-module (gnu packages gettext)
30 #:use-module ((guix licenses) #:select (gpl2+ gpl3+))
31 #:use-module (gnu packages)
32 #:use-module (guix packages)
33 #:use-module (guix download)
34 #:use-module (guix build-system gnu)
35 #:use-module (guix build-system perl)
36 #:use-module (gnu packages docbook)
37 #:use-module (gnu packages emacs)
38 #:use-module (gnu packages hurd)
39 #:use-module (gnu packages libunistring)
40 #:use-module (gnu packages ncurses)
41 #:use-module (gnu packages perl)
42 #:use-module (gnu packages perl-check)
43 #:use-module (gnu packages tex)
44 #:use-module (gnu packages xml)
45 #:use-module (guix utils))
46
47 (define-public gettext-minimal
48 (package
49 (name "gettext-minimal")
50 (version "0.20.1")
51 (source (origin
52 (method url-fetch)
53 (uri (string-append "mirror://gnu/gettext/gettext-"
54 version ".tar.gz"))
55 (sha256
56 (base32
57 "0p3zwkk27wm2m2ccfqm57nj7vqkmfpn7ja1nf65zmhz8qqs5chb6"))))
58 (build-system gnu-build-system)
59 (outputs '("out"
60 "doc")) ;9 MiB of HTML
61 (inputs
62 `(("libunistring" ,libunistring)
63 ("libxml2" ,libxml2)
64
65 ;; TODO: ncurses is only needed for the 'libtextstyle' library.
66 ;; The next version of gettext can use a separate libtextstyle,
67 ;; but for now we include it here in 'gettext-minimal'.
68 ("ncurses" ,ncurses)))
69 (arguments
70 `(#:configure-flags '("--with-included-libunistring=no"
71 "--with-included-libxml=no")
72 #:phases
73 (modify-phases %standard-phases
74 (add-before 'patch-source-shebangs 'patch-fixed-paths
75 (lambda _
76 (substitute* '("gettext-tools/config.h.in"
77 "gettext-tools/gnulib-tests/init.sh"
78 "gettext-tools/tests/init.sh"
79 "gettext-tools/system-tests/run-test")
80 (("/bin/sh") "sh"))
81 (substitute* '("gettext-tools/src/project-id"
82 "gettext-tools/projects/KDE/trigger"
83 "gettext-tools/projects/GNOME/trigger")
84 (("/bin/pwd") "pwd"))
85 #t))
86 (add-before 'check 'patch-tests
87 (lambda* (#:key inputs #:allow-other-keys)
88 (let* ((bash (which "sh")))
89 ;; Some of the files we're patching are
90 ;; ISO-8859-1-encoded, so choose it as the default
91 ;; encoding so the byte encoding is preserved.
92 (with-fluids ((%default-port-encoding #f))
93 (substitute*
94 (find-files "gettext-tools/tests"
95 "^(lang-sh|msg(exec|filter)-[0-9])")
96 (("#![[:blank:]]/bin/sh")
97 (format #f "#!~a" bash)))
98
99 (substitute* (cons "gettext-tools/src/msginit.c"
100 (find-files "gettext-tools/gnulib-tests"
101 "posix_spawn"))
102 (("/bin/sh")
103 bash))
104
105 (substitute* "gettext-tools/src/project-id"
106 (("/bin/pwd")
107 "pwd"))
108
109 #t)))))
110
111 ;; When tests fail, we want to know the details.
112 #:make-flags '("VERBOSE=yes"
113 ,@(if (hurd-target?)
114 ;; Linking to libgettextlib.so makes test-raise fail
115 '("XFAIL_TESTS=test-raise")
116 '()))))
117 (home-page "https://www.gnu.org/software/gettext/")
118 (synopsis
119 "Tools and documentation for translation (used to build other packages)")
120 (description
121 "GNU Gettext is a package providing a framework for translating the
122 textual output of programs into multiple languages. It provides translators
123 with the means to create message catalogs, and a runtime library to load
124 translated messages from the catalogs. Nearly all GNU packages use Gettext.")
125 (properties `((upstream-name . "gettext")
126 (cpe-name . "gettext")))
127 (license gpl3+))) ;some files are under GPLv2+
128
129 ;; Use that name to avoid clashes with Guile's 'gettext' procedure.
130 ;;
131 ;; We used to resort to #:renamer on the user side, but that prevented
132 ;; circular dependencies involving (gnu packages gettext). This is because
133 ;; 'resolve-interface' (as of Guile 2.0.9) iterates eagerly over the used
134 ;; module when there's a #:renamer, and that module may be empty at that point
135 ;; in case or circular dependencies.
136 (define-public gnu-gettext
137 (package
138 (inherit gettext-minimal)
139 (name "gettext")
140 (arguments
141 (substitute-keyword-arguments (package-arguments gettext-minimal)
142 ((#:phases phases)
143 `(modify-phases ,phases
144 (add-after 'install 'add-emacs-autoloads
145 (lambda* (#:key outputs #:allow-other-keys)
146 ;; Make 'po-mode' and other things available by default.
147 (with-directory-excursion
148 (string-append (assoc-ref outputs "out")
149 "/share/emacs/site-lisp")
150 (symlink "start-po.el" "gettext-autoloads.el")
151 #t)))))))
152 (native-inputs `(("emacs" ,emacs-minimal))) ; for Emacs tools
153 (synopsis "Tools and documentation for translation")))
154
155 (define-public libtextstyle
156 (package
157 (name "libtextstyle")
158 (version "0.21")
159 (source (origin
160 (inherit (package-source gnu-gettext))
161 (uri (string-append "mirror://gnu/gettext/gettext-"
162 version ".tar.gz"))
163 (sha256
164 (base32
165 "04kbg1sx0ncfrsbr85ggjslqkzzb243fcw9nyh3rrv1a22ihszf7"))))
166 (build-system gnu-build-system)
167 (arguments
168 '(#:configure-flags '("--disable-static")
169 #:phases (modify-phases %standard-phases
170 (add-after 'unpack 'chdir
171 (lambda _
172 (chdir "libtextstyle")
173 #t)))))
174 ;; libtextstyle bundles libxml2, glib (a small subset thereof), and
175 ;; libcroco, but it purposefully prevents users from using an external
176 ;; copy, to reduce the startup time of programs using libtextstyle.
177 (home-page "https://www.gnu.org/software/gettext/")
178 (synopsis "Text styling library")
179 (description
180 "GNU libtextstyle is a C library that provides an easy way to add styling
181 to programs that produce output to a console or terminal emulator window. It
182 allows applications to emit text annotated with styling information, such as
183 color, font attributes (weight, posture), or underlining.")
184 (license gpl3+)))
185
186 (define-public po4a
187 (package
188 (name "po4a")
189 (version "0.61")
190 (source (origin
191 (method url-fetch)
192 (uri (string-append "https://github.com/mquinson/po4a/releases/download/v"
193 version "/po4a-" version ".tar.gz"))
194 (sha256
195 (base32
196 "1nw61dj7ymrsjps79vvfdzp549drwd51kyj598937zvyafq4r5b2"))))
197 (build-system perl-build-system)
198 (arguments
199 `(#:phases
200 (modify-phases %standard-phases
201 (add-after 'install 'wrap-programs
202 (lambda* (#:key outputs #:allow-other-keys)
203 ;; Make sure all executables in "bin" find the Perl modules
204 ;; provided by this package at runtime.
205 (let* ((out (assoc-ref outputs "out"))
206 (bin (string-append out "/bin/"))
207 (path (string-append out "/lib/perl5/site_perl")))
208 (for-each (lambda (file)
209 (wrap-program file
210 `("PERL5LIB" ":" prefix (,path))))
211 (find-files bin "\\.*$"))
212 #t)))
213 (add-before 'reset-gzip-timestamps 'make-compressed-files-writable
214 (lambda* (#:key outputs #:allow-other-keys)
215 (for-each make-file-writable
216 (find-files (string-append (assoc-ref outputs "out")
217 "/share/man")
218 ".*\\.gz$"))
219 #t))
220 (add-after 'unpack 'patch-docbook-xml
221 (lambda* (#:key inputs #:allow-other-keys)
222 (substitute* (find-files "." ".*\\.xml(-good)?")
223 (("http://www.oasis-open.org/docbook/xml/4.1.2/")
224 (string-append (assoc-ref inputs "docbook-xml")
225 "/xml/dtd/docbook/")))
226 #t))
227 (add-before 'check 'disable-failing-tests
228 (lambda _
229 ;; FIXME: these tests require SGMLS.pm.
230 (delete-file "t/01-classes.t")
231
232 (delete-file "t/add.t")
233 (delete-file "t/core-porefs.t")
234 (delete-file "t/fmt-asciidoc.t")
235 (delete-file "t/fmt-sgml.t")
236
237 #t)))))
238 (native-inputs
239 `(("gettext" ,gettext-minimal)
240 ("perl-module-build" ,perl-module-build)
241 ("docbook-xsl" ,docbook-xsl)
242 ("libxml2" ,libxml2)
243 ("xsltproc" ,libxslt)
244
245 ;; For tests.
246 ("docbook-xml" ,docbook-xml-4.1.2)
247 ("perl-test-pod" ,perl-test-pod)
248 ("perl-yaml-tiny" ,perl-yaml-tiny)
249 ("texlive" ,texlive-tiny)))
250 (home-page "https://po4a.org/")
251 (synopsis "Scripts to ease maintenance of translations")
252 (description
253 "The po4a (PO for anything) project goal is to ease translations (and
254 more interestingly, the maintenance of translations) using gettext tools on
255 areas where they were not expected like documentation.")
256 (license gpl2+)))