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"
95 (add-before 'configure 'link-expat
97 ;; Gettext defaults to opening expat via dlopen on
98 ;; "Linux". Change to link directly.
99 (substitute* "gettext-tools/configure"
100 (("LIBEXPAT=\"-ldl\"") "LIBEXPAT=\"-ldl -lexpat\"")
101 (("LTLIBEXPAT=\"-ldl\"") "LTLIBEXPAT=\"-ldl -lexpat\""))
104 ;; When tests fail, we want to know the details.
105 #:make-flags '("VERBOSE=yes")))
106 (home-page "https://www.gnu.org/software/gettext/")
108 "Tools and documentation for translation (used to build other packages)")
110 "GNU Gettext is a package providing a framework for translating the
111 textual output of programs into multiple languages. It provides translators
112 with the means to create message catalogs, and a runtime library to load
113 translated messages from the catalogs. Nearly all GNU packages use Gettext.")
114 (license gpl3+))) ;some files are under GPLv2+
116 ;; Use that name to avoid clashes with Guile's 'gettext' procedure.
118 ;; We used to resort to #:renamer on the user side, but that prevented
119 ;; circular dependencies involving (gnu packages gettext). This is because
120 ;; 'resolve-interface' (as of Guile 2.0.9) iterates eagerly over the used
121 ;; module when there's a #:renamer, and that module may be empty at that point
122 ;; in case or circular dependencies.
123 (define-public gnu-gettext
125 (inherit gettext-minimal)
128 (substitute-keyword-arguments (package-arguments gettext-minimal)
130 `(modify-phases ,phases
131 (add-after 'install 'add-emacs-autoloads
132 (lambda* (#:key outputs #:allow-other-keys)
133 ;; Make 'po-mode' and other things available by default.
134 (with-directory-excursion
135 (string-append (assoc-ref outputs "out")
136 "/share/emacs/site-lisp")
137 (symlink "start-po.el" "gettext-autoloads.el")
139 (native-inputs `(("emacs" ,emacs-minimal))) ; for Emacs tools
140 (synopsis "Tools and documentation for translation")))
148 (uri (string-append "https://alioth.debian.org/frs/download.php"
149 "/file/4142/po4a-" version ".tar.gz"))
152 "01vm0750aq0h2lphrflv3wq9gz7y0py8frglfpacn58ivyvy242h"))))
153 (build-system perl-build-system)
156 (modify-phases %standard-phases
157 (add-before 'configure 'set-search-path
159 ;; Work around "dotless @INC" build failure.
161 (string-append (getcwd) ":"
162 (getenv "PERL5LIB")))
164 ;; FIXME: One test fails as we don't have SGMLS.pm
165 (add-before 'check 'disable-sgml-test
167 (delete-file "t/20-sgml.t")
169 (add-after 'unpack 'fix-builder
170 (lambda* (#:key inputs outputs #:allow-other-keys)
171 (substitute* "Po4aBuilder.pm"
172 ;; By default it tries to install into perl's manpath.
173 (("my \\$mandir = .*$")
174 (string-append "my $mandir = \"" (assoc-ref outputs "out")
177 (add-after 'install 'wrap-programs
178 (lambda* (#:key outputs #:allow-other-keys)
179 ;; Make sure all executables in "bin" find the Perl modules
180 ;; provided by this package at runtime.
181 (let* ((out (assoc-ref outputs "out"))
182 (bin (string-append out "/bin/"))
183 (path (string-append out "/lib/perl5/site_perl")))
184 (for-each (lambda (file)
186 `("PERL5LIB" ":" prefix (,path))))
187 (find-files bin "\\.*$"))
189 (add-before 'reset-gzip-timestamps 'make-compressed-files-writable
190 (lambda* (#:key outputs #:allow-other-keys)
191 (for-each make-file-writable
192 (find-files (string-append (assoc-ref outputs "out")
197 `(("gettext" ,gettext-minimal)
198 ("perl-module-build" ,perl-module-build)
199 ("docbook-xsl" ,docbook-xsl)
200 ("docbook-xml" ,docbook-xml) ;for tests
201 ("texlive" ,texlive-tiny) ;for tests
203 ("xsltproc" ,libxslt)))
204 (home-page "https://po4a.org/")
205 (synopsis "Scripts to ease maintenance of translations")
207 "The po4a (PO for anything) project goal is to ease translations (and
208 more interestingly, the maintenance of translations) using gettext tools on
209 areas where they were not expected like documentation.")