Different options on how to build¶
ci/build.sh [Debug|Release]cmake && make|ninja
Build Configurations¶
Make sure to install all dependencies
cmocka_extensions, cmocka_mocks, safu & samconf
cmake & make without any options (default)¶
cmake -B build/ .
make -C build/
Builds everything except for the InfluxDB backend. Everything is build in Debug mode.
make -C build/ install
Installs everything except mock_libelos.
Can be configured with the options described in section cmake options.
Alternatively use the CI hooks for developer setup
./ci/install_deps.py ./ci/build.sh [Release|Debug]
ci/install_deps.py¶
Intended to easier install the dependencies cmocka_extensions, cmocka_mocks, safu & samconf
ci/install_deps.py
By default it installs from the main branch of the GitHub repositories. The behavior can be modified by specifying one of the following files in this order:
file specified by
ELOS_DEPENDENCY_CONFIGenvironment variable
export ELOS_DEPENDENCY_CONFIG=".myconfig/my_dependencies.json"
dependencies.jsonin the root of the projectci/dependencies_default.jsonin the root of the project
Each resource can be defined by the [url|path][commit|branch|tag][cmake_opts]
options. This could look like:
{
   "safu": {
      "path": "../safu"
   },
   "samconf": {
      "url": "https://github.com/Elektrobit/samconf.git",
      "tag": "samconf-0.49.3"
   },
   "cmocka_mocks": {
      "url": "https://github.com/Elektrobit/cmocka_mocks.git",
      "commit": "2206cfbcf315b3c7381f9b9f4aa29238b18c1a6b",
      "cmake_opts": ["-D", "UNIT_TESTS=off"]
   },
   "cmocka_extensions": {
      "branch": "main"
   }
}
If no URL or path is provided the default is used. A path is used as is without checking the branch, tag or commit and includes local changes that aren’t committed jet.
The url property supports the evaluation of environment variables like
SOURCES_URI so it is possible to define template configurations like:
{
    "safu": {
        "url":  "${SOURCES_URI}/safu.git",
        "branch": "integration"
    },
    "samconf": {
        "url": "${SOURCES_URI}/samconf.git",
        "branch": "integration"
    },
    "cmocka_mocks": {
        "url": "${SOURCES_URI}/cmocka_mocks.git",
        "branch": "integration"
    },
    "cmocka_extensions": {
        "url": "${SOURCES_URI}/cmocka_extensions.git",
        "branch": "integration"
    }
}
and call install_deps.py like :
SOURCES_URI=https://${GIT_USER_TOKEN}@github.com/Elektrobit/
These dependencies get installed into build/deps/ and if provided with an URL the sources can be found in build/deps/src.
In addition the install_deps.py provides the following command line options to tune the install process:
usage: install_deps.py [-h] [-c CONFIG] [-G] [--no-tests] [--no-mocks] [--ci]
                       [--clean-first]
options:
  -h, --help            show this help message and exit
  -c CONFIG, --config CONFIG
                        the user config for dependencies (default
                        /home/runner/work/elos/elos/dependencies.json or
                        enviroment variable ELOS_DEPENDENCY_CONFIG)
  -G, --global          install the dependencies globaly
  --no-tests            don't install cmocka_extensions & cmocka_mocks
  --no-mocks            don't build & install mock libraries (no cmocka
                        depenedencies)
  --ci                  run cmake with CI flag
  --clean-first         clean cmake caches first
