texlivePackages.tex4ht: build tex4ht.jar

This commit is contained in:
Vincenzo Mantova
2026-05-20 10:40:03 +01:00
parent 12f7f2d057
commit b6d1624a2c
4 changed files with 67 additions and 2 deletions
@@ -7,6 +7,8 @@
unzip,
buildPackages,
texlive,
gnum4,
jdk_headless,
zlib,
libiconv,
libpng,
@@ -791,6 +793,60 @@ rec {
enableParallelBuilding = true;
};
# tex4ht.jar
# we build this as a TeX package, but under texlive.bin to avoid exposing it in texlivePackages
tex4htJar = stdenv.mkDerivation {
pname = "tex4ht-jar";
inherit (texlive.pkgs.tex4ht) meta version;
outputs = [ "tex" ];
src = texlive.pkgs.tex4ht.texsource + "/source/generic/tex4ht";
nativeBuildInputs = [
gnum4
jdk_headless
(texlive.schemes.texliveBasic.withPackages (ps: [
# override tex4ht-jar with an empty package to avoid a self dependency
{ pname = "tex4ht-jar"; }
ps.protex
ps.tex4ht
]))
];
preHook = ''
export out="$tex"
'';
# the current Makefile is broken, so we build the artifact by hand
# we also use latex instead of htlatex as the latter is orders of magnitude slower
buildPhase = ''
make tex4ht-dir.tex
mkdir -p work.dir/src/tex4ht
for f in *-xtpipes.tex ; do
latex -output-directory=work.dir/src/tex4ht "\\RequirePackage{tex4ht}\\input $f"
done
mkdir -p work.dir/src/xtpipes
latex -output-directory=work.dir/src/xtpipes "\\RequirePackage{tex4ht}\\input xtpipes.tex"
mkdir -p work.dir/src/xtpipes/util
mv work.dir/src/xtpipes/xtpipes.java.java work.dir/src/xtpipes.java
mv work.dir/src/xtpipes/ScriptsManager*.java work.dir/src/xtpipes/util
mkdir -p xtpipes.dir/xtpipes/lib
cp work.dir/src/xtpipes/xtpipes*.{4xt,dtd} xtpipes.dir/xtpipes/lib
javac -d xtpipes.dir work.dir/src/{*,*/*,*/*/*}.java
jar cf tex4ht.dir/texmf/tex4ht/bin/tex4ht.jar -C xtpipes.dir .
'';
installPhase = ''
install -D -t "$tex"/tex4ht/bin tex4ht.dir/texmf/tex4ht/bin/tex4ht.jar
'';
};
} # un-indented
//
@@ -47,6 +47,8 @@
luajit,
texinfo,
# for bin.nix
gnum4,
jdk_headless,
perlPackages,
python3Packages,
pkg-config,
@@ -225,7 +227,7 @@ let
inherit mirrors pname;
fixedHashes = fixedHashes."${pname}-${toString revision}${extraRevision}" or { };
}
// lib.optionalAttrs (args ? deps) { deps = map (n: tl.${n}) (args.deps or [ ]); }
// lib.optionalAttrs (args ? deps) { deps = map (n: tl.${n} or bin.${n}) (args.deps or [ ]); }
)
) overriddenTlpdb;
@@ -17603,7 +17603,7 @@
doc = "0np84cifjrc9ls39gvnf0pfmyr2azbmkjng68wf22mpbbax0vblj";
};
tex4ht-77991 = {
run = "1brpxgcxrn8x45rnxd2mi9fjjlifafrd5d9naghxd12h36i5xz50";
run = "1g06wmrnj8psqyby6nq53m0wavs0pcl8wllyhms6jyc1vnya9in7";
doc = "04z1bsgy3lisx7ifskxzna5jcbjkbwwjlqfwbfppnmjp5rwphxdv";
source = "1fvgpz4r686f86hf8mjj31724dcr1l9s02nirfn01fjlxq9fkpkm";
};
@@ -555,6 +555,13 @@ lib.recursiveUpdate orig rec {
#### misc
# replace tex4ht.jar with our rebuilt version
tex4ht.deps = (orig.tex4ht.deps or [ ]) ++ [ "tex4htJar" ];
tex4ht.postUnpack = ''
[[ ! -d "$out"/tex4ht/bin ]] || rm -fr "$out"/tex4ht/bin
'';
tex4ht.hasJar = false;
# Use top-level git-latexdiff's version and src. NOTE that this derivation is
# still different from top-level's `git-latexdiff`, due to __structuredAttrs
# enabled unconditionally. Still though this derivation produces a funcitonal