tpack

Difference between version 1 and 2 - Previous - Next
<<toc>>

----

**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 [starkit]s 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:
%|Deployment|files|Compression|Tclkit 8.4|Tclkit 8.5|Tclkit 8.6|Tclkit 8.7|Tcl 8.4|Tcl 8.5|Tcl 8.6|Tcl 8.7|%
&|starkit|1|yes|yes|yes|yes|yes|no|no|no|&
&|zipkit|1|yes|no|no|yes|no|no|no|yes|&
&|Ttarkit|2|no|yes|yes|yes|yes|yes|yes|yes|&
  
**Links**

    * Homepage: https://github.com/mittelmark/DGTcl
    * Download: https://downgit.github.io/#/home?url=https://github.com/mittelmark/DGTcl/tree/master/apps/tpack
    * Manual: http://htmlpreview.github.io/?https://github.com/mittelmark/DGTcl/blob/master/apps/tpack/tpack.html
    * Version: 0.1 - 2021-09-13
    * License: MIT

**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**
   * [starkit] - standard Tclkit approach since Tcl 8.4
   * [zipkit] - the new zip file based approach since Tcl 8.7
   * [tarpack] for deploying multi-file libraries as single file Tcl-modules.

----

**Discussion**

Please discuss here ...



<<categories>> Package | Deployment