texlive.combine: generate fmtutil.cnf

This commit is contained in:
Vincenzo Mantova 2021-07-12 20:37:51 +01:00
parent a2f5c6f52f
commit 5fc3462a46
2 changed files with 18 additions and 6 deletions

View File

@ -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

View File

@ -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";