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 (gnu packages)
32 #:use-module (gnu packages bash)
33 #:use-module (gnu packages compression)
34 #:use-module (gnu packages fontutils)
35 #:use-module (gnu packages gd)
36 #:use-module (gnu packages ghostscript)
37 #:use-module (gnu packages gtk)
38 #:use-module (gnu packages icu4c)
39 #:use-module (gnu packages image)
40 #:use-module (gnu packages lua)
41 #:use-module (gnu packages multiprecision)
42 #:use-module (gnu packages pdf)
43 #:use-module (gnu packages perl)
44 #:use-module (gnu packages pkg-config)
45 #:use-module (gnu packages python)
46 #:use-module (gnu packages qt)
47 #:use-module (gnu packages ruby)
48 #:use-module (gnu packages shells)
49 #:use-module (gnu packages base)
50 #:use-module (gnu packages xorg)
51 #:use-module (gnu packages xdisorg)
52 #:use-module (gnu packages zip)
53 #:autoload (gnu packages texinfo) (texinfo)
54 #:use-module (ice-9 ftw)
55 #:use-module (srfi srfi-1))
57 (define texlive-extra-src
60 (uri "ftp://tug.org/historic/systems/texlive/2016/texlive-20160523-extra.tar.xz")
62 "0q4a92zmwhn4ry6xgrp4k8wq11ax2sg9rg9yrsrdkr719y0x887a"))))
64 (define texlive-texmf-src
67 (uri "ftp://tug.org/historic/systems/texlive/2016/texlive-20160523b-texmf.tar.xz")
69 "1dv8vgfzpczqw82hv9g7a8djhhyzywljmrarlcyy6g2qi5q51glr"))))
78 (uri "ftp://tug.org/historic/systems/texlive/2016/texlive-20160523b-source.tar.xz")
80 "1v91vahxlxkdra0qz3f132vvx5d9cx2jy84yl1hkch0agyj2rcx8"))))
81 (build-system gnu-build-system)
83 `(("texlive-extra-src" ,texlive-extra-src)
85 ("fontconfig" ,fontconfig)
86 ("fontforge" ,fontforge)
87 ("freetype" ,freetype)
90 ("ghostscript" ,ghostscript)
91 ("graphite2" ,graphite2)
92 ("harfbuzz" ,harfbuzz)
94 ("libpaper" ,libpaper)
103 ("python" ,python-2) ; incompatible with Python 3 (print syntax)
108 ("zziplib" ,zziplib)))
110 `(("pkg-config" ,pkg-config)))
112 `(#:out-of-source? #t
114 `("--disable-native-texlive-build"
115 "--with-system-cairo"
116 "--with-system-freetype2"
119 "--with-system-graphite2"
120 "--with-system-harfbuzz"
122 "--with-system-libgs"
123 "--with-system-libpaper"
124 "--with-system-libpng"
126 "--with-system-pixman"
127 "--with-system-poppler"
128 "--with-system-potrace"
129 "--with-system-teckit"
132 "--with-system-zziplib")
134 ;; Disable tests on mips64 to cope with a failure of luajiterr.test.
135 ;; XXX FIXME fix luajit properly on mips64.
136 #:tests? ,(not (string-prefix? "mips64" (or (%current-target-system)
139 (modify-phases %standard-phases
140 (add-after 'install 'postint
141 (lambda* (#:key inputs outputs #:allow-other-keys #:rest args)
142 (let* ((out (assoc-ref outputs "out"))
143 (share (string-append out "/share"))
144 (texlive-extra (assoc-ref inputs "texlive-extra-src"))
145 (unpack (assoc-ref %standard-phases 'unpack))
146 (patch-source-shebangs
147 (assoc-ref %standard-phases 'patch-source-shebangs)))
148 ;; Create symbolic links for the latex variants and their
150 (with-directory-excursion (string-append out "/bin/")
152 '("pdftex" "pdftex" "xetex" "luatex")
153 '("latex" "pdflatex" "xelatex" "lualatex")))
154 (with-directory-excursion (string-append share "/man/man1/")
155 (symlink "luatex.1" "lualatex.1"))
156 ;; Unpack texlive-extra and install tlpkg.
157 (mkdir "texlive-extra")
158 (with-directory-excursion "texlive-extra"
159 (apply unpack (list #:source texlive-extra))
160 (apply patch-source-shebangs (list #:source texlive-extra))
161 (system* "mv" "tlpkg" share))))))))
162 (synopsis "TeX Live, a package of the TeX typesetting system")
164 "TeX Live provides a comprehensive TeX document production system.
165 It includes all the major TeX-related programs, macro packages, and fonts
166 that are free software, including support for many languages around the
169 This package contains the binaries.")
170 (license (license:fsf-free "https://www.tug.org/texlive/copying.html"))
171 (home-page "https://www.tug.org/texlive/")))
173 (define texlive-texmf
175 (name "texlive-texmf")
177 (source texlive-texmf-src)
178 (build-system gnu-build-system)
180 `(("texlive-bin" ,texlive-bin)
183 ("python" ,python-2) ; incompatible with Python 3 (print syntax)
187 `(#:modules ((guix build gnu-build-system)
191 ;; This package takes 4 GiB, which we can't afford to distribute from
196 (modify-phases (map (cut assq <> %standard-phases)
197 '(set-paths unpack patch-source-shebangs))
198 (add-after 'patch-source-shebangs 'install
199 (lambda* (#:key outputs #:allow-other-keys)
200 (let ((share (string-append (assoc-ref outputs "out") "/share")))
202 (system* "mv" "texmf-dist" share))))
203 (add-after 'install 'texmf-config
204 (lambda* (#:key inputs outputs #:allow-other-keys)
205 (let* ((out (assoc-ref outputs "out"))
206 (share (string-append out "/share"))
207 (texmfroot (string-append share "/texmf-dist/web2c"))
208 (texmfcnf (string-append texmfroot "/texmf.cnf"))
209 (texlive-bin (assoc-ref inputs "texlive-bin"))
210 (texbin (string-append texlive-bin "/bin"))
211 (tlpkg (string-append texlive-bin "/share/tlpkg")))
212 ;; Register SHARE as TEXMFROOT in texmf.cnf.
213 (substitute* texmfcnf
214 (("TEXMFROOT = \\$SELFAUTOPARENT")
215 (string-append "TEXMFROOT = " share))
216 (("TEXMFLOCAL = \\$SELFAUTOGRANDPARENT/texmf-local")
217 "TEXMFLOCAL = $SELFAUTODIR/share/texmf-local")
218 (("!!\\$TEXMFLOCAL") "$TEXMFLOCAL"))
219 ;; Register paths in texmfcnf.lua, needed for context.
220 (substitute* (string-append texmfroot "/texmfcnf.lua")
221 (("selfautodir:") out)
222 (("selfautoparent:") (string-append share "/")))
223 ;; Set path to TeXLive Perl modules
225 (string-append (getenv "PERL5LIB") ":" tlpkg))
226 ;; Configure the texmf-dist tree; inspired from
227 ;; http://slackbuilds.org/repository/13.37/office/texlive/
228 (setenv "PATH" (string-append (getenv "PATH") ":" texbin))
229 (setenv "TEXMFCNF" texmfroot)
230 (system* "updmap-sys" "--nohash" "--syncwithtrees")
232 (system* "fmtutil-sys" "--all")))))))
233 (properties `((max-silent-time . 9600))) ; don't time out while grafting
234 (synopsis "TeX Live, a package of the TeX typesetting system")
236 "TeX Live provides a comprehensive TeX document production system.
237 It includes all the major TeX-related programs, macro packages, and fonts
238 that are free software, including support for many languages around the
241 This package contains the complete tree of texmf-dist data.")
242 (license (license:fsf-free "https://www.tug.org/texlive/copying.html"))
243 (home-page "https://www.tug.org/texlive/")))
245 (define-public texlive
250 (build-system trivial-build-system)
251 (inputs `(("bash" ,bash) ; for wrap-program
252 ("texlive-bin" ,texlive-bin)
253 ("texlive-texmf" ,texlive-texmf)))
255 (list (search-path-specification
256 (variable "TEXMFLOCAL")
257 (files '("share/texmf-local")))))
259 `(#:modules ((guix build utils))
261 ;; Build the union of texlive-bin and texlive-texmf, but take the
262 ;; conflicting subdirectory share/texmf-dist from texlive-texmf.
264 (use-modules (guix build utils))
265 (let ((out (assoc-ref %outputs "out"))
266 (bin (assoc-ref %build-inputs "texlive-bin"))
267 (texmf (assoc-ref %build-inputs "texlive-texmf"))
268 (bash (assoc-ref %build-inputs "bash")))
270 (with-directory-excursion out
273 (symlink (string-append bin "/" name) name))
276 (with-directory-excursion "bin"
277 (setenv "PATH" (string-append bash "/bin"))
280 (symlink name (basename name))
284 (,(string-append texmf "/share/texmf-dist/web2c")))))
285 (find-files (string-append bin "/bin/") "")))
287 (with-directory-excursion "share"
290 (symlink (string-append bin "/share/" name) name))
291 '("info" "man" "tlpkg"))
294 (symlink (string-append texmf "/share/" name) name))
295 '("texmf-dist" "texmf-var"))))))))
296 (synopsis "TeX Live, a package of the TeX typesetting system")
298 "TeX Live provides a comprehensive TeX document production system.
299 It includes all the major TeX-related programs, macro packages, and fonts
300 that are free software, including support for many languages around the
303 This package contains the complete TeX Live distribution.")
304 (license (license:fsf-free "https://www.tug.org/texlive/copying.html"))
305 (home-page "https://www.tug.org/texlive/")))
308 ;; texlive-texmf-minimal is a pruned, small version of the texlive tree,
309 ;; in particular dropping documentation and fonts. It weighs in at 470 MiB
311 (define texlive-texmf-minimal
312 (package (inherit texlive-texmf)
313 (name "texlive-texmf-minimal")
315 (substitute-keyword-arguments
316 (package-arguments texlive-texmf)
322 `(modify-phases ,phases
323 (add-after 'unpack 'prune
325 (define (delete subdir exclude)
326 "Delete all files and directories in SUBDIR except for those
327 given in the list EXCLUDE."
328 (with-directory-excursion subdir
329 (for-each delete-file-recursively
330 (lset-difference equal?
334 (with-directory-excursion "texmf-dist"
335 (for-each delete-file-recursively
336 '("doc" "source" "tex4ht"))
337 ;; Delete all subdirectories of "fonts", except for "tfm" and
338 ;; any directories named "cm".
339 (delete "fonts" '("afm" "map" "pk" "source" "tfm" "type1"))
340 (delete "fonts/afm" '("public"))
341 (delete "fonts/afm/public" '("amsfonts"))
342 (delete "fonts/afm/public/amsfonts" '("cm"))
343 (delete "fonts/map" '("dvips"))
344 (delete "fonts/map/dvips" '("cm"))
345 (delete "fonts/source" '("public"))
346 (delete "fonts/source/public" '("cm"))
347 (delete "fonts/tfm" '("public"))
348 (delete "fonts/type1" '("public"))
349 (delete "fonts/type1/public" '("amsfonts"))
350 (delete "fonts/type1/public/amsfonts" '("cm")))
353 "TeX Live provides a comprehensive TeX document production system.
354 It includes all the major TeX-related programs, macro packages, and fonts
355 that are free software, including support for many languages around the
358 This package contains a small subset of the texmf-dist data.")))
361 ;; texlive-minimal is the same as texlive, but using texlive-texmf-minimal
362 ;; instead of the full texlive-texmf. It can be used, for instance, as a
363 ;; native input to packages that need texlive to build their documentation.
364 (define-public texlive-minimal
365 (package (inherit texlive)
366 (name "texlive-minimal")
368 `(("texlive-texmf" ,texlive-texmf-minimal)
369 ,@(alist-delete "texlive-texmf" (package-inputs texlive))))
371 (list (search-path-specification
372 (variable "TEXMFLOCAL")
373 (files '("share/texmf-local")))))
375 "TeX Live provides a comprehensive TeX document production system.
376 It includes all the major TeX-related programs, macro packages, and fonts
377 that are free software, including support for many languages around the
380 This package contains a small working part of the TeX Live distribution.")))
383 (define-public rubber
389 (uri (list (string-append "https://launchpad.net/rubber/trunk/"
390 version "/+download/rubber-"
392 (string-append "http://ebeffara.free.fr/pub/rubber-"
396 "1xbkv8ll889933gyi2a5hj7hhh216k04gn8fwz5lfv5iz8s34gbq"))))
397 (build-system gnu-build-system)
398 (arguments '(#:tests? #f)) ; no `check' target
399 (inputs `(("texinfo" ,texinfo)
400 ("python" ,python-2) ; incompatible with Python 3 (print syntax)
402 (home-page "https://launchpad.net/rubber")
403 (synopsis "Wrapper for LaTeX and friends")
405 "Rubber is a program whose purpose is to handle all tasks related to the
406 compilation of LaTeX documents. This includes compiling the document itself,
407 of course, enough times so that all references are defined, and running BibTeX
408 to manage bibliographic references. Automatic execution of dvips to produce
409 PostScript documents is also included, as well as usage of pdfLaTeX to produce
411 (license license:gpl2+)))
413 (define-public texmaker
419 (uri (string-append "http://www.xm1math.net/texmaker/texmaker-"
423 "056njk6j8wma23mlp7xa3rgfaxx0q8ynwx8wkmj7iy0b85p9ds9c"))))
424 (build-system gnu-build-system)
427 (modify-phases %standard-phases
428 ;; Qt has its own configuration utility.
430 (lambda* (#:key outputs #:allow-other-keys)
431 (let ((out (assoc-ref outputs "out")))
432 (zero? (system* "qmake"
433 (string-append "PREFIX=" out)
434 (string-append "DESKTOPDIR=" out
435 "/share/applications")
436 (string-append "ICONDIR=" out "/share/pixmaps")
437 "texmaker.pro"))))))))
439 `(("poppler-qt5" ,poppler-qt5)
443 `(("pkg-config" ,pkg-config)))
444 (home-page "http://www.xm1math.net/texmaker/")
445 (synopsis "LaTeX editor")
446 (description "Texmaker is a program that integrates many tools needed to
447 develop documents with LaTeX, in a single application.")
448 (license license:gpl2+)))