$ show tectonic-typesetting/tectonic
Tectonic is a modernized, self-contained TeX/LaTeX engine that compiles .tex documents to PDF or HTML. It is built on a fork of XeTeX and integrates BibTeX, font shaping via HarfBuzz/FreeType, SVG-to-HTML conversion, and full PDF output via xdvipdfmx. The architecture is a Rust workspace with multiple crates implementing engines, I/O abstraction, bundle management, and C library bridges. The CLI tool provides subcommands (build, watch, new, bundle, dump, show) and supports workspace configuration via Tectonic.toml. The system is production-ready, with extensive test coverage, fuzzing, and support for cross-compilation. While the core TeX engine remains in C/C++ with global state, the Rust layers provide clean abstractions (IoProvider, StatusBackend, CachableBundle) that are reusable and well-architected. The codebase is actively maintained, with regular commits and CI/CD pipelines, though some C components show age and legacy patterns.
The LLM identified 3 files worth highlighting for reuse:
Provides a `target_cfg!` macro and `TargetConfiguration` struct that enable build scripts to reliably detect target platform features (endianness, pointer width, OS) during cross-compilation. This is a self-contained, reusable utility for any Rust project that needs conditional compilation in build.rs, demonstrating non-obvious understanding of cargo's cfg limitations.
Defines a `find_external_dependency` function that locates native C libraries via pkg-config or vcpkg. It is a tiny, reusable build helper that any project binding to C libraries can adopt. The code handles cross-compilation, version requirements, and library name conventions, making it a practical extraction for complex build setups.
A complete, standalone BibTeX engine rewritten in Rust. It parses .aux, .bst, and .bib files, executes style file commands, and produces .bbl and .blg output. The implementation is well-structured with a builder pattern for configuration, clear error handling, and no dependencies on the rest of Tectonic. It could be extracted as a separate crate for bibliography processing in other projects.