Building Coccinelle

tested on slackware/150

Warning

this is painful and when used with the LINBIT OFFICIAL SOURCE TARBALL drbd-kernel building system offers an online alternative. this is only required if you want to spatch yourself.

Plan A – slackware builds

works as for slackware/150

sbopkg -i ocaml
sbopkg -i ocaml-findlib
sbopkg -i ocaml-num
sbopkg -i coccinelle

Plam B – everything from source

grab latest ocaml release

wget https://caml.inria.fr/pub/distrib/ocaml-4.13/ocaml-4.13.1.tar.gz
tar xzf ocaml-4.13.1.tar.gz
cd ocaml-4.13.1/
./configure --sysconfdir=/etc --localstatedir=/var
time make > ../ocaml.log && echo BUILT
make install

git clone https://gitlab.gnome.org/Archive/libcroco.git
cd libcroco/
./autogen.sh
./configure --sysconfdir=/etc --localstatedir=/var
make
make install

also grab latest findlib

wget http://download.camlcity.org/download/findlib-1.9.1.tar.gz
tar xzf findlib-1.9.1.tar.gz
cd findlib-1.9.1/
./configure # not a gnu
make
make install

many Perl deps required to build po4a — TODO is this still required since we get Coccinelle with OPAM?

sbopkg -i perl-Module-Build
sbopkg -i perl-YAML-Tiny
sbopkg -i perl-File-Remove
sbopkg -i perl-YAML-Tiny
sbopkg -i perl-Module-Install
perl -e shell -MCPAN
install Pod::Parser
sbopkg -i perl-MIME-Charset
sbopkg -i perl-Unicode-LineBreak
sbopkg -i po4a

Build spatch & hash

grab latest bubblewrap (https://github.com/containers/bubblewrap/tags)

cd bubblewrap-0.5.0/
    ./configure --sysconfdir=/etc --localstatedir=/var
make
make install

install latest opam binaries (https://opam.ocaml.org/doc/Install.html)

bash -c "sh <(curl -fsSL https://raw.githubusercontent.com/ocaml/opam/master/shell/install.sh)"
opam init

then install Coccinelle using OPAM!

#opam update
opam install coccinelle

Ready to go

which spatch

Troubles

while building coccinelle

File "parsing_cocci/lexer_cocci.mll", line 301, character 67: unescaped newline in string.

==> use OPAM instead

Resources

https://coccinelle.gitlabpages.inria.fr/website/

https://coccinelle.gitlabpages.inria.fr/website/download.html

https://www.kernel.org/doc/html/v4.15/dev-tools/coccinelle.html#getting-coccinelle

https://ocaml.org/


HOME | GUIDES | LECTURES | LAB | SMTP HEALTH | HTML5 | CONTACT
Copyright © 2024 Pierre-Philipp Braun