Sophie

Sophie

distrib > Mageia > 7 > i586 > media > core-release > by-pkgid > dcb57bc1f616cf3a8072df2efbbf2767 > files > 39

elinks-0.12-18.mga7.i586.rpm

<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>ECMAScript support?!</title><meta name="generator" content="DocBook XSL Stylesheets V1.76.1"><link rel="home" href="index.html" title="The ELinks Manual"><link rel="up" href="ch01.html" title="Chapter 1. Getting ELinks up and running"><link rel="prev" href="ch01s05.html" title="Tips to obtain a very small static elinks binary"><link rel="next" href="ch01s07.html" title="Feature configuration file (features.conf)"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">ECMAScript support?!</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch01s05.html">Prev</a> </td><th width="60%" align="center">Chapter 1. Getting ELinks up and running</th><td width="20%" align="right"> <a accesskey="n" href="ch01s07.html">Next</a></td></tr></table><hr></div><div class="section" title="ECMAScript support?!"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="ecmascript"></a>ECMAScript support?!</h2></div></div></div><p>Yes, there is some ECMAScript support in ELinks. There isn't anything we could
call complete, but some bits could help with the most common ECMAScript usage
cases - help you (and then us ;) get into your banking account, pass through
those ignorant page redirects done by JavaScript code snippets and so.</p><p>ELinks does not have own ECMAScript parser and compiler; instead it reuses
other people's work (this may eventually change, see the bottom of this file).
First we aimed at the NJS engine, which is easy to install, small and compact;
has nice naming scheme, horrible calling conventions and very lacking
documentation; is not actively developed; and generally looks broken and
extremely clumsy to work with. So we instead went the way of the SpiderMonkey
(SM) engine (property of Mozilla), which is hard to install, bigger (mind you,
it comes from Mozilla ;), has ugly naming scheme but nice calling conventions,
acceptable documentation, is actively developed and ought to work.</p><div class="section" title="Ok, so how to get the ECMAScript support working?"><div class="titlepage"><div><div><h3 class="title"><a name="idp4110784"></a>Ok, so how to get the ECMAScript support working?</h3></div></div></div><p>Some systems come with either the SpiderMonkey installed or as an option. It
would be good to test if you can take the easy path and let the system take
care of installation through a package system. Below are listed instructions
on what package you need to install on various systems (please help improve
the list). If all goes well you can proceed to rebuilding ELinks.</p><p>On Debian testing (Etch) or unstable (SID), run the following:</p><pre class="literallayout">$ apt-get install libmozjs-dev</pre><p>On Debian stable (Sarge), run the following:</p><pre class="literallayout">$ apt-get install libsmjs-dev</pre><p>Installing the -dev package will automatically pull in the library package.</p><p>Once this is done, rebuild ELinks. The configure script should detect
the SpiderMonkey library—check for this line in the features summary:</p><pre class="literallayout">ECMAScript (JavaScript) ......... SpiderMonkey document scripting</pre><p>After following these instructions on a Debian system, you are done and should
ignore the following directions.</p><p>The rest is only for non-Debian system.</p><p>Note that this procedure enables you to install SpiderMonkey, but in such a
way that it might not work with anything else but ELinks. It is unlikely that
anything else is ever going to use SpiderMonkey on your system, but if you
want to take the safe way, get SM and follow the instructions in
<code class="literal">src/README.html</code> instead. You will probably need to do some checkouting of
bits of the Mozilla CVS tree and so, have fun.</p><p>To get SpiderMonkey source, go at
<a class="ulink" href="ftp://ftp.mozilla.org/pub/mozilla.org/js/" target="_top">ftp://ftp.mozilla.org/pub/mozilla.org/js/</a> and fetch the newest <code class="literal">js-</code>
tarball there (<code class="literal">js-1.5-rc6a.tar.gz</code> at the time of writing this; you may try
the RPMs, but we didn't test them).</p><pre class="literallayout">$ cd elinks
$ wget ftp://ftp.mozilla.org/pub/mozilla.org/js/js-1.5-rc6a.tar.gz
$ tar xvzf js-1.5-rc6a.tar.gz</pre><p>Next, you need to patch it so that you will have any chance to install it as
you fetched it. Grab it in ELinks at <code class="literal">contrib/js-1.5-rc6a+elinks.patch</code> (if
you have a different version, still try to go ahead, you might have some
success), then go to the SpiderMonkey directory (called js) and apply it as</p><pre class="literallayout">$ cd js
$ patch -p1 &lt;../contrib/js-1.5-rc6a+elinks.patch
$ cd src</pre><p>Now, edit config.mk and adjust the <code class="literal">$PREFIX</code> variable - you probably won't
like the default value - ELinks will find it there, but your dynamic linker
likely won't.</p><p>E.g., for /usr/local installation:</p><pre class="literallayout">$ sed 's#^PREFIX = /opt/spidermonkey#PREFIX = /usr/local#' &lt; config.mk &gt; config.mk.t
$ mv -f config.mk.t config.mk</pre><p>Now you can finally go for it:</p><pre class="literallayout">$ make -f Makefile.ref
$ make -f Makefile.ref export</pre><p>Now install it:</p><pre class="literallayout">$ su -c 'make -f Makefile.ref install &amp;&amp; (ldconfig -v | grep libjs)'</pre><p>Check for:</p><pre class="literallayout">libjs.so -&gt; libjs.so</pre><p>If you don't get such result, check that the library's installation path
(e.g. /usr/local/lib) is present in /etc/ld.so.conf (man 8 ldconfig).</p><p>If all went well, you can proceed to rebuild ELinks now. If something broke,
see you on #elinks @ FreeNode or in the mailing list.
You may add your options to <code class="literal">./configure</code> as usual; SpiderMonkey should be
autodetected.</p><pre class="literallayout">$ cd ../..
$ ./configure</pre><p>Check for the following line in the features summary:</p><pre class="literallayout">ECMAScript (JavaScript) ......... SpiderMonkey document scripting</pre><p>Then run:</p><pre class="literallayout">$ make
$ su -c 'make install'</pre><p>Enjoy.</p></div><div class="section" title="The ECMAScript support is buggy! Shall I blame Mozilla people?"><div class="titlepage"><div><div><h3 class="title"><a name="idp3601968"></a>The ECMAScript support is buggy! Shall I blame Mozilla people?</h3></div></div></div><p>Likely not. The ECMAScript engine provides only the language compiler and some
basic built-in objects, and it's more than likely that the problem is on our
side in the implementation of some of the HTML/DOM objects (perhaps we just
haven't bothered to implement it at all yet). So better tell us first, and if
we think it's not our fault we will tell you to go complain to Mozilla (better
yet if it does not work in the Mozilla browsers neither ;-).</p></div><div class="section" title="Now, I would still like NJS or a new JS engine from scratch…"><div class="titlepage"><div><div><h3 class="title"><a name="idp3275936"></a>Now, I would still like NJS or a new JS engine from scratch…</h3></div></div></div><p>...and you don't fear some coding? That's fine then! ELinks is in no way tied
to SpiderMonkey, in fact the ECMAScript support was carefully implemented so
that there are no SpiderMonkey references outside of
<code class="literal">src/ecmascript/spidermonkey.*</code>. If you want to implement an alternative
ECMAScript backend, go ahead - you will just need to write an autoconf
detection for it and tie it to <code class="literal">src/ecmascript/ecmascript.c</code>, which should be
easy. We await your patches eagerly.</p></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch01s05.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="ch01.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="ch01s07.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Tips to obtain a very small static elinks binary </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Feature configuration file (<code class="literal">features.conf</code>)</td></tr></table></div></body></html>