Monday, March 17, 2008

Python 2.5 and Tcl/Tk 8.5 DSL Extension

I've been playing with Damn Small Linux (DSL) as a host OS for my Xerblin project and so far I'm impressed. It's a cute system: Knoppix base with a full-fledged but tiny desktop system and a fairly sophisticated facility for customization via "Extensions" (and other means.)

In order to run Xerblin (which depends on Tkinter), I'm creating an extension for DSL that includes Python 2.5 as well as Tcl/Tk 8.5 (there is already a Python 2.5 extension but it doesn't include Tkinter support.) It's proving to be very straightforward, in part because both the folks responsible for Tcl/Tk and the folks responsible for Python have done a great job on their respective build processes, and in part because the DSL extension creation process is undemanding.

Compiling and Installing Python and Tcl/Tk
Briefly, I created a couple of "destination" directories in the /opt directory, one for Python and one for Tcl/Tk:

mkdir /opt/tcltk-8.5
mkdir /opt/python2.5

Then, having downloaded the source code for each from their respective websites, I did the configure; make; make install dance and specified the proper "destination" directories

tar xzvf tcl8.5.1-src.tar.gz
cd tcl8.5.1/unix
./configure --prefix=/opt/tcltk-8.5 --exec-prefix=/opt/tcltk-8.5
make && make install

Tk (note the --with-tcl option, that was one thing that had to be there to tell Tk where to find the Tcl libs):
tar xzvf tk8.5.1-src.tar.gz
cd tk8.5.1/unix
./configure \
--with-tcl=/opt/tcltk-8.5/lib \
--prefix=/opt/tcltk-8.5 \
make && make install

tar xzvf Python-2.5.2.tgz
cd Python-2.5.2
./configure --prefix=/opt/python2.5 --exec-prefix=/opt/python2.5
make && make install

Note, before you can compile Python and have it find Tcl/Tk and build Tkinter you must tell it where Tcl/Tk are, and to do this you must edit Python's file. I'll flesh this out later...

  • Symlinks to /opt/bin
  • Stripping out unneeded cruft
  • Making the extensions proper
  • Running ldconfig