Building Tclkit on IRIX

PO 2008/02/28

This page describes, how to build a Tclkit on a SGI machine running IRIX 6.5

1 General preparation steps

1.1 Choose Tcl version

If building a Tcl 8.5 based Tclkit, set environment variable KIT_VERSION to 5:

 setenv KIT_VERSION 5

For building a Tcl 8.4 based Tclkit, either nothing needs to be set, or you can set KIT_VERSION to 4:

 setenv KIT_VERSION 4

1.2 Download and unpack

Download and unpack the TclKit distribution:

 tclsh genkit A
 cp tars/genkit .

1.3 Apply patches

1.3.1 File src/tcl[85]/unix/tclUnixPipe.c

Search for functions TclpCreateTempFile and TclpTempFileName.

Add and modify the local variable list:

 char fileName[L_tmpnam + 9 + 5];
 static int ctr=0;
 char ctrStr[15];

Replace the line a few lines below the local variables:

 strcat(fileName, "tclXXXXXX");

with the following statements:

 snprintf(ctrStr,14,"tcl%05iXXXXXX",ctr++);
 strcat(fileName, ctrStr);

Patch taken from: http://sourceforge.net/tracker/index.php?func=detail&aid=878333&group_id=10894&atid=110894﷑

1.3.2 File src/vfs/configure

Goto line 6000 and search for CYGPATH to find the following line:

 vars="-I\"$(${CYGPATH} ${TCL_SRC_DIR}/generic)\""

Change that line into

 vars=""

1.3.3 File src/mk/unix/Makefile.in

Remove all calls to "ranlib"

1.3.4 File genkit

Optionally modify genkit, if your hostname is a fully-qualified long name: Change every occurence of "hostname" into "hostname -s"

2. Compilation with gcc

2.1 File genkit

Add the following to the list of OS (around line 50):

 IRIX64        { array set X {make gmake}
          array set Z {stripopt "-f"} }

2.2 File src/zlib/Makefile

Modify line

 CC=cc

into

 CC=gcc

2.3 Gcc version < 3

If using an old gcc (tested with 2.8.1) you must edit the following files:

 src/tcl/unix/configure
 src/tk/unix/configure

and remove the compiler option: -fno-strict-aliasing

3. Compilation with MIPSpro

It is assumed, that we compile for ABI Mips3, so that the TclKit runs on a great variety of SGI machines.

3.1 File genkit

Add the following to the list of OS (around line 50):

 IRIX64        { array set X {make gmake gcc cc g++ CC}
          array set Z {stripopt "-f"} }

3.2 Set environment variables

In tcsh specify:

 setenv CC cc
 setenv CXX CC
 setenv CFLAGS "-O -mips3 -n32 -DHAVE_LONG_LONG"
 setenv CXXFLAGS "-O -mips3 -n32 -DHAVE_LONG_LONG"

HAVE_LONG_LONG define is for the mk package.

3.3 File src/zlib/Makefile

Add -mips3 to CFLAGS

3.4 File genkit

Add -mips3 to the following lines near end of "proc B":

 eval run $X(gcc) -mips3 -c $O $D $TCL_DEFS $TCL_CFLAGS_OPTIMIZE \
     [glob src/*.c] [list $S/tcl$Z(85)/unix/tclAppInit.c] $Z(gccsuff)
 eval run $gcc -mips3 -o $target [glob *.o] $L $Z(ldsuff)

4. Build the TclKit

Issue the following commands to build the IRIX Tclkit:

 tclsh8.4 genkit B tcl
 tclsh8.4 genkit B
 sh genkit C
 sh genkit D
 sh genkit E

5. Test the TclKit

 ./tclkit-HOSTNAME
  > info patchlevel
  > package require Tk
  > package require Itcl
  ...

Good luck


RZ you could get ready to run kit files from http://www.sourceforge.net/projects/kbskit . The above patch should also be made in function TclpCreateTempFile.