How to install the Perl module "JavaScript" on Unix
This page was created on Wed Sep 23 2009 and last changed on Sat Oct 05 2024.
This article deals with installing JavaScript on Unix, specifically FreeBSD. Although FreeBSD comes with a port of SpiderMonkey, in/usr/ports/lang/spidermonkey
, it
doesn't seem to work with the Perl JavaScript module. Following the
advice given in the JavaScript module, I reinstalled the spidermonkey
library myself and built against that.
-
Download the Javascript source code from Mozilla:
wget http://ftp.mozilla.org/pub/mozilla.org/js/js-1.7.0.tar.gz
-
Unpack this file and go to the subdirectory
js/src
. -
Run the makefile like this:
gmake -f Makefile.ref
-
This produces an error message:
config.mk:150: config/FreeBSD7.2-RELEASE.mk: No such file or directory cat: ../../dist/FreeBSD7.2-RELEASE_DBG.OBJ/nspr/Version: No such file or directory gmake: *** No rule to make target `config/FreeBSD7.2-RELEASE.mk'. Stop.
-
Copy the file
config/Linux_All.mk
toconfig/FreeBSD7.2-RELEASE.mk
, or whatever it said in the equivalent message. -
Run
gmake
again. -
The output files are in the directory
FreeBSD7.2-RELEASE_DBG.OBJ/
. -
Copy the header files (
*.h
) and tables (*.tbl
) from thesrc
directory to theFreeBSD7.2-RELEASE_DBG.OBJ
.[ben@mikan] src 575 $ cp *.tbl *.h FreeBSD7.2-RELEASE_DBG.OBJ/
Note that the header filejsautocfg.h
is only in theFreeBSD7.2-RELEASE_DBG.OBJ
directory, so if you compile against the header files insrc
, you will get a huge number of errors from the C compiler, starting off with the line/home/ben/software/js/js/src/jstypes.h:245:71: error: jsautocfg.h: No such file or directory
-
Set up the environment to link against the compiled library:
export JS_LIB=/home/ben/software/js/js/src/FreeBSD7.2-RELEASE_DBG.OBJ/ export JS_INC=/home/ben/software/js/js/src/FreeBSD7.2-RELEASE_DBG.OBJ/
-
Run
cpan
to install JavaScript:cpan JavaScript
In my case this required installing one prerequisite, Test::Exception. Remember that ifcpan
fails, you can always download the distribution fromCPAN
and install it withperl Makefile.PL make make test make install
Copyright © Ben Bullock 2009-2024. All
rights reserved.
For comments, questions, and corrections, please email
Ben Bullock
(benkasminbullock@gmail.com).
/
Privacy /
Disclaimer