Artifact 7014342dfd790c35ac7e387520f0b34495e80db8090a4045a431d2a3a80fe508:
Wiki page
[
toadkits] by
hypnotoad
2018-01-09 17:03:47.
D 2018-01-09T17:03:47.700
L toadkits
P 8b93777e889cc6873fb21f075b785fefba02e661565ba74fea2bd5fa9b393ed8
U hypnotoad
W 2975
<h3>What is a toadkit?</h3>
A toadkit is a self-contained executable with a complete software application. Toadkits are an update of the Tcl as One Big Executable (TOBE) concept. (See http://www.hwaci.com/sw/tobe/). Tcl/Tk is statically compiled along with enough tools to mount the executable as a virtual file system. This virtual file system contains Tcl/Tk code, application resources. Binary packages can be either statically linked to the executable, or distributed as shared libraries in the VFS.
<p>
All of this code is packaged in a single file that the user can double-click on, or drag and drop files on top of.
<p>
<h3>Building a toadkit.</h3>
These instructions used to be a bit more involved. But the process has been integrated into the automations of ODIE.
<p>
<verbatim>
mkdir odie
mkdir odie/odie
mkdir odie/download
mkdir odie/build
fossil clone http://fossil.etoyoc.com/fossil/odie odie/download/odie.fos
cd odie/odie
fossil open ../download/odie.fos
cd ../build
tclsh ../odie/make.tcl local-env toadkit
</verbatim>
<p>
This build process assumes the following: you have access to fossil and git in your local environment, as well as
<p>
In the process of building the basekit, odie will download the Tcl/Tk core, and sources for the included packages. Source code is downloaded to the <b>sandbox</b> which is the same directory that <i>odie</i> was unpacked to. In the <b>build</b> folder will by a series of <b>pkg.*</b> folders, on per binary package. That is where Odie compiles the binary packages. In addition is PKGROOT, which is a virtual file system where binary packages are "installed" so they can be copied into a waiting VFS.
<p>
For details on what is inside, see: [Anatomy of a Toadkit project]
<p>
To wrap your own program using the basekit, create a VFS directory. (Say myproduct.vfs)
<p>
<verbatim>
cp -a ~/myproject/src myproject.vfs
tclsh ../odie/make.tcl wrap clevername myproject.vfs
</verbatim>
This will produce an execuable named <b>clevername</b>. If myproject.vfs includes a file called "main.tcl" in the root, the executable will load that file instead of reverting to the standard tcl interactive shell behavior. <b>main.tcl</b> will be able to respond to the command line. As part of the kitbuilding process, the entire VFS is scanned, and a file <b>packages.tcl</b> is produced, and placed in the root of the VFS. This is the master manifest of all packages that are included in the VFS. This file will be read automatically when the process starts.
<p>
If a file named "main.tcl" is present in the root of the VFS, the process will source this file after loading the package manifest. TOBE behaves like any other tcl process, it can respond to arguments on the command line (look in the argv variable.)
<p>
If no main.tcl is present, toadkits behave as a standard Tcl shell. Tk is statically linked, but not loaded automatically. It can be accessed with a simple "package require Tk".
Z 8bc9b29e38f810768483a97c3812a44b