Tcl/Tk 8.4 port for Windows/CE

This file includes build instructions for the port of Tcl/Tk to the
Window/CE platform.  It has been tested for the following configuration
only.

These are based on notes available at:

      http://wiki.tcl.tk/10103

That page includes notes for the port made using Microsoft eVC3, which
supported Windows/CE up to v3.0 (aka PocketPC 2002).  My current porting
environment uses eVC4 (as noted below), which has a minimum porting
version of Windows/CE 4.0 (aka PocketPC 2003).

** Obtaining Tcl/Tk and extension sources **

 * Tcl/Tk require patched sources for Windows/CE compilation.
   Obtain a copy of the pre-patched Tcl/Tk sources, or apply the patches
   in the 'etc/' directory to Tcl and Tk (8.4.12+ sources).
 * Sources for [incr Tcl/Tk] require the CVS head.  This can be directly
   checked out from CVS at SF, see:
	http://incrtcl.sourceforge.net/
   Or can be obtained from the nightly CVS snapshot at:
	ftp://ftp.tcl.tk/pub/tcl/nightly-cvs/
   A snapshot from 2004-09-07 or newer must be used.

** Installation of the required build software **

 1. Install cygwin on your machine from http://www.cygwin.org/.
    Ensure that you include 'make', 'patch', 'tar' and 'gzip' in the list
    of apps to install.

 2. Get Rainer Keuchel's celib binaries:
	http://www.rainer-keuchel.de/wince/celib.html
	http://www.wince-devel.org/src/celib-3.11-dll-src.tar.gz
    Unpack them on your system (e.g., in C:/src)
	mkdir /cygdrive/c/src
	tar zxf /path/to/celib-3.11-dll-src.tar.gz
    This should give you a directory named 'celib-palm-3.0' which includes
    sources and libraries to build against.

 3. Using the 'patch' program from cygwin, patch the celib sources with the
    included patch 'celib-3-evc4.patch' in the 'etc/' directory.
	cd /cygdrive/c/src/celib-palm-3.0
	patch -p0 -i /path/to/celib-3-evc4.patch
    This patch contains changes to ignore some of the celib compatability
    functions that are supported in newer revisions of Windows/CE.

 3. Install MSVC++ 6 or other functional compiler.

 4. Install embedded Visual C++ 4.0 and newest SP release. You can skip
    embedded VB, but let it install in the default directory.
	http://msdn.microsoft.com/mobility/downloads/updates/default.aspx
    Files: eVC4.exe, eVC4sp4.exe

 5. Install the Pocket PC 2003 SDK if it is not installed already:
	http://msdn.microsoft.com/mobility/downloads/sdks/default.aspx
	http://www.microsoft.com/downloads/details.aspx?familyid=9996b314-0364-4623-9ede-0b5fbb133652&displaylang=en
    This may be installed by the eVC4 install.
    File: "Microsoft Pocket PC 2003 SDK.msi"

 6. Unpack Window/CE compatible Tcl and Tk sources (e.g., to tcl8.4ce and
    tk8.4ce respectively)

 7. Pray that it all installed OK ... you should have the following:

    * An installed Win32 compiler found on the path
    * Various CE Tools in "C:/Windows CE Tools"
    * The embedded VC in "C:/Program Files/Microsoft eMbedded C++ 4.0"
    * The PPC 2003 SDK in "C:/Windows CE Tools/wce420/Pocket PC 2003"
    * celib sources (e.g., C:/src/celib-palm-3.0)
    * Tcl 8.4-ce sources (e.g., C:/src/tcl8.4ce)
    * Tk 8.4-ce sources (e.g., C:/src/tk8.4ce)

** Building of the required software **

 1. Configure the system in the cygwin shell and run make:
	cd /cygdrive/c/src
	mkdir tclbuild ; cd tclbuild
	/cygdrive/c/src/tcl8.4ce-src/win/configure \
		--enable-wince="420,ARMV4,ARM,Pocket PC 2003" \
		--with-celib=/cygdrive/c/src/celib-palm-3.0 \
		--prefix=C:/src/inst
	make
	make install

    The install step will place the code in C:/src/inst.  While this will
    not run on your desktop Windows system, it makes it easier to see what
    needs bundling onto the CE device.

 2. Repeat for Tk.
	cd /cygdrive/c/src
	mkdir tkbuild ; cd tkbuild
	/cygdrive/c/src/tk8.4ce-src/win/configure \
		--enable-wince="420,ARMV4,ARM,Pocket PC 2003" \
		--with-celib=/cygdrive/c/src/celib-palm-3.0 \
		--prefix=C:/src/inst
		--with-tcl=/cygdrive/c/src/tclbuild
	make
	make install

 3. Tcl/Tk builds complete

 4. Repeat for other CE-compatible extensions (e.g. itcl) using the
    appropriate flags to reference Tcl/Tk builds, for example:
	cd /cygdrive/c/src
	mkdir itclbuild ; cd itclbuild
	/cygdrive/c/src/itcl/configure \
		--enable-wince="420,ARMV4,ARM,Pocket PC 2003" \
		--with-celib=/cygdrive/c/src/celib-palm-3.0 \
		--prefix=C:/src/inst \
		--with-tcl=/cygdrive/c/src/tclbuild \
		--with-tk=/cygdrive/c/src/tkbuild
	make
	make install

    Most extensions should 'install' just fine, but some extensions may
    try and invoke 'tclsh' to do some part of the install.  Those
    extensions will need to be hand-installed.

** Assembly from builds **

Due to the required cross-compilation for Windows/CE, you have to construct
the resulting bits for placement on the CE device by hand.  If the install
step for all your applications worked correctly, then you simply need to
copy the 'C:/src/inst/{bin,lib}' directories to '<CE_Device>/Tcl'.

You also need to copy the appropriate celib.dll to '<CE_Device>/Tcl/bin'.
This should be 'celib-palm-3.0\wince-arm-pocket-wce300-release\celib.dll'.

Any pure-Tcl extensions (those without any C component) can simply have
their 'lib/extX.Y' directory copied to the '<CE_Device>/Tcl/lib' directory
to function correctly.
