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