
Installing Sketch
=================

These installation instructions are divided into two parts. The first
part describes the third party software you need for Sketch. The second
part describes the installation of Sketch itself.

If you've installed Sketch before you might want to go directly to the
Sketch specific instructions.

If you're installing on Linux, there are some platform specific notes
about necessary packages and binaries of Sketch, Python et al. at the
end.


Installing the third party software.
====================================


1.  Install Tcl/Tk
--------------------------

On my System, I use Tcl/Tk 8.0. Tcl 7.6 and Tk 4.2 should also work.
Most (all?) Linux distributions include Tcl/Tk so this step shouldn't be
a problem. Tcl/Tk can be found at
<http://www.scriptics.com/software/download.html>

Sketch uses only standard Tk features. No additional packages are
required.


2.  Install Python
--------------------------

Python is available from its WWW home page: <http://www.python.org/> or
via ftp from <ftp://ftp.python.org/pub/python/>. See Python's
documentation for installation instructions.

Alternatively, you can use the rpm-packages available at
http://andrich.net/python.

You need at least version 1.5.1. Version 1.5 or older will not work,
since Sketch uses some features only provided by 1.5.1.

When configuring Python, be sure to enable the Tkinter module (Python's
installation instructions tell you how to do that). It is disabled by
default. Tkinter is Python's standard Tk interface.

It may be a good idea to check whether Tkinter works by running some of
the example scripts from Python's Demo/tkinter/* subdirectories.



3.  Install the Python Imaging Library (PIL)
----------------------------------------------------

This library is available from <http://www.pythonware.com>. See the
accompanying documentation for installation instructions. The
installation instructions of PIL versions 1.0b1 and earlier seem to
state that you have to build PIL in the Python source tree; this is not
true, you can build them anywhere you like if you have a complete Python
installation.

The installation instructions have a section describing how to add it to
tkinter. Sketch doesn't need this, as it uses its own image rendering
code. It does no harm to do it, though.

One point not mentioned in the PIL installation instructions are the
headerfiles (.h files). For easier configuration of Sketch I recommend
to install the files the following files found the libImaging
subdirectory into a directory under the Python include directory:

     ImConfig.h  ImPlatform.h  Imaging.h

(e.g. if your Python include directory is /usr/include/python1.5, put
them into /usr/include/python1.5/Extensions)

At the moment I use release 1.0 (older versions should also work).



4. Optional: Python XML package
-------------------------------

This step is optional. The XML package is only needed by the SVG import
filter. If you don't know what XML is or SVG, just skip this step. It is
not needed for normal use of Sketch.

If you want to test the SVG import filter, you can get the source of the
XML package at: http://www.python.org/topics/xml/download.html




Installing Sketch:
==================

Sketch has a configure, build and install script. This script is
modelled after (but less generic and powerful than) the proposed
standard for Python packages and applications currently discussed in the
Python distutils SIG.

In case this script does not work for you, you can also use the old
'pedestrian' method that was required by older versions of Sketch. This
method is described as method 2 below.

The installation process consists of three steps: configuration,
compilation and installation. These steps are quite independend from
each other, so even if the script doesn't work for one step it might
still work for the other two.


Method 1: setup.py
==================

Sketch comes with a script setup.py that can be used to configure, build
and install Sketch on your System. The normal way to invoke this script
is:

    $ setup.py <command> [options...]

where <command> is either 'configure', 'build' or 'install'. The command
may be followed by options, described below. 'setup --help' prints a
help message.



Configuration:
--------------

Sketch needs to access the Python Imaging Library from C, so it needs to
know where its headerfiles are. Unfortunately there's no standard place
where they are installed, but if you've installed them as described
under 'Install PIL' above, you can just do:

    $ setup.py configure

If your PIL headerfiles are somewhere else, use

    $ setup.py configure --imaging-include=<dir>

where <dir> is the appropriate directory.

Another option you may want to use is '--with-nls' to enable national
language support. If you've set the environment variable LANG to a
suitable value (e.g. de for German) Sketch uses that language in its
menus, dialogs and messages, if Sketch has the appropriate translation.



