Polish (Poland)English (United Kingdom)

What is Cookit?

Cookit is a standalone Tcl/Tk binary similar to Tclkit. Cookit is created using cookfs virtual filesystem and is designed to provide a Tclkit alternative that is more space efficient, does not require C++ and ultimately will not require tclvfs package.

Latest cookit version: 1.3.1 (released 2011-10-01) | download files


Building Cookit from scratch
Tcl/Tk - Cookit
Wednesday, 29 September 2010 20:10
In this article I am going to describe how to build ready-to-use working cookit version.

Requirements

  • Before you actually start building the Cookit distribution, make sure you have Tcl interpreter installed on your system. As the Cookit/Cookfs are tightly related to Tcl, there is no surprised it is required to move on.
  • The examples below comes from MS Windows system, but there is absolutely no problem in doing the same on any Unix platform, just make sure you have gcc and cvs installed.
  • The build script will download pretty huge amount of data from the internet (sources and compiler in case of Windows) - make sure your link speed is at reasonable speed.

Build process

  1. Download the ready-to-use build environment from http://sourceforge.net/projects/cookit/ . At the time of writing the lates version is cookit-buildsystem-1.0.zip. Once downloaded, unpack to C:/cookit_bs directory (or any other of your choice). Alternatively, you may get the latest source code available: svn co https://cookit.svn.sourceforge.net/svnroot/cookit cookit_bs
  2. The most important file is build.tcl. This script is able to perform various tasks based on the command line parameters. In case of MS Windows it also downloads Msys/Mingw for gcc compiler.
    Our first step will be to download the source code of Tcl, Tk, Tclvfs and cookfs:
    c:/cookit_bs>tclsh85 build.tcl -usemingw retrievesource tcl tk vfs cookfs
    Downloading win32 build tools; this will take a few minutes
     
    [ 1/ 4] Retrieve source code for cookfs
        [12:31:41] Retrieving
        [12:31:45] Success
     
    [ 2/ 4] Retrieve source code for tcl
        [12:31:45] Retrieving
        [12:38:49] Success
     
    [ 3/ 4] Retrieve source code for tk
        [12:38:49] Retrieving
        [12:42:08] Success
     
    [ 4/ 4] Retrieve source code for vfs
        [12:42:08] Retrieving
        [12:42:24] Success
     
     
    [12:42:24] Command completed successfully

    Note that the building script does not display any information on download progress, which may bring you to false impression that it hangs, while it is getting data from the Internet.
    Also note that to build Cookit distribution, the Tcl 8.6 is used, which is currently (at the time of writing) not yet published officially. It may happen that some compilation errors uccur.
  3. Now it is time to enter the command that will actually build cookit.exe. The file is not too big, but we can make it even smaller with using the UPX packer. To do this, put upx.exe in the same directory where build.tcl resides, and append -upx best option to the command line:
    c:/cookit_bs> tclsh85 build.tcl -usemingw -upx best build-cookit
     
    [ 1/ 7] Build tcl 8.6b1.2
        [13:39:29] Initializing
        [13:39:29] Configuring
        [13:40:26] Compiling
        [13:49:39] Installing
        [13:50:08] Finalizing
     
    [ 2/ 7] Build cookfs 1.0
        [13:50:08] Initializing
        [13:50:10] Configuring
        [13:51:17] Compiling
        [13:51:21] Installing
        [13:51:21] Finalizing
     
    [ 3/ 7] Build resources 1.0
        [13:51:21] Initializing
        [13:51:21] Configuring
        [13:51:21] Compiling
        [13:51:22] Installing
        [13:51:22] Finalizing
     
    [ 4/ 7] Build vfs 1.4.1
        [13:51:22] Initializing
        [13:51:22] Configuring
        [13:52:36] Compiling
        [13:52:38] Installing
        [13:52:46] Finalizing
     
    [ 5/ 7] Build cookit 1.0
        [13:52:46] Initializing
        [13:52:46] Configuring
        [13:52:46] Compiling
        [13:52:47] Installing
        [13:52:47] Finalizing
     
    [ 6/ 7] Link binary
        [13:52:47] Initializing
        [13:52:47] Linking
        [13:52:48] Stripping
        [13:52:49] Compressing
     
    [ 7/ 7] Add CookFS layer
        [13:52:57] Initializing
        [13:52:57] Adding temporary VFS
        [13:53:00] Re-compressing VFS
        [13:53:07] Finalizing
     
     
    [13:53:09] Command completed successfully
    The result file cookit.exe is located in output/_win32_x86 subdirectory.
  4. The Cookit we have just built does not include Tk. In order to have the version able to handle GUI, we have to build it in the following way:
    c:/cookit_bs>tclsh85 build.tcl -usemingw -upx best -binarysuffix ui -tk latest build-cookit
     
    [ 1/ 8] Build tcl 8.6b1.2
        [14:17:39] Initializing
        [14:17:39] Configuring
        [14:17:39] Compiling
        [14:20:11] Installing
        [14:20:39] Finalizing
     
    [ 2/ 8] Build tk 8.6b1.2
        [14:20:39] Initializing
        [14:20:39] Configuring
        [14:21:54] Compiling
        [14:25:49] Installing
        [14:25:59] Finalizing
     
    [ 3/ 8] Build cookfs 1.0
        [14:25:59] Initializing
        [14:25:59] Configuring
        [14:25:59] Compiling
        [14:26:00] Installing
        [14:26:00] Finalizing
     
    [ 4/ 8] Build resources 1.0
        [14:26:00] Initializing
        [14:26:00] Configuring
        [14:26:00] Compiling
        [14:26:01] Installing
        [14:26:01] Finalizing
     
    [ 5/ 8] Build vfs 1.4.1
        [14:26:01] Initializing
        [14:26:01] Configuring
        [14:26:01] Compiling
        [14:26:01] Installing
        [14:26:10] Finalizing
     
    [ 6/ 8] Build cookit 1.0
        [14:26:10] Initializing
        [14:26:10] Configuring
        [14:26:10] Compiling
        [14:26:11] Installing
        [14:26:11] Finalizing
     
    [ 7/ 8] Link binary
        [14:26:11] Initializing
        [14:26:11] Linking
        [14:26:14] Stripping
        [14:26:15] Compressing
     
    [ 8/ 8] Add CookFS layer
        [14:26:27] Initializing
        [14:26:28] Adding temporary VFS
        [14:26:31] Re-compressing VFS
        [14:26:43] Finalizing
     
     
    [14:26:44] Command completed successfully
    The option -binarysufix ui causes adding a suffix to file name: cookit-ui.exe.
  5. Now you can enjoy your just built version of Cookit:
    c:/cookit_bs>dir _outputwin32-x86
     
    2010-10-02  22:26         1 778 005 cookit-ui.exe
    2010-10-02  22:12         1 057 102 cookit.exe

     


    To make sure it is working, just run it - by default it will display Tcl console:
    cookit_konsola
This concludes this tutorial. Read other articles to learn how to practicaly use the Cookit :)
Last Updated on Wednesday, 09 March 2011 12:20
 
Tcl 8.5 Network Programming book
Learning Nagios 3.0 book