gnu: Add setBfree.
[jackhill/guix/guix.git] / gnu / packages / texlive.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2013, 2014, 2015 Andreas Enge <andreas@enge.fr>
3 ;;; Copyright © 2014 Eric Bavier <bavier@member.fsf.org>
4 ;;; Copyright © 2015 Mark H Weaver <mhw@netris.org>
5 ;;;
6 ;;; This file is part of GNU Guix.
7 ;;;
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.
12 ;;;
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.
17 ;;;
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/>.
20
21 (define-module (gnu packages texlive)
22 #:use-module ((guix licenses) #:prefix license:)
23 #:use-module (guix packages)
24 #:use-module (guix download)
25 #:use-module (guix build-system gnu)
26 #:use-module (guix build-system trivial)
27 #:use-module (gnu packages)
28 #:use-module (gnu packages bash)
29 #:use-module (gnu packages compression)
30 #:use-module (gnu packages fontutils)
31 #:use-module (gnu packages gd)
32 #:use-module (gnu packages ghostscript)
33 #:use-module (gnu packages gtk)
34 #:use-module (gnu packages icu4c)
35 #:use-module (gnu packages image)
36 #:use-module (gnu packages lua)
37 #:use-module (gnu packages pdf)
38 #:use-module (gnu packages perl)
39 #:use-module (gnu packages pkg-config)
40 #:use-module (gnu packages python)
41 #:use-module (gnu packages ruby)
42 #:use-module (gnu packages tcsh)
43 #:use-module (gnu packages base)
44 #:use-module (gnu packages xorg)
45 #:use-module (gnu packages xdisorg)
46 #:use-module (gnu packages zip)
47 #:autoload (gnu packages texinfo) (texinfo))
48
49 (define texlive-extra-src
50 (origin
51 (method url-fetch)
52 (uri "ftp://tug.org/historic/systems/texlive/2014/texlive-20140525-extra.tar.xz")
53 (sha256 (base32
54 "1zlnjysvxskcy05iva6jfklirwv12wqyn3ia119a7xnqlvhpqz33"))))
55
56 (define texlive-texmf-src
57 (origin
58 (method url-fetch)
59 (uri "ftp://tug.org/historic/systems/texlive/2014/texlive-20140525-texmf.tar.xz")
60 (sha256 (base32
61 "0qsr55ms1278dhmgixs5qqwd4fxhh369ihkki6wgh8xaqm8p48p0"))))
62
63 (define-public texlive-bin
64 (package
65 (name "texlive-bin")
66 (version "2014")
67 (source
68 (origin
69 (method url-fetch)
70 (uri "ftp://tug.org/historic/systems/texlive/2014/texlive-20140525-source.tar.xz")
71 (sha256 (base32
72 "1glmaw2jv42grbsn05kay825j66scimjqqc32776bb1356q4xfq8"))))
73 (build-system gnu-build-system)
74 (inputs
75 `(("texlive-extra-src" ,texlive-extra-src)
76 ("cairo" ,cairo)
77 ("fontconfig" ,fontconfig)
78 ("fontforge" ,fontforge)
79 ("freetype" ,freetype)
80 ("gd" ,gd)
81 ("ghostscript" ,ghostscript)
82 ("graphite2" ,graphite2)
83 ("harfbuzz" ,harfbuzz)
84 ("icu4c" ,icu4c)
85 ("libpaper" ,libpaper)
86 ("libpng" ,libpng)
87 ("libxaw" ,libxaw)
88 ("libxt" ,libxt)
89 ("perl" ,perl)
90 ("pixman" ,pixman)
91 ("poppler" ,poppler)
92 ("potrace" ,potrace)
93 ("python" ,python-2) ; incompatible with Python 3 (print syntax)
94 ("ruby" ,ruby)
95 ("tcsh" ,tcsh)
96 ("teckit" ,teckit)
97 ("zlib" ,zlib)
98 ("zziplib" ,zziplib)))
99 (native-inputs
100 `(("pkg-config" ,pkg-config)))
101 (arguments
102 `(#:out-of-source? #t
103 #:configure-flags
104 `("--disable-native-texlive-build"
105 "--with-system-cairo"
106 "--with-system-freetype2"
107 "--with-system-gd"
108 "--with-system-graphite2"
109 "--with-system-harfbuzz"
110 "--with-system-icu"
111 "--with-system-libgs"
112 "--with-system-libpaper"
113 "--with-system-libpng"
114 "--with-system-pixman"
115 "--with-system-poppler"
116 "--with-system-potrace"
117 "--with-system-teckit"
118 "--with-system-xpdf"
119 "--with-system-zlib"
120 "--with-system-zziplib")
121
122 ;; Disable tests on mips64 to cope with a failure of luajiterr.test.
123 ;; XXX FIXME fix luajit properly on mips64.
124 #:tests? ,(not (string-prefix? "mips64" (or (%current-target-system)
125 (%current-system))))
126 #:phases
127 (alist-cons-after
128 'install 'postinst
129 (lambda* (#:key inputs outputs #:allow-other-keys #:rest args)
130 (let* ((out (assoc-ref outputs "out"))
131 (share (string-append out "/share"))
132 (texlive-extra (assoc-ref inputs "texlive-extra-src"))
133 (unpack (assoc-ref %standard-phases 'unpack))
134 (patch-source-shebangs
135 (assoc-ref %standard-phases 'patch-source-shebangs)))
136 ;; Create symbolic links for the latex variants and their
137 ;; man pages.
138 (with-directory-excursion (string-append out "/bin/")
139 (for-each symlink
140 '("pdftex" "pdftex" "xetex" "luatex")
141 '("latex" "pdflatex" "xelatex" "lualatex")))
142 (with-directory-excursion (string-append share "/man/man1/")
143 (symlink "luatex.1" "lualatex.1"))
144 ;; Unpack texlive-extra and install tlpkg.
145 (mkdir "texlive-extra")
146 (with-directory-excursion "texlive-extra"
147 (apply unpack (list #:source texlive-extra))
148 (apply patch-source-shebangs (list #:source texlive-extra))
149 (system* "mv" "tlpkg" share))))
150 %standard-phases)))
151 (synopsis "TeX Live, a package of the TeX typesetting system")
152 (description
153 "TeX Live provides a comprehensive TeX document production system.
154 It includes all the major TeX-related programs, macro packages, and fonts
155 that are free software, including support for many languages around the
156 world.
157
158 This package contains the binaries.")
159 (license (license:fsf-free "http://tug.org/texlive/copying.html"))
160 (home-page "http://www.tug.org/texlive/")))
161
162 (define-public texlive-texmf
163 (package
164 (name "texlive-texmf")
165 (version "2014")
166 (source texlive-texmf-src)
167 (build-system gnu-build-system)
168 (inputs
169 `(("texlive-bin" ,texlive-bin)
170 ("lua" ,lua)
171 ("perl" ,perl)
172 ("python" ,python-2) ; incompatible with Python 3 (print syntax)
173 ("ruby" ,ruby)
174 ("tcsh" ,tcsh)))
175 (arguments
176 `(#:modules ((guix build gnu-build-system)
177 (guix build utils)
178 (srfi srfi-26))
179 #:phases
180 (alist-cons-before
181 'texmf-config 'install
182 (lambda* (#:key outputs #:allow-other-keys)
183 (let ((share (string-append (assoc-ref outputs "out") "/share")))
184 (mkdir-p share)
185 (system* "mv" "texmf-dist" share)))
186 (alist-cons-after
187 'patch-source-shebangs 'texmf-config
188 (lambda* (#:key inputs outputs #:allow-other-keys)
189 (let* ((share (string-append (assoc-ref outputs "out") "/share"))
190 (texmfroot (string-append share "/texmf-dist/web2c"))
191 (texmfcnf (string-append texmfroot "/texmf.cnf"))
192 (texbin (string-append (assoc-ref inputs "texlive-bin")
193 "/bin")))
194 ;; Register SHARE as TEXMFROOT in texmf.cnf.
195 (substitute* texmfcnf
196 (("TEXMFROOT = \\$SELFAUTOPARENT")
197 (string-append "TEXMFROOT = " share)))
198 ;; Configure the texmf-dist tree; inspired from
199 ;; http://slackbuilds.org/repository/13.37/office/texlive/
200 (setenv "PATH" (string-append (getenv "PATH") ":" texbin))
201 (setenv "TEXMFCNF" texmfroot)
202 (system* "updmap-sys" "--nohash" "--syncwithtrees")
203 (system* "mktexlsr")
204 (system* "fmtutil-sys" "--all")))
205 (map (cut assq <> %standard-phases)
206 '(set-paths unpack patch-source-shebangs))))))
207 (synopsis "TeX Live, a package of the TeX typesetting system")
208 (description
209 "TeX Live provides a comprehensive TeX document production system.
210 It includes all the major TeX-related programs, macro packages, and fonts
211 that are free software, including support for many languages around the
212 world.
213
214 This package contains the complete tree of texmf-dist data.")
215 (license (license:fsf-free "http://tug.org/texlive/copying.html"))
216 (home-page "http://www.tug.org/texlive/")))
217
218 (define-public texlive
219 (package
220 (name "texlive")
221 (version "2014")
222 (source #f)
223 (build-system trivial-build-system)
224 (inputs `(("bash" ,bash) ; for wrap-program
225 ("texlive-bin" ,texlive-bin)
226 ("texlive-texmf" ,texlive-texmf)))
227 (arguments
228 `(#:modules ((guix build utils))
229 #:builder
230 ;; Build the union of texlive-bin and texlive-texmf, but take the
231 ;; conflicting subdirectory share/texmf-dist from texlive-texmf.
232 (begin
233 (use-modules (guix build utils))
234 (let ((out (assoc-ref %outputs "out"))
235 (bin (assoc-ref %build-inputs "texlive-bin"))
236 (texmf (assoc-ref %build-inputs "texlive-texmf"))
237 (bash (assoc-ref %build-inputs "bash")))
238 (mkdir out)
239 (with-directory-excursion out
240 (for-each
241 (lambda (name)
242 (symlink (string-append bin "/" name) name))
243 '("include" "lib"))
244 (mkdir "bin")
245 (with-directory-excursion "bin"
246 (setenv "PATH" (string-append bash "/bin"))
247 (for-each
248 (lambda (name)
249 (symlink name (basename name))
250 (wrap-program
251 (basename name)
252 `("TEXMFCNF" =
253 (,(string-append texmf "/share/texmf-dist/web2c")))))
254 (find-files (string-append bin "/bin/") "")))
255 (mkdir "share")
256 (with-directory-excursion "share"
257 (for-each
258 (lambda (name)
259 (symlink (string-append bin "/share/" name) name))
260 '("info" "man" "tlpkg"))
261 (for-each
262 (lambda (name)
263 (symlink (string-append texmf "/share/" name) name))
264 '("texmf-dist" "texmf-var"))))))))
265 (synopsis "TeX Live, a package of the TeX typesetting system")
266 (description
267 "TeX Live provides a comprehensive TeX document production system.
268 It includes all the major TeX-related programs, macro packages, and fonts
269 that are free software, including support for many languages around the
270 world.
271
272 This package contains the complete TeX Live distribution.")
273 (license (license:fsf-free "http://tug.org/texlive/copying.html"))
274 (home-page "http://www.tug.org/texlive/")))
275
276 (define-public rubber
277 (package
278 (name "rubber")
279 (version "1.1")
280 (source (origin
281 (method url-fetch)
282 (uri (list (string-append "https://launchpad.net/rubber/trunk/"
283 version "/+download/rubber-"
284 version ".tar.gz")
285 (string-append "http://ebeffara.free.fr/pub/rubber-"
286 version ".tar.gz")))
287 (sha256
288 (base32
289 "1xbkv8ll889933gyi2a5hj7hhh216k04gn8fwz5lfv5iz8s34gbq"))))
290 (build-system gnu-build-system)
291 (arguments '(#:tests? #f)) ; no `check' target
292 (inputs `(("texinfo" ,texinfo)
293 ("python" ,python-2) ; incompatible with Python 3 (print syntax)
294 ("which" ,which)))
295 (home-page "https://launchpad.net/rubber")
296 (synopsis "Wrapper for LaTeX and friends")
297 (description
298 "Rubber is a program whose purpose is to handle all tasks related to the
299 compilation of LaTeX documents. This includes compiling the document itself,
300 of course, enough times so that all references are defined, and running BibTeX
301 to manage bibliographic references. Automatic execution of dvips to produce
302 PostScript documents is also included, as well as usage of pdfLaTeX to produce
303 PDF documents.")
304 (license license:gpl2+)))