From 5fc3462a467f058aa26a81df4e3e53780a9782ab Mon Sep 17 00:00:00 2001 From: Vincenzo Mantova Date: Mon, 12 Jul 2021 20:37:51 +0100 Subject: [PATCH] texlive.combine: generate fmtutil.cnf --- .../tools/typesetting/tex/texlive/combine.nix | 22 ++++++++++++++----- .../tools/typesetting/tex/texlive/default.nix | 2 +- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/pkgs/tools/typesetting/tex/texlive/combine.nix b/pkgs/tools/typesetting/tex/texlive/combine.nix index 17e46d3f93f..8babce90057 100644 --- a/pkgs/tools/typesetting/tex/texlive/combine.nix +++ b/pkgs/tools/typesetting/tex/texlive/combine.nix @@ -120,10 +120,12 @@ in (buildEnv { mkdir $out/share/texmf-local ) '' + - # now filter hyphenation patterns, in a hacky way ATM + # now filter hyphenation patterns and formats (let hyphens = lib.filter (p: p.hasHyphens or false && p.tlType == "run") pkgList.splitBin.wrong; - pnames = uniqueStrings (map (p: p.pname) hyphens); + hyphenPNames = uniqueStrings (map (p: p.pname) hyphens); + formats = lib.filter (p: p.hasFormats or false && p.tlType == "run") pkgList.splitBin.wrong; + formatPNames = uniqueStrings (map (p: p.pname) formats); # sed expression that prints the lines in /start/,/end/ except for /end/ section = start: end: "/${start}/,/${end}/{ /${start}/p; /${end}/!p; };\n"; script = @@ -133,7 +135,7 @@ in (buildEnv { # pick up the header + "2,/^% from/{ /^% from/!p; };\n" # pick up all sections matching packages that we combine - + lib.concatMapStrings (pname: section "^% from ${pname}:$" "^% from|^%%% No changes may be made beyond this point.$") pnames + + lib.concatMapStrings (pname: section "^% from ${pname}:$" "^% from|^%%% No changes may be made beyond this point.$") hyphenPNames # pick up the footer (for language.def) + "/^%%% No changes may be made beyond this point.$/,$p;\n" ); @@ -141,9 +143,15 @@ in (buildEnv { writeText "hyphens.lua.sed" ( "1{ s/^(-- Generated by .*)$/\\1, modified by texlive.combine/; p; }\n" + "2,/^-- END of language.us.lua/p;\n" - + lib.concatMapStrings (pname: section "^-- from ${pname}:$" "^}$|^-- from") pnames + + lib.concatMapStrings (pname: section "^-- from ${pname}:$" "^}$|^-- from") hyphenPNames + "$p;\n" ); + fmtutilSed = + writeText "fmtutil.sed" ( + "1{ s/^(# Generated by .*)$/\\1, modified by texlive.combine/; p; }\n" + + "2,/^# from/{ /^# from/!p; };\n" + + lib.concatMapStrings (pname: section "^# from ${pname}:$" "^# from") formatPNames + ); in '' ( cd ./share/texmf/tex/generic/config/ @@ -152,6 +160,10 @@ in (buildEnv { done [[ -e language.dat.lua ]] && sed -E -n -f '${scriptLua}' -i language.dat.lua ) + ( + cd ./share/texmf/web2c/ + [[ -e fmtutil.cnf ]] && sed -E -n -f '${fmtutilSed}' -i fmtutil.cnf + ) '') + # function to wrap created executables with required env vars @@ -212,7 +224,7 @@ in (buildEnv { perl `type -P mktexlsr.pl` ./share/texmf ${bin.texlinks} "$out/bin" && wrapBin - (perl `type -P fmtutil.pl` --sys --all || true) | grep '^fmtutil' # too verbose + perl `type -P fmtutil.pl` --sys --all | grep '^fmtutil' # too verbose #${bin.texlinks} "$out/bin" && wrapBin # do we need to regenerate format links? # Disable unavailable map files diff --git a/pkgs/tools/typesetting/tex/texlive/default.nix b/pkgs/tools/typesetting/tex/texlive/default.nix index 80d1d997fa9..4497cdfbed2 100644 --- a/pkgs/tools/typesetting/tex/texlive/default.nix +++ b/pkgs/tools/typesetting/tex/texlive/default.nix @@ -109,7 +109,7 @@ let pkgs = # tarball of a collection/scheme itself only contains a tlobj file [( if (attrs.hasRunfiles or false) then mkPkgV "run" - # the fake derivations are used for filtering of hyphenation patterns + # the fake derivations are used for filtering of hyphenation patterns and formats else { inherit pname version; tlType = "run";