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