gnu: r-fastseg: Update to 1.30.0.
[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 (license gpl3+))) ;some files are under GPLv2+
116
117 ;; Use that name to avoid clashes with Guile's 'gettext' procedure.
118 ;;
119 ;; We used to resort to #:renamer on the user side, but that prevented
120 ;; circular dependencies involving (gnu packages gettext). This is because
121 ;; 'resolve-interface' (as of Guile 2.0.9) iterates eagerly over the used
122 ;; module when there's a #:renamer, and that module may be empty at that point
123 ;; in case or circular dependencies.
124 (define-public gnu-gettext
125 (package
126 (inherit gettext-minimal)
127 (name "gettext")
128 (arguments
129 (substitute-keyword-arguments (package-arguments gettext-minimal)
130 ((#:phases phases)
131 `(modify-phases ,phases
132 (add-after 'install 'add-emacs-autoloads
133 (lambda* (#:key outputs #:allow-other-keys)
134 ;; Make 'po-mode' and other things available by default.
135 (with-directory-excursion
136 (string-append (assoc-ref outputs "out")
137 "/share/emacs/site-lisp")
138 (symlink "start-po.el" "gettext-autoloads.el")
139 #t)))))))
140 (native-inputs `(("emacs" ,emacs-minimal))) ; for Emacs tools
141 (synopsis "Tools and documentation for translation")))
142
143 (define-public po4a
144 (package
145 (name "po4a")
146 (version "0.55")
147 (source (origin
148 (method url-fetch)
149 (uri (string-append "https://github.com/mquinson/po4a/releases/download/v"
150 version "/po4a-" version ".tar.gz"))
151 (sha256
152 (base32
153 "1qss4q5df3nsydsbggb7gg50bn0kdxq5wn8riqm9zwkiq6a4bifg"))))
154 (build-system perl-build-system)
155 (arguments
156 `(#:phases
157 (modify-phases %standard-phases
158 (add-after 'install 'wrap-programs
159 (lambda* (#:key outputs #:allow-other-keys)
160 ;; Make sure all executables in "bin" find the Perl modules
161 ;; provided by this package at runtime.
162 (let* ((out (assoc-ref outputs "out"))
163 (bin (string-append out "/bin/"))
164 (path (string-append out "/lib/perl5/site_perl")))
165 (for-each (lambda (file)
166 (wrap-program file
167 `("PERL5LIB" ":" prefix (,path))))
168 (find-files bin "\\.*$"))
169 #t)))
170 (add-before 'reset-gzip-timestamps 'make-compressed-files-writable
171 (lambda* (#:key outputs #:allow-other-keys)
172 (for-each make-file-writable
173 (find-files (string-append (assoc-ref outputs "out")
174 "/share/man")
175 ".*\\.gz$"))
176 #t))
177 (add-after 'unpack 'patch-docbook-xml
178 (lambda* (#:key inputs #:allow-other-keys)
179 (substitute* (find-files "." ".*\\.xml(-good)?")
180 (("http://www.oasis-open.org/docbook/xml/4.1.2/")
181 (string-append (assoc-ref inputs "docbook-xml")
182 "/xml/dtd/docbook/")))
183 #t))
184 (add-before 'check 'disable-failing-tests
185 (lambda _
186 ;; FIXME: ‘Files ../t-03-asciidoc/Titles.po and Titles.po differ’.
187 (delete-file "t/03-asciidoc.t")
188
189 ;; FIXME: these tests require SGMLS.pm.
190 (delete-file "t/01-classes.t")
191 (delete-file "t/16-sgml.t")
192
193 #t)))))
194 (native-inputs
195 `(("gettext" ,gettext-minimal)
196 ("perl-module-build" ,perl-module-build)
197 ("docbook-xsl" ,docbook-xsl)
198 ("libxml2" ,libxml2)
199 ("xsltproc" ,libxslt)
200
201 ;; For tests.
202 ("docbook-xml" ,docbook-xml-4.1.2)
203 ("perl-yaml-tiny" ,perl-yaml-tiny)
204 ("texlive" ,texlive-tiny)))
205 (home-page "https://po4a.org/")
206 (synopsis "Scripts to ease maintenance of translations")
207 (description
208 "The po4a (PO for anything) project goal is to ease translations (and
209 more interestingly, the maintenance of translations) using gettext tools on
210 areas where they were not expected like documentation.")
211 (license gpl2+)))