Commit | Line | Data |
---|---|---|
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> |
9350a084 | 5 | ;;; Copyright © 2016, 2019 Efraim Flashner <efraim@flashner.co.il> |
9e015894 | 6 | ;;; Copyright © 2016 Alex Kost <alezost@gmail.com> |
dcc70a50 | 7 | ;;; Copyright © 2017, 2019, 2020 Marius Bakke <marius@gnu.org> |
480da86d | 8 | ;;; Copyright © 2017 Mathieu Othacehe <m.othacehe@gmail.com> |
acc2dab7 | 9 | ;;; Copyright © 2017 Eric Bavier <bavier@member.fsf.org> |
e51101ec | 10 | ;;; Copyright © 2018, 2019, 2020 Tobias Geerinckx-Rice <me@tobias.gr> |
3730e3c6 | 11 | ;;; Copyright © 2019 Miguel <rosen644835@gmail.com> |
2fc298d1 | 12 | ;;; Copyright © 2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org> |
625708b0 | 13 | ;;; Copyright © 2020 EuAndreh <eu@euandre.org> |
f190f92f | 14 | ;;; |
233e7676 | 15 | ;;; This file is part of GNU Guix. |
f190f92f | 16 | ;;; |
233e7676 | 17 | ;;; GNU Guix is free software; you can redistribute it and/or modify it |
f190f92f NK |
18 | ;;; under the terms of the GNU General Public License as published by |
19 | ;;; the Free Software Foundation; either version 3 of the License, or (at | |
20 | ;;; your option) any later version. | |
21 | ;;; | |
233e7676 | 22 | ;;; GNU Guix is distributed in the hope that it will be useful, but |
f190f92f NK |
23 | ;;; WITHOUT ANY WARRANTY; without even the implied warranty of |
24 | ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
25 | ;;; GNU General Public License for more details. | |
26 | ;;; | |
27 | ;;; You should have received a copy of the GNU General Public License | |
233e7676 | 28 | ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>. |
f190f92f | 29 | |
1ffa7090 | 30 | (define-module (gnu packages gettext) |
625708b0 | 31 | #:use-module ((guix licenses) #:select (gpl2+ gpl3+ bsd-3)) |
59a43334 | 32 | #:use-module (gnu packages) |
f190f92f | 33 | #:use-module (guix packages) |
495ac045 | 34 | #:use-module (guix gexp) |
f190f92f | 35 | #:use-module (guix download) |
c42a4b76 | 36 | #:use-module (guix build-system gnu) |
97f70018 | 37 | #:use-module (guix build-system perl) |
625708b0 E |
38 | #:use-module (guix build-system python) |
39 | #:use-module (gnu packages check) | |
97f70018 | 40 | #:use-module (gnu packages docbook) |
9e015894 | 41 | #:use-module (gnu packages emacs) |
2fc298d1 | 42 | #:use-module (gnu packages hurd) |
3730e3c6 MB |
43 | #:use-module (gnu packages libunistring) |
44 | #:use-module (gnu packages ncurses) | |
97f70018 | 45 | #:use-module (gnu packages perl) |
d343c12b | 46 | #:use-module (gnu packages perl-check) |
8f9ac901 | 47 | #:use-module (gnu packages tex) |
9e015894 | 48 | #:use-module (gnu packages xml) |
625708b0 E |
49 | #:use-module (gnu packages python-xyz) |
50 | #:use-module (gnu packages sphinx) | |
9e015894 | 51 | #:use-module (guix utils)) |
f190f92f | 52 | |
b94a6ca0 | 53 | (define-public gettext-minimal |
f190f92f | 54 | (package |
b94a6ca0 | 55 | (name "gettext-minimal") |
94a6127f | 56 | (version "0.21") |
2c9143a1 | 57 | (source (origin |
3730e3c6 MB |
58 | (method url-fetch) |
59 | (uri (string-append "mirror://gnu/gettext/gettext-" | |
60 | version ".tar.gz")) | |
61 | (sha256 | |
62 | (base32 | |
94a6127f | 63 | "04kbg1sx0ncfrsbr85ggjslqkzzb243fcw9nyh3rrv1a22ihszf7")))) |
f190f92f | 64 | (build-system gnu-build-system) |
d7170f44 | 65 | (outputs '("out" |
3730e3c6 | 66 | "doc")) ;9 MiB of HTML |
c42a4b76 | 67 | (inputs |
8394619b LC |
68 | (list libunistring |
69 | libxml2 | |
70 | ;; TODO: ncurses is only needed for the 'libtextstyle' library. | |
71 | ;; The next version of gettext can use a separate libtextstyle, | |
72 | ;; but for now we include it here in 'gettext-minimal'. | |
73 | ncurses)) | |
f190f92f | 74 | (arguments |
495ac045 LC |
75 | (list #:configure-flags #~'("--with-included-libunistring=no" |
76 | "--with-included-libxml=no") | |
77 | #:phases | |
78 | #~(modify-phases %standard-phases | |
79 | (add-before 'patch-source-shebangs 'patch-fixed-paths | |
80 | (lambda _ | |
81 | (substitute* '("gettext-tools/config.h.in" | |
82 | "gettext-tools/gnulib-tests/init.sh" | |
83 | "gettext-tools/tests/init.sh" | |
84 | "gettext-tools/system-tests/run-test") | |
85 | (("/bin/sh") "sh")) | |
86 | (substitute* '("gettext-tools/src/project-id" | |
87 | "gettext-tools/projects/KDE/trigger" | |
88 | "gettext-tools/projects/GNOME/trigger") | |
89 | (("/bin/pwd") "pwd")) | |
90 | #t)) | |
91 | (add-before 'check 'patch-tests | |
92 | (lambda* (#:key inputs #:allow-other-keys) | |
93 | (let* ((bash (which "sh"))) | |
94 | ;; Some of the files we're patching are | |
95 | ;; ISO-8859-1-encoded, so choose it as the default | |
96 | ;; encoding so the byte encoding is preserved. | |
97 | (with-fluids ((%default-port-encoding #f)) | |
98 | (substitute* | |
99 | (find-files "gettext-tools/tests" | |
100 | "^(lang-sh|msg(exec|filter)-[0-9])") | |
101 | (("#![[:blank:]]/bin/sh") | |
102 | (format #f "#!~a" bash))) | |
0e4e4b13 | 103 | |
495ac045 LC |
104 | (substitute* (cons "gettext-tools/src/msginit.c" |
105 | (find-files "gettext-tools/gnulib-tests" | |
106 | "posix_spawn")) | |
107 | (("/bin/sh") | |
108 | bash)) | |
0e4e4b13 | 109 | |
495ac045 LC |
110 | (substitute* "gettext-tools/src/project-id" |
111 | (("/bin/pwd") | |
112 | "pwd")) | |
ae7ba731 | 113 | |
a21590da LC |
114 | ;; Work around Gnulib test failures on armhf-linux. |
115 | #$@(if (target-arm32?) | |
116 | #~((with-directory-excursion "gettext-tools" | |
117 | (invoke "patch" "--force" "-p1" "-i" | |
118 | #$(local-file | |
119 | (search-patch | |
120 | "coreutils-gnulib-tests.patch"))))) | |
121 | '()) | |
122 | ||
495ac045 | 123 | #t))))) |
0e4e4b13 LC |
124 | |
125 | ;; When tests fail, we want to know the details. | |
495ac045 LC |
126 | #:make-flags #~'("VERBOSE=yes" |
127 | #$@(if (hurd-target?) | |
128 | ;; Linking to libgettextlib.so makes test-raise fail | |
129 | '("XFAIL_TESTS=test-raise") | |
130 | '())))) | |
6fd52309 | 131 | (home-page "https://www.gnu.org/software/gettext/") |
b94a6ca0 AK |
132 | (synopsis |
133 | "Tools and documentation for translation (used to build other packages)") | |
f190f92f | 134 | (description |
79c311b8 LC |
135 | "GNU Gettext is a package providing a framework for translating the |
136 | textual output of programs into multiple languages. It provides translators | |
b94a6ca0 AK |
137 | with the means to create message catalogs, and a runtime library to load |
138 | translated messages from the catalogs. Nearly all GNU packages use Gettext.") | |
69cb225c LC |
139 | (properties `((upstream-name . "gettext") |
140 | (cpe-name . "gettext"))) | |
1c301e48 | 141 | (license gpl3+))) ;some files are under GPLv2+ |
97f70018 | 142 | |
b94a6ca0 AK |
143 | ;; Use that name to avoid clashes with Guile's 'gettext' procedure. |
144 | ;; | |
145 | ;; We used to resort to #:renamer on the user side, but that prevented | |
146 | ;; circular dependencies involving (gnu packages gettext). This is because | |
147 | ;; 'resolve-interface' (as of Guile 2.0.9) iterates eagerly over the used | |
148 | ;; module when there's a #:renamer, and that module may be empty at that point | |
149 | ;; in case or circular dependencies. | |
150 | (define-public gnu-gettext | |
1a265842 | 151 | (package/inherit gettext-minimal |
b94a6ca0 | 152 | (name "gettext") |
9e015894 AK |
153 | (arguments |
154 | (substitute-keyword-arguments (package-arguments gettext-minimal) | |
155 | ((#:phases phases) | |
495ac045 LC |
156 | #~(modify-phases #$phases |
157 | (add-after 'install 'add-emacs-autoloads | |
158 | (lambda* (#:key outputs #:allow-other-keys) | |
159 | ;; Make 'po-mode' and other things available by default. | |
160 | (with-directory-excursion | |
161 | (string-append (assoc-ref outputs "out") | |
162 | "/share/emacs/site-lisp") | |
163 | (symlink "start-po.el" "gettext-autoloads.el") | |
164 | #t))))))) | |
165 | (native-inputs `(("emacs" ,emacs-minimal))) ; for Emacs tools | |
b94a6ca0 AK |
166 | (synopsis "Tools and documentation for translation"))) |
167 | ||
ea541333 LC |
168 | (define-public libtextstyle |
169 | (package | |
170 | (name "libtextstyle") | |
7b58d009 | 171 | (version "0.21") |
ea541333 LC |
172 | (source (origin |
173 | (inherit (package-source gnu-gettext)) | |
174 | (uri (string-append "mirror://gnu/gettext/gettext-" | |
175 | version ".tar.gz")) | |
176 | (sha256 | |
177 | (base32 | |
7b58d009 | 178 | "04kbg1sx0ncfrsbr85ggjslqkzzb243fcw9nyh3rrv1a22ihszf7")))) |
ea541333 LC |
179 | (build-system gnu-build-system) |
180 | (arguments | |
181 | '(#:configure-flags '("--disable-static") | |
182 | #:phases (modify-phases %standard-phases | |
183 | (add-after 'unpack 'chdir | |
184 | (lambda _ | |
185 | (chdir "libtextstyle") | |
186 | #t))))) | |
187 | ;; libtextstyle bundles libxml2, glib (a small subset thereof), and | |
188 | ;; libcroco, but it purposefully prevents users from using an external | |
189 | ;; copy, to reduce the startup time of programs using libtextstyle. | |
190 | (home-page "https://www.gnu.org/software/gettext/") | |
191 | (synopsis "Text styling library") | |
192 | (description | |
193 | "GNU libtextstyle is a C library that provides an easy way to add styling | |
194 | to programs that produce output to a console or terminal emulator window. It | |
195 | allows applications to emit text annotated with styling information, such as | |
196 | color, font attributes (weight, posture), or underlining.") | |
197 | (license gpl3+))) | |
198 | ||
625708b0 E |
199 | (define-public mdpo |
200 | (package | |
201 | (name "mdpo") | |
202 | (version "0.3.6") | |
203 | (source | |
204 | (origin | |
205 | (method url-fetch) | |
206 | (uri (pypi-uri "mdpo" version)) | |
207 | (sha256 | |
208 | (base32 "0kgbm0af7jwpfspa2xxiy9nc2l1r2s1rhbhz4r229zcqv49ak6sq")))) | |
209 | (build-system python-build-system) | |
210 | (native-inputs | |
8394619b LC |
211 | (list python-bump2version |
212 | python-flake8 | |
213 | python-flake8-implicit-str-concat | |
214 | python-flake8-print | |
215 | python-isort | |
216 | python-pre-commit | |
217 | python-pytest | |
218 | python-pytest-cov | |
219 | python-sphinx | |
220 | python-sphinx-argparse | |
221 | python-sphinx-rtd-theme | |
222 | python-twine | |
223 | python-yamllint)) | |
625708b0 | 224 | (propagated-inputs |
8394619b | 225 | (list python-polib python-pymd4c)) |
625708b0 E |
226 | (home-page "https://github.com/mondeja/mdpo") |
227 | (synopsis "Markdown file translation utilities using pofiles") | |
228 | (description | |
229 | "The mdpo utility creates pofiles, the format stabilished by GNU Gettext, | |
230 | from Markdown files.") | |
231 | (license bsd-3))) | |
232 | ||
97f70018 RW |
233 | (define-public po4a |
234 | (package | |
235 | (name "po4a") | |
a597ddea | 236 | (version "0.63") |
97f70018 RW |
237 | (source (origin |
238 | (method url-fetch) | |
816db966 JL |
239 | (uri (string-append "https://github.com/mquinson/po4a/releases/download/v" |
240 | version "/po4a-" version ".tar.gz")) | |
97f70018 RW |
241 | (sha256 |
242 | (base32 | |
a597ddea | 243 | "1kmlfpdl1i1wrcdn0k1frh44fq10sfwswi3azvibli2lakpf66z2")))) |
97f70018 RW |
244 | (build-system perl-build-system) |
245 | (arguments | |
246 | `(#:phases | |
247 | (modify-phases %standard-phases | |
97f70018 | 248 | (add-after 'install 'wrap-programs |
dcc70a50 | 249 | (lambda* (#:key inputs outputs #:allow-other-keys) |
97f70018 | 250 | ;; Make sure all executables in "bin" find the Perl modules |
dcc70a50 | 251 | ;; required by this package at runtime. |
97f70018 RW |
252 | (let* ((out (assoc-ref outputs "out")) |
253 | (bin (string-append out "/bin/")) | |
dcc70a50 MB |
254 | (Pod::Parser (assoc-ref inputs "perl-pod-parser")) |
255 | (path (string-append out "/lib/perl5/site_perl:" | |
256 | Pod::Parser "/lib/perl5/site_perl"))) | |
97f70018 RW |
257 | (for-each (lambda (file) |
258 | (wrap-program file | |
259 | `("PERL5LIB" ":" prefix (,path)))) | |
260 | (find-files bin "\\.*$")) | |
727bec13 | 261 | #t))) |
9350a084 EF |
262 | (add-after 'unpack 'patch-docbook-xml |
263 | (lambda* (#:key inputs #:allow-other-keys) | |
264 | (substitute* (find-files "." ".*\\.xml(-good)?") | |
265 | (("http://www.oasis-open.org/docbook/xml/4.1.2/") | |
266 | (string-append (assoc-ref inputs "docbook-xml") | |
267 | "/xml/dtd/docbook/"))) | |
268 | #t)) | |
dcc70a50 MB |
269 | (add-before 'build 'do-not-override-PERL5LIB |
270 | (lambda _ | |
271 | ;; Don't hard-code PERL5LIB to include just the build directory | |
272 | ;; so that the build script finds modules from inputs. | |
273 | (substitute* "Po4aBuilder.pm" | |
274 | (("PERL5LIB=lib") "")) | |
275 | (setenv "PERL5LIB" (string-append (getenv "PERL5LIB") ":lib")))) | |
895789ea TGR |
276 | (add-before 'check 'disable-failing-tests |
277 | (lambda _ | |
9350a084 EF |
278 | ;; FIXME: these tests require SGMLS.pm. |
279 | (delete-file "t/01-classes.t") | |
d343c12b JL |
280 | |
281 | (delete-file "t/add.t") | |
282 | (delete-file "t/core-porefs.t") | |
283 | (delete-file "t/fmt-asciidoc.t") | |
284 | (delete-file "t/fmt-sgml.t") | |
895789ea | 285 | |
727bec13 | 286 | #t))))) |
97f70018 | 287 | (native-inputs |
b94a6ca0 | 288 | `(("gettext" ,gettext-minimal) |
97f70018 RW |
289 | ("perl-module-build" ,perl-module-build) |
290 | ("docbook-xsl" ,docbook-xsl) | |
97f70018 | 291 | ("libxml2" ,libxml2) |
895789ea TGR |
292 | ("xsltproc" ,libxslt) |
293 | ||
294 | ;; For tests. | |
9350a084 | 295 | ("docbook-xml" ,docbook-xml-4.1.2) |
d343c12b | 296 | ("perl-test-pod" ,perl-test-pod) |
895789ea TGR |
297 | ("perl-yaml-tiny" ,perl-yaml-tiny) |
298 | ("texlive" ,texlive-tiny))) | |
dcc70a50 | 299 | (inputs |
8394619b | 300 | (list perl-pod-parser)) |
4eb0f5cd | 301 | (home-page "https://po4a.org/") |
97f70018 RW |
302 | (synopsis "Scripts to ease maintenance of translations") |
303 | (description | |
304 | "The po4a (PO for anything) project goal is to ease translations (and | |
305 | more interestingly, the maintenance of translations) using gettext tools on | |
306 | areas where they were not expected like documentation.") | |
307 | (license gpl2+))) |