me
/
guix
Archived
1
0
Fork 0

gnu: Externalize libkpathsea in texlive and texlive-bin.

* gnu/packages/tex.scm (texlive-libkpathsea): New variable.
(texlive-bin): Inherit from above.
[arguments]<#:configure-flags>: Use "--disable-kpathsea",
"--with-system-kpathsea", "--with-kpathsea-includes" and
"--with-kpathsea-lib".
<#:phases>: Remove phases now handled by the package above.
[native-inputs]: Add GROFF-MINIMAL.
[propagated-inputs]: Add TEXLIVE-LIBKPATHSEA.
(texlive-bin-full): New variable.
(texlive-texmf)[build-system]: Use COPY-BUILD-SYSTEM.
[arguments]: Set #:INSTALL-PLAN accordingly.  Replace TEXLIVE-BIN with
TEXLIVE-BIN-FULL.
* guix/profiles.scm (texlive-font-maps): Fetch executables from
TEXLIVE-LIBKPATHSEA instead of TEXLIVE-BIN.
Nicolas Goaziou 2023-06-26 12:00:51 +02:00
parent 0561616a32
commit 19fd100413
No known key found for this signature in database
GPG Key ID: DA00B4F048E92F2D
2 changed files with 350 additions and 217 deletions

View File

@ -77,6 +77,7 @@
#:use-module (gnu packages gd) #:use-module (gnu packages gd)
#:use-module (gnu packages ghostscript) #:use-module (gnu packages ghostscript)
#:use-module (gnu packages graphviz) #:use-module (gnu packages graphviz)
#:use-module (gnu packages groff)
#:use-module (gnu packages gtk) #:use-module (gnu packages gtk)
#:use-module (gnu packages icu4c) #:use-module (gnu packages icu4c)
#:use-module (gnu packages image) #:use-module (gnu packages image)
@ -108,6 +109,96 @@
(define-deprecated/public old-name name (define-deprecated/public old-name name
(deprecated-package (symbol->string 'old-name) name))) (deprecated-package (symbol->string 'old-name) name)))
(define-public texlive-libkpathsea
(package
(name "texlive-libkpathsea")
(version "20230313")
(source
(origin
(method url-fetch)
(uri (string-append "ftp://tug.org/historic/systems/texlive/"
(string-take version 4)
"/texlive-" version "-source.tar.xz"))
(sha256
(base32
"1fbrkv7g9j6ipmwjx27l8l9l974rmply8bhf7c2iqc6h3q7aly1q"))
(modules '((guix build utils)
(ice-9 ftw)))
(snippet
#~(begin
(with-directory-excursion "libs"
(for-each
delete-file-recursively
(scandir "."
(lambda (file)
(and (not (member file '("." "..")))
(eq? 'directory (stat:type (stat file))))))))
(with-directory-excursion "texk"
(let ((preserved-directories '("." ".." "kpathsea")))
(for-each
delete-file-recursively
(scandir "."
(lambda (file)
(and (not (member file preserved-directories))
(eq? 'directory (stat:type (stat file)))))))))))))
(build-system gnu-build-system)
(arguments
(list
#:out-of-source? #t
#:configure-flags
#~(list "--disable-static"
"--disable-native-texlive-build"
"--enable-shared"
"--with-banner-add=/GNU Guix"
"--disable-all-pkgs"
"--enable-kpathsea")
#:phases
#~(modify-phases %standard-phases
(add-after 'unpack 'customize-texmf.cnf
;; The default "texmf.cnf" file is provided by this package.
;; Every variable of interest is set relatively to the GUIX_TEXMF
;; environment variable defined via a search path below.
;;
;; This phase must happen before the `configure' phase, because
;; the value of the TEXMFCNF variable (modified along with the
;; SELFAUTOLOC reference below) is used at compile time to
;; generate "paths.h" file.
(lambda _
(substitute* "texk/kpathsea/texmf.cnf"
(("^TEXMFROOT = .*")
"TEXMFROOT = {$GUIX_TEXMF}/..\n")
(("^TEXMF = .*")
"TEXMF = {$GUIX_TEXMF}\n")
(("\\$SELFAUTOLOC(/share/texmf-dist/web2c)" _ suffix)
(string-append #$output suffix))
;; Don't truncate lines.
(("^error_line = .*$") "error_line = 254\n")
(("^half_error_line = .*$") "half_error_line = 238\n")
(("^max_print_line = .*$") "max_print_line = 1000\n"))))
(add-after 'unpack 'patch-directory-traversal
;; When ST_NLINK_TRICK is set, kpathsea attempts to avoid work
;; when searching files by assuming that a directory with exactly
;; two links has no subdirectories. This assumption does not hold
;; in our case, so some directories with symlinked sub-directories
;; would not be traversed.
(lambda _
(substitute* "texk/kpathsea/config.h"
(("#define ST_NLINK_TRICK") ""))))
(add-after 'install 'post-install
(lambda _
(with-directory-excursion "texk/kpathsea"
(invoke "make" "install")))))))
(native-search-paths
(list (search-path-specification
(variable "GUIX_TEXMF")
(files '("share/texmf-dist")))))
(home-page "https://www.tug.org/texlive/")
(synopsis "Path searching library")
(description
"Kpathsea is a library whose purpose is to return a filename from a list
of user-specified directories similar to how shells look up executables.")
(license license:lgpl2.1)))
(define-public texlive-scripts (define-public texlive-scripts
(package (package
(name "texlive-scripts") (name "texlive-scripts")
@ -473,20 +564,11 @@ and should be preferred to it whenever a package would otherwise depend on
(define-deprecated-package texlive-ukrhyph texlive-hyphen-complete) (define-deprecated-package texlive-ukrhyph texlive-hyphen-complete)
(define-public texlive-bin (define-public texlive-bin
(package (package/inherit texlive-libkpathsea
(name "texlive-bin") (name "texlive-bin")
(version "20230313")
(source (source
(origin (origin
(method url-fetch) (inherit (package-source texlive-libkpathsea))
(uri (string-append "ftp://tug.org/historic/systems/texlive/"
(string-take version 4)
"/texlive-" version "-source.tar.xz"))
(sha256
(base32
"1fbrkv7g9j6ipmwjx27l8l9l974rmply8bhf7c2iqc6h3q7aly1q"))
(modules '((guix build utils)
(ice-9 ftw)))
(snippet (snippet
;; TODO: Unbundle stuff in texk/dvisvgm/dvisvgm-src/libs too. ;; TODO: Unbundle stuff in texk/dvisvgm/dvisvgm-src/libs too.
#~(with-directory-excursion "libs" #~(with-directory-excursion "libs"
@ -498,36 +580,8 @@ and should be preferred to it whenever a package would otherwise depend on
(scandir "." (scandir "."
(lambda (file) (lambda (file)
(and (not (member file preserved-directories)) (and (not (member file preserved-directories))
(eq? 'directory (stat:type (stat file)))))))))))) (eq? 'directory
(build-system gnu-build-system) (stat:type (stat file))))))))))))
(native-inputs (list pkg-config))
(inputs
(list config
cairo
fontconfig
fontforge
freetype
gd
gmp
ghostscript
graphite2
harfbuzz
icu4c
libpaper
libpng
libxaw
libxt
mpfr
perl
pixman
potrace
python
ruby-2.7
tcsh
teckit
zlib
zziplib))
(propagated-inputs (list texlive-scripts))
(arguments (arguments
(list (list
#:modules '((guix build gnu-build-system) #:modules '((guix build gnu-build-system)
@ -538,36 +592,41 @@ and should be preferred to it whenever a package would otherwise depend on
#:out-of-source? #t #:out-of-source? #t
#:parallel-tests? #f ;bibtex8.test fails otherwise #:parallel-tests? #f ;bibtex8.test fails otherwise
#:configure-flags #:configure-flags
#~(list "--disable-static" #~(let ((kpathsea #$(this-package-input "texlive-libkpathsea")))
;; "Linked scripts" are taken care of in their respective (list "--with-banner-add=/GNU Guix"
;; packages. "--enable-shared"
"--disable-linked-scripts" "--disable-native-texlive-build"
"--disable-native-texlive-build" "--disable-static"
"--enable-shared" "--disable-linked-scripts"
"--with-banner-add=/GNU Guix" "--disable-kpathsea"
"--with-system-cairo" "--with-system-cairo"
"--with-system-freetype2" "--with-system-freetype2"
"--with-system-gd" "--with-system-gd"
"--with-system-gmp" "--with-system-gmp"
"--with-system-graphite2" "--with-system-graphite2"
"--with-system-harfbuzz" "--with-system-harfbuzz"
"--with-system-icu" "--with-system-icu"
"--with-system-libgs" "--with-system-libgs"
"--with-system-libpaper" "--with-system-libpaper"
"--with-system-libpng" "--with-system-libpng"
"--with-system-mpfr" "--with-system-mpfr"
"--with-system-pixman" "--with-system-pixman"
"--with-system-potrace" "--with-system-potrace"
"--with-system-teckit" "--with-system-teckit"
"--with-system-zlib" "--with-system-zlib"
"--with-system-zziplib" "--with-system-zziplib"
;; LuaJIT is not ported to some architectures yet. ;; Help locating external kpathsea. For some reason
#$@(if (or (target-ppc64le?) ;; PKG-CONFIG is unable to find it.
(target-riscv64?)) "--with-system-kpathsea"
'("--disable-luajittex" (format #f "--with-kpathsea-includes=~a/include" kpathsea)
"--disable-luajithbtex" (format #f "--with-kpathsea-lib=~a/lib" kpathsea)
"--disable-mfluajit") ;; LuaJIT is not ported to some architectures yet.
'())) #$@(if (or (target-ppc64le?)
(target-riscv64?))
'("--disable-luajittex"
"--disable-luajithbtex"
"--disable-mfluajit")
'())))
;; Disable tests on some architectures to cope with a failure of ;; Disable tests on some architectures to cope with a failure of
;; luajiterr.test. ;; luajiterr.test.
;; ;;
@ -579,6 +638,14 @@ and should be preferred to it whenever a package would otherwise depend on
(string-prefix? "powerpc64le" s)))) (string-prefix? "powerpc64le" s))))
#:phases #:phases
#~(modify-phases %standard-phases #~(modify-phases %standard-phases
(add-after 'unpack 'locate-external-kpathsea
;; Despite our best efforts, the configure scripts below is not
;; able to find external kpathsea.
(lambda _
(substitute* "texk/web2c/configure"
(("/usr/include /usr/local/include")
(string-append #$(this-package-input "texlive-libkpathsea")
"/include")))))
(add-after 'unpack 'patch-psutils-test (add-after 'unpack 'patch-psutils-test
(lambda _ (lambda _
;; This test fails due to a rounding difference with libpaper ;; This test fails due to a rounding difference with libpaper
@ -621,15 +688,6 @@ and should be preferred to it whenever a package would otherwise depend on
(("srcdir/tests/pprecA-0.ind pprecA-0.ind1 \\|\\| exit 1") (("srcdir/tests/pprecA-0.ind pprecA-0.ind1 \\|\\| exit 1")
"srcdir/tests/pprecA-0.ind pprecA-0.ind1 || exit 77"))))) "srcdir/tests/pprecA-0.ind pprecA-0.ind1 || exit 77")))))
'()) '())
;; When ST_NLINK_TRICK is set, kpathsea attempts to avoid work when
;; searching files by assuming that a directory with exactly two
;; links has no subdirectories. This assumption does not hold in our
;; case, so some directories with symlinked subdirectories would not
;; be traversed.
(add-after 'unpack 'patch-directory-traversal
(lambda _
(substitute* "texk/kpathsea/config.h"
(("#define ST_NLINK_TRICK") ""))))
#$@(if (target-arm32?) #$@(if (target-arm32?)
`((add-after 'unpack 'skip-faulty-test `((add-after 'unpack 'skip-faulty-test
(lambda _ (lambda _
@ -640,31 +698,6 @@ and should be preferred to it whenever a package would otherwise depend on
(("^TEXMFCNF=" all) (("^TEXMFCNF=" all)
(string-append "exit 77 # skip\n" all)))))) (string-append "exit 77 # skip\n" all))))))
'()) '())
(add-after 'check 'customize-texmf.cnf
;; The default texmf.cnf is provided by this package, texlive-bin.
;; Every variable of interest is set relatively to the GUIX_TEXMF
;; environment variable defined via a search path specification
;; further below. The configuration file is patched after the test
;; suite has run, as it relies on the default configuration to find
;; its paths (and the GUIX_TEXMF variable isn't set yet).
(lambda _
;; The current directory is build/ because of the out-of-tree
;; build.
(let* ((source (first (scandir ".." (cut string-suffix?
"source" <>))))
(texmf.cnf (string-append "../" source
"/texk/kpathsea/texmf.cnf")))
(substitute* texmf.cnf
(("^TEXMFROOT = .*")
"TEXMFROOT = {$GUIX_TEXMF}/..\n")
(("^TEXMF = .*")
"TEXMF = {$GUIX_TEXMF}\n")
(("^%TEXMFCNF = .*")
"TEXMFCNF = {$GUIX_TEXMF}/web2c\n")
;; Don't truncate lines.
(("^error_line = .*$") "error_line = 254\n")
(("^half_error_line = .*$") "half_error_line = 238\n")
(("^max_print_line = .*$") "max_print_line = 1000\n")))))
(add-after 'install 'post-install (add-after 'install 'post-install
(lambda _ (lambda _
;; Create symbolic links for the latex variants. We link ;; Create symbolic links for the latex variants. We link
@ -680,10 +713,34 @@ and should be preferred to it whenever a package would otherwise depend on
(string-append (getenv "PATH") ":" #$output "/bin")) (string-append (getenv "PATH") ":" #$output "/bin"))
(with-directory-excursion #$output (with-directory-excursion #$output
(assoc-ref %standard-phases 'patch-source-shebangs))))))) (assoc-ref %standard-phases 'patch-source-shebangs)))))))
(native-search-paths (native-inputs (list groff-minimal pkg-config))
(list (search-path-specification (inputs
(variable "GUIX_TEXMF") (list cairo
(files '("share/texmf-dist"))))) config
fontconfig
fontforge
freetype
gd
ghostscript
gmp
graphite2
harfbuzz
icu4c
libpaper
libpng
libxaw
libxt
mpfr
perl
pixman
potrace
python
ruby-2.7
tcsh
teckit
zlib
zziplib))
(propagated-inputs (list texlive-libkpathsea texlive-scripts))
(synopsis "TeX Live, a package of the TeX typesetting system") (synopsis "TeX Live, a package of the TeX typesetting system")
(description (description
"TeX Live provides a comprehensive TeX document production system. "TeX Live provides a comprehensive TeX document production system.
@ -910,40 +967,6 @@ right to left and left to right modes.")
a re-implementation of the @code{shadowtext} package adding Bidi support.") a re-implementation of the @code{shadowtext} package adding Bidi support.")
(license license:lppl1.3+))) (license license:lppl1.3+)))
(define-public texlive-libkpathsea
(package/inherit texlive-bin
(name "texlive-libkpathsea")
(source
(origin
(inherit (package-source texlive-bin))
(snippet
`(begin
,(origin-snippet (package-source texlive-bin))
(with-directory-excursion "texk"
(let ((preserved-directories '("." ".." "kpathsea")))
(for-each
delete-file-recursively
(scandir "."
(lambda (file)
(and (not (member file preserved-directories))
(eq? 'directory (stat:type (stat file)))))))))))))
(arguments
(substitute-keyword-arguments (package-arguments texlive-bin)
((#:configure-flags flags)
`(cons* "--disable-all-pkgs" "--enable-kpathsea"
"--enable-shared" ,flags))
((#:phases phases)
`(modify-phases %standard-phases
(add-after 'install 'post-install
(lambda* (#:key inputs outputs #:allow-other-keys)
(with-directory-excursion "texk/kpathsea"
(invoke "make" "install"))))))))
(inputs '())
(synopsis "Path searching library")
(description "kpathsea is a library, whose purpose is to return a filename
from a list of user-specified directories similar to how shells look up
executables. It is maintained as a part of TeX Live.")))
(define-public texlive-alphalph (define-public texlive-alphalph
(package (package
(name "texlive-alphalph") (name "texlive-alphalph")
@ -10358,6 +10381,133 @@ documents as well as DVI output.")
(define-deprecated-package texlive-generic-pdftex texlive-pdftex) (define-deprecated-package texlive-generic-pdftex texlive-pdftex)
(define texlive-bin-full
(package/inherit texlive-bin
(name "texlive-bin-full")
(arguments
(substitute-keyword-arguments (package-arguments texlive-bin)
((#:configure-flags _)
#~(let ((kpathsea #$(this-package-input "texlive-libkpathsea")))
(list "--with-banner-add=/GNU Guix"
"--enable-shared"
"--disable-native-texlive-build"
"--disable-static"
"--disable-kpathsea"
"--with-system-cairo"
"--with-system-freetype2"
"--with-system-gd"
"--with-system-gmp"
"--with-system-graphite2"
"--with-system-harfbuzz"
"--with-system-icu"
"--with-system-libgs"
"--with-system-libpaper"
"--with-system-libpng"
"--with-system-mpfr"
"--with-system-pixman"
"--with-system-potrace"
"--with-system-teckit"
"--with-system-zlib"
"--with-system-zziplib"
;; Help locating external kpathsea. For some reason
;; PKG-CONFIG is unable to find it.
"--with-system-kpathsea"
(format #f "--with-kpathsea-includes=~a/include" kpathsea)
(format #f "--with-kpathsea-lib=~a/lib" kpathsea)
;; LuaJIT is not ported to some architectures yet.
#$@(if (or (target-ppc64le?)
(target-riscv64?))
'("--disable-luajittex"
"--disable-luajithbtex"
"--disable-mfluajit")
'()))))
((#:phases phases)
#~(modify-phases #$phases
(add-after 'install 'symlink-kpathsea-binaries
(lambda _
(let ((bin (string-append
#$(this-package-input "texlive-libkpathsea")
"/bin"))
(files
'("kpseaccess" "kpsereadlink" "kpsestat" "kpsewhich")))
(with-directory-excursion (string-append #$output "/bin")
(for-each (lambda (b) (symlink (string-append bin "/" b) b))
files)))))
(add-after 'install 'merge-core-scripts
(lambda* (#:key inputs native-inputs #:allow-other-keys)
(let ((texlive-scripts
(dirname
(dirname
(search-input-file (or native-inputs inputs)
"tlpkg/texlive.tlpdb"))))
(tlpkg (string-append #$output "/share/tlpkg")))
;; "tlpkg" directory is neither provided by texlive-bin nor
;; by texlive-texmf.
(mkdir-p tlpkg)
(copy-recursively (string-append texlive-scripts "/tlpkg")
tlpkg)
;; texlive-bin source doesn't provide this Perl script.
;; Yet, it is referenced in "fmtutil.pl" so we need to move
;; it here too.
(install-file
(string-append texlive-scripts
"/texmf-dist/scripts/texlive/mktexlsr.pl")
(string-append #$output
"/share/texmf-dist/scripts/texlive")))))
(add-after 'merge-core-scripts 'patch-core-scripts
(lambda _
(with-directory-excursion
(string-append #$output "/share/texmf-dist/scripts/texlive")
;; Make sure that fmtutil can find its Perl modules.
(substitute* "fmtutil.pl"
(("\\$TEXMFROOT/")
(string-append #$output "/share/")))
;; Likewise for updmap.pl.
(substitute* "updmap.pl"
(("\\$TEXMFROOT/tlpkg")
(string-append #$output "/share/tlpkg")))
;; Likewise for the tlmgr.
(substitute* "tlmgr.pl"
((".*\\$::installerdir = \\$Master.*" all)
(format #f " $Master = ~s;~%~a"
(string-append #$output "/share")
all))))))
(add-after 'patch-core-scripts 'patch-shell-scripts
(lambda _
(with-directory-excursion
(string-append #$output "/share/texmf-dist/scripts")
;; First patch shell scripts with ".sh" extension.
(let* ((scripts (find-files "." "\\.sh$"))
(commands '("awk" "basename" "cat" "grep" "mkdir" "rm"
"sed" "sort" "uname"))
(command-regexp
(format #f "\\b(~a)\\b" (string-join commands "|")))
(iso-8859-1-encoded-scripts
'("./texlive-extra/rubibtex.sh"
"./texlive-extra/rumakeindex.sh")))
(define (substitute-commands scripts)
(substitute* scripts
((command-regexp dummy command)
(which command))))
(substitute-commands
(lset-difference string= scripts iso-8859-1-encoded-scripts))
(with-fluids ((%default-port-encoding "ISO-8859-1"))
(substitute-commands iso-8859-1-encoded-scripts)))
;; Then patch scripts without such extension.
(let ((dirs (map (compose dirname which)
(list "awk" "cat" "grep" "sed"))))
(substitute* (find-files "texlive" "^mktex(mf|pk|tfm)$")
(("^version=" m)
(format #false "PATH=\"~{~a:~}$PATH\"; export PATH~%~a"
dirs m)))))))))))
(native-inputs
(modify-inputs (package-native-inputs texlive-bin)
(append (package-source texlive-scripts))))
(inputs
(modify-inputs (package-inputs texlive-bin)
(append texlive-libkpathsea)))
(propagated-inputs '())))
(define texlive-texmf (define texlive-texmf
(package (package
(name "texlive-texmf") (name "texlive-texmf")
@ -10370,71 +10520,55 @@ documents as well as DVI output.")
(sha256 (sha256
(base32 (base32
"0lqjm11pr9vasvivaci3k9xcmdyd08ldnh31zf8avjjs09xcfkac")))) "0lqjm11pr9vasvivaci3k9xcmdyd08ldnh31zf8avjjs09xcfkac"))))
(build-system gnu-build-system) (build-system copy-build-system)
(inputs
(list lua
perl
python
ruby
tcsh
texlive-bin))
(arguments (arguments
(list (list
#:modules '((guix build gnu-build-system) #:modules '((guix build copy-build-system)
(guix build utils) (guix build utils)
(srfi srfi-1)
(srfi srfi-26)) (srfi srfi-26))
;; This package takes 4 GiB, which we can't afford to distribute from ;; This package takes 4 GiB, which we can't afford to distribute from
;; our servers. ;; our servers.
#:substitutable? #f #:substitutable? #f
#:install-plan #~'(("texmf-dist/" "share/texmf-dist"))
#:phases #:phases
#~(modify-phases (map (cut assq <> %standard-phases) #~(modify-phases %standard-phases
'(set-paths unpack patch-source-shebangs))
(add-after 'unpack 'unset-environment-variables
(lambda _
(unsetenv "TEXMF")
(unsetenv "TEXMFCNF")))
(add-after 'patch-source-shebangs 'install
(lambda _
(let ((share (string-append #$output "/share")))
(mkdir-p share)
(invoke "mv" "texmf-dist" share))))
(add-after 'install 'texmf-config (add-after 'install 'texmf-config
(lambda _ (lambda* (#:key inputs native-inputs #:allow-other-keys)
(let* ((share (string-append #$output "/share")) (let* ((share (string-append #$output "/share"))
(texmfroot (string-append share "/texmf-dist/web2c")) (texmf-dist (string-append share "/texmf-dist"))
(texmfcnf (string-append texmfroot "/texmf.cnf")) (web2c (string-append texmf-dist "/web2c"))
(fmtutilcnf (string-append texmfroot "/fmtutil.cnf")) (fmtutil.cnf (string-append web2c "/fmtutil.cnf"))
(texlive-bin #$(this-package-input "texlive-bin")) (texlive-bin
(texbin (string-append texlive-bin "/bin")) #$(this-package-native-input "texlive-bin-full")))
(tlpkg (string-append texlive-bin "/share/tlpkg")))
;; LuaJIT is not ported to powerpc64* yet. ;; LuaJIT is not ported to powerpc64* yet.
(if #$(target-ppc64le?) (if #$(target-ppc64le?)
(substitute* fmtutilcnf (substitute* fmtutil.cnf
(("^(luajittex|luajithbtex|mfluajit)" m) (("^(luajittex|luajithbtex|mfluajit)" m)
(string-append "#! " m)))) (string-append "#! " m))))
;; Register SHARE as TEXMFROOT in texmf.cnf.
(substitute* texmfcnf
(("TEXMFROOT = \\$SELFAUTOPARENT")
(string-append "TEXMFROOT = " share))
(("TEXMFLOCAL = \\$SELFAUTOGRANDPARENT/texmf-local")
"TEXMFLOCAL = $SELFAUTODIR/share/texmf-local")
(("!!\\$TEXMFLOCAL") "$TEXMFLOCAL"))
;; Register paths in texmfcnf.lua, needed for context. ;; Register paths in texmfcnf.lua, needed for context.
(substitute* (string-append texmfroot "/texmfcnf.lua") (substitute* (string-append web2c "/texmfcnf.lua")
(("selfautodir:") #$output) (("selfautodir:") #$output)
(("selfautoparent:") (string-append share "/"))) (("selfautoparent:") (string-append share "/")))
;; Set path to TeXLive Perl modules ;; Set path to TeXLive Perl modules
(setenv "PERL5LIB" (setenv "PERL5LIB"
(string-append (getenv "PERL5LIB") ":" tlpkg)) (string-append (getenv "PERL5LIB") ":"
;; Configure the texmf-dist tree; inspired from (string-append texlive-bin
;; http://slackbuilds.org/repository/13.37/office/texlive/ "/share/tlpkg")))
(setenv "PATH" (string-append (getenv "PATH") ":" texbin)) ;; Configure the texmf-dist tree.
(setenv "TEXMFCNF" texmfroot) (setenv "GUIX_TEXMF" texmf-dist)
(invoke "updmap-sys" "--nohash" "--syncwithtrees") (setenv "PATH"
(invoke "mktexlsr") (string-append (getenv "PATH") ":" texlive-bin "/bin:"))
(invoke "fmtutil-sys" "--all"))))))) (let ((updmap.cfg (string-append web2c "/updmap.cfg")))
(invoke (string-append texlive-bin "/bin/updmap-sys")
"--nohash" "--syncwithtrees"
(string-append "--cnffile=" updmap.cfg)))
(invoke (string-append texlive-bin "/bin/fmtutil-sys")
"--cnffile" fmtutil.cnf
"--all"
"--fmtdir" web2c)))))))
(native-inputs (list texlive-bin-full))
(inputs (list lua perl python-wrapper ruby tcsh))
(properties `((max-silent-time . 9600))) ; don't time out while grafting (properties `((max-silent-time . 9600))) ; don't time out while grafting
(synopsis "TeX Live, a package of the TeX typesetting system") (synopsis "TeX Live, a package of the TeX typesetting system")
(description (description
@ -10453,52 +10587,51 @@ This package contains the complete tree of texmf-dist data.")
(version (package-version texlive-bin)) (version (package-version texlive-bin))
(source #f) (source #f)
(build-system trivial-build-system) (build-system trivial-build-system)
(inputs
(list bash-minimal ;for wrap-program
texlive-bin
texlive-texmf))
(native-search-paths
(list (search-path-specification
(variable "TEXMFLOCAL")
(files '("share/texmf-local")))))
(arguments (arguments
(list (list
#:modules '((guix build utils)) #:modules '((guix build utils))
#:builder #:builder
;; Build the union of texlive-bin and texlive-texmf, but take the ;; Build the union of texlive-bin-full and texlive-texmf, but take the
;; conflicting subdirectory share/texmf-dist from texlive-texmf. ;; conflicting subdirectory share/texmf-dist from texlive-texmf.
#~(begin #~(begin
(use-modules (guix build utils)) (use-modules (guix build utils))
(let ((bin #$(this-package-input "texlive-bin")) (let ((bin #$(this-package-input "texlive-bin-full"))
(texmf #$(this-package-input "texlive-texmf")) (texmf #$(this-package-input "texlive-texmf")))
(bash #$(this-package-input "bash-minimal")))
(mkdir #$output) (mkdir #$output)
(with-directory-excursion #$output (with-directory-excursion #$output
;; "include/" and "lib/" directories.
(for-each (for-each
(lambda (name) (lambda (name)
(symlink (string-append bin "/" name) name)) (symlink (string-append bin "/" name) name))
'("include" "lib")) '("include" "lib"))
;; "bin/" directory.
(mkdir "bin") (mkdir "bin")
(with-directory-excursion "bin" (with-directory-excursion "bin"
(setenv "PATH" (string-append bash "/bin"))
(for-each (for-each
(lambda (name) (lambda (name) (symlink name (basename name)))
(symlink name (basename name))
(wrap-program
(basename name)
`("TEXMFCNF" =
(,(string-append texmf "/share/texmf-dist/web2c")))))
(find-files (string-append bin "/bin/") ""))) (find-files (string-append bin "/bin/") "")))
;; "share/info", "share/man", share/texmf-dist/" and
;; "share/tlpkg/" directories.
(mkdir "share") (mkdir "share")
(with-directory-excursion "share" (with-directory-excursion "share"
(for-each (for-each
(lambda (name) (lambda (name)
(symlink (string-append bin "/share/" name) name)) (symlink (string-append bin "/share/" name) name))
'("info" "man" "tlpkg")) '("info" "man" "tlpkg"))
(for-each (symlink (string-append texmf "/share/texmf-dist")
(lambda (name) "texmf-dist"))
(symlink (string-append texmf "/share/" name) name)) ;; Now everything is in place, generate ls-R file.
'("texmf-dist" "texmf-var")))))))) (setenv "PATH"
(string-append
(getenv "PATH") ":"
#$(this-package-input "texlive-bin-full") "/bin"))
(invoke (string-append bin "/bin/mktexlsr")))))))
(inputs (list texlive-bin-full texlive-texmf))
(propagated-inputs (list texlive-libkpathsea))
(native-search-paths
(list (search-path-specification
(variable "TEXMFLOCAL")
(files '("share/texmf-local")))))
(synopsis "TeX Live, a package of the TeX typesetting system") (synopsis "TeX Live, a package of the TeX typesetting system")
(description (description
"TeX Live provides a comprehensive TeX document production system. "TeX Live provides a comprehensive TeX document production system.

View File

@ -1791,8 +1791,8 @@ MANIFEST."
(append-map entry->texlive-input (manifest-entries manifest))) (append-map entry->texlive-input (manifest-entries manifest)))
(define texlive-scripts (define texlive-scripts
(module-ref (resolve-interface '(gnu packages tex)) 'texlive-scripts)) (module-ref (resolve-interface '(gnu packages tex)) 'texlive-scripts))
(define texlive-bin (define texlive-libkpathsea
(module-ref (resolve-interface '(gnu packages tex)) 'texlive-bin)) (module-ref (resolve-interface '(gnu packages tex)) 'texlive-libkpathsea))
(define coreutils (define coreutils
(module-ref (resolve-interface '(gnu packages base)) 'coreutils)) (module-ref (resolve-interface '(gnu packages base)) 'coreutils))
(define grep (define grep
@ -1818,8 +1818,8 @@ MANIFEST."
#:create-all-directories? #t #:create-all-directories? #t
#:log-port (%make-void-port "w")) #:log-port (%make-void-port "w"))
;; XXX: This is annoying, but it's necessary because texlive-bin ;; XXX: This is annoying, but it's necessary because
;; does not provide wrapped executables. ;; texlive-libkpathsea does not provide wrapped executables.
(setenv "PATH" (setenv "PATH"
(string-append #$(file-append coreutils "/bin") (string-append #$(file-append coreutils "/bin")
":" ":"
@ -1827,7 +1827,7 @@ MANIFEST."
":" ":"
#$(file-append sed "/bin") #$(file-append sed "/bin")
":" ":"
#$(file-append texlive-bin "/bin"))) #$(file-append texlive-libkpathsea "/bin")))
(setenv "PERL5LIB" #$(file-append texlive-scripts "/share/tlpkg")) (setenv "PERL5LIB" #$(file-append texlive-scripts "/share/tlpkg"))
(setenv "GUIX_TEXMF" "/tmp/texlive/share/texmf-dist") (setenv "GUIX_TEXMF" "/tmp/texlive/share/texmf-dist")