Build and Installation
Relevant source files
The following files were used as context for generating this wiki page:
Librelp utilizes a standard GNU Autotools-based build system, which is augmented by specialized scripts for containerized development and Continuous Integration (CI). The build process covers configuration via autoreconf and configure, compilation using make, and an extensive testing framework.
The library supports multiple transport security layers, specifically GnuTLS and OpenSSL, which can be toggled during the configuration phase. It is designed to be highly portable, with specific considerations for various platforms including Linux (Alpine, etc.), Solaris, and AIX.
Build Process Overview
The core build lifecycle follows the sequence of reconfiguration, configuration, compilation, and verification.
The build process is often wrapped in containerized environments to ensure consistency across different developer machines and CI runners.
Sources: devtools/run-ci.sh:22-31, devtools/run-static-analyzer.sh:14-16
Environment and Containers
Development and builds can be executed within Docker containers to provide all necessary dependencies. The devcontainer.sh script manages these containers, mapping the project root to /rsyslog inside the container and passing environment variables like CC, CFLAGS, and LDFLAGS.
Key environment variables used in the build process:
| Variable | Description |
|---|---|
CC | The C compiler to use (e.g., gcc-9, clang-9). |
CFLAGS | Compiler flags for optimization or sanitizers. |
PROJ_CONFIGURE_OPTIONS | Standard options passed to the configure script. |
CI_MAKE_OPT | Options for the make command (e.g., -j2). |
Sources: devtools/devcontainer.sh:35-64, devtools/run-ci.sh:5-10
Configuration Options
The configure script allows enabling or disabling specific features of librelp. A primary focus is the selection of TLS libraries.
TLS Library Selection
Users can choose between GnuTLS and OpenSSL at compile time. This is handled through configure flags:
--enable-tls: Enables TLS support, typically defaulting to GnuTLS.--enable-tls-openssl: Specifically enables the OpenSSL backend.
Sources: devtools/travis-run-compile-tests.sh:13, devtools/travis-run-compile-tests.sh:44
Static Analysis
Static analysis is integrated into the build pipeline using scan-build. The script run-static-analyzer.sh configures the project and then runs make through the analyzer to detect potential bugs before runtime.
Sources: devtools/run-static-analyzer.sh:4-21
Testing Framework
Librelp includes a robust test bench initiated by make check. This framework uses shell scripts to orchestrate tests between a sender (send) and a receiver (receive).
Automated Testing Flow
The test framework manages process lifecycles and port assignments to prevent collisions during parallel runs.
Sources: tests/test-framework.sh:23-70
Test Verification
Tests are verified by comparing the OUTFILE generated by the receiver against expected message counts or specific strings. If a test fails, gather-check-logs.sh is used to extract relevant failure information from .trs and .log files, limiting output size for CI efficiency.
Sources: tests/test-framework.sh:110-155, devtools/gather-check-logs.sh:7-40
Memory Leak Detection
Tests can be run under Valgrind to identify memory management issues. The framework provides a startup_receiver_valgrind function that executes the receiver through libtool --mode=execute valgrind.
Sources: tests/test-framework.sh:42-53
Summary
The Build and Installation system for librelp is designed for cross-platform compatibility and rigorous verification. By leveraging Autotools and Docker-based isolation, the project ensures that the library can be reliably compiled with different compiler versions and TLS backends while maintaining high code quality through static analysis and automated test suites.