当前位置: 首页 > 工具软件 > SpiderMonkey > 使用案例 >

liunx安装SpiderMonkey的操作过程!~

艾子石
2023-12-01

ruby-spidermonkey安装
2011-05-05 13:25

下载编译安装SpiderMonkey:

wget http://ftp.mozilla.org/pub/mozilla.org/js/js-1.7.0.tar.gz -O- | tar xvz

cd mozilla/js/src
make -f Makefile.ref

cd Linux_All_DBG.OBJ
sudo cp spidermonkey.so /usr/local/lib/site_ruby/1.8/i486-linux  
sudo mv libjs.so /usr/lib

Ruby-Spidermonkey安装:

 

git clone git://github.com/wycats/ruby-spidermonkey.git

cd ruby-spidermonkey

cp mozilla/js ./   

ruby extconf.rb --with-js-include=js/src --with-js-lib=js/src/Linux_All_DBG.OBJ

 

 

spidermonkey安装脚本:(未测试)

<shell>

#!/bin/bash  
if test "$USER" = root; then  
    wget http://ftp.mozilla.org/pub/mozilla.org/js/js-1.7.0.tar.gz -O- | tar xvz  
    cd js/src
    make -f Makefile.ref
    mkdir -p /usr/include/smjs/ -v
    cp *.{h,tbl} /usr/include/smjs/ -v
    cd Linux_All_DBG.OBJ
    cp *.h /usr/include/smjs/ -v
    mkdir -p /usr/local/{bin,lib}/ -v
    cp js /usr/local/bin/ -v
    cp libjs.so /usr/local/lib/ -v
else  
    echo "You must be root. Try sudo $0"
fi 

</shell>

 

另一段安装方法:

wget http://ftp.mozilla.org/pub/mozilla.org/js/js-1.7.0.tar.gz -O- | tar xvz
cd js/src
make -f Makefile.ref
mkdir -p /usr/include/smjs/ -v
cp *.{h,tbl} /usr/include/smjs/ -v
cd Linux_All_DBG.OBJ
cp *.h /usr/include/smjs/ -v
mkdir -p /usr/local/{bin,lib}/ -v
cp js /usr/local/bin/ -v
cp libjs.so /usr/local/lib/ -v
以上安装完成后,运行/usr/local/bin/js 就应该可以启动js解释运行引擎了.

 

http://subtech.g.hatena.ne.jp/cho45/20061025/1161763717

 

 

 


SpiderMonkey是Mozilla项目的一部分,用C语言写成,是负责执行JavaScript脚本的引擎。另外还有一个叫Rhino的Java引擎。

首先从网上下载SpiderMonkey安装包

下载地址:http://ftp.mozilla.org/pub/mozilla.org/js/

[root@wangde js]# tar -zxvf js-1.7.0.tar.gz

[root@wangde js]# cd js

[root@wangde js]# ls
jsd  README  src
[root@wangde js]# cd src
[root@wangde src]# gcc
gcc: no input files
[root@wangde src]# clear

