Build instructions for experimenting with XPCOM support in Swarm.
0) Set a couple variables...
(I haven't fully autoconfed the Mozilla stuff in Swarm.)
$ export S=/src # $S/mozilla should be where Mozilla sources are
$ export B=/build # $B/mozilla should be where Mozilla object code is
# I always configure Mozilla using --srcdir=$S/mozilla.
1) Get the current sources to Mozilla
I use the CVS sources and update fairly frequently, but I think
this will work with Mozilla 0.7. However, the build procedure of
Swarm assumes you've got a source build of Mozilla. These days,
it's rare that Mozilla won't build cleanly from CVS.
2) I build Mozilla using the script below on Debian. Note that --disable-debug
means that you lose useful debugging code and symbols, but you'll get a much
smaller and faster browser. However, without it you'll get a gigabyte
of object code.
$ cd $B
$ mkdir mozilla
$ cd mozilla
$ script-below
#!/bin/sh
SRCDIR=$S/mozilla
#DEBUG=--disable-debug
$SRCDIR/configure --srcdir=$SRCDIR --prefix=$P --with-pthreads --enable-editor $DEBUG --enable-optimize --with-extensions=xmlterm,irc,wallet,psm-glue,cookie,xml-rpc,xmlextras,cview,transformiix --enable-svg --enable-xsl && make
3) Assuming that the build works, run `mozilla' in dist/bin once to
register the default components, then quit.
4) Get ftp://ftp.swarm.org/pub/swarm/src/testing/swarm-2001-02-07.tar.gz
5) On Debian, I build the basic Swarm sources using a script like below.
Substitute paths as appropriate. JAR is specified from Sun JDK because
the jar code in Kaffe doesn't work. It is probably possible to build
using --without-jdkdir and avoid the Java details, but I haven't done
that for about a week. Maybe there is some slight build problem that way.
#!/bin/sh
JAR=$HOME/jdk1.3/bin/jar JAVAC=jikes $SWARMSRCDIR/configure --prefix=$P --with-jdkdir=$P --srcdir=$SWARMSRCDIR --datadir=$DATADIR --with-hdf5dir=$P --datadir=$DATADIR && make
Note that the current sources require use of HDF5-1.2.2 if you use the
--with-hdf5dir option.
6) To build the XPCOM support stuff in Swarm, cd into `COM' and run
"make generate".
7) cd in to `c' and run make
8) When you run Mozilla again, it should see the Swarm component.
9) find the file prefs.js in ~/.mozilla and add this line to it:
user_pref("signed.applets.codebase_principal_support",true)
This will tell Mozilla to ask you about attempts to run XPCOM code.
Normally, this is completely disabled for content that isn't signed.
Eventually, the restriction will be circumvented by having the plugin
control the load of models.
10) Load up http://www.swarm.org/~mgd/simpleSim/simpleSim.html
Other demos
a) Get ftp://ftp.swarm.org/pub/swarm/src/testing/COMdemo-0.0.tar.gz
b) In COMdemo-0.0/demo, run `make'.
c) You should now be able to Open/File on svg.xml and get the bars
oscillating.
d) Alternatively, try going to the URL area and typing:
chrome://swarmdemo/content/swarmdemo.xul
..should bring up a similiar demo. This one is an example of building
browser components. (Components have XPCOM privileges without asking.)
Other tips:
A) It should work to put $B/mozilla/dist/bin in your PATH.
B) xpcshell is a handy way to run the JavaScript interpreter without
loading the whole browser. To do this you'll need to set MOZILLA_FIVE_HOME
to $B/mozilla/dist/bin and add that directory to the LD_LIBRARY_PATH, too.
It's a lot easier to load core dumps from xpcshell than mozilla, simply
due to the sheer virtual memory requirements.
For example, to see a minimalistic Swarm object creation, you can run:
$ xpcshell -f run.js
test.html runs the same code, but from the browser.
Contact mgd@swarm.org for further help