cwal and s2?
Having been bitten far too often by back-end systems making upgrades which break scripts of mine implemented in various languages (most notably PHP), i felt motivated to use my very own scripting engine for most server-side dynamic content generation.
No, s2 is not as feature-full or performant as PHP or perl or python or ruby or whatever else shared hosters host these days, but (A) it serves my server-side needs and (B) there's zero chance of anyone else making changes to it which break my stuff.
cwal and s2 currently have no fully-automated install because, frankly, nobody but myself uses it and a new installation is relatively rare. What follows are instructions for how it gets set up on my systems, including s2cgi...
Install cwal and s2
Download cwal (includes s2):
mkdir ~/fossil
cd ~/fossil
fossil clone https://fossil.wanderinghorse.net/r/cwal cwal.fossil
Build it:
cd ~/fossil
mkdir cwal
cd cwal
fossil open ../cwal.fossil
./configure
make
# Build s2:
cd s2
make
make unit
# Build s2 modules:
cd mod
make
make unit
Install and configure s2sh
and S2_HOME
There are, as of this writing, no automated rules for installing s2.
Its installation conventionally lives under ~/s2
, and the following assumes
that will be the case on the target system...
cp -p ~/fossil/cwal/s2/s2sh.sh ~/bin/s2sh
# ^^^^ then edit its S2_HOME value to suit (`~/s2`).
# Optionally s2sh2 (essentially the same tool with
# slightly more modern CLI flags):
cp -p ~/bin/s2sh ~/bin/s2sh2
# ^^^^ then edit the last line to call `s2sh2` instead of `s2sh`.
Now set up S2_HOME
:
# Make the directory...
mkdir ~/s2
cd ~/s2
# Install the shell app(s):
cp -p ~/fossil/cwal/s2/s2sh{,2} .
# Link in (or recursively copy) require.d, used by many s2 scripts:
ln -s ~/fossil/cwal/s2/require.d .
# Link to (or copy) the loadable modules:
mkdir mod
cd mod
ln -s ~/fossil/cwal/s2/mod/*/*.so .
Install CGI bits...
Most of my s2 back-end stuff is scripts serving/supporting CGI applications, primarily JSON-based APIs. Those bits need the s2cgi framework...
cd ~/s2
fossil clone https://fossil.wanderinghorse.net/r/s2cgi ~/fossil/s2cgi.fossil
mkdir cgi
cd cgi
fossil open ~/fossil/s2cgi.fossil
# If this setup is for a local dev copy of the wanderinghorse.net set, then:
mkdir search.d # used by the local dev site's search engine
That's all of it. As a general rule, each s2cgi-using site gets its own subdirectory under ~/s2/cgi
. When that happens, such repositories must be fossil open
'ed with the --nested
option to allow them to be opened from within another opened repository.