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