1. Build

1.1. Dependencies

1.1.1. Required

  • Classic build tools (GCC, Make, ...)
  • CMake (>= 2.8)
  • Swig
  • Tshark
  • Check
  • rsync
  • libpcap
  • Gawk
  • libedit
  • libpcre

1.1.2. Optional

  • Git
  • Cppcheck
  • Netfilter Queue
  • Valgrind
  • rpm-build
  • Sphinx (>= 2)
  • Doxygen
  • Inkscape
  • python-blockdiag
  • python-seqdiag

1.1.3. Examples

Debian (and compatible)

$ sudo apt-get install build-essential cmake swig tshark check
$ sudo apt-get install rsync libpcap-dev gawk libedit-dev libpcre3-dev
$ sudo apt-get install cppcheck libnetfilter-queue-dev valgrind
$ sudo apt-get install python-sphinx doxygen python-blockdiag python-seqdiag


$ sudo yum install gcc gcc-c++ make cmake python-sphinx wireshark check doxygen
$ sudo yum install check-devel rsync libpcap-devel gawk libedit-devel pcre-devel
$ sudo yum install git cppcheck libnetfilter_queue-devel rpm-build valgrind valgrind-devel

The swig package in Fedora is broken and will not be usable to compile Haka. You will need to get a swig build from upstream.

$ git clone https://github.com/swig/swig.git
$ cd swig
$ git co rel-2.0.11
$ ./autogen.sh
$ ./configure
$ make
$ sudo make install

1.2. Download

You can get the sources of Haka from a tarball or directly by cloning the Git repository.

1.2.1. From sources tarball

First download the source tarball from the Haka website.

Then type the following commands:

$ tar -xzf haka.tar.gz
$ cd haka

1.2.2. Git

You must first clone the Git repository. Our project is hosted on GitHub:

$ git clone https://github.com/haka-security/haka.git


The repository uses submodules that need to be initialized and updated:

$ git submodule init
$ git submodule update

1.3. Build

1.3.1. Configure

It is mandatory to create a separate directory to store all the files generated during the build using cmake.

$ mkdir workspace
$ cd workspace
$ cmake .. <options>


To add an option to cmake, add -DOPTION=VALUE to the command line option when calling cmake. The configuration with cmake supports the following options:


Select the build type to be compiled (default: Release)


Choose the Lua version to use (default: luajit)


Installation prefix (default: /)

1.3.2. Compile

Use make like usual to compile:

$ make

1.3.3. Install

To install Haka on your system, type this command:

$ sudo make install

By default, Haka will be installed in /usr/local. You might want to update your PATH environment variable to be able to easily launch the various tools from the command line.

Local install

To install Haka locally, type this command:

$ make localinstall

Using localinstall allow to install haka locally under the folder out. To use this version, you will have to set a few environment variables by sourcing the generated file env.sh:

$ cd out/
$ . env.sh

1.3.4. Documentation

Run make doc to generate documentation in html. The documentation is then available in doc inside your build folder.

In order to build it, you need to have, at least, Sphinx and Doxygen installed. To get all images, you also need the tools Inkscape, blockdiag and seqdiag. You might need to install the fonts used for those images in your system. The files are located in doc/theme/haka/fonts.

1.3.5. Tests

Run make tests to play all tests.

You can also pass some arguments to ctest by using the variable CTEST_ARGS.

$ make tests CTEST_ARGS="-V"

This command will install locally the project and run the tests in the folder. If you need to run the tests manually using the command ctest, you can prepare the environment with the command make pretests.

1.3.6. Packaging

Run make package to build a tgz package.