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>
8 ;;; Copyright © 2016 Thomas Danckaert <post@thomasdanckaert.be>
9 ;;; Copyright © 2016 Ricardo Wurmus <rekado@elephly.net>
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 tex)
27 #:use-module ((guix licenses) #:prefix license:)
28 #:use-module (guix packages)
29 #:use-module (guix download)
30 #:use-module (guix build-system gnu)
31 #:use-module (guix build-system perl)
32 #:use-module (guix build-system trivial)
33 #:use-module (guix utils)
34 #:use-module (guix git-download)
35 #:use-module (gnu packages)
36 #:use-module (gnu packages autotools)
37 #:use-module (gnu packages bash)
38 #:use-module (gnu packages compression)
39 #:use-module (gnu packages fontutils)
40 #:use-module (gnu packages gd)
41 #:use-module (gnu packages ghostscript)
42 #:use-module (gnu packages gtk)
43 #:use-module (gnu packages icu4c)
44 #:use-module (gnu packages image)
45 #:use-module (gnu packages lua)
46 #:use-module (gnu packages multiprecision)
47 #:use-module (gnu packages pdf)
48 #:use-module (gnu packages perl)
49 #:use-module (gnu packages pkg-config)
50 #:use-module (gnu packages python)
51 #:use-module (gnu packages qt)
52 #:use-module (gnu packages ruby)
53 #:use-module (gnu packages shells)
54 #:use-module (gnu packages base)
55 #:use-module (gnu packages xorg)
56 #:use-module (gnu packages xdisorg)
57 #:use-module (gnu packages zip)
58 #:autoload (gnu packages texinfo) (texinfo)
59 #:use-module (ice-9 ftw)
60 #:use-module (srfi srfi-1))
62 (define texlive-extra-src
65 (uri "ftp://tug.org/historic/systems/texlive/2016/texlive-20160523-extra.tar.xz")
67 "0q4a92zmwhn4ry6xgrp4k8wq11ax2sg9rg9yrsrdkr719y0x887a"))))
69 (define texlive-texmf-src
72 (uri "ftp://tug.org/historic/systems/texlive/2016/texlive-20160523b-texmf.tar.xz")
74 "1dv8vgfzpczqw82hv9g7a8djhhyzywljmrarlcyy6g2qi5q51glr"))))
83 (uri "ftp://tug.org/historic/systems/texlive/2016/texlive-20160523b-source.tar.xz")
85 "1v91vahxlxkdra0qz3f132vvx5d9cx2jy84yl1hkch0agyj2rcx8"))))
86 (build-system gnu-build-system)
88 `(("texlive-extra-src" ,texlive-extra-src)
90 ("fontconfig" ,fontconfig)
91 ("fontforge" ,fontforge)
92 ("freetype" ,freetype)
95 ("ghostscript" ,ghostscript)
96 ("graphite2" ,graphite2)
97 ("harfbuzz" ,harfbuzz)
99 ("libpaper" ,libpaper)
108 ("python" ,python-2) ; incompatible with Python 3 (print syntax)
113 ("zziplib" ,zziplib)))
115 `(("pkg-config" ,pkg-config)))
117 `(#:out-of-source? #t
119 `("--disable-native-texlive-build"
120 "--with-system-cairo"
121 "--with-system-freetype2"
124 "--with-system-graphite2"
125 "--with-system-harfbuzz"
127 "--with-system-libgs"
128 "--with-system-libpaper"
129 "--with-system-libpng"
131 "--with-system-pixman"
132 "--with-system-poppler"
133 "--with-system-potrace"
134 "--with-system-teckit"
137 "--with-system-zziplib")
139 ;; Disable tests on mips64 to cope with a failure of luajiterr.test.
140 ;; XXX FIXME fix luajit properly on mips64.
141 #:tests? ,(not (string-prefix? "mips64" (or (%current-target-system)
144 (modify-phases %standard-phases
145 (add-after 'install 'postint
146 (lambda* (#:key inputs outputs #:allow-other-keys #:rest args)
147 (let* ((out (assoc-ref outputs "out"))
148 (share (string-append out "/share"))
149 (texlive-extra (assoc-ref inputs "texlive-extra-src"))
150 (unpack (assoc-ref %standard-phases 'unpack))
151 (patch-source-shebangs
152 (assoc-ref %standard-phases 'patch-source-shebangs)))
153 ;; Create symbolic links for the latex variants and their
155 (with-directory-excursion (string-append out "/bin/")
157 '("pdftex" "pdftex" "xetex" "luatex")
158 '("latex" "pdflatex" "xelatex" "lualatex")))
159 (with-directory-excursion (string-append share "/man/man1/")
160 (symlink "luatex.1" "lualatex.1"))
161 ;; Unpack texlive-extra and install tlpkg.
162 (mkdir "texlive-extra")
163 (with-directory-excursion "texlive-extra"
164 (apply unpack (list #:source texlive-extra))
165 (apply patch-source-shebangs (list #:source texlive-extra))
166 (system* "mv" "tlpkg" share))))))))
167 (synopsis "TeX Live, a package of the TeX typesetting system")
169 "TeX Live provides a comprehensive TeX document production system.
170 It includes all the major TeX-related programs, macro packages, and fonts
171 that are free software, including support for many languages around the
174 This package contains the binaries.")
175 (license (license:fsf-free "https://www.tug.org/texlive/copying.html"))
176 (home-page "https://www.tug.org/texlive/")))
178 (define texlive-texmf
180 (name "texlive-texmf")
182 (source texlive-texmf-src)
183 (build-system gnu-build-system)
185 `(("texlive-bin" ,texlive-bin)
188 ("python" ,python-2) ; incompatible with Python 3 (print syntax)
192 `(#:modules ((guix build gnu-build-system)
196 ;; This package takes 4 GiB, which we can't afford to distribute from
201 (modify-phases (map (cut assq <> %standard-phases)
202 '(set-paths unpack patch-source-shebangs))
203 (add-after 'patch-source-shebangs 'install
204 (lambda* (#:key outputs #:allow-other-keys)
205 (let ((share (string-append (assoc-ref outputs "out") "/share")))
207 (system* "mv" "texmf-dist" share))))
208 (add-after 'install 'texmf-config
209 (lambda* (#:key inputs outputs #:allow-other-keys)
210 (let* ((out (assoc-ref outputs "out"))
211 (share (string-append out "/share"))
212 (texmfroot (string-append share "/texmf-dist/web2c"))
213 (texmfcnf (string-append texmfroot "/texmf.cnf"))
214 (texlive-bin (assoc-ref inputs "texlive-bin"))
215 (texbin (string-append texlive-bin "/bin"))
216 (tlpkg (string-append texlive-bin "/share/tlpkg")))
217 ;; Register SHARE as TEXMFROOT in texmf.cnf.
218 (substitute* texmfcnf
219 (("TEXMFROOT = \\$SELFAUTOPARENT")
220 (string-append "TEXMFROOT = " share))
221 (("TEXMFLOCAL = \\$SELFAUTOGRANDPARENT/texmf-local")
222 "TEXMFLOCAL = $SELFAUTODIR/share/texmf-local")
223 (("!!\\$TEXMFLOCAL") "$TEXMFLOCAL"))
224 ;; Register paths in texmfcnf.lua, needed for context.
225 (substitute* (string-append texmfroot "/texmfcnf.lua")
226 (("selfautodir:") out)
227 (("selfautoparent:") (string-append share "/")))
228 ;; Set path to TeXLive Perl modules
230 (string-append (getenv "PERL5LIB") ":" tlpkg))
231 ;; Configure the texmf-dist tree; inspired from
232 ;; http://slackbuilds.org/repository/13.37/office/texlive/
233 (setenv "PATH" (string-append (getenv "PATH") ":" texbin))
234 (setenv "TEXMFCNF" texmfroot)
235 (system* "updmap-sys" "--nohash" "--syncwithtrees")
237 (system* "fmtutil-sys" "--all")))))))
238 (properties `((max-silent-time . 9600))) ; don't time out while grafting
239 (synopsis "TeX Live, a package of the TeX typesetting system")
241 "TeX Live provides a comprehensive TeX document production system.
242 It includes all the major TeX-related programs, macro packages, and fonts
243 that are free software, including support for many languages around the
246 This package contains the complete tree of texmf-dist data.")
247 (license (license:fsf-free "https://www.tug.org/texlive/copying.html"))
248 (home-page "https://www.tug.org/texlive/")))
250 (define-public texlive
255 (build-system trivial-build-system)
256 (inputs `(("bash" ,bash) ; for wrap-program
257 ("texlive-bin" ,texlive-bin)
258 ("texlive-texmf" ,texlive-texmf)))
260 (list (search-path-specification
261 (variable "TEXMFLOCAL")
262 (files '("share/texmf-local")))))
264 `(#:modules ((guix build utils))
266 ;; Build the union of texlive-bin and texlive-texmf, but take the
267 ;; conflicting subdirectory share/texmf-dist from texlive-texmf.
269 (use-modules (guix build utils))
270 (let ((out (assoc-ref %outputs "out"))
271 (bin (assoc-ref %build-inputs "texlive-bin"))
272 (texmf (assoc-ref %build-inputs "texlive-texmf"))
273 (bash (assoc-ref %build-inputs "bash")))
275 (with-directory-excursion out
278 (symlink (string-append bin "/" name) name))
281 (with-directory-excursion "bin"
282 (setenv "PATH" (string-append bash "/bin"))
285 (symlink name (basename name))
289 (,(string-append texmf "/share/texmf-dist/web2c")))))
290 (find-files (string-append bin "/bin/") "")))
292 (with-directory-excursion "share"
295 (symlink (string-append bin "/share/" name) name))
296 '("info" "man" "tlpkg"))
299 (symlink (string-append texmf "/share/" name) name))
300 '("texmf-dist" "texmf-var"))))))))
301 (synopsis "TeX Live, a package of the TeX typesetting system")
303 "TeX Live provides a comprehensive TeX document production system.
304 It includes all the major TeX-related programs, macro packages, and fonts
305 that are free software, including support for many languages around the
308 This package contains the complete TeX Live distribution.")
309 (license (license:fsf-free "https://www.tug.org/texlive/copying.html"))
310 (home-page "https://www.tug.org/texlive/")))
313 ;; texlive-texmf-minimal is a pruned, small version of the texlive tree,
314 ;; in particular dropping documentation and fonts. It weighs in at 470 MiB
316 (define texlive-texmf-minimal
317 (package (inherit texlive-texmf)
318 (name "texlive-texmf-minimal")
320 (substitute-keyword-arguments
321 (package-arguments texlive-texmf)
327 `(modify-phases ,phases
328 (add-after 'unpack 'prune
330 (define (delete subdir exclude)
331 "Delete all files and directories in SUBDIR except for those
332 given in the list EXCLUDE."
333 (with-directory-excursion subdir
334 (for-each delete-file-recursively
335 (lset-difference equal?
339 (with-directory-excursion "texmf-dist"
340 (for-each delete-file-recursively
341 '("doc" "source" "tex4ht"))
342 ;; Delete all subdirectories of "fonts", except for "tfm" and
343 ;; any directories named "cm".
344 (delete "fonts" '("afm" "map" "pk" "source" "tfm" "type1"))
345 (delete "fonts/afm" '("public"))
346 (delete "fonts/afm/public" '("amsfonts"))
347 (delete "fonts/afm/public/amsfonts" '("cm"))
348 (delete "fonts/map" '("dvips"))
349 (delete "fonts/map/dvips" '("cm"))
350 (delete "fonts/source" '("public"))
351 (delete "fonts/source/public" '("cm"))
352 (delete "fonts/tfm" '("public"))
353 (delete "fonts/type1" '("public"))
354 (delete "fonts/type1/public" '("amsfonts"))
355 (delete "fonts/type1/public/amsfonts" '("cm")))
358 "TeX Live provides a comprehensive TeX document production system.
359 It includes all the major TeX-related programs, macro packages, and fonts
360 that are free software, including support for many languages around the
363 This package contains a small subset of the texmf-dist data.")))
366 ;; texlive-minimal is the same as texlive, but using texlive-texmf-minimal
367 ;; instead of the full texlive-texmf. It can be used, for instance, as a
368 ;; native input to packages that need texlive to build their documentation.
369 (define-public texlive-minimal
370 (package (inherit texlive)
371 (name "texlive-minimal")
373 `(("texlive-texmf" ,texlive-texmf-minimal)
374 ,@(alist-delete "texlive-texmf" (package-inputs texlive))))
376 (list (search-path-specification
377 (variable "TEXMFLOCAL")
378 (files '("share/texmf-local")))))
380 "TeX Live provides a comprehensive TeX document production system.
381 It includes all the major TeX-related programs, macro packages, and fonts
382 that are free software, including support for many languages around the
385 This package contains a small working part of the TeX Live distribution.")))
387 (define-public perl-text-bibtex
389 (name "perl-text-bibtex")
394 (uri (string-append "mirror://cpan/authors/id/A/AM/AMBS/Text-BibTeX-"
398 "0kkfx8skk763pivz6h2ffy2zdp1lvy6d5sz0kjaj0mdbjffvnnb4"))))
399 (build-system perl-build-system)
402 (modify-phases %standard-phases
403 (add-after 'unpack 'add-output-directory-to-rpath
404 (lambda* (#:key outputs #:allow-other-keys)
405 (substitute* "inc/MyBuilder.pm"
407 (string-append "-Wl,-rpath="
408 (assoc-ref outputs "out") "/lib " line)))
410 (add-after 'unpack 'install-libraries-to-/lib
411 (lambda* (#:key outputs #:allow-other-keys)
412 (substitute* "Build.PL"
416 `(("perl-capture-tiny" ,perl-capture-tiny)
417 ("perl-config-autoconf" ,perl-config-autoconf)
418 ("perl-extutils-libbuilder" ,perl-extutils-libbuilder)
419 ("perl-module-build" ,perl-module-build)))
420 (home-page "http://search.cpan.org/dist/Text-BibTeX")
421 (synopsis "Interface to read and parse BibTeX files")
422 (description "@code{Text::BibTeX} is a Perl library for reading, parsing,
423 and processing BibTeX files. @code{Text::BibTeX} gives you access to the data
424 at many different levels: you may work with BibTeX entries as simple field to
425 string mappings, or get at the original form of the data as a list of simple
426 values (strings, macros, or numbers) pasted together.")
427 (license (package-license perl))))
430 (define-public rubber
436 (uri (list (string-append "https://launchpad.net/rubber/trunk/"
437 version "/+download/rubber-"
439 (string-append "http://ebeffara.free.fr/pub/rubber-"
443 "1xbkv8ll889933gyi2a5hj7hhh216k04gn8fwz5lfv5iz8s34gbq"))))
444 (build-system gnu-build-system)
445 (arguments '(#:tests? #f)) ; no `check' target
446 (inputs `(("texinfo" ,texinfo)
447 ("python" ,python-2) ; incompatible with Python 3 (print syntax)
449 (home-page "https://launchpad.net/rubber")
450 (synopsis "Wrapper for LaTeX and friends")
452 "Rubber is a program whose purpose is to handle all tasks related to the
453 compilation of LaTeX documents. This includes compiling the document itself,
454 of course, enough times so that all references are defined, and running BibTeX
455 to manage bibliographic references. Automatic execution of dvips to produce
456 PostScript documents is also included, as well as usage of pdfLaTeX to produce
458 (license license:gpl2+)))
460 (define-public texmaker
466 (uri (string-append "http://www.xm1math.net/texmaker/texmaker-"
470 "056njk6j8wma23mlp7xa3rgfaxx0q8ynwx8wkmj7iy0b85p9ds9c"))))
471 (build-system gnu-build-system)
474 (modify-phases %standard-phases
475 ;; Qt has its own configuration utility.
477 (lambda* (#:key outputs #:allow-other-keys)
478 (let ((out (assoc-ref outputs "out")))
479 (zero? (system* "qmake"
480 (string-append "PREFIX=" out)
481 (string-append "DESKTOPDIR=" out
482 "/share/applications")
483 (string-append "ICONDIR=" out "/share/pixmaps")
484 "texmaker.pro"))))))))
486 `(("poppler-qt5" ,poppler-qt5)
488 ("qtscript" ,qtscript)
489 ("qtwebkit" ,qtwebkit)
492 `(("pkg-config" ,pkg-config)))
493 (home-page "http://www.xm1math.net/texmaker/")
494 (synopsis "LaTeX editor")
495 (description "Texmaker is a program that integrates many tools needed to
496 develop documents with LaTeX, in a single application.")
497 (license license:gpl2+)))
500 (define-public teximpatient
502 (name "teximpatient")
506 (uri (string-append "mirror://gnu/" name "/" name "-"
510 "0h56w22d99dh4fgld4ssik8ggnmhmrrbnrn1lnxi1zr0miphn1sd"))))
511 (build-system gnu-build-system)
514 (modify-phases %standard-phases
516 ;; Unfortunately some mistakes have been made in packaging.
517 ;; Work around them here ...
519 (lambda* (#:key inputs outputs #:allow-other-keys)
520 (let ((srcdir "teximpatient-2.4"))
521 (system* "tar" "-xzf" (assoc-ref inputs "source")
522 (string-append "--one-top-level=" srcdir))
523 (delete-file (string-append srcdir "/book.pdf"))
526 (assoc-ref inputs "automake")
531 `(("texlive" ,texlive)
532 ("automake" ,automake)))
533 (home-page "http://www.gnu.org/software/teximpatient")
534 (synopsis "Book on TeX, plain TeX and Eplain")
535 (description "@i{TeX for the Impatient} is a ~350 page book on TeX,
536 plain TeX, and Eplain, originally written by Paul Abrahams, Kathryn Hargreaves,
538 (license license:fdl1.3+)))