~npalix/coccinelle/upstream

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
 ** News **

- Coccinelle no longer needs ocaml-sexplib, nor ocaml-extlib, nor
  libpycaml-ocaml-dev, nor ocaml-camlp4-devel.
- 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.12.1).
See http://caml.inria.fr/download.en.html

On Debian/Ubuntu, install the following packages
 - pkg-config (optional, but strongly recommended)
 - ocaml-native-compilers (or alternatively ocaml)
 - ocaml-findlib
 - menhir and libmenhir-ocaml-dev (optional, bundled)
 - libpcre-ocaml-dev (optional, bundled)
 - libparmap-ocaml-dev (optional, bundled)
 - texlive-fonts-extra (for the documentation)

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

You can try to use the package manager of your distribution to install
the build dependencies. This is not guaranteed to work, as the
dependencies may change, but chances are it will help you. Some
examples:

$ apt-get build-dep coccinelle
$ dnf builddep coccinelle
$ yum builddep coccinelle

Then simply type
 ./autogen
 ./configure
 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-pcre-syntax   no pcre regexp syntax
                        version of spatch
See ./configure --help for more options




By default, '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 byte or opt
all.opt                 compiles the optimized version + frontends
check                   run tests (note: not all tests are expected to succeed)

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, 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'
 by default in the directory pointed by
   pkg-config --variable=completionsdir bash-completion
 if available, or $datarootdir/bash-completion/completions otherwise.
 The directory can be overridden by passing --with-bash-completion=$DIR
 to ./configure.
 The option --without-bash-completion disables the script installation.

 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
 - Developer 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