gnu: xorg: Disable not compiling xf86-video-geode.
[jackhill/guix/guix.git] / gnu / packages / texlive.scm
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)
27 #:use-module (gnu packages fontutils)
28 #:use-module (gnu packages ghostscript)
29 #:use-module (gnu packages icu4c)
30 #:use-module (gnu packages libpng)
31 #:use-module (gnu packages pdf)
32 #:use-module (gnu packages perl)
33 #:use-module (gnu packages pkg-config)
34 #:use-module (gnu packages python)
35 #:use-module (gnu packages tcsh)
36 #:use-module (gnu packages xorg)
37 #:use-module (gnu packages zip))
38
39 (define texlive-extra-src
40 (origin
41 (method url-fetch)
42 (uri "ftp://tug.org/historic/systems/texlive/2012/texlive-20120701-extra.tar.xz")
43 (sha256 (base32
44 "0cb8fnv4x281gy5ka779f00ssdmdpjj4x3pkh9j9vq45hrwg3522"))))
45
46 (define texlive-texmf-src
47 (origin
48 (method url-fetch)
49 (uri "ftp://tug.org/historic/systems/texlive/2012/texlive-20120701-texmf.tar.xz")
50 (sha256 (base32
51 "1fn1dg9k7pnh8a80j23zfkbrfnqyc4c2w4ss30dpkqj490nxsywq"))))
52
53 (define-public texlive
54 (package
55 (name "texlive")
56 (version "2012")
57 (source (origin
58 (method url-fetch)
59 (uri "ftp://tug.org/historic/systems/texlive/2012/texlive-20120701-source.tar.xz")
60 (sha256 (base32
61 "10bcrdfsqnc6y3gqcb8ndnjy07i5kz63as39irbq4gmcbmyn2rln"))))
62 (build-system gnu-build-system)
63 (inputs `(("texlive-extra-src" ,texlive-extra-src)
64 ("texlive-texmf-src" ,texlive-texmf-src)
65 ("fontconfig" ,fontconfig)
66 ("freetype" ,freetype)
67 ("icu4c" ,icu4c)
68 ("ghostscript" ,ghostscript)
69 ("libpng" ,libpng)
70 ("libxaw" ,libxaw)
71 ("libxt" ,libxt)
72 ("perl" ,perl)
73 ("poppler" ,poppler)
74 ("pkg-config" ,pkg-config)
75 ;; FIXME: Add interpreters fontforge and ruby,
76 ;; once they are available.
77 ("python" ,python)
78 ("tcsh" ,tcsh)
79 ("teckit" ,teckit)
80 ("t1lib" ,t1lib)
81 ("zlib" ,zlib)
82 ("zziplib" ,zziplib)))
83 (outputs '("out" "data"))
84 (arguments
85 `(#:out-of-source? #t
86 #:configure-flags
87 `("--disable-native-texlive-build"
88 ;; Although the texmf and texmf-dist data is taken from
89 ;; texlive-texmf, setting datarootdir is still useful:
90 ;; "make install" creates symbolic links to scripts in this place.
91 ,(string-append "--datarootdir=" (assoc-ref %outputs "data"))
92 ,(string-append "--infodir=" (assoc-ref %outputs "out") "/share/info")
93 ,(string-append "--mandir=" (assoc-ref %outputs "out") "/share/man")
94 "--with-system-freetype2"
95 ;; "--with-system-gd"
96 ;; "--with-system-graphite"
97 "--with-system-icu"
98 "--with-system-libgs"
99 "--with-system-libpng"
100 "--with-system-poppler"
101 "--with-system-t1lib"
102 "--with-system-teckit"
103 "--with-system-xpdf"
104 "--with-system-zlib"
105 "--with-system-zziplib")
106 #:phases
107 (alist-replace
108 'configure
109 (lambda* (#:key outputs #:allow-other-keys #:rest args)
110 (let ((configure (assoc-ref %standard-phases 'configure)))
111 (substitute* "utils/psutils/Makefile.in"
112 (("/usr/bin/env perl") (which "perl")))
113 (apply configure args)))
114 (alist-cons-after
115 'install 'postinst
116 (lambda* (#:key inputs outputs #:allow-other-keys #:rest args)
117 (let ((texlive-extra (assoc-ref inputs "texlive-extra-src"))
118 (texlive-texmf (assoc-ref inputs "texlive-texmf-src"))
119 (out (assoc-ref outputs "out"))
120 (data (assoc-ref outputs "data"))
121 (unpack (assoc-ref %standard-phases 'unpack))
122 (patch-source-shebangs
123 (assoc-ref %standard-phases 'patch-source-shebangs)))
124 ;; Create symbolic links for the latex variants and their
125 ;; man pages.
126 (with-directory-excursion (string-append out "/bin/")
127 (for-each symlink
128 '("pdftex" "pdftex" "xetex" "luatex")
129 '("latex" "pdflatex" "xelatex" "lualatex")))
130 (with-directory-excursion (string-append out "/share/man/man1/")
131 (symlink "luatex.1" "lualatex.1"))
132 ;; Delete texmf and texmf-dist from "data", since they
133 ;; will be reinstalled from texlive-texmf.
134 (system* "rm" "-r" (string-append data "/texmf"))
135 (system* "rm" "-r" (string-append data "/texmf-dist"))
136 ;; Unpack texlive-extra and install tlpkg.
137 (mkdir "texlive-extra")
138 (with-directory-excursion "texlive-extra"
139 (apply unpack (list #:source texlive-extra))
140 (apply patch-source-shebangs (list #:source texlive-extra))
141 (system* "mv" "tlpkg" data)
142 (chdir ".."))
143 ;; Unpack and install texlive-texmf.
144 (mkdir "texlive-texmf")
145 (with-directory-excursion "texlive-texmf"
146 (apply unpack (list #:source texlive-texmf))
147 (apply patch-source-shebangs (list #:source texlive-texmf))
148 ;; Register "data" for kpathsea in texmf.cnf.
149 (substitute* "texmf/web2c/texmf.cnf"
150 (("TEXMFROOT = \\$SELFAUTOPARENT")
151 (string-append "TEXMFROOT = " data)))
152 (system* "mv" "texmf" data)
153 (system* "mv" "texmf-dist" data)
154 (chdir ".."))
155 ;; texmf.cnf must also be placed in "out", since kpsewhich does
156 ;; not know about "data" until it has found this file.
157 (mkdir (string-append out "/share/texmf"))
158 (mkdir (string-append out "/share/texmf/web2c"))
159 (copy-file (string-append data "/texmf/web2c/texmf.cnf")
160 (string-append out "/share/texmf/web2c/texmf.cnf"))))
161 (alist-cons-after 'patch-shebangs 'texconfig
162 (lambda* (#:key outputs #:allow-other-keys)
163 (let ((out (assoc-ref outputs "out")))
164 ;; Configure the texlive system; inspired from
165 ;; http://slackbuilds.org/repository/13.37/office/texlive/
166 (setenv "PATH" (string-append (getenv "PATH") ":" out "/bin"))
167 (system* "updmap-sys" "--nohash" "--syncwithtrees")
168 (system* "mktexlsr")
169 (system* "fmtutil-sys" "--all")))
170 %standard-phases)))))
171 (synopsis "Tex Live, a package of the TeX typesetting system")
172 (description
173 "TeX Live provides a comprehensive TeX document production system.
174 It includes all the major TeX-related programs, macro packages, and fonts
175 that are free software, including support for many languages around the
176 world.")
177 (license (license:fsf-free "http://tug.org/texlive/copying.html"))
178 (home-page "http://www.tug.org/texlive/")))