Installing Cgipp on a unix system
|
Most unix-sysadmins and aspiring sysadmins know that unix is
pretty much like Plato's ideas, which everyone has a different image
of what'll look like. There are small (and sometimes not-so small)
differences between the implementations of unix, so some patching of
the Makefiles/headerfiles might be needed. I have tried to stay true
to ANSI C++ and have not included any fancy coding (like templates,
exceptions, etc) so just about any C++ compiler with an iostream
library will be able to compile it. It has mainly been tested on
unix-flavours with g++ (it uses only libstdc++ and not libg++) which
is available (free of charge!) on all(?) unix-platforms. I also use
autoconf to provide a configure-script which will check your system
for what it needs from your system to compile properly. If you are
fairly new to installing libraries, contact your sysadmin or your local
guru (if you don't have one, get one) if you run into problems.
If you're lucky, you'll only need to edit one file,
mkinfo.mk, where you'll need to set the following variables (as
in a Makefile) correct:
- CGIDIR - Where you want your compiled cgi-scripts to end
up. This is very often public_html/cgi-bin/
- LIBDIR - Where you want your compiled Cgipp-library to be
put. On systems where I am meant to be root I (arrogantly) set this
to /usr/lib, on multi-platform systems where I am not meant to be root
i set it in an appropriate lib/$(ARCH)/ as lib/linux/ on linux.
- LIBADMIN - The person in charge of the library
(e.g. stig@ii.uib.no) Initially set to get your username and
your host if you don't know but don't rely on this.
- CGIEXAMPLES - The example files which is compiled to check
if the library was properly compiled and installed. Should at least
include test.cgi and probably also fulltest.cgi
- LOG - Where you want your logfile, I prefer to either put
it in my account if I am the sole cgi-programmer or in the standard
log-area if I am the webmaster. This file should in most cases be
world-writable (666 mode) to allow nobody (which most proper
webservers is run as) to write to the log.
- OLD - If you wish to compile the library for old scripts,
define OLD, but it is not recommended so please don't muck around with
it, leave it commented out. (It is there mostly for me and my
friends' rather big libraries :-)
The most important defines and details comes either from
mkinfo.mk, or the configure script, but if things screw up you might
wish to check a couple of headerfiles (it is in 99 of 100 cases not needed),
most notably general defines in Defs.H and
debugging-defines in Debug.H (new cgi-programmers may be surprised by the
attention given to debugging, but it's importance will very soon
become apparent).
Run ./configure and if no fatal errors appeared, run
make or make shared if your OS supports ELF (SVR4 and
Solaris) and you want shared libraries which I use on my biggest
site (the Legendary Dragonlands where at least 16 scripts run every
minute so the shared cgi-library and the supporting library lies in
the cache almost constantly. For even larger sites (50 000+) hits a day,
this may be of vital importance. To test it use make examples
Debugging note: if you wish the debugging to be
nonstandard (it is almost minimal already), check src/Makefile
for options. If you define MAINTAINER you'll get plenty of seemingly
useless debugging which will make huge debuggingfiles (expect at least
10-20k each time an app is run)
LIBDIRPATH: If you set the LIBDIR variable in mkinfo.mk
to anything nonstandard you should also set the FULLINCLUDE variable
in the src/Makefile to also include a correct -L option
(example is included in src/Makefile
crude debugging note: If you wish to include "normal" debugging
when you create the library, add -g to the CFLAGS in
src/Makefile. This will make the library much larger and this
form of debugging is IMVHO virtually useless, at least I have yet to
see anyone actually use a standard debugger on a cgi-script. Use the
cgidebugging provided instead for better results.
Solaris Note: If you wish to compile a shared library on
Solaris, edit the SHARELINKFLAG in the src/Makefile
If you run into other problems, have suggestions, etc., contact
me by email at stig@ii.uib.no and I usually
answer pretty quick (except in weekends)