gnu: Add qtwebkit.
[jackhill/guix/guix.git] / gnu / packages / tex.scm
CommitLineData
eb0119ef 1;;; GNU Guix --- Functional package management for GNU
4a6635f3 2;;; Copyright © 2013, 2014, 2015, 2016 Andreas Enge <andreas@enge.fr>
42e1394b 3;;; Copyright © 2014 Eric Bavier <bavier@member.fsf.org>
d2e84281 4;;; Copyright © 2015 Mark H Weaver <mhw@netris.org>
4791876c 5;;; Copyright © 2016 Roel Janssen <roel@gnu.org>
7a15a68f 6;;; Copyright © 2016 Efraim Flashner <efraim@flashner.co.il>
2d634d9b 7;;; Copyright © 2016 Federico Beffa <beffa@fbengineering.ch>
eb0119ef
AE
8;;;
9;;; This file is part of GNU Guix.
10;;;
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.
15;;;
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.
20;;;
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/>.
23
8f9ac901 24(define-module (gnu packages tex)
b5b73a82 25 #:use-module ((guix licenses) #:prefix license:)
eb0119ef
AE
26 #:use-module (guix packages)
27 #:use-module (guix download)
28 #:use-module (guix build-system gnu)
0aa34e82 29 #:use-module (guix build-system trivial)
6b5eb840 30 #:use-module (guix utils)
83457fe0 31 #:use-module (guix git-download)
eb0119ef 32 #:use-module (gnu packages)
83457fe0 33 #:use-module (gnu packages autotools)
0aa34e82 34 #:use-module (gnu packages bash)
eb0119ef 35 #:use-module (gnu packages compression)
a86177d6 36 #:use-module (gnu packages fontutils)
fd89b36b 37 #:use-module (gnu packages gd)
eb0119ef 38 #:use-module (gnu packages ghostscript)
fd89b36b 39 #:use-module (gnu packages gtk)
eb0119ef 40 #:use-module (gnu packages icu4c)
e55354b8 41 #:use-module (gnu packages image)
0aa34e82 42 #:use-module (gnu packages lua)
0256c746 43 #:use-module (gnu packages multiprecision)
eb0119ef
AE
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)
4791876c 48 #:use-module (gnu packages qt)
b32c8549 49 #:use-module (gnu packages ruby)
b7194849 50 #:use-module (gnu packages shells)
ce0614dd 51 #:use-module (gnu packages base)
c0589f75 52 #:use-module (gnu packages xorg)
ece9b417 53 #:use-module (gnu packages xdisorg)
231eae53 54 #:use-module (gnu packages zip)
6b5eb840
AE
55 #:autoload (gnu packages texinfo) (texinfo)
56 #:use-module (ice-9 ftw)
57 #:use-module (srfi srfi-1))
eb0119ef
AE
58
59(define texlive-extra-src
60 (origin
61 (method url-fetch)
7a15a68f 62 (uri "ftp://tug.org/historic/systems/texlive/2016/texlive-20160523-extra.tar.xz")
eb0119ef 63 (sha256 (base32
7a15a68f 64 "0q4a92zmwhn4ry6xgrp4k8wq11ax2sg9rg9yrsrdkr719y0x887a"))))
eb0119ef
AE
65
66(define texlive-texmf-src
67 (origin
68 (method url-fetch)
29a56d8e 69 (uri "ftp://tug.org/historic/systems/texlive/2016/texlive-20160523b-texmf.tar.xz")
eb0119ef 70 (sha256 (base32
29a56d8e 71 "1dv8vgfzpczqw82hv9g7a8djhhyzywljmrarlcyy6g2qi5q51glr"))))
eb0119ef 72
8bcdc23f 73(define texlive-bin
eb0119ef 74 (package
0aa34e82 75 (name "texlive-bin")
7a15a68f 76 (version "2016")
0aa34e82
AE
77 (source
78 (origin
79 (method url-fetch)
29a56d8e 80 (uri "ftp://tug.org/historic/systems/texlive/2016/texlive-20160523b-source.tar.xz")
0aa34e82 81 (sha256 (base32
29a56d8e 82 "1v91vahxlxkdra0qz3f132vvx5d9cx2jy84yl1hkch0agyj2rcx8"))))
eb0119ef 83 (build-system gnu-build-system)
0aa34e82
AE
84 (inputs
85 `(("texlive-extra-src" ,texlive-extra-src)
86 ("cairo" ,cairo)
87 ("fontconfig" ,fontconfig)
88 ("fontforge" ,fontforge)
89 ("freetype" ,freetype)
90 ("gd" ,gd)
0256c746 91 ("gmp" ,gmp)
0aa34e82
AE
92 ("ghostscript" ,ghostscript)
93 ("graphite2" ,graphite2)
94 ("harfbuzz" ,harfbuzz)
95 ("icu4c" ,icu4c)
96 ("libpaper" ,libpaper)
97 ("libpng" ,libpng)
98 ("libxaw" ,libxaw)
99 ("libxt" ,libxt)
0256c746 100 ("mpfr" ,mpfr)
0aa34e82
AE
101 ("perl" ,perl)
102 ("pixman" ,pixman)
103 ("poppler" ,poppler)
104 ("potrace" ,potrace)
105 ("python" ,python-2) ; incompatible with Python 3 (print syntax)
106 ("ruby" ,ruby)
107 ("tcsh" ,tcsh)
108 ("teckit" ,teckit)
109 ("zlib" ,zlib)
110 ("zziplib" ,zziplib)))
c4c4cc05 111 (native-inputs
e9a6d225 112 `(("pkg-config" ,pkg-config)))
eb0119ef
AE
113 (arguments
114 `(#:out-of-source? #t
115 #:configure-flags
116 `("--disable-native-texlive-build"
fd89b36b 117 "--with-system-cairo"
eb0119ef 118 "--with-system-freetype2"
fd89b36b 119 "--with-system-gd"
0256c746 120 "--with-system-gmp"
be2c88ca 121 "--with-system-graphite2"
c70cf7eb 122 "--with-system-harfbuzz"
eb0119ef
AE
123 "--with-system-icu"
124 "--with-system-libgs"
609578a7 125 "--with-system-libpaper"
eb0119ef 126 "--with-system-libpng"
0256c746 127 "--with-system-mpfr"
fd89b36b 128 "--with-system-pixman"
eb0119ef 129 "--with-system-poppler"
75916982 130 "--with-system-potrace"
eb0119ef
AE
131 "--with-system-teckit"
132 "--with-system-xpdf"
133 "--with-system-zlib"
134 "--with-system-zziplib")
2f4640e3
MW
135
136 ;; Disable tests on mips64 to cope with a failure of luajiterr.test.
137 ;; XXX FIXME fix luajit properly on mips64.
d2e84281 138 #:tests? ,(not (string-prefix? "mips64" (or (%current-target-system)
2f4640e3 139 (%current-system))))
eb0119ef 140 #:phases
4a6635f3
AE
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
151 ;; man pages.
152 (with-directory-excursion (string-append out "/bin/")
153 (for-each symlink
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))))))))
0aa34e82
AE
164 (synopsis "TeX Live, a package of the TeX typesetting system")
165 (description
166 "TeX Live provides a comprehensive TeX document production system.
167It includes all the major TeX-related programs, macro packages, and fonts
168that are free software, including support for many languages around the
169world.
170
171This package contains the binaries.")
132e14b4
EF
172 (license (license:fsf-free "https://www.tug.org/texlive/copying.html"))
173 (home-page "https://www.tug.org/texlive/")))
0aa34e82 174
8bcdc23f 175(define texlive-texmf
0aa34e82
AE
176 (package
177 (name "texlive-texmf")
7a15a68f 178 (version "2016")
0aa34e82
AE
179 (source texlive-texmf-src)
180 (build-system gnu-build-system)
181 (inputs
182 `(("texlive-bin" ,texlive-bin)
183 ("lua" ,lua)
184 ("perl" ,perl)
185 ("python" ,python-2) ; incompatible with Python 3 (print syntax)
186 ("ruby" ,ruby)
187 ("tcsh" ,tcsh)))
188 (arguments
189 `(#:modules ((guix build gnu-build-system)
190 (guix build utils)
191 (srfi srfi-26))
a348af40
LC
192
193 ;; This package takes 4 GiB, which we can't afford to distribute from
194 ;; our servers.
195 #:substitutable? #f
196
0aa34e82 197 #:phases
4a6635f3
AE
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")))
203 (mkdir-p 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")
2d634d9b
FB
217 (string-append "TEXMFROOT = " share))
218 (("TEXMFLOCAL = \\$SELFAUTOGRANDPARENT/texmf-local")
219 "TEXMFLOCAL = $SELFAUTODIR/share/texmf-local")
220 (("!!\\$TEXMFLOCAL") "$TEXMFLOCAL"))
4a6635f3
AE
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
226 (setenv "PERL5LIB"
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")
233 (system* "mktexlsr")
234 (system* "fmtutil-sys" "--all")))))))
7a15a68f 235 (properties `((max-silent-time . 9600))) ; don't time out while grafting
0aa34e82 236 (synopsis "TeX Live, a package of the TeX typesetting system")
eb0119ef
AE
237 (description
238 "TeX Live provides a comprehensive TeX document production system.
239It includes all the major TeX-related programs, macro packages, and fonts
240that are free software, including support for many languages around the
0aa34e82
AE
241world.
242
243This package contains the complete tree of texmf-dist data.")
132e14b4
EF
244 (license (license:fsf-free "https://www.tug.org/texlive/copying.html"))
245 (home-page "https://www.tug.org/texlive/")))
0aa34e82
AE
246
247(define-public texlive
248 (package
249 (name "texlive")
7a15a68f 250 (version "2016")
0aa34e82
AE
251 (source #f)
252 (build-system trivial-build-system)
253 (inputs `(("bash" ,bash) ; for wrap-program
254 ("texlive-bin" ,texlive-bin)
255 ("texlive-texmf" ,texlive-texmf)))
2d634d9b
FB
256 (native-search-paths
257 (list (search-path-specification
258 (variable "TEXMFLOCAL")
259 (files '("share/texmf-local")))))
0aa34e82
AE
260 (arguments
261 `(#:modules ((guix build utils))
262 #:builder
263 ;; Build the union of texlive-bin and texlive-texmf, but take the
264 ;; conflicting subdirectory share/texmf-dist from texlive-texmf.
265 (begin
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")))
271 (mkdir out)
272 (with-directory-excursion out
273 (for-each
274 (lambda (name)
275 (symlink (string-append bin "/" name) name))
276 '("include" "lib"))
277 (mkdir "bin")
278 (with-directory-excursion "bin"
279 (setenv "PATH" (string-append bash "/bin"))
280 (for-each
281 (lambda (name)
282 (symlink name (basename name))
283 (wrap-program
284 (basename name)
285 `("TEXMFCNF" =
286 (,(string-append texmf "/share/texmf-dist/web2c")))))
287 (find-files (string-append bin "/bin/") "")))
288 (mkdir "share")
289 (with-directory-excursion "share"
290 (for-each
291 (lambda (name)
292 (symlink (string-append bin "/share/" name) name))
293 '("info" "man" "tlpkg"))
294 (for-each
295 (lambda (name)
296 (symlink (string-append texmf "/share/" name) name))
297 '("texmf-dist" "texmf-var"))))))))
298 (synopsis "TeX Live, a package of the TeX typesetting system")
299 (description
300 "TeX Live provides a comprehensive TeX document production system.
301It includes all the major TeX-related programs, macro packages, and fonts
302that are free software, including support for many languages around the
303world.
304
305This package contains the complete TeX Live distribution.")
132e14b4
EF
306 (license (license:fsf-free "https://www.tug.org/texlive/copying.html"))
307 (home-page "https://www.tug.org/texlive/")))
231eae53 308
6b5eb840
AE
309
310;; texlive-texmf-minimal is a pruned, small version of the texlive tree,
a348af40
LC
311;; in particular dropping documentation and fonts. It weighs in at 470 MiB
312;; instead of 4 GiB.
6b5eb840
AE
313(define texlive-texmf-minimal
314 (package (inherit texlive-texmf)
315 (name "texlive-texmf-minimal")
316 (arguments
317 (substitute-keyword-arguments
318 (package-arguments texlive-texmf)
319 ((#:modules modules)
320 `((ice-9 ftw)
321 (srfi srfi-1)
322 ,@modules))
323 ((#:phases phases)
324 `(modify-phases ,phases
325 (add-after 'unpack 'prune
326 (lambda _
327 (define (delete subdir exclude)
328 "Delete all files and directories in SUBDIR except for those
329given in the list EXCLUDE."
330 (with-directory-excursion subdir
331 (for-each delete-file-recursively
332 (lset-difference equal?
333 (scandir ".")
334 (append '("." "..")
335 exclude)))))
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")))
353 #t))))))
354 (description
355 "TeX Live provides a comprehensive TeX document production system.
356It includes all the major TeX-related programs, macro packages, and fonts
357that are free software, including support for many languages around the
358world.
359
360This package contains a small subset of the texmf-dist data.")))
361
362
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")
369 (inputs
370 `(("texlive-texmf" ,texlive-texmf-minimal)
371 ,@(alist-delete "texlive-texmf" (package-inputs texlive))))
2d634d9b
FB
372 (native-search-paths
373 (list (search-path-specification
374 (variable "TEXMFLOCAL")
375 (files '("share/texmf-local")))))
6b5eb840
AE
376 (description
377 "TeX Live provides a comprehensive TeX document production system.
378It includes all the major TeX-related programs, macro packages, and fonts
379that are free software, including support for many languages around the
380world.
381
382This package contains a small working part of the TeX Live distribution.")))
383
384
231eae53
LC
385(define-public rubber
386 (package
387 (name "rubber")
388 (version "1.1")
389 (source (origin
390 (method url-fetch)
391 (uri (list (string-append "https://launchpad.net/rubber/trunk/"
392 version "/+download/rubber-"
393 version ".tar.gz")
394 (string-append "http://ebeffara.free.fr/pub/rubber-"
395 version ".tar.gz")))
396 (sha256
397 (base32
398 "1xbkv8ll889933gyi2a5hj7hhh216k04gn8fwz5lfv5iz8s34gbq"))))
399 (build-system gnu-build-system)
400 (arguments '(#:tests? #f)) ; no `check' target
401 (inputs `(("texinfo" ,texinfo)
9bee5d6c 402 ("python" ,python-2) ; incompatible with Python 3 (print syntax)
231eae53
LC
403 ("which" ,which)))
404 (home-page "https://launchpad.net/rubber")
35b9e423 405 (synopsis "Wrapper for LaTeX and friends")
231eae53
LC
406 (description
407 "Rubber is a program whose purpose is to handle all tasks related to the
408compilation of LaTeX documents. This includes compiling the document itself,
409of course, enough times so that all references are defined, and running BibTeX
410to manage bibliographic references. Automatic execution of dvips to produce
411PostScript documents is also included, as well as usage of pdfLaTeX to produce
412PDF documents.")
413 (license license:gpl2+)))
4791876c
RJ
414
415(define-public texmaker
416 (package
417 (name "texmaker")
418 (version "4.5")
419 (source (origin
420 (method url-fetch)
421 (uri (string-append "http://www.xm1math.net/texmaker/texmaker-"
422 version ".tar.bz2"))
423 (sha256
424 (base32
425 "056njk6j8wma23mlp7xa3rgfaxx0q8ynwx8wkmj7iy0b85p9ds9c"))))
426 (build-system gnu-build-system)
427 (arguments
428 `(#:phases
429 (modify-phases %standard-phases
430 ;; Qt has its own configuration utility.
431 (replace 'configure
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"))))))))
440 (inputs
441 `(("poppler-qt5" ,poppler-qt5)
442 ("qt" ,qt)
443 ("zlib" ,zlib)))
444 (native-inputs
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
449develop documents with LaTeX, in a single application.")
450 (license license:gpl2+)))
83457fe0
JD
451
452
453(define-public teximpatient
454 (package
455 (name "teximpatient")
456 (version "2.4")
457 (source (origin
458 (method url-fetch)
459 (uri (string-append "mirror://gnu/" name "/" name "-"
460 version ".tar.gz"))
461 (sha256
462 (base32
463 "0h56w22d99dh4fgld4ssik8ggnmhmrrbnrn1lnxi1zr0miphn1sd"))))
464 (build-system gnu-build-system)
465 (arguments
466 `(#:phases
467 (modify-phases %standard-phases
468 (delete 'check)
469 ;; Unfortunately some mistakes have been made in packaging.
470 ;; Work around them here ...
471 (replace 'unpack
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"))
477 (install-file (car
478 (find-files
479 (assoc-ref inputs "automake")
480 "^install-sh$"))
481 srcdir)
482 (chdir srcdir)))))))
483 (native-inputs
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,
489plain TeX, and Eplain, originally written by Paul Abrahams, Kathryn Hargreaves,
490and Karl Berry.")
491 (license license:fdl1.3+)))