Installation
First off UCW doesn't do version numbers. Some people may remember it did and it did, but it doesn't anymore. Still there are two versions of UCW to choose from: ucw_dev and ucw_public, both held in a Darcs repository. ucw_dev is controlled by Marco Baringer, creator of ucw. Ucw_public is world writable. At the moment I would advise to go with ucw_dev which is also the focus of this intro. _public is not always in sync with _dev, although lately it does a good job of keeping up.
The (experimental) easy way
There's a shortcut nowadays. Marco Baringer made a UCW candybox with all the dependencies boxed up and ready to fire. At the moment it's quite experimental, but if it doesn't work at least you've got all the dependencies in one go. Try:
wget http://common-lisp.net/project/ucw/ucw-boxset.tar.gz tar -zxf ucw-boxset.tar.gz cd ucw-boxset YOURLISPHERE (-)-load start.lisp
This will start UCW with the built in httpd server backend. But if you want to get the dependencies seperately or want a different initial setup, read and get some of the following:
The (old and boring) hard way
To get _dev or _public, install Darcs on your computer and execute:
darcs get http://common-lisp.net/project/ucw/repos/ucw_dev
or
darcs get http://common-lisp.net/project/ucw/repos/ucw_public
Daily snapshots for ucw_dev are available at http://common-lisp.net/project/ucw/tarballs/ucw_dev-latest.tar.gz
Daily snapshots for ucw_public are available at http://common-lisp.net/project/ucw/tarballs/ucw_public-latest.tar.gz
Now it is time for the dependencies. A word of caution: ucw has it's own versions for a number of libraries so even if you already have the latest version of some package, check this documentation or the readme supplied with the sources. As a rule of thumb, get the latest of everything and the ucw version if supplied.
At the moment UCW requires the following dependencies:
- a lisp implementation - one of the following: sbcl, cmucl, allegro, lispworks, openmcl
- arnesi - an all purpose lisp toolkit
- yaclml - yet another common lisp markup language
- parenscript - javascript in common-lisp
- iterate - a lispy loop
- rfc2388 - implements multipart/form specification
- rfc2109 - implements cookie specification
- split-sequence - splits sequences
- slime - Superior Lisp Interaction Mode for Emacs
- cl-ppcre - regular expressions lib
- trivial-sockets - handles stream sockets for undemanding network applications
- net.uri or PURI - parses URI's according to the RFC 2396 specification
- cl-fad - a portable pathname library based on code from PCL
- net-telent-date - an RFC822-compliant date parser and printer
- cl-launch - invokes lisp code from the command line
- detachtty - a screen-like detachment tool to be able to detach and reattach the lisp server from and to a console
- a server backend - be it mod_lisp (apache 1 or 2), araneida, allegroserve, portable aserve or the built in httpd server
- asdf - a package loader facility
A note on compatibility: Some configurations of implementation and server work better than others. Just report your bugs in the mailinglist, the list is quite responsive. As a pointer, an implementation/server-pair of sbcl or openmcl and mod_lisp seem too see the heaviest testing. The built-in httpd server also works well but isn't fit for production use.
Implementation.
Pick one in the list above.
Debian
Someone from Debian (Luca Capello) is working hard to to support ucw out of the box, but he is not quite there yet. Keep an eye on the cl-debian mailing list (UCW status, seeing the light at the end of the tunnel) for the latest developments.
Dependencies
arnesi
Arnesi is a Common Lisp utility suite. It contains various "bits 'n pieces" of code which were useful while developing other code. It can be found on http://common-lisp.net/project/bese/arnesi.html.
You will need the latest version:
darcs get http://common-lisp.net/project/bese/repos/arnesi_dev/
Daily snapshots are available at http://common-lisp.net/project/bese/tarballs/arnesi_dev-latest.tar.gz
yaclml
yaclml is a collection of macros and utilities for generating XML/HTML like markup from lisp code. It can be found on http://common-lisp.net/project/bese/yaclml.html.
You will need the latest version:
darcs get http://common-lisp.net/project/bese/repos/yaclml/
Daily snapshots are available at: http://common-lisp.net/project/bese/tarballs/yaclml-latest.tar.gz
parenscript - ucw version
Parenscript is a javascript compiler. You will need to get the latest development version:
darcs get http://common-lisp.net/project/ucw/repos/parenscript/
Daily snapshots are available at: http://common-lisp.net/project/ucw/tarballs/parenscript-latest.tar.gz
iterate
Iterate is an iteration construct for Common Lisp. It can be found on
http://common-lisp.net/project/iterate/Download link: http://common-lisp.net/project/iterate/releases/iterate-current.tar.gz
rfc2388 - ucw version
Rfc2388 is a lisp implemantation of RFC 2388, which is used to process form data posted with HTTP POST method using enctype "multipart/form-data".
UCW uses its own fork of rfc2388. You can get the latest code from the darcs repository located at http://common-lisp.net/project/ucw/repos/rfc2388:
darcs get http://common-lisp.net/project/ucw/repos/rfc2388/
Daily snapshots are available at http://common-lisp.net/project/ucw/tarballs/rfc2388-latest.tar.gz
rfc2109 - ucw version
Rfc2109 is the lisp implementation of the cookie protocol. You can get it at: http://common-lisp.net/project/rfc2109/:
darcs get http://common-lisp.net/project/rfc2109/rfc2109
Daily snapshots are available at http://www.common-lisp.net/project/rfc2109/release/rfc2109-latest.tar.gz
split-sequence
splits sequences
info: http://www.cliki.net/SPLIT-SEQUENCE
download: http://ww.telent.net/cclan/split-sequence.tar.gz (you might have to select a mirror first)
If said link is dead, go to http://ww.telent.net/cclan-choose-mirror to delete your CCLAN-SITE cookie and choose another mirror. At least some of them are definitely working.
SLIME
The Superior Lisp Interaction Mode for Emacs.
Download and install the latest CVS version of SLIME from http://common-lisp.net/project/slime.
To checkout from CVS you must first login to the repository:
export CVSROOT=:pserver:anonymous@common-lisp.net:/project/slime/cvsroot cvs login
Enter anonymous when prompted for the password. You can then check out the latest version with:
cvs checkout slime
It's swank you want to add to your asd systems dir. To solve a current problem with cl-launch you might want to overwrite your swank.asd file with this one:
http://cl-debian.alioth.debian.org/repository/pvaneynd/slime/debian/swank.asdCheck the description on cl-launch to see why.
cl-ppcre
Edi Weitz's regular expression library: http://www.weitz.de/cl-ppcre/.
Download the latest version: http://weitz.de/files/cl-ppcre.tar.gz
trivial-sockets
Networking library to create small server applications. Download the latest version from: http://ww.telent.net/cclan/trivial-sockets.tar.gz (you might have to select a mirror first.
If said link is dead, go to http://ww.telent.net/cclan-choose-mirror to delete your CCLAN-SITE cookie and choose another mirror. At least some of them are definitely working.
Or use asdf install.
net.uri/PURI
All of the backends (except araneida) depend on Franz's open-source net.uri library. It only works on Allegro but Kevin Rosenberg has made a portable version called PURI.
For allegro users, NET.URI can be downloaded from here (it may be included in your version of acl): http://opensource.franz.com/uri/index.html
If you're not using allegro you'll need puri which can be downloaded from http://puri.b9.com/download.html
cl-fad
A portable pathname library based on code from Peter Seibels book Practical Common Lisp.
info: http://www.cliki.net/CL-FAD
download: http://weitz.de/files/cl-fad.tar.gz
net-telent-date
A library consisting mostly of the time parsing routines from CMUCL that were removed from SBCL. Additionally it has a universal-time to rfc822 date converter.
info: http://www.cliki.net/net-telent-date
download: http://ww.telent.net/cclan/net-telent-date.tar.gz
cl-launch
A bash script to make your Lisp software easily invokable from the shell command-line.
info: http://www.cliki.net/cl-launch
download page: http://fare.tunes.org/files/cl-launch/
Download and add to your shell executable search path so ucw can find it while loading. Cl-launch can either be called cl-launch or cl-launch.sh, ucw will check for both. Also cl-launch depends on swank behavior other than that of the current cvs code, at least under sbcl, eg via swank-loader it looks for files under the load path, which is not what you want if you made a symbolic link to another dir. The easiest way to get around this problem is to overwrite your swank.asd file (in the slime directory root), with this one:
http://cl-debian.alioth.debian.org/repository/pvaneynd/slime/debian/swank.asdThe downside might be that swank won't work anymore as it should, although i haven't heard anyone about this yet. Another approach is to copy your swank*.fasls from the slime directory to the relevant shadow directory under ~/.cache/...
Check this thread for more info:
http://common-lisp.net/pipermail/slime-devel/2006-March/004664.htmlYes, ucw is bleeding edge ;)
detachtty - ucw version
A screen-like detachment tool to be able to detach and re-attach the lisp server from and to a console. Ucw uses a custom detachtty version, e.g. detachtty-9 plus a patch by Kevin Rosenberg. It accepts an eval argument when invoking a lisp, with obvious benefits. Get it through Darcs:
darcs get http://common-lisp.net/project/bese/repos/detachtty/
Go to the directory root and compile and install:
make make install
the backend
Ucw supports all the popular lisp backends. Whichever floats your boat. If you've got no clue which to choose I'd advice to go for mod_lisp. It works well with other languages, you get the benefit of apaches options and extras and all it does is pump the code straight to ucw so there's no trouble with quirks in the intermediate layer. Apache requires some work to function correctly, read the text below. The other backends should work out of the box, as long as they're recognized by asdf. aserve as well as portable aserve are in the package systems of gentoo and debian. Gentoo also supports mod_lisp and mod_lisp2 for apache and araneida. Read this blog post by Bill Clementson to form a more balanced opinion.
mod_lisp/mod_lisp2 for apache
You can choose between apache 1 and 2. First of course you have to have a Apache web server up and runnnig; then you have to add the mod-lisp module by Marc Battyani which you find at http://www.fractalconcept.com/asp/html/mod_lisp.html
First download the mod_lisp c file. Watch out, don't follow the logic of the website. Except for the windows version the info is outdated concerning the apache 1 version and info about apache 2 is non-existent. Go to subversion from the download page or click the links below:
- apache 1 .c file - mod_lisp.c
- apache 1 binaries for windows - there is a link on the site for version 2.32 but it leads to nowhere
- apache 2 .c file - mod_lisp2.c
- apache 2 windows binary - mod_lisp2.zip
As stated in the intro, if you want to use ucw on a windows machine you're on your own. I have got no experience or information.
If you went for the c module on a unix clone, use the command.
apxs -i -c mod_lisp.c
or
apxs2 -i -c mod_lisp2.c
for respectively apache 1 or 2. This will install the module in the appropriate apache directory. Debian users using apt-get should get one of the apache dev versions to get apxs(2) installed. Then add the following lines to 'httpd.conf' or other relevant configure file in your apache configuration directory for both apache 1 and 2. Just be sure to change mod_lisp.so to mod_lisp2.so for apache 2.
LoadModule lisp_module /path/to/modules/directory/mod_lisp.so
LispServer 127.0.0.1 3001 ucw
<LocationMatch "/path/.*\.ucw"> SetHandler lisp-handler </LocationMatch>
This means that ucw INTERNALLY talks to apache on port 3001 at the internet address 127.0.0.1 (so in this case your localhost). The locationmatch part redirects all traffic from (in this case) 127.0.0.1 with prefix "/path/" and files ending on .ucw to ucw. So http://127.0.0.1/path/something.ucw as well as http://127.0.0.1/path/anotherpath/somethingelse.ucw will be redirected, but not http://127.0.0.1/somethingfaulty.ucw or http://127.0.0.1/path/somethingfaulty.html .
allegroserve or portableaserve
Should you want to use the aserve backend you will need to download and install either the AllegroServe if you use acl or portableaserve for any other. AllegroServe doesn't seem to have an asdf file, you're going to have to load it manually or however AllegroServe handles it's own files. Portableaserve does however.
AllegroServe can be downloaded from here (it may be included in your version of acl): http://opensource.franz.com/aserve/
portableaserve is hosted on sourceforge: http://portableaserve.sf.net
portableaserve download: http://constantly.at/lisp/aserve.tar.gz
To use portableaserve you'll also need the Allegro Common Lisp compatibility package (acl-compat). It's part of portableaserve and so it's home is also the before-mentioned sourceforge site.
acl-compat download: http://constantly.at/lisp/acl-compat.tar.gz
araneida
Should you want to use the araneida backend you will need to download araneida. Get the latest version just to be on the safe side. Originally araneida was meant to live behind apache and it can of course still be configured as such. Explaining this is beyond the scope of this document but have a look at this site for more info.
info: http://www.cliki.net/Araneida}
download: http://common-lisp.net/project/araneida/release/araneida-latest.tar.gz
or use darcs, although the connection seems a bit slow:
darcs get http://verisons.telent.net/araneida/
httpd
Ucw's in-house server. It's a simple server bundled with ucw. Nice for testing.
asdf
To download it or read up on it go to http://cliki.net/ASDF
Asdf makes sure common lisp packages and the files in those packages get loaded in the correct order. I would suggest you read the manual at http://constantly.at/lisp/asdf/. Really the first link is all you need to know right now.
Basically every lisp package you downloaded so far has defined an .asd file. Usually in the root of the directory. This file has to appear in the search path of asdf, which is a list of directories defined by the special variable asdf:*central-registry*. The directories are typically called "systems". Under a unix clone, make a symbolic link to a systems dir as described in the document or as shown below. If a package defines more than one .asd file, just shove the whole dir on the *central-registry*, again as described in the document or as shown below.
For example: on some linux installations the directory /usr/share/common-lisp/systems is in the list of asdf:*central-registry*. Now create a symlink from a particular .asd file to /usr/share/common-lisp/systems :
ln -s /path/to/library/lib.asd /usr/share/common-lisp/systems
To shove a whole directory on the *central-registry* do the following in your lisp startup file or in the repl:
(push #P"/path/to/asd/files/" asdf:*central-registry*)
All the required packages need to be recognized by asdf if you don't want to load every file by yourself.