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, 2017 Ricardo Wurmus <rekado@elephly.net>
5 ;;; Copyright © 2016 Efraim Flashner <efraim@flashner.co.il>
6 ;;; Copyright © 2016 Alex Kost <alezost@gmail.com>
7 ;;; Copyright © 2017 Marius Bakke <mbakke@fastmail.com>
8 ;;; Copyright © 2017 Mathieu Othacehe <m.othacehe@gmail.com>
9 ;;; Copyright © 2017 Eric Bavier <bavier@member.fsf.org>
11 ;;; This file is part of GNU Guix.
13 ;;; GNU Guix is free software; you can redistribute it and/or modify it
14 ;;; under the terms of the GNU General Public License as published by
15 ;;; the Free Software Foundation; either version 3 of the License, or (at
16 ;;; your option) any later version.
18 ;;; GNU Guix is distributed in the hope that it will be useful, but
19 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
20 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 ;;; GNU General Public License for more details.
23 ;;; You should have received a copy of the GNU General Public License
24 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
26 (define-module (gnu packages gettext)
27 #:use-module ((guix licenses) #:select (gpl2+ gpl3+))
28 #:use-module (gnu packages)
29 #:use-module (guix packages)
30 #:use-module (guix download)
31 #:use-module (guix build-system gnu)
32 #:use-module (guix build-system perl)
33 #:use-module (gnu packages docbook)
34 #:use-module (gnu packages emacs)
35 #:use-module (gnu packages perl)
36 #:use-module (gnu packages tex)
37 #:use-module (gnu packages xml)
38 #:use-module (guix utils))
40 (define-public gettext-minimal
42 (name "gettext-minimal")
46 (uri (string-append "mirror://gnu/gettext/gettext-"
50 "0hsw28f9q9xaggjlsdp2qmbp2rbd1mp0njzan2ld9kiqwkq2m57z"))
51 (modules '((guix build utils)))
54 ;; The gnulib test-lock test is prone to writer starvation
55 ;; with our glibc@2.25, which prefers readers, so disable it.
56 ;; The gnulib commit b20e8afb0b2 should fix this once
58 (substitute* "gettext-runtime/tests/Makefile.in"
59 (("TESTS = test-lock\\$\\(EXEEXT\\)") "TESTS ="))
60 (substitute* "gettext-tools/gnulib-tests/Makefile.in"
61 (("test-lock\\$\\(EXEEXT\\) ") ""))
63 (build-system gnu-build-system)
65 "doc")) ;8 MiB of HTML
70 (modify-phases %standard-phases
71 (add-before 'check 'patch-tests
72 (lambda* (#:key inputs #:allow-other-keys)
73 (let* ((bash (which "sh")))
74 ;; Some of the files we're patching are
75 ;; ISO-8859-1-encoded, so choose it as the default
76 ;; encoding so the byte encoding is preserved.
77 (with-fluids ((%default-port-encoding #f))
79 (find-files "gettext-tools/tests"
80 "^(lang-sh|msg(exec|filter)-[0-9])")
81 (("#![[:blank:]]/bin/sh")
82 (format #f "#!~a" bash)))
84 (substitute* (cons "gettext-tools/src/msginit.c"
85 (find-files "gettext-tools/gnulib-tests"
90 (substitute* "gettext-tools/src/project-id"
93 (add-before 'configure 'link-expat
95 ;; Gettext defaults to opening expat via dlopen on
96 ;; "Linux". Change to link directly.
97 (substitute* "gettext-tools/configure"
98 (("LIBEXPAT=\"-ldl\"") "LIBEXPAT=\"-ldl -lexpat\"")
99 (("LTLIBEXPAT=\"-ldl\"") "LTLIBEXPAT=\"-ldl -lexpat\"")))))
101 ;; When tests fail, we want to know the details.
102 #:make-flags '("VERBOSE=yes")))
103 (home-page "https://www.gnu.org/software/gettext/")
105 "Tools and documentation for translation (used to build other packages)")
107 "GNU Gettext is a package providing a framework for translating the
108 textual output of programs into multiple languages. It provides translators
109 with the means to create message catalogs, and a runtime library to load
110 translated messages from the catalogs. Nearly all GNU packages use Gettext.")
111 (license gpl3+))) ;some files are under GPLv2+
113 ;; Use that name to avoid clashes with Guile's 'gettext' procedure.
115 ;; We used to resort to #:renamer on the user side, but that prevented
116 ;; circular dependencies involving (gnu packages gettext). This is because
117 ;; 'resolve-interface' (as of Guile 2.0.9) iterates eagerly over the used
118 ;; module when there's a #:renamer, and that module may be empty at that point
119 ;; in case or circular dependencies.
120 (define-public gnu-gettext
122 (inherit gettext-minimal)
125 (substitute-keyword-arguments (package-arguments gettext-minimal)
127 `(modify-phases ,phases
128 (add-after 'install 'add-emacs-autoloads
129 (lambda* (#:key outputs #:allow-other-keys)
130 ;; Make 'po-mode' and other things available by default.
131 (with-directory-excursion
132 (string-append (assoc-ref outputs "out")
133 "/share/emacs/site-lisp")
134 (symlink "start-po.el" "gettext-autoloads.el")
136 (native-inputs `(("emacs" ,emacs-minimal))) ; for Emacs tools
137 (synopsis "Tools and documentation for translation")))
145 (uri (string-append "https://alioth.debian.org/frs/download.php"
146 "/file/4142/po4a-" version ".tar.gz"))
149 "01vm0750aq0h2lphrflv3wq9gz7y0py8frglfpacn58ivyvy242h"))))
150 (build-system perl-build-system)
153 (modify-phases %standard-phases
154 (add-before 'configure 'set-search-path
156 ;; Work around "dotless @INC" build failure.
158 (string-append (getcwd) ":"
159 (getenv "PERL5LIB")))
161 ;; FIXME: One test fails as we don't have SGMLS.pm
162 (add-before 'check 'disable-sgml-test
164 (delete-file "t/20-sgml.t")
166 (add-after 'unpack 'fix-builder
167 (lambda* (#:key inputs outputs #:allow-other-keys)
168 (substitute* "Po4aBuilder.pm"
169 ;; By default it tries to install into perl's manpath.
170 (("my \\$mandir = .*$")
171 (string-append "my $mandir = \"" (assoc-ref outputs "out")
174 (add-after 'install 'wrap-programs
175 (lambda* (#:key outputs #:allow-other-keys)
176 ;; Make sure all executables in "bin" find the Perl modules
177 ;; provided by this package at runtime.
178 (let* ((out (assoc-ref outputs "out"))
179 (bin (string-append out "/bin/"))
180 (path (string-append out "/lib/perl5/site_perl")))
181 (for-each (lambda (file)
183 `("PERL5LIB" ":" prefix (,path))))
184 (find-files bin "\\.*$"))
186 (add-before 'reset-gzip-timestamps 'make-compressed-files-writable
187 (lambda* (#:key outputs #:allow-other-keys)
188 (for-each make-file-writable
189 (find-files (string-append (assoc-ref outputs "out")
194 `(("gettext" ,gettext-minimal)
195 ("perl-module-build" ,perl-module-build)
196 ("docbook-xsl" ,docbook-xsl)
197 ("docbook-xml" ,docbook-xml) ;for tests
198 ("texlive" ,texlive-tiny) ;for tests
200 ("xsltproc" ,libxslt)))
201 (home-page "http://po4a.alioth.debian.org/")
202 (synopsis "Scripts to ease maintenance of translations")
204 "The po4a (PO for anything) project goal is to ease translations (and
205 more interestingly, the maintenance of translations) using gettext tools on
206 areas where they were not expected like documentation.")