Version 1 of tpack

Updated 2021-09-13 04:39:13 by DDG

Name

tpack - - tar file based deployment system for Tcl applications, supports Tcl 8.4, 8.5, 8.6 without any additional libraries on all platforms

Description

DDG 2021-09-13: tpack is a Tcl script which can be used to deploy your Tcl application to other computers and users. As input out you give your application file app.tcl and a folder containing your libraries app.vfs. The folder structure is the same as for the starkit approach, by careful design of the file app.vfs/main.tcl the same folder can be as well used to for building starkits and tarkits. The script tpack.tcl creates from the file app.tcl a file app.ttcl containing the required parts from the tar library of tcllib to untar tar files and at the end your application code. From the folder app.vfs a tar archive with the extension .ttar is created: app.ttar. To deploy your application those two files has to be copied to the other computer, the file app.ttcl can be as well renamed to let's say app.bin or even app as long as app.ttar is in the same folder like the ttcl file.

Comparison

Here a comparison table between three deployment strategies:

DeploymentfilesCompressionTclkit 8.4Tclkit 8.5Tclkit 8.6Tcl 8.4Tcl 8.5Tcl 8.6
starkit1yesyesyesyesnonono
zipkit1yesnonoyesnonoyes
Tarkit2noyesyesyesyesyesyes

Links

Example

Here is an example for a minimal application consisting of some application file mini.tcl and a folder mini.vfs with some small library test:

## FILE mini.tcl
#!/usr/bin/env tclsh
package require test
puts mini
puts [test::hello]

## FILE mini.vfs/main.tcl
lappend auto_path [file join [file dirname [info script]] lib]

## FILE mini.vfs/lib/test/pkgIndex.tcl
package ifneeded test 0.1 [list source [file join $dir test.tcl]]

## FILE mini.vfs/lib/test/test.tcl
package require Tcl
package provide test 0.1
namespace eval ::test { }
proc ::test::hello { } { puts "Hello World!" }

Such a sample application can be downloaded here: https://github.com/mittelmark/DGTcl/blob/master/apps/tpack/tpack-sample.zip

You can then create your two files using the following commandline:

tpack wrap mini

This will create the files mini.ttcl and mini.ttar which are the files you need to deploy on your computer which should have an existing Tcl installation as prerequisite. For more details consult the manual at http://htmlpreview.github.io/?https://github.com/mittelmark/DGTcl/blob/master/apps/tpack/tpack.html


See also


Discussion

Please discuss here ...