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