Version 10 of LUCK

Updated 2021-05-17 07:59:24 by chw

Lean Undroidwish Construction Kit

A by-product of undroidwish, see it in action in , the available binary templates in , and the source code in .


Web based (CGI) script to make a taylored undroidwish, vanillawish or vanillatclsh from binaries which are searched in the same directory as the tclsh or wish executing this script. Additionally, prefabricated configurations are presented. These are searched like the binaries and additionally relative to the parent directory of this script.

In the first step, the user selects a prefabricated or uploaded configuration or a binary. In the second step, a selection of packages derived from the binary's ZIP is presented plus some other options such as ZIP password and output filename. The package selection and other options can be primed by the info from a prefabricated or uploaded configuration. In the last step the user can generate a new binary and configuration with only the selected packages and other options, which is downloaded as a file.

The CGI script is RESTful and can be used as a service from other Tcl scripts utilizing tcllib's rest package, e.g. to easily mass produce Tcl apps for a variety of platforms. Here is an example on how to read out information and make a binary:

# Demonstrate usage of LUCK RESTfully, requires a locally running LUCK service on port 8015

package require rest

set luck(list) {
    url http://localhost:8015/cgi-bin/luck.tcl description {list of available templates}
    result raw
    method post static_args {api list} req_args {} opt_args {}

# req_args:
#   -template   name of binary template, e.g. vanillawish-linux32
# opt_args:
#   -withtips   when present send alternating lines of extension name and description

set luck(extlist) {
    url http://localhost:8015/cgi-bin/luck.tcl description {list of extensions of given template}
    result raw
    method post static_args {api extlist} req_args {template:} opt_args {withtips}

# req_args:
#   -template   name of binary template, e.g. vanillawish-linux32
#   -include    list of extensions to be embedded
#   -appfile    *.tcl (for app/main.tcl) or *.zip (must have main.tcl)
# opt_args:
#   -cmdline    (undroidwish) additional startup arguments
#   -appicon    (undroidwish) BMP (24 bit RGB) icon
#   -winicon    (Windows binaries) icon (*.ico) for executable
#   -passwd     ZIP password

set luck(generate) {
    url http://localhost:8015/cgi-bin/luck.tcl description {generate a binary}
    result raw
    method post static_args {api generate} req_args {template: include: appfile:} opt_args {cmdline: appicon: winicon: passwd:}

# create REST interface
rest::create_interface luck

# list templates
puts "==== Templates ===="
puts -nonewline [luck::list]

# list extensions of vanillawish-win32.exe
puts "==== Extensions of vanillawish-win32.exe ===="
puts -nonewline [luck::extlist -template vanillawish-win32.exe]

# make tkbugz for win32 from a ZIP which contains main.tcl
# with the single line "source [info nameofexecutable]/tkbugz/tk_bugz.tcl"
set main_tcl_zip {
set f [open tkbugz.exe wb]
puts -nonewline $f \
    [luck::generate -template vanillawish-win32.exe \
         -include tkbugz -appfile [binary decode base64 $main_tcl_zip]]
close $f

Most vanillatclsh-en from the web site contain a REST based TUI frontend called lucktui which is available in the luck package, e.g. by running vanillatclsh... builtin:luck/lucktui.tcl or vanillatclsh... builtin:lucktui for short. Here's a sample session as an ASCII screencast .

In order to setup your own local build/packaging service:

  • fetch the relevant (or all) binary templates from
  • store these in one directory
  • execute vanillawish... builtin:LUCK with a vanillawish runnable on your platform; this starts a local tclhttpd on port 8015 and tries to invoke a web browser on its LUCK page
  • or execute vanillatclsh... builtin:lucktui with a vanillatclsh runnable on your platform; this presents the TUI with a local tclhttpd on port 8015
  • begin mass production of single file self contained Tcl/Tk apps; the world is your oyster!