guix-kreyren/guix/build-system/texlive.scm
Thiago Jung Bauermann ee25e3fcab
gnu: TeX Live: Update to TeX Live 2021
Use version 20210325 for the tarballs, which is the latest one available on
the historical releases repository. And use subversion tag 2021.3 which is
the latest one available as well.

TeX Live dropped support for using the system’s poppler library after the
2020 version.  Quoting from `m4/kpse-xpdf-flags.m4`:

  # Support for our semi-homegrown libs/xpdf library. This is derived
  # from xpdf source code, but xpdf does not distribute it as a library.
  # It is used by pdftex (and nothing else) to read PDF images.
  # Other engines use the semi-homegrown pplib library (q.v.) for that.

  # The well-known poppler library is also originally derived from xpdf
  # source code, but has been greatly revised and extended. TL used to
  # (sort of) support poppler as the system xpdf, but after the TL 2020
  # release we dropped this, because we switched XeTeX to use pplib, and
  # nothing else used poppler. (No engines ever used poppler to generate
  # their PDF output).
  #
  # poppler is aggressively developed, with requirements for new compilers
  # and language versions. That's fine for them, but since we don't need
  # anything new, it has become too time-consuming and problematic to
  # continue to support it in the TL sources, when we don't have any
  # requirement for it.

Therefore the main change in this commit is making the texlive-bin package
use the embedded pplib and xpdf libraries.

Another noteworthy change is to texlive-latex-l3packages, which now needs
to ship a few pre-generated files that cannot be reproduced during the
build process (the comments in the package definition have more details).

* guix/build-system/texlive.scm (%texlive-tag): Set to “texlive-2021.3”.
(%texlive-revision): Set to 59745.
* gnu/packages/tex.scm (hyph-utf8-scripts, texlive-docstrip,
texlive-unicode-data texlive-hyphen-base, texlive-metafont, texlive-cm,
texlive-courier, texlive-lm, texlive-knuth-lib, texlive-tex-plain,
texlive-hyphen-finnish, texlive-hyphen-german, texlive-hyph-utf8,
texlive-dehyph-exptl, texlive-kpathsea, texlive-latex-fancyvrb,
texlive-graphics-def, texlive-latex-graphics, texlive-hyperref,
texlive-oberdiek, texlive-latex-tools, texlive-latex-l3kernel,
texlive-l3build, texlive-luaotfload, texlive-latex-amsmath, texlive-amscls,
texlive-babel, texlive-generic-babel-german, texlive-babel-swedish,
texlive-psnfss, texlive-latex-draftwatermark, texlive-latex-etoc,
texlive-etoolbox, texlive-latex-polyglossia, texlive-tex-texinfo,
texlive-latex-bookmark, texlive-latex-cmap, texlive-latex-fancyhdr,
texlive-latex-kvoptions, texlive-latex-eso-pic, texlive-latex-multirow,
texlive-latex-parskip, texlive-latex-pdfpages, texlive-metapost,
texlive-latex-acmart, texlive-latex-preview, texlive-latex-acronym,
texlive-pdftex, texlive-latex-media9, texlive-latex-ocgx2,
texlive-latex-ms, texlive-latex-pgf, texlive-latex-pgf-generic,
texlive-latex-koma-script, texlive-generic-ltxcmds, texlive-bibtex,
texlive-context-base, texlive-context, texlive-beamer, texlive-pstricks,
texlive-tools, texlive-latex-xkeyval, texlive-csquotes, texlive-biblatex,
texlive-todonotes, texlive-microtype, texlive-caption, texlive-fontaxes,
texlive-cabin, texlive-newtx, texlive-xcharter, texlive-adjustbox,
texlive-tcolorbox): Update hash.
(texlive-extra-src, texlive-texmf-src): Update version to
“20210325”. Update hash.
(texlive-bin)[source]: Update version to “20210325”. Update hash. Preserve
‘libs/pplib’ and ‘libs/xpdf’.
[inputs]: Update hash for ‘texlive-scripts’.  Remove ‘poppler’.
[arguments]: Remove “--with-system-poppler” and “--with-system-xpdf” from
‘#:configure-flags’.  Remove build phase ‘use-code-for-new-poppler’.
(texlive-hyphen-schoolfinnish): Add public variable.
(texlive-hyphen-macedonian): Add 8bit patterns.  Update hash.
(texlive-latex-base)[template]: Update hash.
[arguments]: Set ‘LUAINPUTS’ environment variable in build phase.
[native-inputs]: Update hash for ‘texlive-luatexconfig’.
[propagated-inputs]: Add ‘texlive-hyphen-schoolfinnish’,
‘texlive-latex-l3kernel’ and ‘texlive-latex-l3packages’.
(texlive-latex-l3packages)[source]: Use ‘texlive-origin’. Update hash. Add
generated files.
[arguments]: Adjust paths for ‘TEXINPUTS’ environment variable. Add build
phase ‘copy-generated-files’.
(texlive-texmf, texlive): Update version to “20210325”.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2021-07-21 15:56:03 +02:00

192 lines
7.4 KiB
Scheme

