TSI Architecture
Current Implementation (C)
TSI is implemented in pure C (C11 standard) with no runtime dependencies.
Advantages
- Universal availability: C compiler (gcc/clang/cc) is available on virtually all systems
- Single binary: Can be compiled as a static binary with no dependencies
- Small footprint: Compiled binary is small and efficient
- Easy bootstrap: Most minimal systems have a C compiler
- No runtime dependency: Self-contained executable
- Performance: Fast execution for package management operations
- Distribution independence: Works on any Unix-like system with a C compiler
Implementation Details
- Language: C11 (ISO/IEC 9899:2011)
- Build System: Make
- Dependencies: None (pure C standard library)
- Linking: Static linking preferred (optional dynamic linking on macOS)
Core Components
- Package Management (
package.c/h) - JSON manifest parsing
- Package metadata handling
-
Dependency tracking
-
Dependency Resolution (
resolver.c/h) - Topological sorting
- Dependency graph construction
-
Build order determination
-
Source Fetching (
fetcher.c/h) - Git repository cloning
- Tarball/zip downloading
-
Local source handling
-
Build System Integration (
builder.c/h) - Autotools support
- CMake support
- Meson support
- Plain Makefile support
-
Custom build commands
-
Database (
database.c/h) - Installed package tracking
- JSON-based storage
-
Package metadata persistence
-
Repository (
resolver.c/h) - Package manifest loading
- Repository directory scanning
-
Package lookup
-
CLI (
main.c) - Command-line interface
- Install/remove/list commands
- Package information display
Design Principles
- Minimal Requirements: Only needs a C compiler
- Source-Based: Everything built from source
- Isolated Installation: Packages installed to separate prefix
- Distribution Independent: No reliance on system package managers
- Self-Contained: Single binary, no runtime dependencies
Future Considerations
Potential Enhancements
- Parallel builds
- Build caching
- Binary package distribution (optional)
- Cross-compilation support
- Package signing/verification
Platform Support
- Primary: Linux (all distributions)
- Secondary: macOS, BSD variants
- Target: Embedded systems (Xilinx, etc.)
Build Process
- Compile all C source files to object files
- Link into single binary (
tsi) - Optional: Static linking for maximum portability
- Install to system or user directory
Testing
Comprehensive Docker-based testing: - Minimal systems (no tools) - Systems with C compiler only - Various Linux distributions (Alpine, Ubuntu)
See the docker directory in the repository root for testing details.