-
Notifications
You must be signed in to change notification settings - Fork 0
Building
leaf uses cmake as its build system, which allows for flexible and portable builds.
The build process is divided into these steps:
leaf needs 2 dependencies:
-
libcurl -
libarchive
They can be installed through the package manager of your system.
Note
If you intend to build
leafas a static binary, you can skip this step, these will get built during theleafbuild.
To obtain the source code, this simple command will help you:
git clone --recursive https://github.com/AcaciaLinux/leafNote the --recursive flag, it will tell git to clone submodules too, they are needed for leaf.
If you missed the --recursive flag, you can pull submodules afterwards using the following command while inside the leaf directory: git submodule update --recursive --init.
To start the build process, create a directory called build and enter it using the following two commands:
mkdir -pv build
cd buildStarting the cmake process for a standard build, issue the following command:
cmake ..The cmake build for leaf supports a couple of options:
-
LEAF_STATIC -
BUILD_DOCS -
BUILD_TESTS
They can be put into the middle of the cmake command:
cmake -D<your option>=<ON/OFF> ..
Using this option will lead the leaf binary to be statically linked to make it usable on systems with minimal runtime support: cmake -DLEAF_STATIC=ON ..
Note
You need to configure
leaffor this type of build, refer to the Static build section for further information.**
Using this will create documentation for all the leaf classes and functions: cmake -DBUILD_DOCS=ON ..
This will lead the build system to building the leaf test suite: cmake -DBUILD_TESTS=ON ..
Note
This option should only be used in development environments, it will insert guards and checks into the
leafcorelibrary that will slow it down
You can run tests using the ctest . command when in the build directory.
Normally this should only involve on command (while being in the build directory:
make #To use only one thread for the build (slower)
make -j$(nproc) #To use all your threads for the buildNote
To install leaf, you have to have superuser access by either prefixing
sudoordoasto the following command, or by logging in as therootuser.
The following command will take care of that, always executed from the build directory:
make installIf you want to install leaf into a custom directory, the following command will do the trick:
make DESTDIR=/my/custom/leaf/directory installTo build leaf into a statically linked binary, you need to clone the libcurl and libarchive source code too. Use the following command when in the root of the leaf repository:
bash ./prepare_static.shThis will clone the repositories and patch them to work wit leaf.
Note
Do not forget to use the
LEAF_STATIC=ONoption when running thecmakestep!