Subject: Re: bug#27296: [PATCH 14/35] build-system: Add 'texlive-build-system'.

From: [email-masked] (Ludovic Courtès)
Date: Fri, 09 Jun 2017 16:50:08 +0200

Ricardo Wurmus <[email-masked]> skribis:

> * guix/build-system/texlive.scm: New file.
> * guix/build/texlive-build-system.scm: New file.
> * Makefile.am (MODULES): Add them.
> * doc/guix.texi (Build Systems): Document it.
> * gnu/packages/tex.scm (%texlive-tag, %texlive-revision): Remove variables.
> (texlife-ref): Remove procedure.

[...]

> +@defvr {Scheme Variable} texlive-build-system
> +This variable is exported by @code{(guix build-system texlive)}.  It is
> +used to build TeX packages in batch mode with a specified engine.  The
> +build system sets the @code{TEXINPUTS} variable to find all TeX source
> +files in the inputs.
> +
> +By default it runs @code{luatex} on all files ending on @code{ins}.  A
> +different engine and format can be specified with the
> +@code{#:tex-format} argument.  Different build targets can be specified
> +with the @code{#:build-targets} argument, which expects a list of file
> +names.  The build system adds only @code{texlive-bin} and
> +@code{texlive-latex-base} (both from @code{(gnu packages tex}) to the
> +inputs.  Both can be overridden with the arguments @code{#:texlive-bin}
> +and @code{#:texlive-latex-base}, respectively.
> +
> +The @code{#:tex-directory} tells the build system where to install the
                             ^
Missing word: “parameter”.

> +(define* (lower name
> +                #:key
> +                source inputs native-inputs outputs
> +                system target
> +                (texlive-latex-base (default-texlive-latex-base))
> +                (texlive-bin (default-texlive-bin))
> +                #:allow-other-keys
> +                #:rest arguments)
> +  "Return a bag for NAME."
> +  (define private-keywords
> +    '(#:source #:target #:inputs #:native-inputs
> +      #:texlive-latex-base #:texlive-bin))
> +
> +  (and (not target)                               ;XXX: no cross-compilation
> +       (bag
> +         (name name)
> +         (system system)

If the result is architecture-independent (is it?), we could do the same
thing regardless of whether TARGET is true.

> +(define texlive-build-system
> +  (build-system
> +    (name 'texlive)
> +    (description "The build system for Texlive packages")

“TeX Live”

> +(define* (build #:key inputs build-targets tex-format #:allow-other-keys)
> +  ;; Find additional tex and sty files
> +  (setenv "TEXINPUTS"
> +          (string-append
> +           (getcwd) ":" (getcwd) "/build:"
> +           (string-join
> +            (append-map (match-lambda
> +                          ((_ . dir)
> +                           (find-files dir
> +                                       (lambda (_ stat)
> +                                         (eq? 'directory (stat:type stat)))
> +                                       #:directories? #t
> +                                       #:stat stat)))
> +                        inputs)
> +            ":")))
> +  (setenv "TEXFORMATS"
> +          (string-append (assoc-ref inputs "texlive-latex-base")
> +                         "/share/texmf-dist/web2c/"))
> +  (setenv "LUAINPUTS"
> +          (string-append (assoc-ref inputs "texlive-latex-base")
> +                         "/share/texmf-dist/tex/latex/base/"))

Should these variables be declared as search paths somewhere?

Otherwise LGTM, thanks!

Ludo’.