gnu: texlive-context: Fix "context" call.

* gnu/packages/tex.scm (texlive-context)[arguments]<#:phases>: Add a phase to
locate "texmfcnf.lua" and another one to make "bin/context" effectively
executable.  Remove meaningless symlinks, too.

Change-Id: Ie0df56da0b3a439cc53e4b15b0506907681ed13b
This commit is contained in:
Nicolas Goaziou 2024-05-28 21:19:59 +02:00 committed by Ludovic Courtès
parent b385b88638
commit db0517f323
No known key found for this signature in database
GPG key ID: 090B11993D9AEBB5

View file

@ -58768,17 +58768,30 @@ (define-public texlive-context
(build-system texlive-build-system) (build-system texlive-build-system)
(arguments (arguments
(list (list
#:link-scripts #~(list "context.lua" "mtxrun.lua") #:link-scripts #~(list "mtxrun.lua")
#:phases #:phases
#~(modify-phases %standard-phases #~(modify-phases %standard-phases
(add-after 'link-scripts 'add-symlinks (add-after 'unpack 'locate-texmfcnf.lua
;; Out of the box, "mtxrun" first looks for "texmfcnf.lua" in
;; "~/texmf", then in TEXMFCNF. The latter is set within
;; TEXLIVE-LIBKPATHSEA; it cannot contain the configuration file
;; provided by TEXLIVE-LUATEX. Point to the right file instead.
(lambda* (#:key inputs #:allow-other-keys)
(let ((texmfcnf.lua
(search-input-file inputs
"share/texmf-dist/web2c/texmfcnf.lua")))
(substitute* (find-files "." "\\.lua$")
(("kpse\\.default_texmfcnf\\(\\)")
(format #f "\"~a\"" (dirname texmfcnf.lua)))))))
(add-after 'unpack 'create-context-wrapper
;; Create a "context" script for convenience.
(lambda _ (lambda _
(mkdir-p (string-append #$output "/bin"))
(with-directory-excursion (string-append #$output "/bin") (with-directory-excursion (string-append #$output "/bin")
(symlink "../share/texmf-dist/scripts/context/lua/context.lua" (call-with-output-file "context"
"context.lua") (lambda (port)
(symlink "../share/texmf-dist/scripts/context/lua/mtxrun.lua" (format port "#!/bin/sh~%mtxrun --script context \"$@\"")))
"mtxrun.lua") (chmod "context" #o755)))))))
(symlink "mtxrun" "luametatex")))))))
(propagated-inputs (propagated-inputs
(list texlive-amsfonts (list texlive-amsfonts
texlive-lm texlive-lm