1. Download the Spidermonkey source from following link.
2. Extract the tarball to directory somewhere in your system. It will create ‘js’ sub directory.
Derectory Structure look like tihs:
. .. jsd/ READMe src/
3. Then change to the ’src’ directory.
4. Use ‘make -f Makefile.ref’ to build the source.
When tried to installing under Uuntu Edgy (6.10) you can ended up with following compiling errors.

It turns out these errors were caused by the -g debugging flag when compiling jscpucfg.
Please change the following part of config.mk which is under src directory
120: ifdef USE_MSVC 121: OPTIMIZER = -Zi 122: else 123: OPTIMIZER = -g 124: endif 125: DEFINES += -DDEBUG -DDEBUG_$(shell whoami)
to
120: ifdef USE_MSVC 121: OPTIMIZER = -Zi 122: else 123: OPTIMIZER = 124: endif 125: DEFINES += -DDEBUG -DDEBUG_$(shell whoami)
5. When build is complete you shuold see some messages probably similar to this.

This says the build was successful. libjs.so is stored inside ‘Linux_All_DBG.OBJ’ directory.
6. Now you can use these commands to move the libs and headers to default locationd.

Once you follow these steps Spidermonkey is successfully installed in your system.

how to install jscompact said
[...] the config.mk file, a tutorial on how to install spidermonkey on Ubuntu Edgy can be found here: Compiling Spidermonkey under Ubuntu Edgy « thinksquared After following sukibabee’s tutorial (thankyou!) I managed to install jscompact with no more [...]
Brinley said
Cheers for this article. It helped me figure out how to compile jscompact. Anyway, if someone else stumbles on this article trying to compile spidermonkey for jscompact, I have created a deb package for jscompact at http://blogs.unbolt.net/index.php/brinley/2007/10/18/deb_package_for_jscompact