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