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>
7 ;;; This file is part of GNU Guix.
9 ;;; GNU Guix is free software; you can redistribute it and/or modify it
10 ;;; under the terms of the GNU General Public License as published by
11 ;;; the Free Software Foundation; either version 3 of the License, or (at
12 ;;; your option) any later version.
14 ;;; GNU Guix is distributed in the hope that it will be useful, but
15 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
16 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 ;;; GNU General Public License for more details.
19 ;;; You should have received a copy of the GNU General Public License
20 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
22 (define-module (gnu packages tex)
23 #:use-module ((guix licenses) #:prefix license:)
24 #:use-module (guix packages)
25 #:use-module (guix download)
26 #:use-module (guix build-system gnu)
27 #:use-module (guix build-system trivial)
28 #:use-module (guix utils)
29 #:use-module (gnu packages)
30 #:use-module (gnu packages bash)
31 #:use-module (gnu packages compression)
32 #:use-module (gnu packages fontutils)
33 #:use-module (gnu packages gd)
34 #:use-module (gnu packages ghostscript)
35 #:use-module (gnu packages gtk)
36 #:use-module (gnu packages icu4c)
37 #:use-module (gnu packages image)
38 #:use-module (gnu packages lua)
39 #:use-module (gnu packages multiprecision)
40 #:use-module (gnu packages pdf)
41 #:use-module (gnu packages perl)
42 #:use-module (gnu packages pkg-config)
43 #:use-module (gnu packages python)
44 #:use-module (gnu packages qt)
45 #:use-module (gnu packages ruby)
46 #:use-module (gnu packages tcsh)
47 #:use-module (gnu packages base)
48 #:use-module (gnu packages xorg)
49 #:use-module (gnu packages xdisorg)
50 #:use-module (gnu packages zip)
51 #:autoload (gnu packages texinfo) (texinfo)
52 #:use-module (ice-9 ftw)
53 #:use-module (srfi srfi-1))
55 (define texlive-extra-src
58 (uri "ftp://tug.org/historic/systems/texlive/2015/texlive-20150523-extra.tar.xz")
60 "1dkhhacga8h1v2m9xv1w02glbdda2m8lfp1la1y1zb9yjj8jsa6i"))))
62 (define texlive-texmf-src
65 (uri "ftp://tug.org/historic/systems/texlive/2015/texlive-20150523-texmf.tar.xz")
67 "1a3hpcg6x69ysqx432v6sk4alg0x34813cwk41frmvzprdajpyqy"))))
76 (uri "ftp://tug.org/historic/systems/texlive/2015/texlive-20150521-source.tar.xz")
78 "0sa6kmz4jwhv6lw702gxszhhjkvw071wba0ngk1c76g8vixwv6zd"))))
79 (build-system gnu-build-system)
81 `(("texlive-extra-src" ,texlive-extra-src)
83 ("fontconfig" ,fontconfig)
84 ("fontforge" ,fontforge)
85 ("freetype" ,freetype)
88 ("ghostscript" ,ghostscript)
89 ("graphite2" ,graphite2)
90 ("harfbuzz" ,harfbuzz)
92 ("libpaper" ,libpaper)
101 ("python" ,python-2) ; incompatible with Python 3 (print syntax)
106 ("zziplib" ,zziplib)))
108 `(("pkg-config" ,pkg-config)))
110 `(#:out-of-source? #t
112 `("--disable-native-texlive-build"
113 "--with-system-cairo"
114 "--with-system-freetype2"
117 "--with-system-graphite2"
118 "--with-system-harfbuzz"
120 "--with-system-libgs"
121 "--with-system-libpaper"
122 "--with-system-libpng"
124 "--with-system-pixman"
125 "--with-system-poppler"
126 "--with-system-potrace"
127 "--with-system-teckit"
130 "--with-system-zziplib")
132 ;; Disable tests on mips64 to cope with a failure of luajiterr.test.
133 ;; XXX FIXME fix luajit properly on mips64.
134 #:tests? ,(not (string-prefix? "mips64" (or (%current-target-system)
137 (modify-phases %standard-phases
138 (add-after 'install 'postint
139 (lambda* (#:key inputs outputs #:allow-other-keys #:rest args)
140 (let* ((out (assoc-ref outputs "out"))
141 (share (string-append out "/share"))
142 (texlive-extra (assoc-ref inputs "texlive-extra-src"))
143 (unpack (assoc-ref %standard-phases 'unpack))
144 (patch-source-shebangs
145 (assoc-ref %standard-phases 'patch-source-shebangs)))
146 ;; Create symbolic links for the latex variants and their
148 (with-directory-excursion (string-append out "/bin/")
150 '("pdftex" "pdftex" "xetex" "luatex")
151 '("latex" "pdflatex" "xelatex" "lualatex")))
152 (with-directory-excursion (string-append share "/man/man1/")
153 (symlink "luatex.1" "lualatex.1"))
154 ;; Unpack texlive-extra and install tlpkg.
155 (mkdir "texlive-extra")
156 (with-directory-excursion "texlive-extra"
157 (apply unpack (list #:source texlive-extra))
158 (apply patch-source-shebangs (list #:source texlive-extra))
159 (system* "mv" "tlpkg" share))))))))
160 (synopsis "TeX Live, a package of the TeX typesetting system")
162 "TeX Live provides a comprehensive TeX document production system.
163 It includes all the major TeX-related programs, macro packages, and fonts
164 that are free software, including support for many languages around the
167 This package contains the binaries.")
168 (license (license:fsf-free "http://tug.org/texlive/copying.html"))
169 (home-page "http://www.tug.org/texlive/")))
171 (define texlive-texmf
173 (name "texlive-texmf")
175 (source texlive-texmf-src)
176 (build-system gnu-build-system)
178 `(("texlive-bin" ,texlive-bin)
181 ("python" ,python-2) ; incompatible with Python 3 (print syntax)
185 `(#:modules ((guix build gnu-build-system)
189 (modify-phases (map (cut assq <> %standard-phases)
190 '(set-paths unpack patch-source-shebangs))
191 (add-after 'patch-source-shebangs 'install
192 (lambda* (#:key outputs #:allow-other-keys)
193 (let ((share (string-append (assoc-ref outputs "out") "/share")))
195 (system* "mv" "texmf-dist" share))))
196 (add-after 'install 'texmf-config
197 (lambda* (#:key inputs outputs #:allow-other-keys)
198 (let* ((out (assoc-ref outputs "out"))
199 (share (string-append out "/share"))
200 (texmfroot (string-append share "/texmf-dist/web2c"))
201 (texmfcnf (string-append texmfroot "/texmf.cnf"))
202 (texlive-bin (assoc-ref inputs "texlive-bin"))
203 (texbin (string-append texlive-bin "/bin"))
204 (tlpkg (string-append texlive-bin "/share/tlpkg")))
205 ;; Register SHARE as TEXMFROOT in texmf.cnf.
206 (substitute* texmfcnf
207 (("TEXMFROOT = \\$SELFAUTOPARENT")
208 (string-append "TEXMFROOT = " share)))
209 ;; Register paths in texmfcnf.lua, needed for context.
210 (substitute* (string-append texmfroot "/texmfcnf.lua")
211 (("selfautodir:") out)
212 (("selfautoparent:") (string-append share "/")))
213 ;; Set path to TeXLive Perl modules
215 (string-append (getenv "PERL5LIB") ":" tlpkg))
216 ;; Configure the texmf-dist tree; inspired from
217 ;; http://slackbuilds.org/repository/13.37/office/texlive/
218 (setenv "PATH" (string-append (getenv "PATH") ":" texbin))
219 (setenv "TEXMFCNF" texmfroot)
220 (system* "updmap-sys" "--nohash" "--syncwithtrees")
222 (system* "fmtutil-sys" "--all")))))))
223 (synopsis "TeX Live, a package of the TeX typesetting system")
225 "TeX Live provides a comprehensive TeX document production system.
226 It includes all the major TeX-related programs, macro packages, and fonts
227 that are free software, including support for many languages around the
230 This package contains the complete tree of texmf-dist data.")
231 (license (license:fsf-free "http://tug.org/texlive/copying.html"))
232 (home-page "http://www.tug.org/texlive/")))
234 (define-public texlive
239 (build-system trivial-build-system)
240 (inputs `(("bash" ,bash) ; for wrap-program
241 ("texlive-bin" ,texlive-bin)
242 ("texlive-texmf" ,texlive-texmf)))
244 `(#:modules ((guix build utils))
246 ;; Build the union of texlive-bin and texlive-texmf, but take the
247 ;; conflicting subdirectory share/texmf-dist from texlive-texmf.
249 (use-modules (guix build utils))
250 (let ((out (assoc-ref %outputs "out"))
251 (bin (assoc-ref %build-inputs "texlive-bin"))
252 (texmf (assoc-ref %build-inputs "texlive-texmf"))
253 (bash (assoc-ref %build-inputs "bash")))
255 (with-directory-excursion out
258 (symlink (string-append bin "/" name) name))
261 (with-directory-excursion "bin"
262 (setenv "PATH" (string-append bash "/bin"))
265 (symlink name (basename name))
269 (,(string-append texmf "/share/texmf-dist/web2c")))))
270 (find-files (string-append bin "/bin/") "")))
272 (with-directory-excursion "share"
275 (symlink (string-append bin "/share/" name) name))
276 '("info" "man" "tlpkg"))
279 (symlink (string-append texmf "/share/" name) name))
280 '("texmf-dist" "texmf-var"))))))))
281 (synopsis "TeX Live, a package of the TeX typesetting system")
283 "TeX Live provides a comprehensive TeX document production system.
284 It includes all the major TeX-related programs, macro packages, and fonts
285 that are free software, including support for many languages around the
288 This package contains the complete TeX Live distribution.")
289 (license (license:fsf-free "http://tug.org/texlive/copying.html"))
290 (home-page "http://www.tug.org/texlive/")))
293 ;; texlive-texmf-minimal is a pruned, small version of the texlive tree,
294 ;; in particular dropping documentation and fonts.
295 (define texlive-texmf-minimal
296 (package (inherit texlive-texmf)
297 (name "texlive-texmf-minimal")
299 (substitute-keyword-arguments
300 (package-arguments texlive-texmf)
306 `(modify-phases ,phases
307 (add-after 'unpack 'prune
309 (define (delete subdir exclude)
310 "Delete all files and directories in SUBDIR except for those
311 given in the list EXCLUDE."
312 (with-directory-excursion subdir
313 (for-each delete-file-recursively
314 (lset-difference equal?
318 (with-directory-excursion "texmf-dist"
319 (for-each delete-file-recursively
320 '("doc" "source" "tex4ht"))
321 ;; Delete all subdirectories of "fonts", except for "tfm" and
322 ;; any directories named "cm".
323 (delete "fonts" '("afm" "map" "pk" "source" "tfm" "type1"))
324 (delete "fonts/afm" '("public"))
325 (delete "fonts/afm/public" '("amsfonts"))
326 (delete "fonts/afm/public/amsfonts" '("cm"))
327 (delete "fonts/map" '("dvips"))
328 (delete "fonts/map/dvips" '("cm"))
329 (delete "fonts/source" '("public"))
330 (delete "fonts/source/public" '("cm"))
331 (delete "fonts/tfm" '("public"))
332 (delete "fonts/type1" '("public"))
333 (delete "fonts/type1/public" '("amsfonts"))
334 (delete "fonts/type1/public/amsfonts" '("cm")))
337 "TeX Live provides a comprehensive TeX document production system.
338 It includes all the major TeX-related programs, macro packages, and fonts
339 that are free software, including support for many languages around the
342 This package contains a small subset of the texmf-dist data.")))
345 ;; texlive-minimal is the same as texlive, but using texlive-texmf-minimal
346 ;; instead of the full texlive-texmf. It can be used, for instance, as a
347 ;; native input to packages that need texlive to build their documentation.
348 (define-public texlive-minimal
349 (package (inherit texlive)
350 (name "texlive-minimal")
352 `(("texlive-texmf" ,texlive-texmf-minimal)
353 ,@(alist-delete "texlive-texmf" (package-inputs texlive))))
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 working part of the TeX Live distribution.")))
363 (define-public rubber
369 (uri (list (string-append "https://launchpad.net/rubber/trunk/"
370 version "/+download/rubber-"
372 (string-append "http://ebeffara.free.fr/pub/rubber-"
376 "1xbkv8ll889933gyi2a5hj7hhh216k04gn8fwz5lfv5iz8s34gbq"))))
377 (build-system gnu-build-system)
378 (arguments '(#:tests? #f)) ; no `check' target
379 (inputs `(("texinfo" ,texinfo)
380 ("python" ,python-2) ; incompatible with Python 3 (print syntax)
382 (home-page "https://launchpad.net/rubber")
383 (synopsis "Wrapper for LaTeX and friends")
385 "Rubber is a program whose purpose is to handle all tasks related to the
386 compilation of LaTeX documents. This includes compiling the document itself,
387 of course, enough times so that all references are defined, and running BibTeX
388 to manage bibliographic references. Automatic execution of dvips to produce
389 PostScript documents is also included, as well as usage of pdfLaTeX to produce
391 (license license:gpl2+)))
393 (define-public texmaker
399 (uri (string-append "http://www.xm1math.net/texmaker/texmaker-"
403 "056njk6j8wma23mlp7xa3rgfaxx0q8ynwx8wkmj7iy0b85p9ds9c"))))
404 (build-system gnu-build-system)
407 (modify-phases %standard-phases
408 ;; Qt has its own configuration utility.
410 (lambda* (#:key outputs #:allow-other-keys)
411 (let ((out (assoc-ref outputs "out")))
412 (zero? (system* "qmake"
413 (string-append "PREFIX=" out)
414 (string-append "DESKTOPDIR=" out
415 "/share/applications")
416 (string-append "ICONDIR=" out "/share/pixmaps")
417 "texmaker.pro"))))))))
419 `(("poppler-qt5" ,poppler-qt5)
423 `(("pkg-config" ,pkg-config)))
424 (home-page "http://www.xm1math.net/texmaker/")
425 (synopsis "LaTeX editor")
426 (description "Texmaker is a program that integrates many tools needed to
427 develop documents with LaTeX, in a single application.")
428 (license license:gpl2+)))