gnu: Add emacs-ob-ipython.
[jackhill/guix/guix.git] / gnu / packages / texlive.scm
CommitLineData
eb0119ef 1;;; GNU Guix --- Functional package management for GNU
0aa34e82 2;;; Copyright © 2013, 2014, 2015 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)
eb0119ef 27 #:use-module (gnu packages)
0aa34e82 28 #:use-module (gnu packages bash)
eb0119ef 29 #:use-module (gnu packages compression)
a86177d6 30 #:use-module (gnu packages fontutils)
fd89b36b 31 #:use-module (gnu packages gd)
eb0119ef 32 #:use-module (gnu packages ghostscript)
fd89b36b 33 #:use-module (gnu packages gtk)
eb0119ef 34 #:use-module (gnu packages icu4c)
e55354b8 35 #:use-module (gnu packages image)
0aa34e82 36 #:use-module (gnu packages lua)
eb0119ef
AE
37 #:use-module (gnu packages pdf)
38 #:use-module (gnu packages perl)
39 #:use-module (gnu packages pkg-config)
40 #:use-module (gnu packages python)
b32c8549 41 #:use-module (gnu packages ruby)
95b6c70f 42 #:use-module (gnu packages tcsh)
ce0614dd 43 #:use-module (gnu packages base)
c0589f75 44 #:use-module (gnu packages xorg)
ece9b417 45 #:use-module (gnu packages xdisorg)
231eae53
LC
46 #:use-module (gnu packages zip)
47 #:autoload (gnu packages texinfo) (texinfo))
eb0119ef
AE
48
49(define texlive-extra-src
50 (origin
51 (method url-fetch)
42e1394b 52 (uri "ftp://tug.org/historic/systems/texlive/2014/texlive-20140525-extra.tar.xz")
eb0119ef 53 (sha256 (base32
42e1394b 54 "1zlnjysvxskcy05iva6jfklirwv12wqyn3ia119a7xnqlvhpqz33"))))
eb0119ef
AE
55
56(define texlive-texmf-src
57 (origin
58 (method url-fetch)
42e1394b 59 (uri "ftp://tug.org/historic/systems/texlive/2014/texlive-20140525-texmf.tar.xz")
eb0119ef 60 (sha256 (base32
42e1394b 61 "0qsr55ms1278dhmgixs5qqwd4fxhh369ihkki6wgh8xaqm8p48p0"))))
eb0119ef 62
0aa34e82 63(define-public texlive-bin
eb0119ef 64 (package
0aa34e82 65 (name "texlive-bin")
42e1394b 66 (version "2014")
0aa34e82
AE
67 (source
68 (origin
69 (method url-fetch)
70 (uri "ftp://tug.org/historic/systems/texlive/2014/texlive-20140525-source.tar.xz")
71 (sha256 (base32
72 "1glmaw2jv42grbsn05kay825j66scimjqqc32776bb1356q4xfq8"))))
eb0119ef 73 (build-system gnu-build-system)
0aa34e82
AE
74 (inputs
75 `(("texlive-extra-src" ,texlive-extra-src)
76 ("cairo" ,cairo)
77 ("fontconfig" ,fontconfig)
78 ("fontforge" ,fontforge)
79 ("freetype" ,freetype)
80 ("gd" ,gd)
81 ("ghostscript" ,ghostscript)
82 ("graphite2" ,graphite2)
83 ("harfbuzz" ,harfbuzz)
84 ("icu4c" ,icu4c)
85 ("libpaper" ,libpaper)
86 ("libpng" ,libpng)
87 ("libxaw" ,libxaw)
88 ("libxt" ,libxt)
89 ("perl" ,perl)
90 ("pixman" ,pixman)
91 ("poppler" ,poppler)
92 ("potrace" ,potrace)
93 ("python" ,python-2) ; incompatible with Python 3 (print syntax)
94 ("ruby" ,ruby)
95 ("tcsh" ,tcsh)
96 ("teckit" ,teckit)
97 ("zlib" ,zlib)
98 ("zziplib" ,zziplib)))
c4c4cc05 99 (native-inputs
e9a6d225 100 `(("pkg-config" ,pkg-config)))
eb0119ef
AE
101 (arguments
102 `(#:out-of-source? #t
103 #:configure-flags
104 `("--disable-native-texlive-build"
fd89b36b 105 "--with-system-cairo"
eb0119ef 106 "--with-system-freetype2"
fd89b36b 107 "--with-system-gd"
be2c88ca 108 "--with-system-graphite2"
c70cf7eb 109 "--with-system-harfbuzz"
eb0119ef
AE
110 "--with-system-icu"
111 "--with-system-libgs"
609578a7 112 "--with-system-libpaper"
eb0119ef 113 "--with-system-libpng"
fd89b36b 114 "--with-system-pixman"
eb0119ef 115 "--with-system-poppler"
75916982 116 "--with-system-potrace"
eb0119ef
AE
117 "--with-system-teckit"
118 "--with-system-xpdf"
119 "--with-system-zlib"
120 "--with-system-zziplib")
2f4640e3
MW
121
122 ;; Disable tests on mips64 to cope with a failure of luajiterr.test.
123 ;; XXX FIXME fix luajit properly on mips64.
d2e84281 124 #:tests? ,(not (string-prefix? "mips64" (or (%current-target-system)
2f4640e3 125 (%current-system))))
eb0119ef 126 #:phases
eb0119ef
AE
127 (alist-cons-after
128 'install 'postinst
129 (lambda* (#:key inputs outputs #:allow-other-keys #:rest args)
0aa34e82
AE
130 (let* ((out (assoc-ref outputs "out"))
131 (share (string-append out "/share"))
132 (texlive-extra (assoc-ref inputs "texlive-extra-src"))
133 (unpack (assoc-ref %standard-phases 'unpack))
134 (patch-source-shebangs
135 (assoc-ref %standard-phases 'patch-source-shebangs)))
eb0119ef
AE
136 ;; Create symbolic links for the latex variants and their
137 ;; man pages.
138 (with-directory-excursion (string-append out "/bin/")
139 (for-each symlink
140 '("pdftex" "pdftex" "xetex" "luatex")
141 '("latex" "pdflatex" "xelatex" "lualatex")))
0aa34e82 142 (with-directory-excursion (string-append share "/man/man1/")
eb0119ef 143 (symlink "luatex.1" "lualatex.1"))
eb0119ef
AE
144 ;; Unpack texlive-extra and install tlpkg.
145 (mkdir "texlive-extra")
146 (with-directory-excursion "texlive-extra"
147 (apply unpack (list #:source texlive-extra))
148 (apply patch-source-shebangs (list #:source texlive-extra))
0aa34e82
AE
149 (system* "mv" "tlpkg" share))))
150 %standard-phases)))
151 (synopsis "TeX Live, a package of the TeX typesetting system")
152 (description
153 "TeX Live provides a comprehensive TeX document production system.
154It includes all the major TeX-related programs, macro packages, and fonts
155that are free software, including support for many languages around the
156world.
157
158This package contains the binaries.")
159 (license (license:fsf-free "http://tug.org/texlive/copying.html"))
160 (home-page "http://www.tug.org/texlive/")))
161
162(define-public texlive-texmf
163 (package
164 (name "texlive-texmf")
165 (version "2014")
166 (source texlive-texmf-src)
167 (build-system gnu-build-system)
168 (inputs
169 `(("texlive-bin" ,texlive-bin)
170 ("lua" ,lua)
171 ("perl" ,perl)
172 ("python" ,python-2) ; incompatible with Python 3 (print syntax)
173 ("ruby" ,ruby)
174 ("tcsh" ,tcsh)))
175 (arguments
176 `(#:modules ((guix build gnu-build-system)
177 (guix build utils)
178 (srfi srfi-26))
0aa34e82
AE
179 #:phases
180 (alist-cons-before
181 'texmf-config 'install
eb0119ef 182 (lambda* (#:key outputs #:allow-other-keys)
0aa34e82
AE
183 (let ((share (string-append (assoc-ref outputs "out") "/share")))
184 (mkdir-p share)
185 (system* "mv" "texmf-dist" share)))
186 (alist-cons-after
187 'patch-source-shebangs 'texmf-config
188 (lambda* (#:key inputs outputs #:allow-other-keys)
189 (let* ((share (string-append (assoc-ref outputs "out") "/share"))
190 (texmfroot (string-append share "/texmf-dist/web2c"))
191 (texmfcnf (string-append texmfroot "/texmf.cnf"))
192 (texbin (string-append (assoc-ref inputs "texlive-bin")
193 "/bin")))
194 ;; Register SHARE as TEXMFROOT in texmf.cnf.
195 (substitute* texmfcnf
196 (("TEXMFROOT = \\$SELFAUTOPARENT")
197 (string-append "TEXMFROOT = " share)))
198 ;; Configure the texmf-dist tree; inspired from
199 ;; http://slackbuilds.org/repository/13.37/office/texlive/
200 (setenv "PATH" (string-append (getenv "PATH") ":" texbin))
201 (setenv "TEXMFCNF" texmfroot)
202 (system* "updmap-sys" "--nohash" "--syncwithtrees")
203 (system* "mktexlsr")
204 (system* "fmtutil-sys" "--all")))
205 (map (cut assq <> %standard-phases)
206 '(set-paths unpack patch-source-shebangs))))))
207 (synopsis "TeX Live, a package of the TeX typesetting system")
eb0119ef
AE
208 (description
209 "TeX Live provides a comprehensive TeX document production system.
210It includes all the major TeX-related programs, macro packages, and fonts
211that are free software, including support for many languages around the
0aa34e82
AE
212world.
213
214This package contains the complete tree of texmf-dist data.")
215 (license (license:fsf-free "http://tug.org/texlive/copying.html"))
216 (home-page "http://www.tug.org/texlive/")))
217
218(define-public texlive
219 (package
220 (name "texlive")
221 (version "2014")
222 (source #f)
223 (build-system trivial-build-system)
224 (inputs `(("bash" ,bash) ; for wrap-program
225 ("texlive-bin" ,texlive-bin)
226 ("texlive-texmf" ,texlive-texmf)))
227 (arguments
228 `(#:modules ((guix build utils))
229 #:builder
230 ;; Build the union of texlive-bin and texlive-texmf, but take the
231 ;; conflicting subdirectory share/texmf-dist from texlive-texmf.
232 (begin
233 (use-modules (guix build utils))
234 (let ((out (assoc-ref %outputs "out"))
235 (bin (assoc-ref %build-inputs "texlive-bin"))
236 (texmf (assoc-ref %build-inputs "texlive-texmf"))
237 (bash (assoc-ref %build-inputs "bash")))
238 (mkdir out)
239 (with-directory-excursion out
240 (for-each
241 (lambda (name)
242 (symlink (string-append bin "/" name) name))
243 '("include" "lib"))
244 (mkdir "bin")
245 (with-directory-excursion "bin"
246 (setenv "PATH" (string-append bash "/bin"))
247 (for-each
248 (lambda (name)
249 (symlink name (basename name))
250 (wrap-program
251 (basename name)
252 `("TEXMFCNF" =
253 (,(string-append texmf "/share/texmf-dist/web2c")))))
254 (find-files (string-append bin "/bin/") "")))
255 (mkdir "share")
256 (with-directory-excursion "share"
257 (for-each
258 (lambda (name)
259 (symlink (string-append bin "/share/" name) name))
260 '("info" "man" "tlpkg"))
261 (for-each
262 (lambda (name)
263 (symlink (string-append texmf "/share/" name) name))
264 '("texmf-dist" "texmf-var"))))))))
265 (synopsis "TeX Live, a package of the TeX typesetting system")
266 (description
267 "TeX Live provides a comprehensive TeX document production system.
268It includes all the major TeX-related programs, macro packages, and fonts
269that are free software, including support for many languages around the
270world.
271
272This package contains the complete TeX Live distribution.")
eb0119ef
AE
273 (license (license:fsf-free "http://tug.org/texlive/copying.html"))
274 (home-page "http://www.tug.org/texlive/")))
231eae53
LC
275
276(define-public rubber
277 (package
278 (name "rubber")
279 (version "1.1")
280 (source (origin
281 (method url-fetch)
282 (uri (list (string-append "https://launchpad.net/rubber/trunk/"
283 version "/+download/rubber-"
284 version ".tar.gz")
285 (string-append "http://ebeffara.free.fr/pub/rubber-"
286 version ".tar.gz")))
287 (sha256
288 (base32
289 "1xbkv8ll889933gyi2a5hj7hhh216k04gn8fwz5lfv5iz8s34gbq"))))
290 (build-system gnu-build-system)
291 (arguments '(#:tests? #f)) ; no `check' target
292 (inputs `(("texinfo" ,texinfo)
9bee5d6c 293 ("python" ,python-2) ; incompatible with Python 3 (print syntax)
231eae53
LC
294 ("which" ,which)))
295 (home-page "https://launchpad.net/rubber")
35b9e423 296 (synopsis "Wrapper for LaTeX and friends")
231eae53
LC
297 (description
298 "Rubber is a program whose purpose is to handle all tasks related to the
299compilation of LaTeX documents. This includes compiling the document itself,
300of course, enough times so that all references are defined, and running BibTeX
301to manage bibliographic references. Automatic execution of dvips to produce
302PostScript documents is also included, as well as usage of pdfLaTeX to produce
303PDF documents.")
304 (license license:gpl2+)))