 ** News **

- Coccinelle no longer needs ocaml-sexplib nor ocaml-extlib.
- Parallel building is possible when you do not build the bytecode
  and native version of spatch simultaneously.


 ** Compilation **

You must first install a recent version of
 - OCaml (at least 3.11),
   see http://caml.inria.fr/download.en.html
   At least, OCaml 3.12 is required to use the OCaml scripting
   feature in the SmPL code.
 - The Menhir parser generator (at least 20080912),
   see http://cristal.inria.fr/~fpottier/menhir/
   (unless you got a version of the coccinelle source with
   the SmPL parser pre-generated)
 - Python and its development files (python-dev)
   (unless you run configure with the --without-python option)

On Debian/Ubuntu, install the following packages
 - pkg-config (optional, but strongly recommended)
 - ocaml-native-compilers (or alternatively ocaml)
 - ocaml-findlib
 - libpycaml-ocaml-dev
 - menhir and libmenhir-ocaml-dev
 - libpcre-ocaml-dev

On Fedora, install the following packages
 - pkgconfig (optional, but strongly recommended)
 - chrpath
 - ocaml
 - ocaml-findlib
 - ocaml-camlp4-devel
 - ocaml-findlib-devel
 - ocaml-ocamldoc
 - ocaml-pcre-devel

Note that on Fedora, there is currently not a
package for menhir and pycaml. However, coccinelle
bundles the sources of these packages and will use them
when needed. The bundled pycaml package has support for
python 3.

Then simply type
 ./configure --enable-release
 make
 make install


Other configuration flags of interest:
--prefix                default: /usr/local
--disable-opt           build the bytecode version
--with-python=PATH      choose a specific python executable
--without-python        no python scripting
--disable-ocaml         no ocaml scripting
--disable-pycaml        uses the bundled pycaml package instead of
                        a installed pycaml package.
--disable-pcre-syntax   no pcre regexp syntax
--enable-release=world  builds the optimized and unoptimized
                        version of spatch
See ./configure --help for more options




When the --enable-release flag was given to ./configure, 'make' will
build in release configuration (no debugging symbols, etc.). It
defaults to the optimized version, unless --disable-opt is given
to configure. You could use 'make opt-only' to compile the
optimized version only. Similarly, you can use 'make byte-only' for
the unoptimized version. 'make install' installs whichever version
was compiled, and installs a script 'spatch' (the frontend) that invokes
the 'best' one with proper environment variables.
You can also use 'make world' to compile the bytecode
and the optimized code version.

Make targets of interest:
opt-only, opt           compiles just the optimized version
byt-only, byte          compiles just the bytecode version
world                   compiles both + frontends + docs
all-release             compiles the optimized version + frontends + docs
all-dev                 compiles the bytecode version + frontends
all                     default target: alias for either all-dev or all-release
all.opt                 compiles the optimized version + frontends
check                   run tests (note: not all tests are expected to succeed)
As these make targets may change in the future, it is preferred to set the
appropriate default using the --enable-release flag.

We provide the files generated by menhir in the tarball.  However,
'make distclean' will remove them. You could either restore them from
the tarball or install menhir.  Using 'make clean' should be safe with
regards to these files.

Note: The test target is intended for developers. In particular, you
      should not expect that every test will pass.

In order to use the OCaml scripting feature in SmPL, you must compile
Coccinelle with at least OCaml version 3.11. An extra file, coccilib.cmi,
is produced and installed in /usr/share/cocci/ocaml, which is needed for
the compilation of ocaml scripts.


 ** Bash integration **

 To have completion under Bash, you can execute the following command:

    make install-bash

 It will install the shell script 'scripts/spatch.bash_completion'
 in /etc/bash_completion.d/spatch

 You can manually copy that file elsewhere if you have a different
 bash_completion directory.



 ** Runtime dependencies **

 - Basic shell commands:
   - ls, cat, cp, mv, rm, grep, mkdir, find
 - Developper tool: diff


 ** Optional runtime dependencies **

 - To quickly apply the semantic patches
   - glimpse indexer

 - To use OCaml scripting feature in SmPL
   - ocaml-native-compilers or ocaml-nox
   - ocaml-findlib

 - To generate a PDF of the control flow graph with '-graphical_trace'
   - pdftk and graphviz (with PDF support)

If runtime tools are not in $PATH, paths to some
of them can be specified with 'configure' or via
commandline parameters to spatch.



 ** Dependencies for additional tools **

    git, pushd, popd, sed, diffstat, cpp

 ** Uninstall **

    To uninstall Coccinelle, you should use the following command

    make uninstall


    To also remove the bash completion script, run

    make uninstall-bash
