lv writes in comp.lang.tcl the following:
According to TingChong <[email protected]>: :I want to create a standalone expect binary on solaris 8. :i.e. without worrying tcl installation. Okay - here's what I did.
$ cat tkex.tcl #! /usr/tcl84/bin/tclsh package require Expect puts [package versions Expect]
(where the first line is a path to where _I_ have tclsh installed).
$ ./tkex.tcl 5.38.0
$ sdx.kit qwrap tkex.tcl 5 updates applied $ ls -l tkex* -rwxr-xr-x 1 lwv26 dept26 824 Aug 18 10:47 tkex.kit -rwxr-xr-x 1 lwv26 dept26 80 Aug 18 10:47 tkex.tcl
lwv26awu (389) $ ./tkex.kit can't find package Expect while executing "package require Expect" (file "/tmp/t/tkex.kit/lib/app-tkex/tkex.tcl" line 4) invoked from within "source /tmp/t/tkex.kit/lib/app-tkex/tkex.tcl" ("package ifneeded" script) invoked from within "package require app-tkex" (file "./tkex.kit/main.tcl" line 3) invoked from within "source ./tkex.kit/main.tcl" ("uplevel" body line 1) invoked from within "uplevel [list source [file join $self main.tcl]]"
Good - the starkit exists, but shows it cannot currently find Expect.
$ sdx.kit unwrap tkex.kit 5 updates applied
$ cd tkex.vfs/lib $ mkdir expect5.38 expect 5.38/SunOS5.8 $ cp /usr/tcl84/lib/expect5.38/pkgIndex.tcl expect5.38/pkgIndex.tcl $ cp /usr/tcl84/lib/expect5.38/libexpect5.38.so expect5.38/SunOS5.8/libexpect5.38.so
$ cat tkex.vfs/lib/expect5.38/pkgIndex.tcl i# Tcl package index file, version 1.0 # This file is sourced either when an application starts up or # by a "package unknown" script. It invokes the # "package ifneeded" command to set up package-related # information so that packages will be loaded automatically # in response to "package require" commands. When this # script is sourced, the variable $dir must contain the # full path name of this file's directory. package ifneeded Expect 5.38.0 [list load [file join $dir [format "%s%s" $::tcl_platform(os) $::tcl_platform(osVersion)] libexpect5.38.so]]
$ tclkit tkex.vfs/main.tcl 5.38.0
$ sdx.kit wrap tkex.kit 9 updates applied
$ ./tkex.kit 5.38.0
$ cp /path/to/tclkit tclkit-runtime $ sdx wrap tkex.kit -runtime tclkit-runtime 8 updates applied $ ls -l tkex.kit -rwxr-xr-x 1 lwv26 dept26 2329846 Aug 18 10:58 tkex.kit $ ksh $ unset PATH $ ./tkex.kit 5.38.0 $ which tclkit $
That part with the unset of PATH is just to prove that the file is self-contained - no tclkit (or anything else!) is in the path, so the only thing executing is the starpack.
Or, we could point out in the http://expect.sf.net/ release ChangeLog something like:
2003-02-14 Andreas Kupries <[email protected]>
NOTE: stubs is not default, but has to be activated via '--enable-stubs'
.
The following is an old comment.
[Explain how Expect has not been generally available for Tclkit applications (significance of stubs and so on), but there have always been several other ways (some proprietary) to create, for example, single-file executables. In any case, Guido Ostkamp has demonstrated "clean" co-operation between the two [L1 ]. His patch--Steve Landers' "modified files" [L2 ] converted into 'patch' format--is publicly available [L3 ].]