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 mkdir $out/share/texmf-local
) )
'' + '' +
# now filter hyphenation patterns, in a hacky way ATM # now filter hyphenation patterns and formats
(let (let
hyphens = lib.filter (p: p.hasHyphens or false && p.tlType == "run") pkgList.splitBin.wrong; 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/ # sed expression that prints the lines in /start/,/end/ except for /end/
section = start: end: "/${start}/,/${end}/{ /${start}/p; /${end}/!p; };\n"; section = start: end: "/${start}/,/${end}/{ /${start}/p; /${end}/!p; };\n";
script = script =
@ -133,7 +135,7 @@ in (buildEnv {
# pick up the header # pick up the header
+ "2,/^% from/{ /^% from/!p; };\n" + "2,/^% from/{ /^% from/!p; };\n"
# pick up all sections matching packages that we combine # 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) # pick up the footer (for language.def)
+ "/^%%% No changes may be made beyond this point.$/,$p;\n" + "/^%%% No changes may be made beyond this point.$/,$p;\n"
); );
@ -141,9 +143,15 @@ in (buildEnv {
writeText "hyphens.lua.sed" ( writeText "hyphens.lua.sed" (
"1{ s/^(-- Generated by .*)$/\\1, modified by texlive.combine/; p; }\n" "1{ s/^(-- Generated by .*)$/\\1, modified by texlive.combine/; p; }\n"
+ "2,/^-- END of language.us.lua/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" + "$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 '' in ''
( (
cd ./share/texmf/tex/generic/config/ cd ./share/texmf/tex/generic/config/
@ -152,6 +160,10 @@ in (buildEnv {
done done
[[ -e language.dat.lua ]] && sed -E -n -f '${scriptLua}' -i language.dat.lua [[ -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 # function to wrap created executables with required env vars
@ -212,7 +224,7 @@ in (buildEnv {
perl `type -P mktexlsr.pl` ./share/texmf perl `type -P mktexlsr.pl` ./share/texmf
${bin.texlinks} "$out/bin" && wrapBin ${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? #${bin.texlinks} "$out/bin" && wrapBin # do we need to regenerate format links?
# Disable unavailable map files # Disable unavailable map files

View file

@ -109,7 +109,7 @@ let
pkgs = pkgs =
# tarball of a collection/scheme itself only contains a tlobj file # tarball of a collection/scheme itself only contains a tlobj file
[( if (attrs.hasRunfiles or false) then mkPkgV "run" [( 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 { else {
inherit pname version; inherit pname version;
tlType = "run"; tlType = "run";