gnu: Adjust to yasm change of module.
[jackhill/guix/guix.git] / gnu / packages / tex.scm
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 ;;;
7 ;;; This file is part of GNU Guix.
8 ;;;
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.
13 ;;;
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.
18 ;;;
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/>.
21
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))
54
55 (define texlive-extra-src
56 (origin
57 (method url-fetch)
58 (uri "ftp://tug.org/historic/systems/texlive/2015/texlive-20150523-extra.tar.xz")
59 (sha256 (base32
60 "1dkhhacga8h1v2m9xv1w02glbdda2m8lfp1la1y1zb9yjj8jsa6i"))))
61
62 (define texlive-texmf-src
63 (origin
64 (method url-fetch)
65 (uri "ftp://tug.org/historic/systems/texlive/2015/texlive-20150523-texmf.tar.xz")
66 (sha256 (base32
67 "1a3hpcg6x69ysqx432v6sk4alg0x34813cwk41frmvzprdajpyqy"))))
68
69 (define texlive-bin
70 (package
71 (name "texlive-bin")
72 (version "2015")
73 (source
74 (origin
75 (method url-fetch)
76 (uri "ftp://tug.org/historic/systems/texlive/2015/texlive-20150521-source.tar.xz")
77 (sha256 (base32
78 "0sa6kmz4jwhv6lw702gxszhhjkvw071wba0ngk1c76g8vixwv6zd"))))
79 (build-system gnu-build-system)
80 (inputs
81 `(("texlive-extra-src" ,texlive-extra-src)
82 ("cairo" ,cairo)
83 ("fontconfig" ,fontconfig)
84 ("fontforge" ,fontforge)
85 ("freetype" ,freetype)
86 ("gd" ,gd)
87 ("gmp" ,gmp)
88 ("ghostscript" ,ghostscript)
89 ("graphite2" ,graphite2)
90 ("harfbuzz" ,harfbuzz)
91 ("icu4c" ,icu4c)
92 ("libpaper" ,libpaper)
93 ("libpng" ,libpng)
94 ("libxaw" ,libxaw)
95 ("libxt" ,libxt)
96 ("mpfr" ,mpfr)
97 ("perl" ,perl)
98 ("pixman" ,pixman)
99 ("poppler" ,poppler)
100 ("potrace" ,potrace)
101 ("python" ,python-2) ; incompatible with Python 3 (print syntax)
102 ("ruby" ,ruby)
103 ("tcsh" ,tcsh)
104 ("teckit" ,teckit)
105 ("zlib" ,zlib)
106 ("zziplib" ,zziplib)))
107 (native-inputs
108 `(("pkg-config" ,pkg-config)))
109 (arguments
110 `(#:out-of-source? #t
111 #:configure-flags
112 `("--disable-native-texlive-build"
113 "--with-system-cairo"
114 "--with-system-freetype2"
115 "--with-system-gd"
116 "--with-system-gmp"
117 "--with-system-graphite2"
118 "--with-system-harfbuzz"
119 "--with-system-icu"
120 "--with-system-libgs"
121 "--with-system-libpaper"
122 "--with-system-libpng"
123 "--with-system-mpfr"
124 "--with-system-pixman"
125 "--with-system-poppler"
126 "--with-system-potrace"
127 "--with-system-teckit"
128 "--with-system-xpdf"
129 "--with-system-zlib"
130 "--with-system-zziplib")
131
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)
135 (%current-system))))
136 #:phases
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
147 ;; man pages.
148 (with-directory-excursion (string-append out "/bin/")
149 (for-each symlink
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")
161 (description
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
165 world.
166
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/")))
170
171 (define texlive-texmf
172 (package
173 (name "texlive-texmf")
174 (version "2015")
175 (source texlive-texmf-src)
176 (build-system gnu-build-system)
177 (inputs
178 `(("texlive-bin" ,texlive-bin)
179 ("lua" ,lua)
180 ("perl" ,perl)
181 ("python" ,python-2) ; incompatible with Python 3 (print syntax)
182 ("ruby" ,ruby)
183 ("tcsh" ,tcsh)))
184 (arguments
185 `(#:modules ((guix build gnu-build-system)
186 (guix build utils)
187 (srfi srfi-26))
188 #:phases
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")))
194 (mkdir-p 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
214 (setenv "PERL5LIB"
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")
221 (system* "mktexlsr")
222 (system* "fmtutil-sys" "--all")))))))
223 (synopsis "TeX Live, a package of the TeX typesetting system")
224 (description
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
228 world.
229
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/")))
233
234 (define-public texlive
235 (package
236 (name "texlive")
237 (version "2015")
238 (source #f)
239 (build-system trivial-build-system)
240 (inputs `(("bash" ,bash) ; for wrap-program
241 ("texlive-bin" ,texlive-bin)
242 ("texlive-texmf" ,texlive-texmf)))
243 (arguments
244 `(#:modules ((guix build utils))
245 #:builder
246 ;; Build the union of texlive-bin and texlive-texmf, but take the
247 ;; conflicting subdirectory share/texmf-dist from texlive-texmf.
248 (begin
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")))
254 (mkdir out)
255 (with-directory-excursion out
256 (for-each
257 (lambda (name)
258 (symlink (string-append bin "/" name) name))
259 '("include" "lib"))
260 (mkdir "bin")
261 (with-directory-excursion "bin"
262 (setenv "PATH" (string-append bash "/bin"))
263 (for-each
264 (lambda (name)
265 (symlink name (basename name))
266 (wrap-program
267 (basename name)
268 `("TEXMFCNF" =
269 (,(string-append texmf "/share/texmf-dist/web2c")))))
270 (find-files (string-append bin "/bin/") "")))
271 (mkdir "share")
272 (with-directory-excursion "share"
273 (for-each
274 (lambda (name)
275 (symlink (string-append bin "/share/" name) name))
276 '("info" "man" "tlpkg"))
277 (for-each
278 (lambda (name)
279 (symlink (string-append texmf "/share/" name) name))
280 '("texmf-dist" "texmf-var"))))))))
281 (synopsis "TeX Live, a package of the TeX typesetting system")
282 (description
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
286 world.
287
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/")))
291
292
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")
298 (arguments
299 (substitute-keyword-arguments
300 (package-arguments texlive-texmf)
301 ((#:modules modules)
302 `((ice-9 ftw)
303 (srfi srfi-1)
304 ,@modules))
305 ((#:phases phases)
306 `(modify-phases ,phases
307 (add-after 'unpack 'prune
308 (lambda _
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?
315 (scandir ".")
316 (append '("." "..")
317 exclude)))))
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")))
335 #t))))))
336 (description
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
340 world.
341
342 This package contains a small subset of the texmf-dist data.")))
343
344
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")
351 (inputs
352 `(("texlive-texmf" ,texlive-texmf-minimal)
353 ,@(alist-delete "texlive-texmf" (package-inputs texlive))))
354 (description
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
358 world.
359
360 This package contains a small working part of the TeX Live distribution.")))
361
362
363 (define-public rubber
364 (package
365 (name "rubber")
366 (version "1.1")
367 (source (origin
368 (method url-fetch)
369 (uri (list (string-append "https://launchpad.net/rubber/trunk/"
370 version "/+download/rubber-"
371 version ".tar.gz")
372 (string-append "http://ebeffara.free.fr/pub/rubber-"
373 version ".tar.gz")))
374 (sha256
375 (base32
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)
381 ("which" ,which)))
382 (home-page "https://launchpad.net/rubber")
383 (synopsis "Wrapper for LaTeX and friends")
384 (description
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
390 PDF documents.")
391 (license license:gpl2+)))
392
393 (define-public texmaker
394 (package
395 (name "texmaker")
396 (version "4.5")
397 (source (origin
398 (method url-fetch)
399 (uri (string-append "http://www.xm1math.net/texmaker/texmaker-"
400 version ".tar.bz2"))
401 (sha256
402 (base32
403 "056njk6j8wma23mlp7xa3rgfaxx0q8ynwx8wkmj7iy0b85p9ds9c"))))
404 (build-system gnu-build-system)
405 (arguments
406 `(#:phases
407 (modify-phases %standard-phases
408 ;; Qt has its own configuration utility.
409 (replace 'configure
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"))))))))
418 (inputs
419 `(("poppler-qt5" ,poppler-qt5)
420 ("qt" ,qt)
421 ("zlib" ,zlib)))
422 (native-inputs
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+)))