Compilation:
------------

This is simple, if configuration was successful. Just do

    $ setup.py build

This compiles the C-modules.


Installation:
-------------

setup.py installs almost all files under <prefix>/lib/sketch-<version>.

<prefix> defaults to /usr/local and <version> is the current Sketch
version. 

It also creates two symbolic links (sketch and sk2ps) in <prefix>/bin
pointng to sketch.py and sk2ps.ps in <prefix>/lib/sketch-<version>.

To install under /usr/local run

    $ setup.py install

to use a different <prefix> run

    $ setup.py install --prefix=<dir>


You can now start Sketch with 

    $ sketch

if <prefix>/bin and is in your $PATH. If it isn't, use the full filename
of the symbolic link in the <prefix>/bin directory.




Method 2: The old, pedestrian Method
====================================


First, change into the subdirectory Pax. You'll find a file Setup.in.
Copy that file to Setup and edit it. Follow the comments in that file.

This works just like the Setup file in Python's Modules directory which
you probably edited to activate Tkinter. Pax has to be linked against
the same versions of Tcl/Tk as Tkinter.

Now, in Pax, type:

     $ make -f Makefile.pre.in boot
     $ make

You should have a file Pax/paxmodule.so now.

Now, go to the Filter subdirectory (there's another Setup.in file here,
but you shouldn't need to change it) and type:

     $ make -f Makefile.pre.in boot
     $ make

You should have a file streamfilter.so now.

Now, go to the Sketch/Modules subdirectory and edit the file Setup.in
there. Again, if you change anything, save the file as Setup.

Now, in Sketch/Modules type (you guessed it):

     $ make -f Makefile.pre.in boot
     $ make

You should have a file _sketchmodule.so now (and some other .so files).

Finally, go to the topmost directory and run the python script
finishinst.py. This will compile the Python source files. This step is
not really necessary, but sketch should start a bit faster)


Starting Sketch:
================


Now you can test Sketch from the topmost directory by running

     $ python sketch.py

or

     $ ./sketch.py

if your Python interpreter is somewhere in your $PATH.


If you want to install Sketch somewhere outside of the source tree, use
the setup.py script as described above.

For further information on Sketch, have a look at the ``User's Guide'',
or if you're interested how Sketch is implemented or if you want to
extend it, read the ``Developer's Guide''. Both documents are quite
incomplete.




Platform specific notes:
========================

This section only covers two Linux distributions at the moment. If you
have something to add here, or if the information here is wrong (I only
have access to SuSE Linux at the moment), mail me about it.


Linux:
------

    SuSE:
    -----

	I'm using version 6.1 of this distribution myself. 

	Sketch should work with the python interpreter that comes with
	SuSE 6.1 and 6.2. You have to install the packages python and
	pyth_tk and of course the packages they depend on.

	The Python Imaging Library is not included in 6.1, but there's a
	binary RPM available from Sketch's web site.

	6.2 has a PIL-package, but it's slightly broken. The file
	/usr/lib/python1.5/site-packages/PIL.pth is missing. To fix
	this, create that file with just the line 'PIL' in it (without
	the quotes). (the purpose and syntax of *.pth files is described
	in /usr/lib/python1.5/site.py)

	There's also a binary RPM of Sketch itself available on the
	web-site, compiled under 6.1.

	
    Red Hat:
    --------

	To compile Sketch and the Python Imaging Library, be sure to
	install the python-devel package.

	Alternatively, you can download RPMs of Python 1.5.2 from
	http://andrich.net/python. 

	In particular, you need these RPMs

	python-1.5.2-2.i386.rpm
	python-tkinter-1.5.2-2.i386.rpm
	python-imaging-1.0b1-3.i386.rpm

	and one of these (for Sketch, it doesn't matter which you use):

	python-_tkinter-1.5.2-2.i386.rpm
	python-imaging-_tkinter-1.0b1-3.i386.rpm
