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