1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2013, 2014, 2015, 2016 Andreas Enge <andreas@enge.fr>
3 ;;; Copyright © 2014 Eric Bavier <bavier@member.fsf.org>
4 ;;; Copyright © 2015 Mark H Weaver <mhw@netris.org>
5 ;;; Copyright © 2016 Roel Janssen <roel@gnu.org>
6 ;;; Copyright © 2016 Efraim Flashner <efraim@flashner.co.il>
7 ;;; Copyright © 2016 Federico Beffa <beffa@fbengineering.ch>
9 ;;; This file is part of GNU Guix.
11 ;;; GNU Guix is free software; you can redistribute it and/or modify it
12 ;;; under the terms of the GNU General Public License as published by
13 ;;; the Free Software Foundation; either version 3 of the License, or (at
14 ;;; your option) any later version.
16 ;;; GNU Guix is distributed in the hope that it will be useful, but
17 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
18 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 ;;; GNU General Public License for more details.
21 ;;; You should have received a copy of the GNU General Public License
22 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
24 (define-module (gnu packages tex)
25 #:use-module ((guix licenses) #:prefix license:)
26 #:use-module (guix packages)
27 #:use-module (guix download)
28 #:use-module (guix build-system gnu)
29 #:use-module (guix build-system trivial)
30 #:use-module (guix utils)
31 #:use-module (guix git-download)
32 #:use-module (gnu packages)
33 #:use-module (gnu packages autotools)
34 #:use-module (gnu packages bash)
35 #:use-module (gnu packages compression)
36 #:use-module (gnu packages fontutils)
37 #:use-module (gnu packages gd)
38 #:use-module (gnu packages ghostscript)
39 #:use-module (gnu packages gtk)
40 #:use-module (gnu packages icu4c)
41 #:use-module (gnu packages image)
42 #:use-module (gnu packages lua)
43 #:use-module (gnu packages multiprecision)
44 #:use-module (gnu packages pdf)
45 #:use-module (gnu packages perl)
46 #:use-module (gnu packages pkg-config)
47 #:use-module (gnu packages python)
48 #:use-module (gnu packages qt)
49 #:use-module (gnu packages ruby)
50 #:use-module (gnu packages shells)
51 #:use-module (gnu packages base)
52 #:use-module (gnu packages xorg)
53 #:use-module (gnu packages xdisorg)
54 #:use-module (gnu packages zip)
55 #:autoload (gnu packages texinfo) (texinfo)
56 #:use-module (ice-9 ftw)
57 #:use-module (srfi srfi-1))
59 (define texlive-extra-src
62 (uri "ftp://tug.org/historic/systems/texlive/2016/texlive-20160523-extra.tar.xz")
64 "0q4a92zmwhn4ry6xgrp4k8wq11ax2sg9rg9yrsrdkr719y0x887a"))))
66 (define texlive-texmf-src
69 (uri "ftp://tug.org/historic/systems/texlive/2016/texlive-20160523b-texmf.tar.xz")
71 "1dv8vgfzpczqw82hv9g7a8djhhyzywljmrarlcyy6g2qi5q51glr"))))
80 (uri "ftp://tug.org/historic/systems/texlive/2016/texlive-20160523b-source.tar.xz")
82 "1v91vahxlxkdra0qz3f132vvx5d9cx2jy84yl1hkch0agyj2rcx8"))))
83 (build-system gnu-build-system)
85 `(("texlive-extra-src" ,texlive-extra-src)
87 ("fontconfig" ,fontconfig)
88 ("fontforge" ,fontforge)
89 ("freetype" ,freetype)
92 ("ghostscript" ,ghostscript)
93 ("graphite2" ,graphite2)
94 ("harfbuzz" ,harfbuzz)
96 ("libpaper" ,libpaper)
105 ("python" ,python-2) ; incompatible with Python 3 (print syntax)
110 ("zziplib" ,zziplib)))
112 `(("pkg-config" ,pkg-config)))
114 `(#:out-of-source? #t
116 `("--disable-native-texlive-build"
117 "--with-system-cairo"
118 "--with-system-freetype2"
121 "--with-system-graphite2"
122 "--with-system-harfbuzz"
124 "--with-system-libgs"
125 "--with-system-libpaper"
126 "--with-system-libpng"
128 "--with-system-pixman"
129 "--with-system-poppler"
130 "--with-system-potrace"
131 "--with-system-teckit"
134 "--with-system-zziplib")
136 ;; Disable tests on mips64 to cope with a failure of luajiterr.test.
137 ;; XXX FIXME fix luajit properly on mips64.
138 #:tests? ,(not (string-prefix? "mips64" (or (%current-target-system)
141 (modify-phases %standard-phases
142 (add-after 'install 'postint
143 (lambda* (#:key inputs outputs #:allow-other-keys #:rest args)
144 (let* ((out (assoc-ref outputs "out"))
145 (share (string-append out "/share"))
146 (texlive-extra (assoc-ref inputs "texlive-extra-src"))
147 (unpack (assoc-ref %standard-phases 'unpack))
148 (patch-source-shebangs
149 (assoc-ref %standard-phases 'patch-source-shebangs)))
150 ;; Create symbolic links for the latex variants and their
152 (with-directory-excursion (string-append out "/bin/")
154 '("pdftex" "pdftex" "xetex" "luatex")
155 '("latex" "pdflatex" "xelatex" "lualatex")))
156 (with-directory-excursion (string-append share "/man/man1/")
157 (symlink "luatex.1" "lualatex.1"))
158 ;; Unpack texlive-extra and install tlpkg.
159 (mkdir "texlive-extra")
160 (with-directory-excursion "texlive-extra"
161 (apply unpack (list #:source texlive-extra))
162 (apply patch-source-shebangs (list #:source texlive-extra))
163 (system* "mv" "tlpkg" share))))))))
164 (synopsis "TeX Live, a package of the TeX typesetting system")
166 "TeX Live provides a comprehensive TeX document production system.
167 It includes all the major TeX-related programs, macro packages, and fonts
168 that are free software, including support for many languages around the
171 This package contains the binaries.")
172 (license (license:fsf-free "https://www.tug.org/texlive/copying.html"))
173 (home-page "https://www.tug.org/texlive/")))
175 (define texlive-texmf
177 (name "texlive-texmf")
179 (source texlive-texmf-src)
180 (build-system gnu-build-system)
182 `(("texlive-bin" ,texlive-bin)
185 ("python" ,python-2) ; incompatible with Python 3 (print syntax)
189 `(#:modules ((guix build gnu-build-system)
193 ;; This package takes 4 GiB, which we can't afford to distribute from
198 (modify-phases (map (cut assq <> %standard-phases)
199 '(set-paths unpack patch-source-shebangs))
200 (add-after 'patch-source-shebangs 'install
201 (lambda* (#:key outputs #:allow-other-keys)
202 (let ((share (string-append (assoc-ref outputs "out") "/share")))
204 (system* "mv" "texmf-dist" share))))
205 (add-after 'install 'texmf-config
206 (lambda* (#:key inputs outputs #:allow-other-keys)
207 (let* ((out (assoc-ref outputs "out"))
208 (share (string-append out "/share"))
209 (texmfroot (string-append share "/texmf-dist/web2c"))
210 (texmfcnf (string-append texmfroot "/texmf.cnf"))
211 (texlive-bin (assoc-ref inputs "texlive-bin"))
212 (texbin (string-append texlive-bin "/bin"))
213 (tlpkg (string-append texlive-bin "/share/tlpkg")))
214 ;; Register SHARE as TEXMFROOT in texmf.cnf.
215 (substitute* texmfcnf
216 (("TEXMFROOT = \\$SELFAUTOPARENT")
217 (string-append "TEXMFROOT = " share))
218 (("TEXMFLOCAL = \\$SELFAUTOGRANDPARENT/texmf-local")
219 "TEXMFLOCAL = $SELFAUTODIR/share/texmf-local")
220 (("!!\\$TEXMFLOCAL") "$TEXMFLOCAL"))
221 ;; Register paths in texmfcnf.lua, needed for context.
222 (substitute* (string-append texmfroot "/texmfcnf.lua")
223 (("selfautodir:") out)
224 (("selfautoparent:") (string-append share "/")))
225 ;; Set path to TeXLive Perl modules
227 (string-append (getenv "PERL5LIB") ":" tlpkg))
228 ;; Configure the texmf-dist tree; inspired from
229 ;; http://slackbuilds.org/repository/13.37/office/texlive/
230 (setenv "PATH" (string-append (getenv "PATH") ":" texbin))
231 (setenv "TEXMFCNF" texmfroot)
232 (system* "updmap-sys" "--nohash" "--syncwithtrees")
234 (system* "fmtutil-sys" "--all")))))))
235 (properties `((max-silent-time . 9600))) ; don't time out while grafting
236 (synopsis "TeX Live, a package of the TeX typesetting system")
238 "TeX Live provides a comprehensive TeX document production system.
239 It includes all the major TeX-related programs, macro packages, and fonts
240 that are free software, including support for many languages around the
243 This package contains the complete tree of texmf-dist data.")
244 (license (license:fsf-free "https://www.tug.org/texlive/copying.html"))
245 (home-page "https://www.tug.org/texlive/")))
247 (define-public texlive
252 (build-system trivial-build-system)
253 (inputs `(("bash" ,bash) ; for wrap-program
254 ("texlive-bin" ,texlive-bin)
255 ("texlive-texmf" ,texlive-texmf)))
257 (list (search-path-specification
258 (variable "TEXMFLOCAL")
259 (files '("share/texmf-local")))))
261 `(#:modules ((guix build utils))
263 ;; Build the union of texlive-bin and texlive-texmf, but take the
264 ;; conflicting subdirectory share/texmf-dist from texlive-texmf.
266 (use-modules (guix build utils))
267 (let ((out (assoc-ref %outputs "out"))
268 (bin (assoc-ref %build-inputs "texlive-bin"))
269 (texmf (assoc-ref %build-inputs "texlive-texmf"))
270 (bash (assoc-ref %build-inputs "bash")))
272 (with-directory-excursion out
275 (symlink (string-append bin "/" name) name))
278 (with-directory-excursion "bin"
279 (setenv "PATH" (string-append bash "/bin"))
282 (symlink name (basename name))
286 (,(string-append texmf "/share/texmf-dist/web2c")))))
287 (find-files (string-append bin "/bin/") "")))
289 (with-directory-excursion "share"
292 (symlink (string-append bin "/share/" name) name))
293 '("info" "man" "tlpkg"))
296 (symlink (string-append texmf "/share/" name) name))
297 '("texmf-dist" "texmf-var"))))))))
298 (synopsis "TeX Live, a package of the TeX typesetting system")
300 "TeX Live provides a comprehensive TeX document production system.
301 It includes all the major TeX-related programs, macro packages, and fonts
302 that are free software, including support for many languages around the
305 This package contains the complete TeX Live distribution.")
306 (license (license:fsf-free "https://www.tug.org/texlive/copying.html"))
307 (home-page "https://www.tug.org/texlive/")))
310 ;; texlive-texmf-minimal is a pruned, small version of the texlive tree,
311 ;; in particular dropping documentation and fonts. It weighs in at 470 MiB
313 (define texlive-texmf-minimal
314 (package (inherit texlive-texmf)
315 (name "texlive-texmf-minimal")
317 (substitute-keyword-arguments
318 (package-arguments texlive-texmf)
324 `(modify-phases ,phases
325 (add-after 'unpack 'prune
327 (define (delete subdir exclude)
328 "Delete all files and directories in SUBDIR except for those
329 given in the list EXCLUDE."
330 (with-directory-excursion subdir
331 (for-each delete-file-recursively
332 (lset-difference equal?
336 (with-directory-excursion "texmf-dist"
337 (for-each delete-file-recursively
338 '("doc" "source" "tex4ht"))
339 ;; Delete all subdirectories of "fonts", except for "tfm" and
340 ;; any directories named "cm".
341 (delete "fonts" '("afm" "map" "pk" "source" "tfm" "type1"))
342 (delete "fonts/afm" '("public"))
343 (delete "fonts/afm/public" '("amsfonts"))
344 (delete "fonts/afm/public/amsfonts" '("cm"))
345 (delete "fonts/map" '("dvips"))
346 (delete "fonts/map/dvips" '("cm"))
347 (delete "fonts/source" '("public"))
348 (delete "fonts/source/public" '("cm"))
349 (delete "fonts/tfm" '("public"))
350 (delete "fonts/type1" '("public"))
351 (delete "fonts/type1/public" '("amsfonts"))
352 (delete "fonts/type1/public/amsfonts" '("cm")))
355 "TeX Live provides a comprehensive TeX document production system.
356 It includes all the major TeX-related programs, macro packages, and fonts
357 that are free software, including support for many languages around the
360 This package contains a small subset of the texmf-dist data.")))
363 ;; texlive-minimal is the same as texlive, but using texlive-texmf-minimal
364 ;; instead of the full texlive-texmf. It can be used, for instance, as a
365 ;; native input to packages that need texlive to build their documentation.
366 (define-public texlive-minimal
367 (package (inherit texlive)
368 (name "texlive-minimal")
370 `(("texlive-texmf" ,texlive-texmf-minimal)
371 ,@(alist-delete "texlive-texmf" (package-inputs texlive))))
373 (list (search-path-specification
374 (variable "TEXMFLOCAL")
375 (files '("share/texmf-local")))))
377 "TeX Live provides a comprehensive TeX document production system.
378 It includes all the major TeX-related programs, macro packages, and fonts
379 that are free software, including support for many languages around the
382 This package contains a small working part of the TeX Live distribution.")))
385 (define-public rubber
391 (uri (list (string-append "https://launchpad.net/rubber/trunk/"
392 version "/+download/rubber-"
394 (string-append "http://ebeffara.free.fr/pub/rubber-"
398 "1xbkv8ll889933gyi2a5hj7hhh216k04gn8fwz5lfv5iz8s34gbq"))))
399 (build-system gnu-build-system)
400 (arguments '(#:tests? #f)) ; no `check' target
401 (inputs `(("texinfo" ,texinfo)
402 ("python" ,python-2) ; incompatible with Python 3 (print syntax)
404 (home-page "https://launchpad.net/rubber")
405 (synopsis "Wrapper for LaTeX and friends")
407 "Rubber is a program whose purpose is to handle all tasks related to the
408 compilation of LaTeX documents. This includes compiling the document itself,
409 of course, enough times so that all references are defined, and running BibTeX
410 to manage bibliographic references. Automatic execution of dvips to produce
411 PostScript documents is also included, as well as usage of pdfLaTeX to produce
413 (license license:gpl2+)))
415 (define-public texmaker
421 (uri (string-append "http://www.xm1math.net/texmaker/texmaker-"
425 "056njk6j8wma23mlp7xa3rgfaxx0q8ynwx8wkmj7iy0b85p9ds9c"))))
426 (build-system gnu-build-system)
429 (modify-phases %standard-phases
430 ;; Qt has its own configuration utility.
432 (lambda* (#:key outputs #:allow-other-keys)
433 (let ((out (assoc-ref outputs "out")))
434 (zero? (system* "qmake"
435 (string-append "PREFIX=" out)
436 (string-append "DESKTOPDIR=" out
437 "/share/applications")
438 (string-append "ICONDIR=" out "/share/pixmaps")
439 "texmaker.pro"))))))))
441 `(("poppler-qt5" ,poppler-qt5)
445 `(("pkg-config" ,pkg-config)))
446 (home-page "http://www.xm1math.net/texmaker/")
447 (synopsis "LaTeX editor")
448 (description "Texmaker is a program that integrates many tools needed to
449 develop documents with LaTeX, in a single application.")
450 (license license:gpl2+)))
453 (define-public teximpatient
455 (name "teximpatient")
459 (uri (string-append "mirror://gnu/" name "/" name "-"
463 "0h56w22d99dh4fgld4ssik8ggnmhmrrbnrn1lnxi1zr0miphn1sd"))))
464 (build-system gnu-build-system)
467 (modify-phases %standard-phases
469 ;; Unfortunately some mistakes have been made in packaging.
470 ;; Work around them here ...
472 (lambda* (#:key inputs outputs #:allow-other-keys)
473 (let ((srcdir "teximpatient-2.4"))
474 (system* "tar" "-xzf" (assoc-ref inputs "source")
475 (string-append "--one-top-level=" srcdir))
476 (delete-file (string-append srcdir "/book.pdf"))
479 (assoc-ref inputs "automake")
484 `(("texlive" ,texlive)
485 ("automake" ,automake)))
486 (home-page "http://www.gnu.org/software/teximpatient")
487 (synopsis "Book on TeX, plain TeX and Eplain")
488 (description "@i{TeX for the Impatient} is a ~350 page book on TeX,
489 plain TeX, and Eplain, originally written by Paul Abrahams, Kathryn Hargreaves,
491 (license license:fdl1.3+)))