gnu: Add missing (gnu packages xdisorg) import.
[jackhill/guix/guix.git] / gnu / packages / texlive.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2013, 2014 Andreas Enge <andreas@enge.fr>
3 ;;; Copyright © 2014 Eric Bavier <bavier@member.fsf.org>
4 ;;;
5 ;;; This file is part of GNU Guix.
6 ;;;
7 ;;; GNU Guix is free software; you can redistribute it and/or modify it
8 ;;; under the terms of the GNU General Public License as published by
9 ;;; the Free Software Foundation; either version 3 of the License, or (at
10 ;;; your option) any later version.
11 ;;;
12 ;;; GNU Guix is distributed in the hope that it will be useful, but
13 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
14 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 ;;; GNU General Public License for more details.
16 ;;;
17 ;;; You should have received a copy of the GNU General Public License
18 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
19
20 (define-module (gnu packages texlive)
21 #:use-module ((guix licenses) #:prefix license:)
22 #:use-module (guix packages)
23 #:use-module (guix download)
24 #:use-module (guix build-system gnu)
25 #:use-module (gnu packages)
26 #:use-module (gnu packages compression)
27 #:use-module (gnu packages fontutils)
28 #:use-module (gnu packages gd)
29 #:use-module (gnu packages ghostscript)
30 #:use-module (gnu packages gtk)
31 #:use-module (gnu packages icu4c)
32 #:use-module (gnu packages image)
33 #:use-module (gnu packages pdf)
34 #:use-module (gnu packages perl)
35 #:use-module (gnu packages pkg-config)
36 #:use-module (gnu packages python)
37 #:use-module (gnu packages ruby)
38 #:use-module (gnu packages tcsh)
39 #:use-module (gnu packages which)
40 #:use-module (gnu packages xorg)
41 #:use-module (gnu packages zip)
42 #:autoload (gnu packages texinfo) (texinfo))
43
44 (define texlive-extra-src
45 (origin
46 (method url-fetch)
47 (uri "ftp://tug.org/historic/systems/texlive/2014/texlive-20140525-extra.tar.xz")
48 (sha256 (base32
49 "1zlnjysvxskcy05iva6jfklirwv12wqyn3ia119a7xnqlvhpqz33"))))
50
51 (define texlive-texmf-src
52 (origin
53 (method url-fetch)
54 (uri "ftp://tug.org/historic/systems/texlive/2014/texlive-20140525-texmf.tar.xz")
55 (sha256 (base32
56 "0qsr55ms1278dhmgixs5qqwd4fxhh369ihkki6wgh8xaqm8p48p0"))))
57
58 (define-public texlive
59 (package
60 (name "texlive")
61 (version "2014")
62 (source (origin
63 (method url-fetch)
64 (uri "ftp://tug.org/historic/systems/texlive/2014/texlive-20140525-source.tar.xz")
65 (sha256 (base32
66 "1glmaw2jv42grbsn05kay825j66scimjqqc32776bb1356q4xfq8"))))
67 (build-system gnu-build-system)
68 (inputs `(("texlive-extra-src" ,texlive-extra-src)
69 ("texlive-texmf-src" ,texlive-texmf-src)
70 ("cairo" ,cairo)
71 ("fontconfig" ,fontconfig)
72 ("fontforge" ,fontforge)
73 ("freetype" ,freetype)
74 ("gd" ,gd)
75 ("ghostscript" ,ghostscript)
76 ("graphite2" ,graphite2)
77 ("harfbuzz" ,harfbuzz)
78 ("icu4c" ,icu4c)
79 ("libpaper" ,libpaper)
80 ("libpng" ,libpng)
81 ("libxaw" ,libxaw)
82 ("libxt" ,libxt)
83 ("perl" ,perl)
84 ("pixman" ,pixman)
85 ("poppler" ,poppler)
86 ("potrace" ,potrace)
87 ("python" ,python-2) ; incompatible with Python 3 (print syntax)
88 ("ruby" ,ruby)
89 ("tcsh" ,tcsh)
90 ("teckit" ,teckit)
91 ("zlib" ,zlib)
92 ("zziplib" ,zziplib)))
93 (native-inputs
94 `(("pkg-config" ,pkg-config)))
95 (outputs '("out" "data"))
96 (arguments
97 `(#:out-of-source? #t
98 #:configure-flags
99 `("--disable-native-texlive-build"
100 ;; Although the texmf-dist data is taken from texlive-texmf,
101 ;; setting datarootdir is still useful:
102 ;; "make install" creates symbolic links to scripts in this place.
103 ,(string-append "--datarootdir=" (assoc-ref %outputs "data"))
104 ,(string-append "--infodir=" (assoc-ref %outputs "out") "/share/info")
105 ,(string-append "--mandir=" (assoc-ref %outputs "out") "/share/man")
106 "--with-system-cairo"
107 "--with-system-freetype2"
108 "--with-system-gd"
109 "--with-system-graphite2"
110 "--with-system-harfbuzz"
111 "--with-system-icu"
112 "--with-system-libgs"
113 "--with-system-libpaper"
114 "--with-system-libpng"
115 "--with-system-pixman"
116 "--with-system-poppler"
117 "--with-system-potrace"
118 "--with-system-teckit"
119 "--with-system-xpdf"
120 "--with-system-zlib"
121 "--with-system-zziplib")
122
123 ;; Disable tests on mips64 to cope with a failure of luajiterr.test.
124 ;; XXX FIXME fix luajit properly on mips64.
125 #:tests? ,(not (equal? "mips64el-linux" (or (%current-target-system)
126 (%current-system))))
127 #:phases
128 (alist-cons-after
129 'install 'postinst
130 (lambda* (#:key inputs outputs #:allow-other-keys #:rest args)
131 (let ((texlive-extra (assoc-ref inputs "texlive-extra-src"))
132 (texlive-texmf (assoc-ref inputs "texlive-texmf-src"))
133 (out (assoc-ref outputs "out"))
134 (data (assoc-ref outputs "data"))
135 (unpack (assoc-ref %standard-phases 'unpack))
136 (patch-source-shebangs
137 (assoc-ref %standard-phases 'patch-source-shebangs)))
138 ;; Create symbolic links for the latex variants and their
139 ;; man pages.
140 (with-directory-excursion (string-append out "/bin/")
141 (for-each symlink
142 '("pdftex" "pdftex" "xetex" "luatex")
143 '("latex" "pdflatex" "xelatex" "lualatex")))
144 (with-directory-excursion (string-append out "/share/man/man1/")
145 (symlink "luatex.1" "lualatex.1"))
146 ;; Delete texmf-dist from "data", since it will be reinstalled
147 ;; from texlive-texmf.
148 (system* "rm" "-r" (string-append data "/texmf-dist"))
149 ;; Unpack texlive-extra and install tlpkg.
150 (mkdir "texlive-extra")
151 (with-directory-excursion "texlive-extra"
152 (apply unpack (list #:source texlive-extra))
153 (apply patch-source-shebangs (list #:source texlive-extra))
154 (system* "mv" "tlpkg" data)
155 (chdir ".."))
156 ;; Unpack and install texlive-texmf.
157 (mkdir "texlive-texmf")
158 (with-directory-excursion "texlive-texmf"
159 (apply unpack (list #:source texlive-texmf))
160 (apply patch-source-shebangs (list #:source texlive-texmf))
161 ;; Register "data" for kpathsea in texmf.cnf.
162 (substitute* "texmf-dist/web2c/texmf.cnf"
163 (("TEXMFROOT = \\$SELFAUTOPARENT")
164 (string-append "TEXMFROOT = " data)))
165 (system* "mv" "texmf-dist" data)
166 (chdir ".."))
167 ;; texmf.cnf must also be placed in "out", since kpsewhich does
168 ;; not know about "data" until it has found this file.
169 (mkdir (string-append out "/share/texmf-dist"))
170 (mkdir (string-append out "/share/texmf-dist/web2c"))
171 (copy-file (string-append data "/texmf-dist/web2c/texmf.cnf")
172 (string-append out "/share/texmf-dist/web2c/texmf.cnf"))))
173 (alist-cons-after 'patch-shebangs 'texconfig
174 (lambda* (#:key outputs #:allow-other-keys)
175 (let ((out (assoc-ref outputs "out")))
176 ;; Configure the texlive system; inspired from
177 ;; http://slackbuilds.org/repository/13.37/office/texlive/
178 (setenv "PATH" (string-append (getenv "PATH") ":" out "/bin"))
179 (system* "updmap-sys" "--nohash" "--syncwithtrees")
180 (system* "mktexlsr")
181 (system* "fmtutil-sys" "--all")))
182 %standard-phases))))
183 (synopsis "Tex Live, a package of the TeX typesetting system")
184 (description
185 "TeX Live provides a comprehensive TeX document production system.
186 It includes all the major TeX-related programs, macro packages, and fonts
187 that are free software, including support for many languages around the
188 world.")
189 (license (license:fsf-free "http://tug.org/texlive/copying.html"))
190 (home-page "http://www.tug.org/texlive/")))
191
192 (define-public rubber
193 (package
194 (name "rubber")
195 (version "1.1")
196 (source (origin
197 (method url-fetch)
198 (uri (list (string-append "https://launchpad.net/rubber/trunk/"
199 version "/+download/rubber-"
200 version ".tar.gz")
201 (string-append "http://ebeffara.free.fr/pub/rubber-"
202 version ".tar.gz")))
203 (sha256
204 (base32
205 "1xbkv8ll889933gyi2a5hj7hhh216k04gn8fwz5lfv5iz8s34gbq"))))
206 (build-system gnu-build-system)
207 (arguments '(#:tests? #f)) ; no `check' target
208 (inputs `(("texinfo" ,texinfo)
209 ("python" ,python-2) ; incompatible with Python 3 (print syntax)
210 ("which" ,which)))
211 (home-page "https://launchpad.net/rubber")
212 (synopsis "Wrapper for LaTeX and friends")
213 (description
214 "Rubber is a program whose purpose is to handle all tasks related to the
215 compilation of LaTeX documents. This includes compiling the document itself,
216 of course, enough times so that all references are defined, and running BibTeX
217 to manage bibliographic references. Automatic execution of dvips to produce
218 PostScript documents is also included, as well as usage of pdfLaTeX to produce
219 PDF documents.")
220 (license license:gpl2+)))