Tcl2Exe

This provides a script that can be used to quickly build one or more tcl scripts or applications into an executable Starpack (windows only at the moment). Sources at https://fossil.mpcjanssen.nl/site-tcl/dir?ci=tip&name=scripts/tcl2exe .

tcl2exe wraps a script using tclkit and sdx including provided libraries and other assets.

  Usage:

  tcl2exe gui[0|1] file.tcl file.exe ?extra-from extra-to? ....
    Quickly wrap a single script from the command line while including the provide extras.
    Extras are copied from `extra-from` into `extra-to` in the created starpack.

  tcl2exe pkgfile <pkg-glob>
    Build all packages from `pkgfile` matching pkg-glob (* if omitted).

  tcl2exe sdx ...
    Call embedded sdx ...

  tcl2exe
    Build all packages from all *.tpkg files in current folder.

  tcl2exe -h|--help|/?
    Show this screen.

Example *.tpkg

This is a one element list with a dict where the first key is the package name. $pkg will be replaced by this.

  • script: Single script file to wrap, omit if application is copied in extras.
  • target: Target executable name
  • GUI: GUI app yes/no. Whether to use tclkit or tclkitsh as runtime
  • extras: List of from -> to mappings. from can be a file or a folder and is relative to the tpkg file. The file or folders are recursively copied into to which is relative to the starpack root.
{ 
  tcl2exe {
    script scripts/$pkg/$pkg.tcl
    target bin/$pkg.exe
    gui 0
    extras {
      scripts/$pkg/bin bin
      scripts/$pkg/doc doc
      scripts/$pkg/lib lib
    }
  }
  tsd {
    script scripts/$pkg.tcl
    target bin/$pkg.exe
    gui 0
    extras {
      c:/Tcl/lib/tdom0.8.3 lib/tdom
    }
  }
  tkcon {
    script scripts/$pkg.tcl
    target bin/$pkg.exe
    gui 1
    extras {
      c:/Tcl/lib/tcllib1.18 lib/tcllib
    }
  }
  remark {
    script scripts/$pkg.tcl
    target bin/$pkg.exe
    gui 0
    extras { }
  }
  tkchat {
    target bin/$pkg.exe
    gui 1
    extras { 
      scripts/$pkg .
    }
  }
}