gnu: python-pandas: Fix build on 32-bit.
[jackhill/guix/guix.git] / gnu / packages / gettext.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2012 Nikita Karetnikov <nikita@karetnikov.org>
3 ;;; Copyright © 2014 Mark H Weaver <mhw@netris.org>
4 ;;; Copyright © 2015 Ricardo Wurmus <rekado@elephly.net>
5 ;;; Copyright © 2016 Efraim Flashner <efraim@flashner.co.il>
6 ;;; Copyright © 2016 Alex Kost <alezost@gmail.com>
7 ;;;
8 ;;; This file is part of GNU Guix.
9 ;;;
10 ;;; GNU Guix is free software; you can redistribute it and/or modify it
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 ;;;
15 ;;; GNU Guix is distributed in the hope that it will be useful, but
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
21 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
22
23 (define-module (gnu packages gettext)
24 #:use-module ((guix licenses) #:select (gpl2+ gpl3+))
25 #:use-module (gnu packages)
26 #:use-module (guix packages)
27 #:use-module (guix download)
28 #:use-module (guix build-system gnu)
29 #:use-module (guix build-system perl)
30 #:use-module (gnu packages docbook)
31 #:use-module (gnu packages emacs)
32 #:use-module (gnu packages perl)
33 #:use-module (gnu packages tex)
34 #:use-module (gnu packages xml)
35 #:use-module (guix utils))
36
37 (define-public gettext-minimal
38 (package
39 (name "gettext-minimal")
40 (version "0.19.8.1")
41 (source (origin
42 (method url-fetch)
43 (uri (string-append "mirror://gnu/gettext/gettext-"
44 version ".tar.gz"))
45 (sha256
46 (base32
47 "0hsw28f9q9xaggjlsdp2qmbp2rbd1mp0njzan2ld9kiqwkq2m57z"))))
48 (build-system gnu-build-system)
49 (outputs '("out"
50 "doc")) ;8 MiB of HTML
51 (inputs
52 `(("expat" ,expat)))
53 (arguments
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)))
68
69 (substitute* (cons "gettext-tools/src/msginit.c"
70 (find-files "gettext-tools/gnulib-tests"
71 "posix_spawn"))
72 (("/bin/sh")
73 bash))
74
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\"")))))
85
86 ;; When tests fail, we want to know the details.
87 #:make-flags '("VERBOSE=yes")))
88 (home-page "http://www.gnu.org/software/gettext/")
89 (synopsis
90 "Tools and documentation for translation (used to build other packages)")
91 (description
92 "GNU Gettext is a package providing a framework for translating the
93 textual output of programs into multiple languages. It provides translators
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.")
96 (license gpl3+))) ;some files are under GPLv2+
97
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")
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
122 (synopsis "Tools and documentation for translation")))
123
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
165 `(("gettext" ,gettext-minimal)
166 ("perl-module-build" ,perl-module-build)
167 ("docbook-xsl" ,docbook-xsl)
168 ("docbook-xml" ,docbook-xml) ;for tests
169 ("texlive" ,texlive-minimal) ;for tests
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+)))