[root@wangde src]# make -f Makefile.ref
cat: ../../dist/Linux_All_DBG.OBJ/nspr/Version: 没有那个文件或目录
cd editline; make -f Makefile.ref all
[root@wangde src]# mkdir -p /usr/include/smjs/ -v
mkdir: 已创建目录 ‘/usr/include/smjs’
[root@wangde src]# cp *.{h,tbl} /usr/include/smjs/ -v
‘jsapi.h’ -> ‘/usr/include/smjs/jsapi.h’
‘jsarena.h’ -> ‘/usr/include/smjs/jsarena.h’
‘jsarray.h’ -> ‘/usr/include/smjs/jsarray.h’
‘jsatom.h’ -> ‘/usr/include/smjs/jsatom.h’
‘jsbit.h’ -> ‘/usr/include/smjs/jsbit.h’
‘jsbool.h’ -> ‘/usr/include/smjs/jsbool.h’
‘jsclist.h’ -> ‘/usr/include/smjs/jsclist.h’
‘jscntxt.h’ -> ‘/usr/include/smjs/jscntxt.h’
‘jscompat.h’ -> ‘/usr/include/smjs/jscompat.h’
‘jsconfig.h’ -> ‘/usr/include/smjs/jsconfig.h’
‘jscpucfg.h’ -> ‘/usr/include/smjs/jscpucfg.h’
‘jsdate.h’ -> ‘/usr/include/smjs/jsdate.h’
‘jsdbgapi.h’ -> ‘/usr/include/smjs/jsdbgapi.h’
‘jsdhash.h’ -> ‘/usr/include/smjs/jsdhash.h’
‘jsdtoa.h’ -> ‘/usr/include/smjs/jsdtoa.h’
‘jsemit.h’ -> ‘/usr/include/smjs/jsemit.h’
‘jsexn.h’ -> ‘/usr/include/smjs/jsexn.h’
‘jsfile.h’ -> ‘/usr/include/smjs/jsfile.h’
‘jsfun.h’ -> ‘/usr/include/smjs/jsfun.h’
‘jsgc.h’ -> ‘/usr/include/smjs/jsgc.h’
‘jshash.h’ -> ‘/usr/include/smjs/jshash.h’
‘jsinterp.h’ -> ‘/usr/include/smjs/jsinterp.h’
‘jsiter.h’ -> ‘/usr/include/smjs/jsiter.h’
‘jslibmath.h’ -> ‘/usr/include/smjs/jslibmath.h’
‘jslock.h’ -> ‘/usr/include/smjs/jslock.h’
‘jslong.h’ -> ‘/usr/include/smjs/jslong.h’
‘jsmath.h’ -> ‘/usr/include/smjs/jsmath.h’
‘jsnum.h’ -> ‘/usr/include/smjs/jsnum.h’
‘jsobj.h’ -> ‘/usr/include/smjs/jsobj.h’
‘jsopcode.h’ -> ‘/usr/include/smjs/jsopcode.h’
‘jsosdep.h’ -> ‘/usr/include/smjs/jsosdep.h’
‘jsotypes.h’ -> ‘/usr/include/smjs/jsotypes.h’
‘jsparse.h’ -> ‘/usr/include/smjs/jsparse.h’
‘jsprf.h’ -> ‘/usr/include/smjs/jsprf.h’
‘jsprvtd.h’ -> ‘/usr/include/smjs/jsprvtd.h’
‘jspubtd.h’ -> ‘/usr/include/smjs/jspubtd.h’
‘jsregexp.h’ -> ‘/usr/include/smjs/jsregexp.h’
‘jsscan.h’ -> ‘/usr/include/smjs/jsscan.h’
‘jsscope.h’ -> ‘/usr/include/smjs/jsscope.h’
‘jsscript.h’ -> ‘/usr/include/smjs/jsscript.h’
‘jsstddef.h’ -> ‘/usr/include/smjs/jsstddef.h’
‘jsstr.h’ -> ‘/usr/include/smjs/jsstr.h’
‘jstypes.h’ -> ‘/usr/include/smjs/jstypes.h’
‘jsutil.h’ -> ‘/usr/include/smjs/jsutil.h’
‘jsxdrapi.h’ -> ‘/usr/include/smjs/jsxdrapi.h’
‘jsxml.h’ -> ‘/usr/include/smjs/jsxml.h’
‘prmjtime.h’ -> ‘/usr/include/smjs/prmjtime.h’
‘resource.h’ -> ‘/usr/include/smjs/resource.h’
‘jskeyword.tbl’ -> ‘/usr/include/smjs/jskeyword.tbl’
‘jsopcode.tbl’ -> ‘/usr/include/smjs/jsopcode.tbl’
‘jsproto.tbl’ -> ‘/usr/include/smjs/jsproto.tbl’
[root@wangde src]# cd Linux_All_DBG.OBJ
[root@wangde Linux_All_DBG.OBJ]# cp *.h /usr/include/smjs/ -v
‘jsautocfg.h’ -> ‘/usr/include/smjs/jsautocfg.h’
‘jsautokw.h’ -> ‘/usr/include/smjs/jsautokw.h’
[root@wangde Linux_All_DBG.OBJ]# mkdir -p /usr/local/{bin,lib}/ -v
You have new mail in /var/spool/mail/root
[root@wangde Linux_All_DBG.OBJ]# cp js /usr/local/bin/ -v
‘js’ -> ‘/usr/local/bin/js’
[root@wangde Linux_All_DBG.OBJ]# cp libjs.so /usr/local/lib/ -v
‘libjs.so’ -> ‘/usr/local/lib/libjs.so’
[root@wangde Linux_All_DBG.OBJ]#

执行成功!~

下面进行测试::

[root@wangde /]# mkdir jstest
[root@wangde /]# cd jstest
[root@wangde jstest]# js -e "var s='www.root@wangde.com';print(s.length);"
19
[root@wangde jstest]# echo "var s='www.root@wangde.com';print(s.length);" > test.js
[root@wangde jstest]# js -f test.js
19
[root@wangde jstest]# js -f test.js -e "print(100+s.length)"
19
119
[root@wangde jstest]#

下面的网址是SpiderMonkey的DOC文档,有兴趣的同学可以看看

 

https://developer.mozilla.org/en/spidermonkey


测试成功!~有什么问题联系我QQ:743543542

posted on 2011-10-13 01:31  lexus 阅读( ...) 评论( ...) 编辑 收藏

转载于:https://www.cnblogs.com/lexus/archive/2011/10/13/2209596.html

 类似资料: