Skip to content

Commit c833ef3

Browse files
committed
fix(spindle-ci): TEXMFCNF=both web2c dirs + explicit PSHEADERS for .pro files
iter 35 got past the texmf.cnf-not-found warning (exec -a wrapper worked), but tex.pro / texps.pro / special.pro / color.pro still 'not found'. Root cause: TEXMFCNF was pointed at exactly one web2c dir (whichever 'find' returned first — typically the partial override at share/texmf-config/web2c/), missing the main one at share/texmf-dist/web2c/ that has the PSHEADERS / DVIPSHEADERS / TEXMF search-cascade definitions. Fix: - Collect ALL web2c dirs containing texmf.cnf, colon-join into TEXMFCNF so kpathsea reads both override + main configs. - Additionally export PSHEADERS=...:dvips/base:dvips/config:dvips as belt+suspenders so kpathsea finds the .pro files even if the cnf cascade still doesn't fully take effect.
1 parent 6d3ea0c commit c833ef3

1 file changed

Lines changed: 24 additions & 8 deletions

File tree

flake.nix

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -219,25 +219,41 @@
219219
ln -s "$texlive_drv/share/$d" "$out/share/$d"
220220
fi
221221
done
222-
# Locate texmf.cnf — texlive.combine puts it under one of:
223-
# share/texmf-dist/web2c/, share/texmf-config/web2c/, share/web2c/
224-
# find it explicitly so TEXMFCNF points to the right dir.
225-
texmfcnf_file=$(find "$texlive_drv/share" -name texmf.cnf -type f 2>/dev/null | head -1)
226-
if [ -z "$texmfcnf_file" ]; then
222+
# Locate ALL texmf.cnf files. texlive.combine writes a config
223+
# override at share/texmf-config/web2c/texmf.cnf, while the main
224+
# one (with PSHEADERS / DVIPSHEADERS / TEXMF definitions) lives at
225+
# share/texmf-dist/web2c/texmf.cnf. kpathsea needs BOTH dirs in
226+
# TEXMFCNF or it only reads the override and misses the search-
227+
# path defaults → tex.pro / texps.pro / special.pro / color.pro
228+
# show up as "not found".
229+
texmfcnf_dirs=""
230+
while IFS= read -r f; do
231+
d=$(dirname "$f")
232+
case ":$texmfcnf_dirs:" in
233+
*":$d:"*) ;;
234+
*) texmfcnf_dirs="''${texmfcnf_dirs:+$texmfcnf_dirs:}$d" ;;
235+
esac
236+
done < <(find "$texlive_drv/share" -name texmf.cnf -type f 2>/dev/null)
237+
if [ -z "$texmfcnf_dirs" ]; then
227238
echo "ERROR: texmf.cnf not found in $texlive_drv/share" >&2
228239
find "$texlive_drv/share" -maxdepth 4 -type d >&2
229240
exit 1
230241
fi
231-
texmfcnf_dir=$(dirname "$texmfcnf_file")
232-
echo "Found texmf.cnf at: $texmfcnf_file"
242+
echo "TEXMFCNF dirs: $texmfcnf_dirs"
243+
# PostScript headers (tex.pro, texps.pro, special.pro, color.pro)
244+
# come from the dvips package. Explicitly point PSHEADERS at the
245+
# dvips dir so kpathsea finds them even if texmf.cnf's search
246+
# cascade isn't fully picked up.
247+
dvips_dir="$texlive_drv/share/texmf-dist/dvips"
233248
# Wrapper preserves argv[0] = $out/bin/dvisvgm so kpathsea
234249
# SELFAUTOLOC = $out/bin. Plain `exec` (no -a) would let the
235250
# kernel pass the dvisvgm-3.6 path as argv[0].
236251
cat > $out/bin/dvisvgm <<EOF
237252
#!${pkgs.bash}/bin/bash
238-
export TEXMFCNF="$texmfcnf_dir"
253+
export TEXMFCNF="$texmfcnf_dirs"
239254
export TEXMFDIST="$texlive_drv/share/texmf-dist"
240255
export TEXMFROOT="$texlive_drv/share"
256+
export PSHEADERS=".:$dvips_dir/base:$dvips_dir/config:$dvips_dir"
241257
exec -a "\$0" "$dvisvgm_bin" "\$@"
242258
EOF
243259
chmod +x $out/bin/dvisvgm

0 commit comments

Comments
 (0)