build-system: texlive: Build union in configure phase.
This allows us to use texmf.cnf instead of having to set all required environment variables manually. * guix/build/texlive-build-system.scm (configure): New procedure. (build): Simplify. (%standard-phases): Add configure phase. * guix/build-system/texlive.scm (texlive-build): Include (guix build union) in modules. (%texlive-build-system-modules): Likewise.
This commit is contained in:
parent
1678be097b
commit
bb3b35975c
|
@ -55,6 +55,7 @@ given Texlive COMPONENT."
|
||||||
(define %texlive-build-system-modules
|
(define %texlive-build-system-modules
|
||||||
;; Build-side modules imported by default.
|
;; Build-side modules imported by default.
|
||||||
`((guix build texlive-build-system)
|
`((guix build texlive-build-system)
|
||||||
|
(guix build union)
|
||||||
,@%gnu-build-system-modules))
|
,@%gnu-build-system-modules))
|
||||||
|
|
||||||
(define (default-texlive-bin)
|
(define (default-texlive-bin)
|
||||||
|
@ -114,6 +115,7 @@ given Texlive COMPONENT."
|
||||||
(substitutable? #t)
|
(substitutable? #t)
|
||||||
(imported-modules %texlive-build-system-modules)
|
(imported-modules %texlive-build-system-modules)
|
||||||
(modules '((guix build texlive-build-system)
|
(modules '((guix build texlive-build-system)
|
||||||
|
(guix build union)
|
||||||
(guix build utils))))
|
(guix build utils))))
|
||||||
"Build SOURCE with INPUTS."
|
"Build SOURCE with INPUTS."
|
||||||
(define builder
|
(define builder
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
(define-module (guix build texlive-build-system)
|
(define-module (guix build texlive-build-system)
|
||||||
#:use-module ((guix build gnu-build-system) #:prefix gnu:)
|
#:use-module ((guix build gnu-build-system) #:prefix gnu:)
|
||||||
#:use-module (guix build utils)
|
#:use-module (guix build utils)
|
||||||
|
#:use-module (guix build union)
|
||||||
#:use-module (ice-9 match)
|
#:use-module (ice-9 match)
|
||||||
#:use-module (ice-9 ftw)
|
#:use-module (ice-9 ftw)
|
||||||
#:use-module (srfi srfi-1)
|
#:use-module (srfi srfi-1)
|
||||||
|
@ -39,28 +40,31 @@
|
||||||
(string-append "&" format)
|
(string-append "&" format)
|
||||||
file)))
|
file)))
|
||||||
|
|
||||||
(define* (build #:key inputs build-targets tex-format #:allow-other-keys)
|
(define* (configure #:key inputs #:allow-other-keys)
|
||||||
;; Find additional tex and sty files
|
(let* ((out (string-append (getcwd) "/.texlive-union"))
|
||||||
(setenv "TEXINPUTS"
|
(texmf.cnf (string-append out "/share/texmf-dist/web2c/texmf.cnf")))
|
||||||
(string-append
|
;; Build a modifiable union of all inputs (but exclude bash)
|
||||||
(getcwd) ":" (getcwd) "/build:"
|
(match inputs
|
||||||
(string-join
|
(((names . directories) ...)
|
||||||
(append-map (match-lambda
|
(union-build out directories
|
||||||
((_ . dir)
|
#:create-all-directories? #t
|
||||||
(find-files dir
|
#:log-port (%make-void-port "w"))))
|
||||||
(lambda (_ stat)
|
|
||||||
(eq? 'directory (stat:type stat)))
|
;; The configuration file "texmf.cnf" is provided by the
|
||||||
#:directories? #t
|
;; "texlive-bin" package. We take it and override only the
|
||||||
#:stat stat)))
|
;; setting for TEXMFROOT and TEXMF. This file won't be consulted
|
||||||
inputs)
|
;; by default, though, so we still need to set TEXMFCNF.
|
||||||
":")))
|
(substitute* texmf.cnf
|
||||||
(setenv "TEXFORMATS"
|
(("^TEXMFROOT = .*")
|
||||||
(string-append (assoc-ref inputs "texlive-latex-base")
|
(string-append "TEXMFROOT = " out "/share\n"))
|
||||||
"/share/texmf-dist/web2c/"))
|
(("^TEXMF = .*")
|
||||||
(setenv "LUAINPUTS"
|
"TEXMF = $TEXMFROOT/share/texmf-dist\n"))
|
||||||
(string-append (assoc-ref inputs "texlive-latex-base")
|
(setenv "TEXMFCNF" (dirname texmf.cnf))
|
||||||
"/share/texmf-dist/tex/latex/base/"))
|
(setenv "TEXMF" (string-append out "/share/texmf-dist")))
|
||||||
(mkdir "build")
|
(mkdir "build")
|
||||||
|
#t)
|
||||||
|
|
||||||
|
(define* (build #:key inputs build-targets tex-format #:allow-other-keys)
|
||||||
(every (cut compile-with-latex tex-format <>)
|
(every (cut compile-with-latex tex-format <>)
|
||||||
(if build-targets build-targets
|
(if build-targets build-targets
|
||||||
(scandir "." (cut string-suffix? ".ins" <>)))))
|
(scandir "." (cut string-suffix? ".ins" <>)))))
|
||||||
|
@ -77,7 +81,7 @@
|
||||||
|
|
||||||
(define %standard-phases
|
(define %standard-phases
|
||||||
(modify-phases gnu:%standard-phases
|
(modify-phases gnu:%standard-phases
|
||||||
(delete 'configure)
|
(replace 'configure configure)
|
||||||
(replace 'build build)
|
(replace 'build build)
|
||||||
(delete 'check)
|
(delete 'check)
|
||||||
(replace 'install install)))
|
(replace 'install install)))
|
||||||
|
|
Loading…
Reference in New Issue