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>
8 ;;; This file is part of GNU Guix.
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.
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.
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/>.
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))
37 (define-public gettext-minimal
39 (name "gettext-minimal")
43 (uri (string-append "mirror://gnu/gettext/gettext-"
47 "0hsw28f9q9xaggjlsdp2qmbp2rbd1mp0njzan2ld9kiqwkq2m57z"))))
48 (build-system gnu-build-system)
50 "doc")) ;8 MiB of HTML
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))
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"
78 (add-before 'configure 'link-expat
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\"")))))
86 ;; When tests fail, we want to know the details.
87 #:make-flags '("VERBOSE=yes")))
88 (home-page "http://www.gnu.org/software/gettext/")
90 "Tools and documentation for translation (used to build other packages)")
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+
98 ;; Use that name to avoid clashes with Guile's 'gettext' procedure.
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
107 (inherit gettext-minimal)
110 (substitute-keyword-arguments (package-arguments gettext-minimal)
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")
121 (native-inputs `(("emacs" ,emacs-minimal))) ; for Emacs tools
122 (synopsis "Tools and documentation for translation")))
130 (uri (string-append "https://alioth.debian.org/frs/download.php"
131 "/file/4142/po4a-" version ".tar.gz"))
134 "01vm0750aq0h2lphrflv3wq9gz7y0py8frglfpacn58ivyvy242h"))))
135 (build-system perl-build-system)
138 (modify-phases %standard-phases
139 ;; FIXME: One test fails as we don't have SGMLS.pm
140 (add-before 'check 'disable-sgml-test
142 (delete-file "t/20-sgml.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")
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)
161 `("PERL5LIB" ":" prefix (,path))))
162 (find-files bin "\\.*$"))
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
171 ("xsltproc" ,libxslt)))
172 (home-page "http://po4a.alioth.debian.org/")
173 (synopsis "Scripts to ease maintenance of translations")
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.")