Version 7 of TEA2

Updated 2003-01-31 19:24:50

The directory and file structure of a TEA package is basically:

         $exec_prefix
          /       \
        lib       bin
         |         |
   PACKAGEx.y   (dependent .dll files on Windows)
         |
  pkgIndex.tcl (.so|.dll files)

The main dynamic (.so or .dll) library file gets installed in the versioned PACKAGE directory, which is OK on all platforms because it will be directly referenced with by 'load' in the pkgIndex.tcl file. Dependent DLL files on Windows must go in the bin directory (or other directory on the user's PATH) in order for them to be found.


Q: What are the steps one needs to take if one has some C and Tcl code that currently can be loaded as a Tcl extension, if they want to restructure the code to be TEA2 compliant?

A: The easiest way is to grab a copy of the sampleextension module from the Tcl CVS repository [L1 ], and edit Makefile.in and configure.in according to the instructions therein. You'll also need GNU autoconf (and GNU m4, and perhaps a few other dependencies). Run autoconf to generate a configure shell script from configure.in, and distribute it with your package.

If you're familiar with autoconf and make, you might want to write your own configure.in and Makefile.in instead -- the sampleextension Makefile imposes some requirements on the directory layout that might not match your current source setup. tcl.m4 -- the file containing the TEA autoconf macros -- is extremely well commented and fairly easy to follow. I can't say the same for the sampleextension Makefile.in, though :-(

Q: How does one determine that a package is TEA2 compliant?

A: Ask Jeff Hobbs to try building it. If it works for him, the package is compliant :-)

But seriously:

 To be "TEA compliant" ideally means that you use the latest TEA spec,
 which is part of the sample extension in cvs in the Tcl SF project.
 However, it essentially means that your extension will compile with
 'configure ; make' on any platform (including Windows), and that these
 have a standard set of options and targets (like recognizing --with-tcl,
 --enable-threads, --enable-symbols for configure and install-libraries
 and install-binaries targets for make). 
 [http://groups.google.com/groups?as_umsgid=3D8F638D.3060806%40ActiveState.com]

Q: What are the recommended tools needed to build a Tcl extension packaged using TEA2?

A:

  1. The source for the extension.
  2. An appropriately installed C compiler

Q: What are the recommended steps required to build a Tcl extension packaged using TEA2?

A:

  1. Download and extract the source code (for the sake of this example, assume the extension is sample_tea2) into a directory.
        For the sake of the following information, assume the directory structure looks like this:
        /usr/source
                /tcl
                /tk
                /sample_tea2
  1. change directory into extension directory (ex. cd sample_tea2)
  2. read the README, INSTALL, or other seemingly relevant documentation, to determine whether there are dependencies that need to be met before continuing.
  3. create a directory into which you plan on performing the configure, compile, and testing of the extension - let's call it sample_tea2_build
        The directory structure now looks like:
        /usr/source
                /tcl
                /tk
                /sample_tea2
                /sample_tea2_build
  1. change directories into sample_tea2_build
  2. Execute the extension's configure command with --help to determine whether there are specific flags you are going to need during configuration time.
  3. Execute the extension's configure command with appropriate flags.
  4. Once configure has successfully completed, execute the make command.
  5. Execute a make test if the extension writer provides a test target, to see if the code is working as expected on your platform.
  6. Execute a make install once you are ready for the extension to be installed.

See also TEA.


[ Category Porting | Category Package | ]