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