At the moment, on most computers, the easiest manner of installing
OCaml Batteries Included on your computer is to take advantage
of GODI
, a package manager specifically dedicated to OCaml. You will
first need to install GODI, if GODI isn't install on your machine yet,
then to select package batteries
in the list of packages
and accept the decisions of GODI. This should take care of installing
OCaml Batteries Included for you.
Note that producing the documentation is long (typically 10-15 minutes).
On Fedora / Debian / Red Hat / Ubuntu stations,
packages libbatteries-ocaml-dev
.
This should take care of installing OCaml Batteries Included for you.
To perform installation of OCaml Batteries Included manually, please make sure that you have already installed all the following tools and libraries:
Once all these libraries are installed, you may download and uncompress the latest version of OCaml Batteries Included, enter the directory produced by decompression and invoke
make all install doc install-docto build and install both the byte-code version, the native version and the documentation of OCaml Batteries Included.
ocamlinit
from the batteries source directory into your ~/.ocamlinit
file and launch ocaml normally,
ocaml
,
or, if you have rlwrap
installed,
rlwrap ocaml
, for more comfortable editing.
For more informations on OCamlBuild, you may read the official documentation.
doc/batteries/myocamlbuild.ml
is an extension of OCamlBuild. It defines Control.Concurrency.Threads
.pkg_batteries
, you need to start your
files with open Batteries
.use_batteries
as they can suddenly
turn correct code into something which doesn't compile. Use tag
use_boilerplate
in conjunction with either use_batteries
or
use_batteries_r
._tags
, placed in the same directory
as your files. For instance, to have my_file.ml
compiled with
Batteries Included as a library and my_other_file.ml
compiled
with both the library, the language extensions and boiler-plate code, your
file _tags
should read:
<my_file.ml>: pkg_batteries <my_other_file.ml>: use_batteries,use_boilerplateThe order of lines doesn't matter, nor does the order of tags on one line. For more informations on
myocamlbuild.ml
and _tags
, see
the documentation
of OCamlBuild.
Batteries
.
USE_OCAMLFIND = true
OCAMLPACKS[] +=
batteries.pa_comprehension.syntax
batteries.pa_string.syntax
batteries
OCAMLDEPFLAGS += -syntax camlp4o
OCAMLFLAGS += -syntax camlp4o
Here's a complete OMakefile for building the "cat" implementation you will
find under the examples/ subdirectory:
USE_OCAMLFIND = true
OCAMLPACKS[] += batteries
OCamlProgram(cat, cat)
The above OCAMLPACKS definition uses Batteries and all the non-destructive
syntax extensions available as of 2008-11-16; this corresponds to the
pkg_batteries
tag in ocamlbuild.
If you only want to use Batteries as a library, without syntax extensions, use
OCAMLPACKS[] += batteries
and drop the OCAMLDEPFLAGS
and OCAMLFLAGS
lines in the above examples, as they are no longer needed.