gnu: Add wl-clipboard.
[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>
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.")
1c301e48 115 (license gpl3+))) ;some files are under GPLv2+
97f70018 116
b94a6ca0
AK
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")
9e015894
AK
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
b94a6ca0
AK
141 (synopsis "Tools and documentation for translation")))
142
97f70018
RW
143(define-public po4a
144 (package
145 (name "po4a")
895789ea 146 (version "0.54")
97f70018
RW
147 (source (origin
148 (method url-fetch)
816db966
JL
149 (uri (string-append "https://github.com/mquinson/po4a/releases/download/v"
150 version "/po4a-" version ".tar.gz"))
97f70018
RW
151 (sha256
152 (base32
895789ea 153 "0l9xc06cr8i5jqycfylr4lynhmkb4ng2534m14kx37bzd4hpcvsr"))))
97f70018
RW
154 (build-system perl-build-system)
155 (arguments
156 `(#:phases
157 (modify-phases %standard-phases
97f70018
RW
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 "\\.*$"))
727bec13
MB
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$"))
895789ea
TGR
176 #t))
177 (add-before 'check 'disable-failing-tests
178 (lambda _
179 ;; FIXME: ‘Files ../t-03-asciidoc/Titles.po and Titles.po differ’.
180 (delete-file "t/03-asciidoc.t")
181
182 ;; FIXME: ‘Unknown format type: html’, and it's not listed.
183 (delete-file "t/09-html.t")
184
185 ;; FIXME: this test requires SGMLS.pm.
186 (delete-file "t/16-sgml.t")
187
727bec13 188 #t)))))
97f70018 189 (native-inputs
b94a6ca0 190 `(("gettext" ,gettext-minimal)
97f70018
RW
191 ("perl-module-build" ,perl-module-build)
192 ("docbook-xsl" ,docbook-xsl)
97f70018 193 ("libxml2" ,libxml2)
895789ea
TGR
194 ("xsltproc" ,libxslt)
195
196 ;; For tests.
197 ("docbook-xml" ,docbook-xml)
198 ("perl-yaml-tiny" ,perl-yaml-tiny)
199 ("texlive" ,texlive-tiny)))
4eb0f5cd 200 (home-page "https://po4a.org/")
97f70018
RW
201 (synopsis "Scripts to ease maintenance of translations")
202 (description
203 "The po4a (PO for anything) project goal is to ease translations (and
204more interestingly, the maintenance of translations) using gettext tools on
205areas where they were not expected like documentation.")
206 (license gpl2+)))