Customising a Tclkit
You will need sdx.kit from the front page of this repo. See tclkits for sources of pre-built kits
# grab a tclkit curl -O http://www.rkeene.org/devel/kitcreator/kitbuild/nightly/tclkit-fossil_trunk-linux-amd64 # make a copy of tclkit to run sdx with cp tclkit-fossil_trunk-linux-amd64 tclkit chmod +x tclkit # extract the vfs ./tclkit sdx.kit extract tclkit-fossil_trunk-linux-amd64 # add some code echo 'puts "Hello, Tclkit"' >> tclkit-fossil_trunk-linux-amd64.vfs/boot.tcl # sync changes back to tclkit ./tclkit sdx.kit sync tclkit-fossil_trunk-linux-amd64 tclkit-fossil_trunk-linux-amd64.vfs
boot.tcl is run on tclkit startup. Since there is no main.tcl, the tclkit will give you a Tcl shell.
Wrapping an Application
Tclkits look for main.tcl to launch an application on startup.
# grab a tclkit curl -O http://www.rkeene.org/devel/kitcreator/kitbuild/nightly/tclkit-fossil_trunk-linux-amd64 # make a copy of tclkit to run sdx with cp tclkit-fossil_trunk-linux-amd64 tclkit chmod +x tclkit # create your application mkdir myapp.vfs echo 'puts "Hello, Starkit!"' > myapp/main.tcl # wrap it! ./tclkit sdx.kit wrap myapp -runtime tclkit-fossil_trunk-linux-amd64
Share the new executable myapp with your friends!
Wrapping a simple script for multiple platforms
This section introduces qwrap for single-script applications, and using non-native runtimes (eg: building Windows kits on Linux).
Create your script:
$ mkdir hello $ cd hello $ echo > hello.tcl " package require Tk pack [button .b -text Hello -command exit] "
Download the required bits:
$ wget -O sdx.kit https://chiselapp.com/user/aspect/repository/sdx/uv/sdx-20110317.kit $ wget -O tclkit.exe http://www.rkeene.org/devel/kitcreator/kitbuild/nightly/tclkit-8.6.7-win64-amd64-xcompile $ wget -O tclkit http://www.rkeene.org/devel/kitcreator/kitbuild/nightly/tclkit-8.6.7-linux-amd64 $ chmod +x tclkit
Wrap for Windows:
$ ./tclkit sdx.kit qwrap hello.tcl -runtime tclkit.exe $ mv hello hello.exe
For native kits, remember the tclkit that runs sdx cannot be the same tclkit that is used for -runtime .. so make a copy:
$ cp tclkit tclkit-linux $ ./tclkit sdx.kit qwrap hello.tcl -runtime tclkit-linux $ ./hello
More!
The above steps are easily elaborated to ...
- wrap for different architectures
- add further libraries (including native ones) (protip: use teapot-client to fetch them)
- include custom assets in your kits
- wrap sdx.kit to make it a standalone executable
- put tclkit and sdx in your $PATH
- .. (almost) anything you can imagine!