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> |
3730e3c6 | 7 | ;;; Copyright © 2017, 2019 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> |
22981806 | 10 | ;;; Copyright © 2018, 2019 Tobias Geerinckx-Rice <me@tobias.gr> |
3730e3c6 | 11 | ;;; Copyright © 2019 Miguel <rosen644835@gmail.com> |
f190f92f | 12 | ;;; |
233e7676 | 13 | ;;; This file is part of GNU Guix. |
f190f92f | 14 | ;;; |
233e7676 | 15 | ;;; GNU Guix is free software; you can redistribute it and/or modify it |
f190f92f NK |
16 | ;;; under the terms of the GNU General Public License as published by |
17 | ;;; the Free Software Foundation; either version 3 of the License, or (at | |
18 | ;;; your option) any later version. | |
19 | ;;; | |
233e7676 | 20 | ;;; GNU Guix is distributed in the hope that it will be useful, but |
f190f92f NK |
21 | ;;; WITHOUT ANY WARRANTY; without even the implied warranty of |
22 | ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
23 | ;;; GNU General Public License for more details. | |
24 | ;;; | |
25 | ;;; You should have received a copy of the GNU General Public License | |
233e7676 | 26 | ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>. |
f190f92f | 27 | |
1ffa7090 | 28 | (define-module (gnu packages gettext) |
97f70018 | 29 | #:use-module ((guix licenses) #:select (gpl2+ gpl3+)) |
59a43334 | 30 | #:use-module (gnu packages) |
f190f92f NK |
31 | #:use-module (guix packages) |
32 | #:use-module (guix download) | |
c42a4b76 | 33 | #:use-module (guix build-system gnu) |
97f70018 RW |
34 | #:use-module (guix build-system perl) |
35 | #:use-module (gnu packages docbook) | |
9e015894 | 36 | #:use-module (gnu packages emacs) |
3730e3c6 MB |
37 | #:use-module (gnu packages libunistring) |
38 | #:use-module (gnu packages ncurses) | |
97f70018 | 39 | #:use-module (gnu packages perl) |
8f9ac901 | 40 | #:use-module (gnu packages tex) |
9e015894 AK |
41 | #:use-module (gnu packages xml) |
42 | #:use-module (guix utils)) | |
f190f92f | 43 | |
b94a6ca0 | 44 | (define-public gettext-minimal |
f190f92f | 45 | (package |
b94a6ca0 | 46 | (name "gettext-minimal") |
3730e3c6 | 47 | (version "0.20.1") |
2c9143a1 | 48 | (source (origin |
3730e3c6 MB |
49 | (method url-fetch) |
50 | (uri (string-append "mirror://gnu/gettext/gettext-" | |
51 | version ".tar.gz")) | |
52 | (sha256 | |
53 | (base32 | |
54 | "0p3zwkk27wm2m2ccfqm57nj7vqkmfpn7ja1nf65zmhz8qqs5chb6")))) | |
f190f92f | 55 | (build-system gnu-build-system) |
d7170f44 | 56 | (outputs '("out" |
3730e3c6 | 57 | "doc")) ;9 MiB of HTML |
c42a4b76 | 58 | (inputs |
3730e3c6 MB |
59 | `(("libunistring" ,libunistring) |
60 | ("libxml2" ,libxml2) | |
61 | ||
62 | ;; TODO: ncurses is only needed for the 'libtextstyle' library. | |
63 | ;; The next version of gettext can use a separate libtextstyle, | |
64 | ;; but for now we include it here in 'gettext-minimal'. | |
65 | ("ncurses" ,ncurses))) | |
f190f92f | 66 | (arguments |
3730e3c6 MB |
67 | `(#:configure-flags '("--with-included-libunistring=no" |
68 | "--with-included-libxml=no") | |
69 | #:phases | |
e5f03762 | 70 | (modify-phases %standard-phases |
3730e3c6 MB |
71 | (add-before 'patch-source-shebangs 'patch-fixed-paths |
72 | (lambda _ | |
73 | (substitute* '("gettext-tools/config.h.in" | |
74 | "gettext-tools/gnulib-tests/init.sh" | |
75 | "gettext-tools/tests/init.sh" | |
76 | "gettext-tools/system-tests/run-test") | |
77 | (("/bin/sh") "sh")) | |
78 | (substitute* '("gettext-tools/src/project-id" | |
79 | "gettext-tools/projects/KDE/trigger" | |
80 | "gettext-tools/projects/GNOME/trigger") | |
81 | (("/bin/pwd") "pwd")) | |
82 | #t)) | |
e5f03762 EF |
83 | (add-before 'check 'patch-tests |
84 | (lambda* (#:key inputs #:allow-other-keys) | |
85 | (let* ((bash (which "sh"))) | |
86 | ;; Some of the files we're patching are | |
87 | ;; ISO-8859-1-encoded, so choose it as the default | |
88 | ;; encoding so the byte encoding is preserved. | |
89 | (with-fluids ((%default-port-encoding #f)) | |
90 | (substitute* | |
91 | (find-files "gettext-tools/tests" | |
92 | "^(lang-sh|msg(exec|filter)-[0-9])") | |
93 | (("#![[:blank:]]/bin/sh") | |
94 | (format #f "#!~a" bash))) | |
0e4e4b13 | 95 | |
e5f03762 EF |
96 | (substitute* (cons "gettext-tools/src/msginit.c" |
97 | (find-files "gettext-tools/gnulib-tests" | |
98 | "posix_spawn")) | |
99 | (("/bin/sh") | |
100 | bash)) | |
0e4e4b13 | 101 | |
e5f03762 EF |
102 | (substitute* "gettext-tools/src/project-id" |
103 | (("/bin/pwd") | |
ae7ba731 MW |
104 | "pwd")) |
105 | ||
3730e3c6 | 106 | #t))))) |
0e4e4b13 LC |
107 | |
108 | ;; When tests fail, we want to know the details. | |
109 | #:make-flags '("VERBOSE=yes"))) | |
6fd52309 | 110 | (home-page "https://www.gnu.org/software/gettext/") |
b94a6ca0 AK |
111 | (synopsis |
112 | "Tools and documentation for translation (used to build other packages)") | |
f190f92f | 113 | (description |
79c311b8 LC |
114 | "GNU Gettext is a package providing a framework for translating the |
115 | textual output of programs into multiple languages. It provides translators | |
b94a6ca0 AK |
116 | with the means to create message catalogs, and a runtime library to load |
117 | translated messages from the catalogs. Nearly all GNU packages use Gettext.") | |
69cb225c LC |
118 | (properties `((upstream-name . "gettext") |
119 | (cpe-name . "gettext"))) | |
1c301e48 | 120 | (license gpl3+))) ;some files are under GPLv2+ |
97f70018 | 121 | |
b94a6ca0 AK |
122 | ;; Use that name to avoid clashes with Guile's 'gettext' procedure. |
123 | ;; | |
124 | ;; We used to resort to #:renamer on the user side, but that prevented | |
125 | ;; circular dependencies involving (gnu packages gettext). This is because | |
126 | ;; 'resolve-interface' (as of Guile 2.0.9) iterates eagerly over the used | |
127 | ;; module when there's a #:renamer, and that module may be empty at that point | |
128 | ;; in case or circular dependencies. | |
129 | (define-public gnu-gettext | |
130 | (package | |
131 | (inherit gettext-minimal) | |
132 | (name "gettext") | |
9e015894 AK |
133 | (arguments |
134 | (substitute-keyword-arguments (package-arguments gettext-minimal) | |
135 | ((#:phases phases) | |
136 | `(modify-phases ,phases | |
137 | (add-after 'install 'add-emacs-autoloads | |
138 | (lambda* (#:key outputs #:allow-other-keys) | |
139 | ;; Make 'po-mode' and other things available by default. | |
140 | (with-directory-excursion | |
141 | (string-append (assoc-ref outputs "out") | |
142 | "/share/emacs/site-lisp") | |
143 | (symlink "start-po.el" "gettext-autoloads.el") | |
144 | #t))))))) | |
145 | (native-inputs `(("emacs" ,emacs-minimal))) ; for Emacs tools | |
b94a6ca0 AK |
146 | (synopsis "Tools and documentation for translation"))) |
147 | ||
ea541333 LC |
148 | (define-public libtextstyle |
149 | (package | |
150 | (name "libtextstyle") | |
151 | (version "0.20.1") | |
152 | (source (origin | |
153 | (inherit (package-source gnu-gettext)) | |
154 | (uri (string-append "mirror://gnu/gettext/gettext-" | |
155 | version ".tar.gz")) | |
156 | (sha256 | |
157 | (base32 | |
158 | "0p3zwkk27wm2m2ccfqm57nj7vqkmfpn7ja1nf65zmhz8qqs5chb6")))) | |
159 | (build-system gnu-build-system) | |
160 | (arguments | |
161 | '(#:configure-flags '("--disable-static") | |
162 | #:phases (modify-phases %standard-phases | |
163 | (add-after 'unpack 'chdir | |
164 | (lambda _ | |
165 | (chdir "libtextstyle") | |
166 | #t))))) | |
167 | ;; libtextstyle bundles libxml2, glib (a small subset thereof), and | |
168 | ;; libcroco, but it purposefully prevents users from using an external | |
169 | ;; copy, to reduce the startup time of programs using libtextstyle. | |
170 | (home-page "https://www.gnu.org/software/gettext/") | |
171 | (synopsis "Text styling library") | |
172 | (description | |
173 | "GNU libtextstyle is a C library that provides an easy way to add styling | |
174 | to programs that produce output to a console or terminal emulator window. It | |
175 | allows applications to emit text annotated with styling information, such as | |
176 | color, font attributes (weight, posture), or underlining.") | |
177 | (license gpl3+))) | |
178 | ||
97f70018 RW |
179 | (define-public po4a |
180 | (package | |
181 | (name "po4a") | |
22981806 | 182 | (version "0.57") |
97f70018 RW |
183 | (source (origin |
184 | (method url-fetch) | |
816db966 JL |
185 | (uri (string-append "https://github.com/mquinson/po4a/releases/download/v" |
186 | version "/po4a-" version ".tar.gz")) | |
97f70018 RW |
187 | (sha256 |
188 | (base32 | |
22981806 | 189 | "15yd27krlpdvjhcnwys6i5k1ww62ifq2yx8k1zxyxiwy84myqmdv")))) |
97f70018 RW |
190 | (build-system perl-build-system) |
191 | (arguments | |
192 | `(#:phases | |
193 | (modify-phases %standard-phases | |
97f70018 RW |
194 | (add-after 'install 'wrap-programs |
195 | (lambda* (#:key outputs #:allow-other-keys) | |
196 | ;; Make sure all executables in "bin" find the Perl modules | |
197 | ;; provided by this package at runtime. | |
198 | (let* ((out (assoc-ref outputs "out")) | |
199 | (bin (string-append out "/bin/")) | |
200 | (path (string-append out "/lib/perl5/site_perl"))) | |
201 | (for-each (lambda (file) | |
202 | (wrap-program file | |
203 | `("PERL5LIB" ":" prefix (,path)))) | |
204 | (find-files bin "\\.*$")) | |
727bec13 MB |
205 | #t))) |
206 | (add-before 'reset-gzip-timestamps 'make-compressed-files-writable | |
207 | (lambda* (#:key outputs #:allow-other-keys) | |
208 | (for-each make-file-writable | |
209 | (find-files (string-append (assoc-ref outputs "out") | |
210 | "/share/man") | |
211 | ".*\\.gz$")) | |
895789ea | 212 | #t)) |
9350a084 EF |
213 | (add-after 'unpack 'patch-docbook-xml |
214 | (lambda* (#:key inputs #:allow-other-keys) | |
215 | (substitute* (find-files "." ".*\\.xml(-good)?") | |
216 | (("http://www.oasis-open.org/docbook/xml/4.1.2/") | |
217 | (string-append (assoc-ref inputs "docbook-xml") | |
218 | "/xml/dtd/docbook/"))) | |
219 | #t)) | |
895789ea TGR |
220 | (add-before 'check 'disable-failing-tests |
221 | (lambda _ | |
222 | ;; FIXME: ‘Files ../t-03-asciidoc/Titles.po and Titles.po differ’. | |
223 | (delete-file "t/03-asciidoc.t") | |
224 | ||
9350a084 EF |
225 | ;; FIXME: these tests require SGMLS.pm. |
226 | (delete-file "t/01-classes.t") | |
895789ea TGR |
227 | (delete-file "t/16-sgml.t") |
228 | ||
727bec13 | 229 | #t))))) |
97f70018 | 230 | (native-inputs |
b94a6ca0 | 231 | `(("gettext" ,gettext-minimal) |
97f70018 RW |
232 | ("perl-module-build" ,perl-module-build) |
233 | ("docbook-xsl" ,docbook-xsl) | |
97f70018 | 234 | ("libxml2" ,libxml2) |
895789ea TGR |
235 | ("xsltproc" ,libxslt) |
236 | ||
237 | ;; For tests. | |
9350a084 | 238 | ("docbook-xml" ,docbook-xml-4.1.2) |
895789ea TGR |
239 | ("perl-yaml-tiny" ,perl-yaml-tiny) |
240 | ("texlive" ,texlive-tiny))) | |
4eb0f5cd | 241 | (home-page "https://po4a.org/") |
97f70018 RW |
242 | (synopsis "Scripts to ease maintenance of translations") |
243 | (description | |
244 | "The po4a (PO for anything) project goal is to ease translations (and | |
245 | more interestingly, the maintenance of translations) using gettext tools on | |
246 | areas where they were not expected like documentation.") | |
247 | (license gpl2+))) |