Scratchpad r75 (See the current copy)

Random [Scripts]
Information about [Tcl]
Information about [Random Number Generation]
----
Random [Diatribes]
My [Scratchpad]
Random [Demonstrations]
My [Friends]
Feel free to contact me about this website at mailto:wiki@rkeene.org
Information about interesting [Current Projects]
Random [Links]
Information about [Roy Keene]
Information about [Threads]
'''What you will find here'''

** [Cross-compiling Tcl] **
''How To Cross-Compile Tcl -- It's Easy''

'''To Windows (x86)'''

 $ RC=i586-mingw32msvc-windres AR=i586-mingw32msvc-ar RANLIB=i586-mingw32msvc-ranlib \
   ./configure --host=i586-mingw32msvc --build=i486-slackware-linux --disable-shared \
   --disable-threads --disable-64bit --disable-symbols

----

'''To MIPS (uClibc)'''

 $ AR=mipsel-linux-uclibc-ar RANLIB=mipsel-linux-uclibc-ranlib ./configure \
   --host=mipsel-linux-uclibc --build=i486-slackware-linux --disable-shared \
   --disable-threads --disable-64-bit --disable-symbols
----
Also see [KitCreator] for building and cross-compiling a [Tclkit].  There are many pre-build Tclkits for almost any platform:
Locally Built [Tclkits]
[http://www.equi4.com/tclkit/download.html | Original Tclkts]

Once you have a Tclkit for your platform and your target platform you can create a "Starpack", which is a native executable (for the target platform) that contains the Tcl interpreter, all its required files, your application, and all its resources -- in a single file.  Steve has good introduction [http://www.stevescripts.com/starpack.html | on his page].

I typically use a script ([http://rkeene.org/projects/starkit2exe/ | starkit2exe]) within a Makefile to create my starpacks.  Using this, I can emulate traditional build procedures.  Typical directory layout looks like:
Makefile
myapp.vfs/
myapp.vfs/main.tcl
myapp.vfs/myapp.tcl
myapp.vfs/lib/
myapp.vfs/lib/libs...

The Makefile typically looks like:
 BINS = myapp-linux-x86 myapp-windows-x86.exe myapp-macosx-x86+ppc.zip
 all: $(BINS)
 myapp-%: myapp.vfs/main.tcl myapp.vfs/handy-budget.tcl myapp.vfs/lib/pkg0.1/pkgIndex.tcl myapp.vfs/lib/pkg0.1/pkg.tcl
        starkit2exe myapp.vfs "$@" `echo $@ | sed 's@^myapp-@@;s@\.exe$$@@;s@\.zip$$@@'`