gnu: gnupg: Fix cross-compile issues.
[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)
eb0119ef 78 ("perl" ,perl)
fd89b36b 79 ("pixman" ,pixman)
eb0119ef
AE
80 ("poppler" ,poppler)
81 ("pkg-config" ,pkg-config)
95b6c70f 82 ;; FIXME: Add interpreters fontforge and ruby,
eb0119ef 83 ;; once they are available.
78fed064 84 ("python" ,python-2) ; incompatible with Python 3 (print syntax)
95b6c70f 85 ("tcsh" ,tcsh)
eb0119ef
AE
86 ("teckit" ,teckit)
87 ("t1lib" ,t1lib)
88 ("zlib" ,zlib)
89 ("zziplib" ,zziplib)))
90 (outputs '("out" "data"))
91 (arguments
92 `(#:out-of-source? #t
93 #:configure-flags
94 `("--disable-native-texlive-build"
fd89b36b
AE
95 ;; Although the texmf-dist data is taken from texlive-texmf,
96 ;; setting datarootdir is still useful:
eb0119ef
AE
97 ;; "make install" creates symbolic links to scripts in this place.
98 ,(string-append "--datarootdir=" (assoc-ref %outputs "data"))
99 ,(string-append "--infodir=" (assoc-ref %outputs "out") "/share/info")
100 ,(string-append "--mandir=" (assoc-ref %outputs "out") "/share/man")
fd89b36b 101 "--with-system-cairo"
eb0119ef 102 "--with-system-freetype2"
fd89b36b
AE
103 "--with-system-gd"
104 ;; "--with-system-graphite2" ; requires cmake build system
105 ;; "--with-system-harfbuzz" ; requires --with-system-graphite2
eb0119ef
AE
106 "--with-system-icu"
107 "--with-system-libgs"
108 "--with-system-libpng"
fd89b36b 109 "--with-system-pixman"
eb0119ef
AE
110 "--with-system-poppler"
111 "--with-system-t1lib"
112 "--with-system-teckit"
113 "--with-system-xpdf"
114 "--with-system-zlib"
115 "--with-system-zziplib")
116 #:phases
117 (alist-replace
118 'configure
119 (lambda* (#:key outputs #:allow-other-keys #:rest args)
120 (let ((configure (assoc-ref %standard-phases 'configure)))
121 (substitute* "utils/psutils/Makefile.in"
122 (("/usr/bin/env perl") (which "perl")))
123 (apply configure args)))
124 (alist-cons-after
125 'install 'postinst
126 (lambda* (#:key inputs outputs #:allow-other-keys #:rest args)
127 (let ((texlive-extra (assoc-ref inputs "texlive-extra-src"))
128 (texlive-texmf (assoc-ref inputs "texlive-texmf-src"))
129 (out (assoc-ref outputs "out"))
130 (data (assoc-ref outputs "data"))
131 (unpack (assoc-ref %standard-phases 'unpack))
132 (patch-source-shebangs
133 (assoc-ref %standard-phases 'patch-source-shebangs)))
134 ;; Create symbolic links for the latex variants and their
135 ;; man pages.
136 (with-directory-excursion (string-append out "/bin/")
137 (for-each symlink
138 '("pdftex" "pdftex" "xetex" "luatex")
139 '("latex" "pdflatex" "xelatex" "lualatex")))
140 (with-directory-excursion (string-append out "/share/man/man1/")
141 (symlink "luatex.1" "lualatex.1"))
fd89b36b
AE
142 ;; Delete texmf-dist from "data", since it will be reinstalled
143 ;; from texlive-texmf.
eb0119ef
AE
144 (system* "rm" "-r" (string-append data "/texmf-dist"))
145 ;; Unpack texlive-extra and install tlpkg.
146 (mkdir "texlive-extra")
147 (with-directory-excursion "texlive-extra"
148 (apply unpack (list #:source texlive-extra))
149 (apply patch-source-shebangs (list #:source texlive-extra))
150 (system* "mv" "tlpkg" data)
151 (chdir ".."))
152 ;; Unpack and install texlive-texmf.
153 (mkdir "texlive-texmf")
154 (with-directory-excursion "texlive-texmf"
155 (apply unpack (list #:source texlive-texmf))
156 (apply patch-source-shebangs (list #:source texlive-texmf))
157 ;; Register "data" for kpathsea in texmf.cnf.
fd89b36b 158 (substitute* "texmf-dist/web2c/texmf.cnf"
eb0119ef
AE
159 (("TEXMFROOT = \\$SELFAUTOPARENT")
160 (string-append "TEXMFROOT = " data)))
eb0119ef
AE
161 (system* "mv" "texmf-dist" data)
162 (chdir ".."))
163 ;; texmf.cnf must also be placed in "out", since kpsewhich does
164 ;; not know about "data" until it has found this file.
fd89b36b
AE
165 (mkdir (string-append out "/share/texmf-dist"))
166 (mkdir (string-append out "/share/texmf-dist/web2c"))
167 (copy-file (string-append data "/texmf-dist/web2c/texmf.cnf")
168 (string-append out "/share/texmf-dist/web2c/texmf.cnf"))))
eb0119ef
AE
169 (alist-cons-after 'patch-shebangs 'texconfig
170 (lambda* (#:key outputs #:allow-other-keys)
171 (let ((out (assoc-ref outputs "out")))
172 ;; Configure the texlive system; inspired from
173 ;; http://slackbuilds.org/repository/13.37/office/texlive/
174 (setenv "PATH" (string-append (getenv "PATH") ":" out "/bin"))
175 (system* "updmap-sys" "--nohash" "--syncwithtrees")
176 (system* "mktexlsr")
177 (system* "fmtutil-sys" "--all")))
178 %standard-phases)))))
179 (synopsis "Tex Live, a package of the TeX typesetting system")
180 (description
181 "TeX Live provides a comprehensive TeX document production system.
182It includes all the major TeX-related programs, macro packages, and fonts
183that are free software, including support for many languages around the
184world.")
185 (license (license:fsf-free "http://tug.org/texlive/copying.html"))
186 (home-page "http://www.tug.org/texlive/")))
231eae53
LC
187
188(define-public rubber
189 (package
190 (name "rubber")
191 (version "1.1")
192 (source (origin
193 (method url-fetch)
194 (uri (list (string-append "https://launchpad.net/rubber/trunk/"
195 version "/+download/rubber-"
196 version ".tar.gz")
197 (string-append "http://ebeffara.free.fr/pub/rubber-"
198 version ".tar.gz")))
199 (sha256
200 (base32
201 "1xbkv8ll889933gyi2a5hj7hhh216k04gn8fwz5lfv5iz8s34gbq"))))
202 (build-system gnu-build-system)
203 (arguments '(#:tests? #f)) ; no `check' target
204 (inputs `(("texinfo" ,texinfo)
9bee5d6c 205 ("python" ,python-2) ; incompatible with Python 3 (print syntax)
231eae53
LC
206 ("which" ,which)))
207 (home-page "https://launchpad.net/rubber")
208 (synopsis "Rubber, a wrapper for LaTeX and friends")
209 (description
210 "Rubber is a program whose purpose is to handle all tasks related to the
211compilation of LaTeX documents. This includes compiling the document itself,
212of course, enough times so that all references are defined, and running BibTeX
213to manage bibliographic references. Automatic execution of dvips to produce
214PostScript documents is also included, as well as usage of pdfLaTeX to produce
215PDF documents.")
216 (license license:gpl2+)))