Commit | Line | Data |
---|---|---|
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> |
455859a5 | 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) |
eb0119ef | 31 | #:use-module (gnu packages) |
0aa34e82 | 32 | #:use-module (gnu packages bash) |
eb0119ef | 33 | #:use-module (gnu packages compression) |
a86177d6 | 34 | #:use-module (gnu packages fontutils) |
fd89b36b | 35 | #:use-module (gnu packages gd) |
eb0119ef | 36 | #:use-module (gnu packages ghostscript) |
fd89b36b | 37 | #:use-module (gnu packages gtk) |
eb0119ef | 38 | #:use-module (gnu packages icu4c) |
e55354b8 | 39 | #:use-module (gnu packages image) |
0aa34e82 | 40 | #:use-module (gnu packages lua) |
0256c746 | 41 | #:use-module (gnu packages multiprecision) |
eb0119ef AE |
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) | |
4791876c | 46 | #:use-module (gnu packages qt) |
b32c8549 | 47 | #:use-module (gnu packages ruby) |
95b6c70f | 48 | #:use-module (gnu packages tcsh) |
ce0614dd | 49 | #:use-module (gnu packages base) |
c0589f75 | 50 | #:use-module (gnu packages xorg) |
ece9b417 | 51 | #:use-module (gnu packages xdisorg) |
231eae53 | 52 | #:use-module (gnu packages zip) |
6b5eb840 AE |
53 | #:autoload (gnu packages texinfo) (texinfo) |
54 | #:use-module (ice-9 ftw) | |
55 | #:use-module (srfi srfi-1)) | |
eb0119ef AE |
56 | |
57 | (define texlive-extra-src | |
58 | (origin | |
59 | (method url-fetch) | |
7a15a68f | 60 | (uri "ftp://tug.org/historic/systems/texlive/2016/texlive-20160523-extra.tar.xz") |
eb0119ef | 61 | (sha256 (base32 |
7a15a68f | 62 | "0q4a92zmwhn4ry6xgrp4k8wq11ax2sg9rg9yrsrdkr719y0x887a")))) |
eb0119ef AE |
63 | |
64 | (define texlive-texmf-src | |
65 | (origin | |
66 | (method url-fetch) | |
29a56d8e | 67 | (uri "ftp://tug.org/historic/systems/texlive/2016/texlive-20160523b-texmf.tar.xz") |
eb0119ef | 68 | (sha256 (base32 |
29a56d8e | 69 | "1dv8vgfzpczqw82hv9g7a8djhhyzywljmrarlcyy6g2qi5q51glr")))) |
eb0119ef | 70 | |
8bcdc23f | 71 | (define texlive-bin |
eb0119ef | 72 | (package |
0aa34e82 | 73 | (name "texlive-bin") |
7a15a68f | 74 | (version "2016") |
0aa34e82 AE |
75 | (source |
76 | (origin | |
77 | (method url-fetch) | |
29a56d8e | 78 | (uri "ftp://tug.org/historic/systems/texlive/2016/texlive-20160523b-source.tar.xz") |
0aa34e82 | 79 | (sha256 (base32 |
29a56d8e | 80 | "1v91vahxlxkdra0qz3f132vvx5d9cx2jy84yl1hkch0agyj2rcx8")))) |
eb0119ef | 81 | (build-system gnu-build-system) |
0aa34e82 AE |
82 | (inputs |
83 | `(("texlive-extra-src" ,texlive-extra-src) | |
84 | ("cairo" ,cairo) | |
85 | ("fontconfig" ,fontconfig) | |
86 | ("fontforge" ,fontforge) | |
87 | ("freetype" ,freetype) | |
88 | ("gd" ,gd) | |
0256c746 | 89 | ("gmp" ,gmp) |
0aa34e82 AE |
90 | ("ghostscript" ,ghostscript) |
91 | ("graphite2" ,graphite2) | |
92 | ("harfbuzz" ,harfbuzz) | |
93 | ("icu4c" ,icu4c) | |
94 | ("libpaper" ,libpaper) | |
95 | ("libpng" ,libpng) | |
96 | ("libxaw" ,libxaw) | |
97 | ("libxt" ,libxt) | |
0256c746 | 98 | ("mpfr" ,mpfr) |
0aa34e82 AE |
99 | ("perl" ,perl) |
100 | ("pixman" ,pixman) | |
101 | ("poppler" ,poppler) | |
102 | ("potrace" ,potrace) | |
103 | ("python" ,python-2) ; incompatible with Python 3 (print syntax) | |
104 | ("ruby" ,ruby) | |
105 | ("tcsh" ,tcsh) | |
106 | ("teckit" ,teckit) | |
107 | ("zlib" ,zlib) | |
108 | ("zziplib" ,zziplib))) | |
c4c4cc05 | 109 | (native-inputs |
e9a6d225 | 110 | `(("pkg-config" ,pkg-config))) |
eb0119ef AE |
111 | (arguments |
112 | `(#:out-of-source? #t | |
113 | #:configure-flags | |
114 | `("--disable-native-texlive-build" | |
fd89b36b | 115 | "--with-system-cairo" |
eb0119ef | 116 | "--with-system-freetype2" |
fd89b36b | 117 | "--with-system-gd" |
0256c746 | 118 | "--with-system-gmp" |
be2c88ca | 119 | "--with-system-graphite2" |
c70cf7eb | 120 | "--with-system-harfbuzz" |
eb0119ef AE |
121 | "--with-system-icu" |
122 | "--with-system-libgs" | |
609578a7 | 123 | "--with-system-libpaper" |
eb0119ef | 124 | "--with-system-libpng" |
0256c746 | 125 | "--with-system-mpfr" |
fd89b36b | 126 | "--with-system-pixman" |
eb0119ef | 127 | "--with-system-poppler" |
75916982 | 128 | "--with-system-potrace" |
eb0119ef AE |
129 | "--with-system-teckit" |
130 | "--with-system-xpdf" | |
131 | "--with-system-zlib" | |
132 | "--with-system-zziplib") | |
2f4640e3 MW |
133 | |
134 | ;; Disable tests on mips64 to cope with a failure of luajiterr.test. | |
135 | ;; XXX FIXME fix luajit properly on mips64. | |
d2e84281 | 136 | #:tests? ,(not (string-prefix? "mips64" (or (%current-target-system) |
2f4640e3 | 137 | (%current-system)))) |
eb0119ef | 138 | #:phases |
4a6635f3 AE |
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 | |
149 | ;; man pages. | |
150 | (with-directory-excursion (string-append out "/bin/") | |
151 | (for-each symlink | |
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)))))))) | |
0aa34e82 AE |
162 | (synopsis "TeX Live, a package of the TeX typesetting system") |
163 | (description | |
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 | |
167 | world. | |
168 | ||
169 | This package contains the binaries.") | |
132e14b4 EF |
170 | (license (license:fsf-free "https://www.tug.org/texlive/copying.html")) |
171 | (home-page "https://www.tug.org/texlive/"))) | |
0aa34e82 | 172 | |
8bcdc23f | 173 | (define texlive-texmf |
0aa34e82 AE |
174 | (package |
175 | (name "texlive-texmf") | |
7a15a68f | 176 | (version "2016") |
0aa34e82 AE |
177 | (source texlive-texmf-src) |
178 | (build-system gnu-build-system) | |
179 | (inputs | |
180 | `(("texlive-bin" ,texlive-bin) | |
181 | ("lua" ,lua) | |
182 | ("perl" ,perl) | |
183 | ("python" ,python-2) ; incompatible with Python 3 (print syntax) | |
184 | ("ruby" ,ruby) | |
185 | ("tcsh" ,tcsh))) | |
186 | (arguments | |
187 | `(#:modules ((guix build gnu-build-system) | |
188 | (guix build utils) | |
189 | (srfi srfi-26)) | |
455859a5 LC |
190 | |
191 | ;; This package takes 4 GiB, which we can't afford to distribute from | |
192 | ;; our servers. | |
193 | #:substitutable? #f | |
194 | ||
0aa34e82 | 195 | #:phases |
4a6635f3 AE |
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"))) | |
201 | (mkdir-p 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") | |
455859a5 LC |
215 | (string-append "TEXMFROOT = " share)) |
216 | (("TEXMFLOCAL = \\$SELFAUTOGRANDPARENT/texmf-local") | |
217 | "TEXMFLOCAL = $SELFAUTODIR/share/texmf-local") | |
218 | (("!!\\$TEXMFLOCAL") "$TEXMFLOCAL")) | |
4a6635f3 AE |
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 | |
224 | (setenv "PERL5LIB" | |
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") | |
231 | (system* "mktexlsr") | |
232 | (system* "fmtutil-sys" "--all"))))))) | |
7a15a68f | 233 | (properties `((max-silent-time . 9600))) ; don't time out while grafting |
0aa34e82 | 234 | (synopsis "TeX Live, a package of the TeX typesetting system") |
eb0119ef AE |
235 | (description |
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 | |
0aa34e82 AE |
239 | world. |
240 | ||
241 | This package contains the complete tree of texmf-dist data.") | |
132e14b4 EF |
242 | (license (license:fsf-free "https://www.tug.org/texlive/copying.html")) |
243 | (home-page "https://www.tug.org/texlive/"))) | |
0aa34e82 AE |
244 | |
245 | (define-public texlive | |
246 | (package | |
247 | (name "texlive") | |
7a15a68f | 248 | (version "2016") |
0aa34e82 AE |
249 | (source #f) |
250 | (build-system trivial-build-system) | |
251 | (inputs `(("bash" ,bash) ; for wrap-program | |
252 | ("texlive-bin" ,texlive-bin) | |
253 | ("texlive-texmf" ,texlive-texmf))) | |
455859a5 LC |
254 | (native-search-paths |
255 | (list (search-path-specification | |
256 | (variable "TEXMFLOCAL") | |
257 | (files '("share/texmf-local"))))) | |
0aa34e82 AE |
258 | (arguments |
259 | `(#:modules ((guix build utils)) | |
260 | #:builder | |
261 | ;; Build the union of texlive-bin and texlive-texmf, but take the | |
262 | ;; conflicting subdirectory share/texmf-dist from texlive-texmf. | |
263 | (begin | |
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"))) | |
269 | (mkdir out) | |
270 | (with-directory-excursion out | |
271 | (for-each | |
272 | (lambda (name) | |
273 | (symlink (string-append bin "/" name) name)) | |
274 | '("include" "lib")) | |
275 | (mkdir "bin") | |
276 | (with-directory-excursion "bin" | |
277 | (setenv "PATH" (string-append bash "/bin")) | |
278 | (for-each | |
279 | (lambda (name) | |
280 | (symlink name (basename name)) | |
281 | (wrap-program | |
282 | (basename name) | |
283 | `("TEXMFCNF" = | |
284 | (,(string-append texmf "/share/texmf-dist/web2c"))))) | |
285 | (find-files (string-append bin "/bin/") ""))) | |
286 | (mkdir "share") | |
287 | (with-directory-excursion "share" | |
288 | (for-each | |
289 | (lambda (name) | |
290 | (symlink (string-append bin "/share/" name) name)) | |
291 | '("info" "man" "tlpkg")) | |
292 | (for-each | |
293 | (lambda (name) | |
294 | (symlink (string-append texmf "/share/" name) name)) | |
295 | '("texmf-dist" "texmf-var")))))))) | |
296 | (synopsis "TeX Live, a package of the TeX typesetting system") | |
297 | (description | |
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 | |
301 | world. | |
302 | ||
303 | This package contains the complete TeX Live distribution.") | |
132e14b4 EF |
304 | (license (license:fsf-free "https://www.tug.org/texlive/copying.html")) |
305 | (home-page "https://www.tug.org/texlive/"))) | |
231eae53 | 306 | |
6b5eb840 AE |
307 | |
308 | ;; texlive-texmf-minimal is a pruned, small version of the texlive tree, | |
455859a5 LC |
309 | ;; in particular dropping documentation and fonts. It weighs in at 470 MiB |
310 | ;; instead of 4 GiB. | |
6b5eb840 AE |
311 | (define texlive-texmf-minimal |
312 | (package (inherit texlive-texmf) | |
313 | (name "texlive-texmf-minimal") | |
314 | (arguments | |
315 | (substitute-keyword-arguments | |
316 | (package-arguments texlive-texmf) | |
317 | ((#:modules modules) | |
318 | `((ice-9 ftw) | |
319 | (srfi srfi-1) | |
320 | ,@modules)) | |
321 | ((#:phases phases) | |
322 | `(modify-phases ,phases | |
323 | (add-after 'unpack 'prune | |
324 | (lambda _ | |
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? | |
331 | (scandir ".") | |
332 | (append '("." "..") | |
333 | exclude))))) | |
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"))) | |
351 | #t)))))) | |
352 | (description | |
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 | |
356 | world. | |
357 | ||
358 | This package contains a small subset of the texmf-dist data."))) | |
359 | ||
360 | ||
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") | |
367 | (inputs | |
368 | `(("texlive-texmf" ,texlive-texmf-minimal) | |
369 | ,@(alist-delete "texlive-texmf" (package-inputs texlive)))) | |
455859a5 LC |
370 | (native-search-paths |
371 | (list (search-path-specification | |
372 | (variable "TEXMFLOCAL") | |
373 | (files '("share/texmf-local"))))) | |
6b5eb840 AE |
374 | (description |
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 | |
378 | world. | |
379 | ||
380 | This package contains a small working part of the TeX Live distribution."))) | |
381 | ||
382 | ||
231eae53 LC |
383 | (define-public rubber |
384 | (package | |
385 | (name "rubber") | |
386 | (version "1.1") | |
387 | (source (origin | |
388 | (method url-fetch) | |
389 | (uri (list (string-append "https://launchpad.net/rubber/trunk/" | |
390 | version "/+download/rubber-" | |
391 | version ".tar.gz") | |
392 | (string-append "http://ebeffara.free.fr/pub/rubber-" | |
393 | version ".tar.gz"))) | |
394 | (sha256 | |
395 | (base32 | |
396 | "1xbkv8ll889933gyi2a5hj7hhh216k04gn8fwz5lfv5iz8s34gbq")))) | |
397 | (build-system gnu-build-system) | |
398 | (arguments '(#:tests? #f)) ; no `check' target | |
399 | (inputs `(("texinfo" ,texinfo) | |
9bee5d6c | 400 | ("python" ,python-2) ; incompatible with Python 3 (print syntax) |
231eae53 LC |
401 | ("which" ,which))) |
402 | (home-page "https://launchpad.net/rubber") | |
35b9e423 | 403 | (synopsis "Wrapper for LaTeX and friends") |
231eae53 LC |
404 | (description |
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 | |
410 | PDF documents.") | |
411 | (license license:gpl2+))) | |
4791876c RJ |
412 | |
413 | (define-public texmaker | |
414 | (package | |
415 | (name "texmaker") | |
416 | (version "4.5") | |
417 | (source (origin | |
418 | (method url-fetch) | |
419 | (uri (string-append "http://www.xm1math.net/texmaker/texmaker-" | |
420 | version ".tar.bz2")) | |
421 | (sha256 | |
422 | (base32 | |
423 | "056njk6j8wma23mlp7xa3rgfaxx0q8ynwx8wkmj7iy0b85p9ds9c")))) | |
424 | (build-system gnu-build-system) | |
425 | (arguments | |
426 | `(#:phases | |
427 | (modify-phases %standard-phases | |
428 | ;; Qt has its own configuration utility. | |
429 | (replace 'configure | |
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")))))))) | |
438 | (inputs | |
439 | `(("poppler-qt5" ,poppler-qt5) | |
440 | ("qt" ,qt) | |
441 | ("zlib" ,zlib))) | |
442 | (native-inputs | |
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+))) |