# Building of the Oakleaf library

The Oakleaf library is distributed in the form of the source code, and must be compiled prior to use.

It is also pre-packaged in GNU/Debian and Ubuntu. The install is, by the way:

        # [sudo] apt install liboakleaf1 liboakleaf-dev liboakleaf-doc

## Prerequisites

A modern Fortran 2008+ compiler and Minpack are required. Minpack should be installed in the development version, the package is `minpack-dev`.

## Getting sources

Download the source archive, and unpack it:

        $ wget https://integral.physics.muni.cz/pub/oakleaf/oakleaf-1.0.1.tar.gz
        $ tar zxf oakleaf-1.0.1.tar.gz

## The package build

The Oakleaf library should to be build in the following steps:

        $ cd oakleaf-1.0.1/
        $ ./configure FCFLAGS="-O2 -ffpe-trap=invalid,zero,overflow"
        $ make
        # make install    # as root, or sudo

It can be later un-installed, if the build directory still exists, by command

        $ cd [some directory]/oakleaf-1.0.1/
        # make uninstall    # as root

The building can be customised via optional parameters of the configure. The optimisation `"-O2"` is reccomended. The library is installed under `/usr/local` by default (see `configure --help`).

If Minpack is not found, although installed, by `./configure`, try to add `LDFLAGS="-L/usr/local/lib"` (eventually adjust the path) and check presence of the file `libminpack.a`.

## Smoke tests

The Oakleaf package has included a verification. The basic tests can be executed as:

        $ make check

The advanced testing, under a high voltage, is performed by

        $ VOLTAGE=high make check

## The placement

By default, the library is placed under `/usr/local` according to the switch `--prefix=` of `./configure`. A program is compiled as

        gfortran -I/usr/local/include .. -L/usr/local/lib ..

If the library is installed by packaging system, `--prefix=/usr` is selected. For GNU/Debian, as well as derivatives like Ubuntu or Mint, the compile step requires only `-I/usr/include`:

        gfortran -I/usr/include ..

The library can be found in `/usr/lib/<arch>`, where the arch `x86_64-linux-gnu` is just for example.