gnu: texlive: Update in-place source updates.
[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>
eb0119ef
AE
7;;;
8;;; This file is part of GNU Guix.
9;;;
10;;; GNU Guix is free software; you can redistribute it and/or modify it
11;;; under the terms of the GNU General Public License as published by
12;;; the Free Software Foundation; either version 3 of the License, or (at
13;;; your option) any later version.
14;;;
15;;; GNU Guix is distributed in the hope that it will be useful, but
16;;; WITHOUT ANY WARRANTY; without even the implied warranty of
17;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18;;; GNU General Public License for more details.
19;;;
20;;; You should have received a copy of the GNU General Public License
21;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
22
8f9ac901 23(define-module (gnu packages tex)
b5b73a82 24 #:use-module ((guix licenses) #:prefix license:)
eb0119ef
AE
25 #:use-module (guix packages)
26 #:use-module (guix download)
27 #:use-module (guix build-system gnu)
0aa34e82 28 #:use-module (guix build-system trivial)
6b5eb840 29 #:use-module (guix utils)
eb0119ef 30 #:use-module (gnu packages)
0aa34e82 31 #:use-module (gnu packages bash)
eb0119ef 32 #:use-module (gnu packages compression)
a86177d6 33 #:use-module (gnu packages fontutils)
fd89b36b 34 #:use-module (gnu packages gd)
eb0119ef 35 #:use-module (gnu packages ghostscript)
fd89b36b 36 #:use-module (gnu packages gtk)
eb0119ef 37 #:use-module (gnu packages icu4c)
e55354b8 38 #:use-module (gnu packages image)
0aa34e82 39 #:use-module (gnu packages lua)
0256c746 40 #:use-module (gnu packages multiprecision)
eb0119ef
AE
41 #:use-module (gnu packages pdf)
42 #:use-module (gnu packages perl)
43 #:use-module (gnu packages pkg-config)
44 #:use-module (gnu packages python)
4791876c 45 #:use-module (gnu packages qt)
b32c8549 46 #:use-module (gnu packages ruby)
95b6c70f 47 #:use-module (gnu packages tcsh)
ce0614dd 48 #:use-module (gnu packages base)
c0589f75 49 #:use-module (gnu packages xorg)
ece9b417 50 #:use-module (gnu packages xdisorg)
231eae53 51 #:use-module (gnu packages zip)
6b5eb840
AE
52 #:autoload (gnu packages texinfo) (texinfo)
53 #:use-module (ice-9 ftw)
54 #:use-module (srfi srfi-1))
eb0119ef
AE
55
56(define texlive-extra-src
57 (origin
58 (method url-fetch)
7a15a68f 59 (uri "ftp://tug.org/historic/systems/texlive/2016/texlive-20160523-extra.tar.xz")
eb0119ef 60 (sha256 (base32
7a15a68f 61 "0q4a92zmwhn4ry6xgrp4k8wq11ax2sg9rg9yrsrdkr719y0x887a"))))
eb0119ef
AE
62
63(define texlive-texmf-src
64 (origin
65 (method url-fetch)
29a56d8e 66 (uri "ftp://tug.org/historic/systems/texlive/2016/texlive-20160523b-texmf.tar.xz")
eb0119ef 67 (sha256 (base32
29a56d8e 68 "1dv8vgfzpczqw82hv9g7a8djhhyzywljmrarlcyy6g2qi5q51glr"))))
eb0119ef 69
8bcdc23f 70(define texlive-bin
eb0119ef 71 (package
0aa34e82 72 (name "texlive-bin")
7a15a68f 73 (version "2016")
0aa34e82
AE
74 (source
75 (origin
76 (method url-fetch)
29a56d8e 77 (uri "ftp://tug.org/historic/systems/texlive/2016/texlive-20160523b-source.tar.xz")
0aa34e82 78 (sha256 (base32
29a56d8e 79 "1v91vahxlxkdra0qz3f132vvx5d9cx2jy84yl1hkch0agyj2rcx8"))))
eb0119ef 80 (build-system gnu-build-system)
0aa34e82
AE
81 (inputs
82 `(("texlive-extra-src" ,texlive-extra-src)
83 ("cairo" ,cairo)
84 ("fontconfig" ,fontconfig)
85 ("fontforge" ,fontforge)
86 ("freetype" ,freetype)
87 ("gd" ,gd)
0256c746 88 ("gmp" ,gmp)
0aa34e82
AE
89 ("ghostscript" ,ghostscript)
90 ("graphite2" ,graphite2)
91 ("harfbuzz" ,harfbuzz)
92 ("icu4c" ,icu4c)
93 ("libpaper" ,libpaper)
94 ("libpng" ,libpng)
95 ("libxaw" ,libxaw)
96 ("libxt" ,libxt)
0256c746 97 ("mpfr" ,mpfr)
0aa34e82
AE
98 ("perl" ,perl)
99 ("pixman" ,pixman)
100 ("poppler" ,poppler)
101 ("potrace" ,potrace)
102 ("python" ,python-2) ; incompatible with Python 3 (print syntax)
103 ("ruby" ,ruby)
104 ("tcsh" ,tcsh)
105 ("teckit" ,teckit)
106 ("zlib" ,zlib)
107 ("zziplib" ,zziplib)))
c4c4cc05 108 (native-inputs
e9a6d225 109 `(("pkg-config" ,pkg-config)))
eb0119ef
AE
110 (arguments
111 `(#:out-of-source? #t
112 #:configure-flags
113 `("--disable-native-texlive-build"
fd89b36b 114 "--with-system-cairo"
eb0119ef 115 "--with-system-freetype2"
fd89b36b 116 "--with-system-gd"
0256c746 117 "--with-system-gmp"
be2c88ca 118 "--with-system-graphite2"
c70cf7eb 119 "--with-system-harfbuzz"
eb0119ef
AE
120 "--with-system-icu"
121 "--with-system-libgs"
609578a7 122 "--with-system-libpaper"
eb0119ef 123 "--with-system-libpng"
0256c746 124 "--with-system-mpfr"
fd89b36b 125 "--with-system-pixman"
eb0119ef 126 "--with-system-poppler"
75916982 127 "--with-system-potrace"
eb0119ef
AE
128 "--with-system-teckit"
129 "--with-system-xpdf"
130 "--with-system-zlib"
131 "--with-system-zziplib")
2f4640e3
MW
132
133 ;; Disable tests on mips64 to cope with a failure of luajiterr.test.
134 ;; XXX FIXME fix luajit properly on mips64.
d2e84281 135 #:tests? ,(not (string-prefix? "mips64" (or (%current-target-system)
2f4640e3 136 (%current-system))))
eb0119ef 137 #:phases
4a6635f3
AE
138 (modify-phases %standard-phases
139 (add-after 'install 'postint
140 (lambda* (#:key inputs outputs #:allow-other-keys #:rest args)
141 (let* ((out (assoc-ref outputs "out"))
142 (share (string-append out "/share"))
143 (texlive-extra (assoc-ref inputs "texlive-extra-src"))
144 (unpack (assoc-ref %standard-phases 'unpack))
145 (patch-source-shebangs
146 (assoc-ref %standard-phases 'patch-source-shebangs)))
147 ;; Create symbolic links for the latex variants and their
148 ;; man pages.
149 (with-directory-excursion (string-append out "/bin/")
150 (for-each symlink
151 '("pdftex" "pdftex" "xetex" "luatex")
152 '("latex" "pdflatex" "xelatex" "lualatex")))
153 (with-directory-excursion (string-append share "/man/man1/")
154 (symlink "luatex.1" "lualatex.1"))
155 ;; Unpack texlive-extra and install tlpkg.
156 (mkdir "texlive-extra")
157 (with-directory-excursion "texlive-extra"
158 (apply unpack (list #:source texlive-extra))
159 (apply patch-source-shebangs (list #:source texlive-extra))
160 (system* "mv" "tlpkg" share))))))))
0aa34e82
AE
161 (synopsis "TeX Live, a package of the TeX typesetting system")
162 (description
163 "TeX Live provides a comprehensive TeX document production system.
164It includes all the major TeX-related programs, macro packages, and fonts
165that are free software, including support for many languages around the
166world.
167
168This package contains the binaries.")
169 (license (license:fsf-free "http://tug.org/texlive/copying.html"))
170 (home-page "http://www.tug.org/texlive/")))
171
8bcdc23f 172(define texlive-texmf
0aa34e82
AE
173 (package
174 (name "texlive-texmf")
7a15a68f 175 (version "2016")
0aa34e82
AE
176 (source texlive-texmf-src)
177 (build-system gnu-build-system)
178 (inputs
179 `(("texlive-bin" ,texlive-bin)
180 ("lua" ,lua)
181 ("perl" ,perl)
182 ("python" ,python-2) ; incompatible with Python 3 (print syntax)
183 ("ruby" ,ruby)
184 ("tcsh" ,tcsh)))
185 (arguments
186 `(#:modules ((guix build gnu-build-system)
187 (guix build utils)
188 (srfi srfi-26))
0aa34e82 189 #:phases
4a6635f3
AE
190 (modify-phases (map (cut assq <> %standard-phases)
191 '(set-paths unpack patch-source-shebangs))
192 (add-after 'patch-source-shebangs 'install
193 (lambda* (#:key outputs #:allow-other-keys)
194 (let ((share (string-append (assoc-ref outputs "out") "/share")))
195 (mkdir-p share)
196 (system* "mv" "texmf-dist" share))))
197 (add-after 'install 'texmf-config
198 (lambda* (#:key inputs outputs #:allow-other-keys)
199 (let* ((out (assoc-ref outputs "out"))
200 (share (string-append out "/share"))
201 (texmfroot (string-append share "/texmf-dist/web2c"))
202 (texmfcnf (string-append texmfroot "/texmf.cnf"))
203 (texlive-bin (assoc-ref inputs "texlive-bin"))
204 (texbin (string-append texlive-bin "/bin"))
205 (tlpkg (string-append texlive-bin "/share/tlpkg")))
206 ;; Register SHARE as TEXMFROOT in texmf.cnf.
207 (substitute* texmfcnf
208 (("TEXMFROOT = \\$SELFAUTOPARENT")
209 (string-append "TEXMFROOT = " share)))
210 ;; Register paths in texmfcnf.lua, needed for context.
211 (substitute* (string-append texmfroot "/texmfcnf.lua")
212 (("selfautodir:") out)
213 (("selfautoparent:") (string-append share "/")))
214 ;; Set path to TeXLive Perl modules
215 (setenv "PERL5LIB"
216 (string-append (getenv "PERL5LIB") ":" tlpkg))
217 ;; Configure the texmf-dist tree; inspired from
218 ;; http://slackbuilds.org/repository/13.37/office/texlive/
219 (setenv "PATH" (string-append (getenv "PATH") ":" texbin))
220 (setenv "TEXMFCNF" texmfroot)
221 (system* "updmap-sys" "--nohash" "--syncwithtrees")
222 (system* "mktexlsr")
223 (system* "fmtutil-sys" "--all")))))))
7a15a68f 224 (properties `((max-silent-time . 9600))) ; don't time out while grafting
0aa34e82 225 (synopsis "TeX Live, a package of the TeX typesetting system")
eb0119ef
AE
226 (description
227 "TeX Live provides a comprehensive TeX document production system.
228It includes all the major TeX-related programs, macro packages, and fonts
229that are free software, including support for many languages around the
0aa34e82
AE
230world.
231
232This package contains the complete tree of texmf-dist data.")
233 (license (license:fsf-free "http://tug.org/texlive/copying.html"))
234 (home-page "http://www.tug.org/texlive/")))
235
236(define-public texlive
237 (package
238 (name "texlive")
7a15a68f 239 (version "2016")
0aa34e82
AE
240 (source #f)
241 (build-system trivial-build-system)
242 (inputs `(("bash" ,bash) ; for wrap-program
243 ("texlive-bin" ,texlive-bin)
244 ("texlive-texmf" ,texlive-texmf)))
245 (arguments
246 `(#:modules ((guix build utils))
247 #:builder
248 ;; Build the union of texlive-bin and texlive-texmf, but take the
249 ;; conflicting subdirectory share/texmf-dist from texlive-texmf.
250 (begin
251 (use-modules (guix build utils))
252 (let ((out (assoc-ref %outputs "out"))
253 (bin (assoc-ref %build-inputs "texlive-bin"))
254 (texmf (assoc-ref %build-inputs "texlive-texmf"))
255 (bash (assoc-ref %build-inputs "bash")))
256 (mkdir out)
257 (with-directory-excursion out
258 (for-each
259 (lambda (name)
260 (symlink (string-append bin "/" name) name))
261 '("include" "lib"))
262 (mkdir "bin")
263 (with-directory-excursion "bin"
264 (setenv "PATH" (string-append bash "/bin"))
265 (for-each
266 (lambda (name)
267 (symlink name (basename name))
268 (wrap-program
269 (basename name)
270 `("TEXMFCNF" =
271 (,(string-append texmf "/share/texmf-dist/web2c")))))
272 (find-files (string-append bin "/bin/") "")))
273 (mkdir "share")
274 (with-directory-excursion "share"
275 (for-each
276 (lambda (name)
277 (symlink (string-append bin "/share/" name) name))
278 '("info" "man" "tlpkg"))
279 (for-each
280 (lambda (name)
281 (symlink (string-append texmf "/share/" name) name))
282 '("texmf-dist" "texmf-var"))))))))
283 (synopsis "TeX Live, a package of the TeX typesetting system")
284 (description
285 "TeX Live provides a comprehensive TeX document production system.
286It includes all the major TeX-related programs, macro packages, and fonts
287that are free software, including support for many languages around the
288world.
289
290This package contains the complete TeX Live distribution.")
eb0119ef
AE
291 (license (license:fsf-free "http://tug.org/texlive/copying.html"))
292 (home-page "http://www.tug.org/texlive/")))
231eae53 293
6b5eb840
AE
294
295;; texlive-texmf-minimal is a pruned, small version of the texlive tree,
296;; in particular dropping documentation and fonts.
297(define texlive-texmf-minimal
298 (package (inherit texlive-texmf)
299 (name "texlive-texmf-minimal")
300 (arguments
301 (substitute-keyword-arguments
302 (package-arguments texlive-texmf)
303 ((#:modules modules)
304 `((ice-9 ftw)
305 (srfi srfi-1)
306 ,@modules))
307 ((#:phases phases)
308 `(modify-phases ,phases
309 (add-after 'unpack 'prune
310 (lambda _
311 (define (delete subdir exclude)
312 "Delete all files and directories in SUBDIR except for those
313given in the list EXCLUDE."
314 (with-directory-excursion subdir
315 (for-each delete-file-recursively
316 (lset-difference equal?
317 (scandir ".")
318 (append '("." "..")
319 exclude)))))
320 (with-directory-excursion "texmf-dist"
321 (for-each delete-file-recursively
322 '("doc" "source" "tex4ht"))
323 ;; Delete all subdirectories of "fonts", except for "tfm" and
324 ;; any directories named "cm".
325 (delete "fonts" '("afm" "map" "pk" "source" "tfm" "type1"))
326 (delete "fonts/afm" '("public"))
327 (delete "fonts/afm/public" '("amsfonts"))
328 (delete "fonts/afm/public/amsfonts" '("cm"))
329 (delete "fonts/map" '("dvips"))
330 (delete "fonts/map/dvips" '("cm"))
331 (delete "fonts/source" '("public"))
332 (delete "fonts/source/public" '("cm"))
333 (delete "fonts/tfm" '("public"))
334 (delete "fonts/type1" '("public"))
335 (delete "fonts/type1/public" '("amsfonts"))
336 (delete "fonts/type1/public/amsfonts" '("cm")))
337 #t))))))
338 (description
339 "TeX Live provides a comprehensive TeX document production system.
340It includes all the major TeX-related programs, macro packages, and fonts
341that are free software, including support for many languages around the
342world.
343
344This package contains a small subset of the texmf-dist data.")))
345
346
347;; texlive-minimal is the same as texlive, but using texlive-texmf-minimal
348;; instead of the full texlive-texmf. It can be used, for instance, as a
349;; native input to packages that need texlive to build their documentation.
350(define-public texlive-minimal
351 (package (inherit texlive)
352 (name "texlive-minimal")
353 (inputs
354 `(("texlive-texmf" ,texlive-texmf-minimal)
355 ,@(alist-delete "texlive-texmf" (package-inputs texlive))))
356 (description
357 "TeX Live provides a comprehensive TeX document production system.
358It includes all the major TeX-related programs, macro packages, and fonts
359that are free software, including support for many languages around the
360world.
361
362This package contains a small working part of the TeX Live distribution.")))
363
364
231eae53
LC
365(define-public rubber
366 (package
367 (name "rubber")
368 (version "1.1")
369 (source (origin
370 (method url-fetch)
371 (uri (list (string-append "https://launchpad.net/rubber/trunk/"
372 version "/+download/rubber-"
373 version ".tar.gz")
374 (string-append "http://ebeffara.free.fr/pub/rubber-"
375 version ".tar.gz")))
376 (sha256
377 (base32
378 "1xbkv8ll889933gyi2a5hj7hhh216k04gn8fwz5lfv5iz8s34gbq"))))
379 (build-system gnu-build-system)
380 (arguments '(#:tests? #f)) ; no `check' target
381 (inputs `(("texinfo" ,texinfo)
9bee5d6c 382 ("python" ,python-2) ; incompatible with Python 3 (print syntax)
231eae53
LC
383 ("which" ,which)))
384 (home-page "https://launchpad.net/rubber")
35b9e423 385 (synopsis "Wrapper for LaTeX and friends")
231eae53
LC
386 (description
387 "Rubber is a program whose purpose is to handle all tasks related to the
388compilation of LaTeX documents. This includes compiling the document itself,
389of course, enough times so that all references are defined, and running BibTeX
390to manage bibliographic references. Automatic execution of dvips to produce
391PostScript documents is also included, as well as usage of pdfLaTeX to produce
392PDF documents.")
393 (license license:gpl2+)))
4791876c
RJ
394
395(define-public texmaker
396 (package
397 (name "texmaker")
398 (version "4.5")
399 (source (origin
400 (method url-fetch)
401 (uri (string-append "http://www.xm1math.net/texmaker/texmaker-"
402 version ".tar.bz2"))
403 (sha256
404 (base32
405 "056njk6j8wma23mlp7xa3rgfaxx0q8ynwx8wkmj7iy0b85p9ds9c"))))
406 (build-system gnu-build-system)
407 (arguments
408 `(#:phases
409 (modify-phases %standard-phases
410 ;; Qt has its own configuration utility.
411 (replace 'configure
412 (lambda* (#:key outputs #:allow-other-keys)
413 (let ((out (assoc-ref outputs "out")))
414 (zero? (system* "qmake"
415 (string-append "PREFIX=" out)
416 (string-append "DESKTOPDIR=" out
417 "/share/applications")
418 (string-append "ICONDIR=" out "/share/pixmaps")
419 "texmaker.pro"))))))))
420 (inputs
421 `(("poppler-qt5" ,poppler-qt5)
422 ("qt" ,qt)
423 ("zlib" ,zlib)))
424 (native-inputs
425 `(("pkg-config" ,pkg-config)))
426 (home-page "http://www.xm1math.net/texmaker/")
427 (synopsis "LaTeX editor")
428 (description "Texmaker is a program that integrates many tools needed to
429develop documents with LaTeX, in a single application.")
430 (license license:gpl2+)))