To use binaries installed from dependencies add build/deps/bin to the PATH environment variable.
ci/build.sh¶
Intended for easier building of different configurations while developing and in CI.
ci/build.sh [BUILD_TARGET]
Builds everything except for the InfluxDB backend.
By default the BUILD_TARGET is Debug.
The build folder is set to build/BUILD_TARGET/cmake and everything is also directly installed into build/BUILD_TARGET/dist/ (except for mock_libelos).
Additional configurations are described in ci/build.sh options.
Output¶
/usr
├── etc/
│  └── elos/
│     └── elos_log4c_demo/
│        └── log4crc
└── local/
   ├── bin/
   │  ├── demo_eloslog
   │  ├── demo_eventbuffer
   │  ├── demo_libelos_v2
   │  ├── demo_scanner_shmem
   │  ├── elos-coredump
   │  ├── elos_log4c_demo
   │  ├── elosc
   │  ├── elosd
   │  ├── elosMon
   │  ├── syslog_example
   │  └── tinyElosc
   ├── include/
   │  └── elos/
   │     ├── common/
   │     │  ├── message.h
   │     │  ├── process.h
   │     │  └── types.h
   │     ├── event/
   │     │  ├── event.h
   │     │  ├── event_source.h
   │     │  └── event_vector.h
   │     ├── libelos/
   │     │  ├── libelos.h
   │     │  └── libeloslog.h
   │     └── libelosplugin/
   │        └── libelosplugin.h
   └── lib/
      ├── elos/
      │  ├── backend/
      │  │  ├── backend_dummy.so
      │  │  ├── backend_json.so
      │  │  └── backend_sql.so
      │  └── scanner/
      │     ├── scanner_kmsg.so
      │     ├── scanner_shmem.so
      │     └── scanner_syslog.so
      ├── libelos.so -> libelos.so.0
      ├── libelos.so.0 -> libelos.so.0.52.3
      ├── libelos.so.0.52.3
      ├── libeloslog4c.so -> libeloslog4c.so.0
      ├── libeloslog4c.so.0 -> libeloslog4c.so.0.52.3
      ├── libeloslog4c.so.0.52.3
      ├── libelosplugin.so -> libelosplugin.so.0
      ├── libelosplugin.so.0 -> libelosplugin.so.0.52.3
      ├── libelosplugin.so.0.52.3
      └── test/
         └── elos unit tests
Dependencies¶
elosd  | 
libelos  | 
mock_libelos  | 
libelosplugin  | 
scanner  | 
backend  | 
Clients  | 
Demos  | 
unit tests  | 
|
|---|---|---|---|---|---|---|---|---|---|
safu  | 
✅  | 
✅  | 
✅  | 
✅  | 
✅  | 
✅  | 
✅  | 
✅  | 
✅  | 
mock_safu  | 
✅  | 
||||||||
samconf  | 
✅  | 
✅  | 
✅  | 
✅  | 
✅  | 
✅  | 
✅  | 
||
mock_samconf  | 
✅  | 
||||||||
cmocka  | 
✅  | 
✅  | 
|||||||
cmocka_extensions  | 
✅  | 
✅  | 
|||||||
cmocka_mocks  | 
✅  | 
||||||||
asan [1]  | 
✅  | 
✅  | 
✅  | 
✅  | 
✅  | 
✅  | 
✅  | 
✅  | 
✅  | 
esmtp  | 
✅ [4]  | 
||||||||
jason-c  | 
✅  | 
✅  | 
✅  | 
✅  | 
✅  | 
✅  | 
✅  | 
||
libcurl  | 
✅ [2]  | 
||||||||
libmnl  | 
✅  | 
✅  | 
|||||||
log4c  | 
✅ [5]  | 
||||||||
sqlite3  | 
✅ [3]  | 
Options¶
cmake options¶
CMAKE_BUILD_TYPE: (default “Debug”)
ENABLE_CI: (default OFF) adds
-Werrorto the compile optionsUNIT_TESTS: (default ON) Build the unit tests
INSTALL_UNIT_TESTS: (default ON) install the unit tests
ELOSD_EVENTLOGGING_BACKEND_SQL: (default ON) Build the sqlite3 backend plugin
ELOSD_EVENTLOGGING_BACKEND_INFLUXDB: (default OFF) Build the InfluxDB backend plugin
ci/build.sh options¶
[BUILD_TYPE] (default “Debug”) sets the build type for cmake
--cienables-DENABLE_CIfor cmake and implicitly sets--clean --verbose--clean|-cdeletes the build directory before the build for a fresh start--verbose|-vadds-vto the parameters for ninja
CI-Helper scripts¶
The ci folder contains a bunch of helper scripts to do different CI task.
Keeping them separated from a specific CI solution enables us to reuse the code
and additionally use them locally during development.
All shell scripts in the ci folder shall use the bash unless specifically justified.