Build and installation

Prerequisites

Two development setups can be used with this sample:

  • the redpesk SDK container, which provides an isolated OCI-based development environment;
  • a redpesk framework built and installed locally from sources.

For the container-based setup, see the SDK container overview and follow the SDK container setup.

For a host installation, follow Build framework on your computer to build and install the AFB runtime and development environment from sources.

For binder usage, see Getting the binder.

The main build dependencies are:

  • CMake;
  • a C compiler, and a C++ compiler when building the C++ implementation;
  • json-c development files;
  • AFB Binding V4 development files (afb-binding >= 4.1.0).

Build from sources

Clone the project and configure a build directory:

git clone https://github.com/redpesk-samples/helloworld-binding.git
cd helloworld-binding
cmake -S . -B build

Build the binding:

cmake --build build

The resulting shared library is:

build/helloworld-binding.so

Build the C++ implementation

The C implementation is selected by default. To build the C++ implementation instead, enable the CPP CMake option:

cmake -S . -B build-cpp -DCPP=ON
cmake --build build-cpp

The generated library exposes the same helloworld API as the C implementation.

Install a source build

A source build can be installed with the standard CMake installation mechanism:

sudo cmake --install build

The installation prefix can be customized at configuration time with CMAKE_INSTALL_PREFIX and the application directory with AFM_APP_DIR.

For development and validation, installing the source build is not required: afb-binder can load the shared library directly from the build directory.

Build the RPM package

RPM builds are handled by the redpesk factory tooling. The repository GitLab CI build job uses the official redpesk factory CI template and builds the package from helloworld-binding.spec.

The same package can be built through a redpesk factory or a configured redpesk local builder.

When using an RPM-based redpesk development environment, install the package build dependencies with:

dnf builddep helloworld-binding

Install from packages

On a system configured with the appropriate redpesk repositories, install the binding with:

dnf install helloworld-binding

The packaged binding is installed under:

/usr/redpesk/helloworld-binding/

The shared library is located at:

/usr/redpesk/helloworld-binding/lib/helloworld-binding.so

To verify the installed files, run:

rpm -ql helloworld-binding

For package deployment on a redpesk target, refer to the redpesk application deployment documentation.