;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2017 Ricardo Wurmus <rekado@elephly.net>
;;; Copyright © 2021 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2021 Thiago Jung Bauermann <bauermann@kolabnow.com>
;;;
;;; This file is part of GNU Guix.
;;;
;;; GNU Guix is free software; you can redistribute it and/or modify it
;;; under the terms of the GNU General Public License as published by
;;; the Free Software Foundation; either version 3 of the License, or (at
;;; your option) any later version.
;;;
;;; GNU Guix is distributed in the hope that it will be useful, but
;;; WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;;; GNU General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License
;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
(define-module (guix build-system texlive)
#:use-module (guix store)
#:use-module (guix utils)
#:use-module (guix packages)
#:use-module (guix monads)
#:use-module (guix gexp)
#:use-module (guix search-paths)
#:use-module (guix build-system)
#:use-module (guix build-system gnu)
#:use-module (guix svn-download)
#:use-module (ice-9 match)
#:export (%texlive-build-system-modules
texlive-build
texlive-build-system
texlive-ref
texlive-origin
%texlive-tag
%texlive-revision))
;; Commentary:
;;
;; Standard build procedure for Texlive packages.
;;
;; Code:
;; These variables specify the SVN tag and the matching SVN revision. They
;; are taken from https://www.tug.org/svn/texlive/tags/
(define %texlive-tag "texlive-2021.3")
(define %texlive-revision 59745)
(define (texlive-origin name version locations hash)
"Return an <origin> object for a TeX Live package consisting of multiple
LOCATIONS with a provided HASH. Use NAME and VERSION to compute a prettier
name for the checkout directory."
(origin
(method svn-multi-fetch)
(uri (svn-multi-reference
(url (string-append "svn://www.tug.org/texlive/tags/"
%texlive-tag "/Master/texmf-dist/"))
(locations locations)
(revision %texlive-revision)))
(file-name (string-append name "-" version "-checkout"))
(sha256 hash)))
(define* (texlive-ref component #:optional id)
"Return a <svn-reference> object for the package ID, which is part of the
given Texlive COMPONENT. If ID is not provided, COMPONENT is used as the top
level package ID."
(svn-reference
(url (string-append "svn://www.tug.org/texlive/tags/"
%texlive-tag "/Master/texmf-dist/"
"source/" component
(if id
(string-append "/" id)
"")))
(revision %texlive-revision)))
(define %texlive-build-system-modules
;; Build-side modules imported by default.
`((guix build texlive-build-system)
(guix build union)
,@%gnu-build-system-modules))
(define (default-texlive-bin)
"Return the default texlive-bin package."
;; Lazily resolve the binding to avoid a circular dependency.
(let ((tex-mod (resolve-interface '(gnu packages tex))))
(module-ref tex-mod 'texlive-bin)))
(define (default-texlive-latex-base)
"Return the default texlive-latex-base package."
;; Lazily resolve the binding to avoid a circular dependency.
(let ((tex-mod (resolve-interface '(gnu packages tex))))
(module-ref tex-mod 'texlive-latex-base)))
(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
'(#:target #:inputs #:native-inputs
#:texlive-latex-base #:texlive-bin))
(bag
(name name)
(system system)
(host-inputs `(,@(if source
`(("source" ,source))
'())
,@inputs
;; Keep the standard inputs of 'gnu-build-system'.
,@(standard-packages)))
(build-inputs `(("texlive-bin" ,texlive-bin)
,@(if texlive-latex-base
`(("texlive-latex-base" ,texlive-latex-base))
'())
,@native-inputs))
(outputs outputs)
(build texlive-build)
(arguments (strip-keyword-arguments private-keywords arguments))))
(define* (texlive-build name inputs
#:key
source
(tests? #f)
tex-directory
(build-targets #f)
(tex-engine #f)
;; FIXME: This would normally default to "luatex" but
;; LuaTeX has a bug where sometimes it corrupts the
;; heap and aborts. This causes the build of texlive
;; packages to fail at random. The problem is being
;; tracked at <https://issues.guix.gnu.org/48064>.
(tex-format "pdftex")
(phases '(@ (guix build texlive-build-system)
%standard-phases))
(outputs '("out"))
(search-paths '())
(system (%current-system))
(guile #f)
(substitutable? #t)
(imported-modules %texlive-build-system-modules)
(modules '((guix build texlive-build-system)
(guix build union)
(guix build utils))))
"Build SOURCE with INPUTS."
(define builder
(with-imported-modules imported-modules
#~(begin
(use-modules #$@(sexp->gexp modules))
#$(with-build-variables inputs outputs
#~(texlive-build #:name #$name
#:source #+source
#:tex-directory #$tex-directory
#:build-targets #$build-targets
#:tex-engine #$(if tex-engine
tex-engine
tex-format)
#:tex-format #$tex-format
#:system #$system
#:tests? #$tests?
#:phases #$(if (pair? phases)
(sexp->gexp phases)
phases)
#:outputs %outputs
#:inputs %build-inputs
#:search-paths '#$(sexp->gexp
(map search-path-specification->sexp
search-paths)))))))
(gexp->derivation name builder
#:system system
#:target #f
#:substitutable? substitutable?))
(define texlive-build-system
(build-system
(name 'texlive)
(description "The build system for TeX Live packages")
(lower lower)))
;;; texlive.scm ends here