gd module install notes

I'm going to assume that you've got the GD library installed, which is pretty trivial to do. If you're having troubles with that, I suggest you have a look at that package's instructions.

This version of gdmodule is written assuming you have PNG, JPEG, FreeType, and Xpm libraries incorporated into your copy of GD. If you have an incomplete version you will have difficulty getting this one to build.

Now, for gdmodule, you'll need to do one of two things. You have the option to link the gdmodule into Python itself or to make it dynamically loadable.

option 1

Determine the installation location (prefix) of Python on your system. This may be done using the command "python -c 'import sys;print sys.prefix'". Once you have determined the install prefix, then grab the file Makefile.pre.in from prefix/lib/python1.5/config.

I have provided a sample of this file, from Python 1.5, but you would do well to copy the one from your build. Also, if you are using Mingw32 (to build for Windows) you are on your own at the moment.

Now that Makefile.pre.in is in the same directory as the gdmodule.c source and Setup.in, edit Setup.in to ensure that the GD library include and lib paths are correct.

Now type "make -f Makefile.pre.in boot; make". You should now have a working gdmodule.so. You should be able to execute the "gddemo.py" script with no errors. Once you have determined that it's all compiled ok, copy gdmodule.so to prefix/lib/python1.5/site-packages (you may need to actually make this directory).

option 2

This requires that you are able to either compile & install Python yourself or are good friends with the person who does :) You need to copy the gdmodule.c file to the Modules directory and edit the "Setup.in" file to add the following lines at the end:
# Richard Jones' GD module.
gd gdmodule.c -I/usr/local/include -L/usr/local/lib -L/usr/lib/X11 -L/usr/X11R6/lib -lgd -lz -lpng -ljpeg -lttf -lX11 -lXpm
Once you've done that, you'll need to delete the "Setup" file and type "make Setup". Then go up to the main Python directory and type "make install" and you're done. You should now be able to execute the "gddemo.py" script with no errors.