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