gnu: nftables: Update to 0.8.
[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>
d99861d3 5;;; Copyright © 2016 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>
f190f92f 9;;;
233e7676 10;;; This file is part of GNU Guix.
f190f92f 11;;;
233e7676 12;;; GNU Guix is free software; you can redistribute it and/or modify it
f190f92f
NK
13;;; under the terms of the GNU General Public License as published by
14;;; the Free Software Foundation; either version 3 of the License, or (at
15;;; your option) any later version.
16;;;
233e7676 17;;; GNU Guix is distributed in the hope that it will be useful, but
f190f92f
NK
18;;; WITHOUT ANY WARRANTY; without even the implied warranty of
19;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20;;; GNU General Public License for more details.
21;;;
22;;; You should have received a copy of the GNU General Public License
233e7676 23;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
f190f92f 24
1ffa7090 25(define-module (gnu packages gettext)
97f70018 26 #:use-module ((guix licenses) #:select (gpl2+ gpl3+))
59a43334 27 #:use-module (gnu packages)
f190f92f
NK
28 #:use-module (guix packages)
29 #:use-module (guix download)
c42a4b76 30 #:use-module (guix build-system gnu)
97f70018
RW
31 #:use-module (guix build-system perl)
32 #:use-module (gnu packages docbook)
9e015894 33 #:use-module (gnu packages emacs)
97f70018 34 #:use-module (gnu packages perl)
8f9ac901 35 #:use-module (gnu packages tex)
9e015894
AK
36 #:use-module (gnu packages xml)
37 #:use-module (guix utils))
f190f92f 38
b94a6ca0 39(define-public gettext-minimal
f190f92f 40 (package
b94a6ca0 41 (name "gettext-minimal")
fba0d4c9 42 (version "0.19.8.1")
2c9143a1
LC
43 (source (origin
44 (method url-fetch)
45 (uri (string-append "mirror://gnu/gettext/gettext-"
46 version ".tar.gz"))
47 (sha256
48 (base32
480da86d
MO
49 "0hsw28f9q9xaggjlsdp2qmbp2rbd1mp0njzan2ld9kiqwkq2m57z"))
50 ;; test-lock has performance issues on multi-core machines,
51 ;; it hangs or takes a long time to complete.
52 ;; There is one commit in gettext and one commit
53 ;; in gettext's embedded gnulib to fix this issue.
54 (patches (search-patches "gettext-multi-core.patch"
55 "gettext-gnulib-multi-core.patch"))))
f190f92f 56 (build-system gnu-build-system)
d7170f44
LC
57 (outputs '("out"
58 "doc")) ;8 MiB of HTML
c42a4b76
AE
59 (inputs
60 `(("expat" ,expat)))
f190f92f 61 (arguments
e5f03762
EF
62 `(#:phases
63 (modify-phases %standard-phases
64 (add-before 'check 'patch-tests
65 (lambda* (#:key inputs #:allow-other-keys)
66 (let* ((bash (which "sh")))
67 ;; Some of the files we're patching are
68 ;; ISO-8859-1-encoded, so choose it as the default
69 ;; encoding so the byte encoding is preserved.
70 (with-fluids ((%default-port-encoding #f))
71 (substitute*
72 (find-files "gettext-tools/tests"
73 "^(lang-sh|msg(exec|filter)-[0-9])")
74 (("#![[:blank:]]/bin/sh")
75 (format #f "#!~a" bash)))
0e4e4b13 76
e5f03762
EF
77 (substitute* (cons "gettext-tools/src/msginit.c"
78 (find-files "gettext-tools/gnulib-tests"
79 "posix_spawn"))
80 (("/bin/sh")
81 bash))
0e4e4b13 82
e5f03762
EF
83 (substitute* "gettext-tools/src/project-id"
84 (("/bin/pwd")
85 "pwd"))))))
86 (add-before 'configure 'link-expat
87 (lambda _
88 ;; Gettext defaults to opening expat via dlopen on
89 ;; "Linux". Change to link directly.
90 (substitute* "gettext-tools/configure"
91 (("LIBEXPAT=\"-ldl\"") "LIBEXPAT=\"-ldl -lexpat\"")
92 (("LTLIBEXPAT=\"-ldl\"") "LTLIBEXPAT=\"-ldl -lexpat\"")))))
0e4e4b13
LC
93
94 ;; When tests fail, we want to know the details.
95 #:make-flags '("VERBOSE=yes")))
6fd52309 96 (home-page "https://www.gnu.org/software/gettext/")
b94a6ca0
AK
97 (synopsis
98 "Tools and documentation for translation (used to build other packages)")
f190f92f 99 (description
79c311b8
LC
100 "GNU Gettext is a package providing a framework for translating the
101textual output of programs into multiple languages. It provides translators
b94a6ca0
AK
102with the means to create message catalogs, and a runtime library to load
103translated messages from the catalogs. Nearly all GNU packages use Gettext.")
1c301e48 104 (license gpl3+))) ;some files are under GPLv2+
97f70018 105
b94a6ca0
AK
106;; Use that name to avoid clashes with Guile's 'gettext' procedure.
107;;
108;; We used to resort to #:renamer on the user side, but that prevented
109;; circular dependencies involving (gnu packages gettext). This is because
110;; 'resolve-interface' (as of Guile 2.0.9) iterates eagerly over the used
111;; module when there's a #:renamer, and that module may be empty at that point
112;; in case or circular dependencies.
113(define-public gnu-gettext
114 (package
115 (inherit gettext-minimal)
116 (name "gettext")
9e015894
AK
117 (arguments
118 (substitute-keyword-arguments (package-arguments gettext-minimal)
119 ((#:phases phases)
120 `(modify-phases ,phases
121 (add-after 'install 'add-emacs-autoloads
122 (lambda* (#:key outputs #:allow-other-keys)
123 ;; Make 'po-mode' and other things available by default.
124 (with-directory-excursion
125 (string-append (assoc-ref outputs "out")
126 "/share/emacs/site-lisp")
127 (symlink "start-po.el" "gettext-autoloads.el")
128 #t)))))))
129 (native-inputs `(("emacs" ,emacs-minimal))) ; for Emacs tools
b94a6ca0
AK
130 (synopsis "Tools and documentation for translation")))
131
97f70018
RW
132(define-public po4a
133 (package
134 (name "po4a")
135 (version "0.47")
136 (source (origin
137 (method url-fetch)
138 (uri (string-append "https://alioth.debian.org/frs/download.php"
139 "/file/4142/po4a-" version ".tar.gz"))
140 (sha256
141 (base32
142 "01vm0750aq0h2lphrflv3wq9gz7y0py8frglfpacn58ivyvy242h"))))
143 (build-system perl-build-system)
144 (arguments
145 `(#:phases
146 (modify-phases %standard-phases
dd54d3d5
RW
147 (add-before 'configure 'set-search-path
148 (lambda _
149 ;; Work around "dotless @INC" build failure.
150 (setenv "PERL5LIB"
151 (string-append (getcwd) ":"
152 (getenv "PERL5LIB")))
153 #t))
97f70018
RW
154 ;; FIXME: One test fails as we don't have SGMLS.pm
155 (add-before 'check 'disable-sgml-test
156 (lambda _
157 (delete-file "t/20-sgml.t")
158 #t))
159 (add-after 'unpack 'fix-builder
160 (lambda* (#:key inputs outputs #:allow-other-keys)
161 (substitute* "Po4aBuilder.pm"
162 ;; By default it tries to install into perl's manpath.
163 (("my \\$mandir = .*$")
164 (string-append "my $mandir = \"" (assoc-ref outputs "out")
165 "/share/man\";\n")))
166 #t))
167 (add-after 'install 'wrap-programs
168 (lambda* (#:key outputs #:allow-other-keys)
169 ;; Make sure all executables in "bin" find the Perl modules
170 ;; provided by this package at runtime.
171 (let* ((out (assoc-ref outputs "out"))
172 (bin (string-append out "/bin/"))
173 (path (string-append out "/lib/perl5/site_perl")))
174 (for-each (lambda (file)
175 (wrap-program file
176 `("PERL5LIB" ":" prefix (,path))))
177 (find-files bin "\\.*$"))
727bec13
MB
178 #t)))
179 (add-before 'reset-gzip-timestamps 'make-compressed-files-writable
180 (lambda* (#:key outputs #:allow-other-keys)
181 (for-each make-file-writable
182 (find-files (string-append (assoc-ref outputs "out")
183 "/share/man")
184 ".*\\.gz$"))
185 #t)))))
97f70018 186 (native-inputs
b94a6ca0 187 `(("gettext" ,gettext-minimal)
97f70018
RW
188 ("perl-module-build" ,perl-module-build)
189 ("docbook-xsl" ,docbook-xsl)
190 ("docbook-xml" ,docbook-xml) ;for tests
84889519 191 ("texlive" ,texlive-tiny) ;for tests
97f70018
RW
192 ("libxml2" ,libxml2)
193 ("xsltproc" ,libxslt)))
194 (home-page "http://po4a.alioth.debian.org/")
195 (synopsis "Scripts to ease maintenance of translations")
196 (description
197 "The po4a (PO for anything) project goal is to ease translations (and
198more interestingly, the maintenance of translations) using gettext tools on
199areas where they were not expected like documentation.")
200 (license gpl2+)))