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:

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 on his page.

I typically use a script (starkit2exe) within a Makefile to create my starpacks. Using this, I can emulate traditional build procedures. Typical directory layout looks like:

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$$@@'`