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.
4. Create a simple tcl script and mark it executable. $ 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). 5. Run it - it should produce a single line - the version of expect that you have installed. $ ./tkex.tcl 5.38.0 6. execute sdx.kit to create a first starkit: $ 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 7. Now, run the starkit: 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. 8. Unwrap the starkit. $ sdx.kit unwrap tkex.kit 5 updates applied 9. place expect into a place where tclkit will find it. $ 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 10. Update the pkgIndex.tcl so that it will find it appropriated. After editing pkgIndex.tcl, it now looks like this: $ 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]] 11. Now test it out. $ tclkit tkex.vfs/main.tcl 5.38.0 12. That works - so let's wrap up the starkit. $ sdx.kit wrap tkex.kit 9 updates applied 13. Test out the starkit. $ ./tkex.kit 5.38.0 14. Now create the single file starpack. First, make a copy of tclkit, so that it can be placed in the final executable. $ 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 ].]