1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2017 Ricardo Wurmus <rekado@elephly.net>
4 ;;; This file is part of GNU Guix.
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.
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.
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/>.
19 (define-module (guix build-system texlive)
20 #:use-module (guix store)
21 #:use-module (guix utils)
22 #:use-module (guix packages)
23 #:use-module (guix derivations)
24 #:use-module (guix search-paths)
25 #:use-module (guix build-system)
26 #:use-module (guix build-system gnu)
27 #:use-module (guix svn-download)
28 #:use-module (ice-9 match)
29 #:export (%texlive-build-system-modules
39 ;; Standard build procedure for Texlive packages.
43 ;; These variables specify the SVN tag and the matching SVN revision. They
44 ;; are taken from https://www.tug.org/svn/texlive/tags/
45 (define %texlive-tag "texlive-2019.3")
46 (define %texlive-revision 51265)
48 (define (texlive-origin name version locations hash)
49 "Return an <origin> object for a TeX Live package consisting of multiple
50 LOCATIONS with a provided HASH. Use NAME and VERSION to compute a prettier
51 name for the checkout directory."
53 (method svn-multi-fetch)
54 (uri (svn-multi-reference
55 (url (string-append "svn://www.tug.org/texlive/tags/"
56 %texlive-tag "/Master/texmf-dist/"))
58 (revision %texlive-revision)))
59 (file-name (string-append name "-" version "-checkout"))
62 (define (texlive-ref component id)
63 "Return a <svn-reference> object for the package ID, which is part of the
64 given Texlive COMPONENT."
66 (url (string-append "svn://www.tug.org/texlive/tags/"
67 %texlive-tag "/Master/texmf-dist/"
68 "source/" component "/" id))
69 (revision %texlive-revision)))
71 (define %texlive-build-system-modules
72 ;; Build-side modules imported by default.
73 `((guix build texlive-build-system)
75 ,@%gnu-build-system-modules))
77 (define (default-texlive-bin)
78 "Return the default texlive-bin package."
79 ;; Lazily resolve the binding to avoid a circular dependency.
80 (let ((tex-mod (resolve-interface '(gnu packages tex))))
81 (module-ref tex-mod 'texlive-bin)))
83 (define (default-texlive-latex-base)
84 "Return the default texlive-latex-base package."
85 ;; Lazily resolve the binding to avoid a circular dependency.
86 (let ((tex-mod (resolve-interface '(gnu packages tex))))
87 (module-ref tex-mod 'texlive-latex-base)))
91 source inputs native-inputs outputs
93 (texlive-latex-base (default-texlive-latex-base))
94 (texlive-bin (default-texlive-bin))
97 "Return a bag for NAME."
98 (define private-keywords
99 '(#:source #:target #:inputs #:native-inputs
100 #:texlive-latex-base #:texlive-bin))
105 (host-inputs `(,@(if source
106 `(("source" ,source))
110 ;; Keep the standard inputs of 'gnu-build-system'.
111 ,@(standard-packages)))
112 (build-inputs `(("texlive-bin" ,texlive-bin)
113 ("texlive-latex-base" ,texlive-latex-base)
116 (build texlive-build)
117 (arguments (strip-keyword-arguments private-keywords arguments))))
119 (define* (texlive-build store name inputs
124 (tex-format "luatex")
125 (phases '(@ (guix build texlive-build-system)
129 (system (%current-system))
132 (imported-modules %texlive-build-system-modules)
133 (modules '((guix build texlive-build-system)
135 (guix build utils))))
136 "Build SOURCE with INPUTS."
139 (use-modules ,@modules)
140 (texlive-build #:name ,name
141 #:source ,(match (assoc-ref inputs "source")
142 (((? derivation? source))
143 (derivation->output-path source))
148 #:tex-directory ,tex-directory
149 #:build-targets ,build-targets
150 #:tex-format ,tex-format
155 #:search-paths ',(map search-path-specification->sexp
157 #:inputs %build-inputs)))
159 (define guile-for-build
162 (package-derivation store guile system #:graft? #f))
164 (let* ((distro (resolve-interface '(gnu packages commencement)))
165 (guile (module-ref distro 'guile-final)))
166 (package-derivation store guile system #:graft? #f)))))
168 (build-expression->derivation store name builder
171 #:modules imported-modules
173 #:guile-for-build guile-for-build
174 #:substitutable? substitutable?))
176 (define texlive-build-system
179 (description "The build system for TeX Live packages")
182 ;;; texlive.scm ends here