This project provides tools for zipfs-based Tclkits:
- Starkit zkk.kit (a minimal zipfs counterpart to sdx.kit)
- Package starkit v2.0.x (with both zipfs and mk4/vlerq starkits, replacing v1.3.x which was for mk4/vlerq kits only)
- Package readkit (allows zipfs-based tclkits to run "old" starkits based on mk4/vlerq) - from JCW via Steve Landers and Eric Taylor
How to use these tools
- zkk.kit works in the same way as sdx.kit, but currently offers only three subcommands: qwrap, wrap and unwrap.
- The starkit and readkit packages are intended for inclusion in the basekit.
A typical zip-based basekit has these files in its zip archive:
| File/Directory | Description |
|---|---|
| //zipfs:/app/tcl_library/ | Files for the statically linked Tcl library |
| //zipfs:/app/tk_library/ | Files for the statically or dynamically linked Tk library |
| //zipfs:/app/libtcl9tk9.0.so | The Tk library (if it is dynamically linked) |
| //zipfs:/app/starkit/ | The starkit and readkit libraries to allow the use of starkits |
| //zipfs:/app/vfs/ | (optional) For native reading of mk4 starkits |
| //zipfs:/app/vlerq/ | (optional) For native reading of mk4 starkits |
If tclvfs and vlerq are included in the basekit as dynamically loadable libraries, then the basekit has native support for mk4 starkits. This is useful because the readkit library still has bugs.
License
These files are derivative works of sdx.kit, readkit.tcl, and starkit.tcl by JCW which did not carry a licensing statement. Modifications by Keith Nash are licensed by the Tcl or Tcllib licenses, or by any terms intended by JCW for his original works.
The libraries zip::decode and fileutil::decode included in zkk.kit are from Tcllib and are subject to the Tcllib license.
On tclkits, basekits, starkits, and starpacks
Before Tcl 9
- A basekit is a single binary file that implements Tcl and may include Tk and other Tcl packages.
- A tclkit is a basekit that has a standard set of packages. Tclkit was the original basekit.
- A starkit is a single-file application that can be run by a basekit, and consists of a brief script header, followed by the delimiting character Control-Z, and then by a file archive. Typically this archive contains only Tcl/Tk code, though it may also include binary packages for one or more platforms.
- A starpack is a standalone single-file application. It is the merger of a basekit and a starkit, and is a binary executable with a file archive appended.
- The tool sdx is used to construct of these files.
This system was developed more than 20 years ago by Jean-Claude Wippler (JCW) and others, and is described in detail in this paper by Steve Landers:
https://tca1.tcl-lang.org/tcl2002/09thTcl-2002-Vancouver/landers-tclkit/tclkit.pdf
The system uses compressed file archives constructed from a database system called MetaKit 4 ("mk4"), or a later compatible (but read-only) alternative called vlerq; combined with a vfs (virtual file system) Tcl package that allows the files held in the database to be mounted by the tclkit in the filesystem seen by its interpreter.
With Tcl 9
Tcl 9 has built-in facilities that replace the additional packages mk4/vlerq and vfs: the zipfs command manages zip-based archives appended to other files and can mount them in its interpreter's filesystem. The construction of basekits, starkits, and starpacks requires some small additional tools, which this project provides.
FAQs
- Q: Can a zipfs basekit run a mk4-based starkit?
A: Yes, it can do so in two ways. A Tcl 9 basekit that includes vfs and vlerq as dynamic libraries can run mk4 starkits like the original tclkit. For other basekits, this facility is provided by the readkit package. However, the starkit code usually needs a few minor revisions to run under Tcl/Tk 9. It is necessary to unpack the starkit, edit its code, and repack it. The repacking might as well use zkk.kit to create a starkit in the new zipfs format.
Q: Can a mk4/vlerq basekit run a zipfs-based starkit?
A: Unfortunately, no. The basekit could in principle use package vfs::zip to mount and run zip-based starkits, but it faces three obstacles:
- vfs::zip measures offsets from the start of the starkit file, not from the character after the Control-Z delimiter (i.e. from the "PK" characters that mark the beginning of a zip archive).
- the basekit expects to find packages in the lib/ directory of a starkit. In contrast, zipfs-based starkits place packages at the top level of the starkit filesystem.
- the starkit may contain code written for Tcl/Tk 9.0 that is not compatible with a Tcl 8.x basekit.