layout | title |
---|---|
page |
Installing and running ocamljs |
#Installing and running ocamljs#
###Installing ocamljs###
- Prerequisites: OCaml 3.11.x or 3.12.0, Findlib, ulex
- Unpack the OCaml source distribution (matching your OCaml installation) into a directory adjacent to the
ocamljs
source (you can also use the-srcdir
argument toconfigure
to point to a different directory). - If you want Lwt and/or Ounit support, unpack their sources (matching the installed versions) into adjacent directories (or use the
-srcdir-lwt
and-srcdir-ounit
arguments). NB:ounit-1.0.3
has1.0.2
in itsMETA
file, so you need to either fix theMETA
file, rename the source directory, or use-srcdir-ounit
. - In the
ocamljs
directory, run./configure
make
buildsocamljs
and the associated librariesmake install
installsocamljs
and the associated librariesmake test
runs the test suite; see Ounit for prerequisitesmake examples
builds all the examples
###Using ocamljs###
The command ocamljs
may be used just like ocamlc
or ocamlopt
. It
generates .cmjs
/.cmjsa
files instead of .cmo
/.cma
. A linked
file (.js
) consists of Javascript source, which may be run through a
standalone Javascript interpreter, or embedded in a web page or
Firefox extension. See the examples for details.
See tools/myocambuild.ml
for some useful ocamlbuild rules.
There is also findlib support which is recommended.