Tcl scripts can be made into standalone executables for various platforms in what are called Starpacks. Statically linking Tcl libraries in a Starpack helps make Tcl programs more portable.
Building a Starpack requires:
- The sdx tool.
- A TclKit runtime for your operating system and architecture.
- A TclKit runtime for the target operating system and architecture.
A TclKit is modified Tcl binary that has whatever dependencies your program needs. They can be generated using Roy Keene's Kit creator.
The Tcler's Wiki
has detailed discussion of how Starpacks work, their history, etc. Here's a
quick-start given some example.tcl
script:
$ tclkit sdx qwrap example.tcl -runtime tcl8.6-linux-x86_64-tcllib.tclkit
These commands build a virtual filesystem, arrange it, and then produce the final executable. See this article for a more thorough explanation of how Starkits work and different ways to build them.
See the starscript.tcl
file for an example of how to programmatically do this.