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>
6 ;;; This file is part of GNU Guix.
8 ;;; GNU Guix is free software; you can redistribute it and/or modify it
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.
13 ;;; GNU Guix is distributed in the hope that it will be useful, but
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.
18 ;;; You should have received a copy of the GNU General Public License
19 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
21 (define-module (gnu packages gettext)
22 #:use-module ((guix licenses) #:select (gpl2+ gpl3+))
23 #:use-module (gnu packages)
24 #:use-module (guix packages)
25 #:use-module (guix download)
26 #:use-module (guix build-system gnu)
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)
31 #:use-module (gnu packages xml))
33 ;; Use that name to avoid clashes with Guile's 'gettext' procedure.
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
46 (uri (string-append "mirror://gnu/gettext/gettext-"
50 "0pb9vp4ifymvdmc31ks3xxcnfqgzj8shll39czmk8c1splclqjzd"))))
51 (build-system gnu-build-system)
55 `(#:phases (alist-cons-before
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))
64 (find-files "gettext-tools/tests"
65 "^(lang-sh|msg(exec|filter)-[0-9])")
66 (("#![[:blank:]]/bin/sh")
67 (format #f "#!~a" bash)))
69 (substitute* (cons "gettext-tools/src/msginit.c"
70 (find-files "gettext-tools/gnulib-tests"
75 (substitute* "gettext-tools/src/project-id"
79 'configure 'link-expat
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\"")))
88 ;; When tests fail, we want to know the details.
89 #:make-flags '("VERBOSE=yes")))
90 (home-page "http://www.gnu.org/software/gettext/")
91 (synopsis "Tools and documentation for translation")
93 "GNU Gettext is a package providing a framework for translating the
94 textual output of programs into multiple languages. It provides translators
95 with the means to create message catalogs, as well as an Emacs mode to work
96 with them, and a runtime library to load translated messages from the
97 catalogs. Nearly all GNU packages use Gettext.")
98 (license gpl3+))) ;some files are under GPLv2+
106 (uri (string-append "https://alioth.debian.org/frs/download.php"
107 "/file/4142/po4a-" version ".tar.gz"))
110 "01vm0750aq0h2lphrflv3wq9gz7y0py8frglfpacn58ivyvy242h"))))
111 (build-system perl-build-system)
114 (modify-phases %standard-phases
115 ;; FIXME: One test fails as we don't have SGMLS.pm
116 (add-before 'check 'disable-sgml-test
118 (delete-file "t/20-sgml.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")
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)
137 `("PERL5LIB" ":" prefix (,path))))
138 (find-files bin "\\.*$"))
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
147 ("xsltproc" ,libxslt)))
148 (home-page "http://po4a.alioth.debian.org/")
149 (synopsis "Scripts to ease maintenance of translations")
151 "The po4a (PO for anything) project goal is to ease translations (and
152 more interestingly, the maintenance of translations) using gettext tools on
153 areas where they were not expected like documentation.")