diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 50ecfa3f4..11914a459 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -161,10 +161,10 @@ test:python: stage: test script: - cd python - - /venv/bin/pytest --verbose . - - /venv/bin/black --extend-exclude=".*(\\.pyi|_pb2.py)$" --check . - - /venv/bin/flake8 --extend-exclude="*.pyi,*_pb2.py" . - - /venv/bin/mypy . + - pytest --verbose . + - black --extend-exclude=".*(\\.pyi|_pb2.py)$" --check . + - flake8 --extend-exclude="*.pyi,*_pb2.py" . + - mypy . image: ${DOCKER_IMAGE_DEV}:${DOCKER_TAG} needs: - job: "build:source: [fedora]" diff --git a/CMakeLists.txt b/CMakeLists.txt index 6fc139cbd..cb64b0cce 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -189,8 +189,8 @@ cmake_dependent_option(WITH_NODE_EXAMPLE "Build with example node-type" cmake_dependent_option(WITH_NODE_EXEC "Build with exec node-type" "${WITH_DEFAULTS}" "" OFF) cmake_dependent_option(WITH_NODE_FILE "Build with file node-type" "${WITH_DEFAULTS}" "" OFF) cmake_dependent_option(WITH_NODE_FPGA "Build with fpga node-type" "${WITH_DEFAULTS}" "WITH_FPGA" OFF) -cmake_dependent_option(WITH_NODE_IEC61850 "Build with iec61850 node-types" "${WITH_DEFAULTS}" "LIBIEC61850_FOUND; NOT WITHOUT_GPL" OFF) cmake_dependent_option(WITH_NODE_IEC60870 "Build with iec60870 node-types" "${WITH_DEFAULTS}" "LIB60870_FOUND; NOT WITHOUT_GPL" OFF) +cmake_dependent_option(WITH_NODE_IEC61850 "Build with iec61850 node-types" "${WITH_DEFAULTS}" "LIBIEC61850_FOUND; NOT WITHOUT_GPL" OFF) cmake_dependent_option(WITH_NODE_INFINIBAND "Build with infiniband node-type" "${WITH_DEFAULTS}" "IBVerbs_FOUND; RDMACM_FOUND" OFF) # Infiniband node-type is currenly broken cmake_dependent_option(WITH_NODE_INFLUXDB "Build with influxdb node-type" "${WITH_DEFAULTS}" "" OFF) cmake_dependent_option(WITH_NODE_KAFKA "Build with kafka node-type" "${WITH_DEFAULTS}" "RDKAFKA_FOUND" OFF) @@ -199,8 +199,9 @@ cmake_dependent_option(WITH_NODE_MODBUS "Build with modbus node-type" cmake_dependent_option(WITH_NODE_MQTT "Build with mqtt node-type" "${WITH_DEFAULTS}" "MOSQUITTO_FOUND" OFF) cmake_dependent_option(WITH_NODE_NANOMSG "Build with nanomsg node-type" "${WITH_DEFAULTS}" "NANOMSG_FOUND" OFF) cmake_dependent_option(WITH_NODE_NGSI "Build with ngsi node-type" "${WITH_DEFAULTS}" "" OFF) -cmake_dependent_option(WITH_NODE_OPAL_ORCHESTRA "Build with opal-orchestra node-type" "${WITH_DEFAULTS}" "OpalOrchestra_FOUND; LibXml2_FOUND" OFF) cmake_dependent_option(WITH_NODE_OPAL_ASYNC "Build with opal.async node-type" "${WITH_DEFAULTS}" "OpalAsyncApi_FOUND" OFF) +cmake_dependent_option(WITH_NODE_OPAL_ORCHESTRA "Build with opal.orchestra node-type" "${WITH_DEFAULTS}" "OpalOrchestra_FOUND; LibXml2_FOUND" OFF) +cmake_dependent_option(WITH_NODE_OPENDSS "Build with opendss node-type" "${WITH_DEFAULTS}" "OpenDSSC_FOUND" OFF) cmake_dependent_option(WITH_NODE_REDIS "Build with redis node-type" "${WITH_DEFAULTS}" "HIREDIS_FOUND; REDISPP_FOUND" OFF) cmake_dependent_option(WITH_NODE_RTP "Build with rtp node-type" "${WITH_DEFAULTS}" "re_FOUND" OFF) cmake_dependent_option(WITH_NODE_SHMEM "Build with shmem node-type" "${WITH_DEFAULTS}" "HAS_SEMAPHORE; HAS_MMAN" OFF) @@ -213,7 +214,6 @@ cmake_dependent_option(WITH_NODE_ULDAQ "Build with uldaq node-type" cmake_dependent_option(WITH_NODE_WEBRTC "Build with webrtc node-type" "${WITH_DEFAULTS}" "WITH_WEB; LibDataChannel_FOUND" OFF) cmake_dependent_option(WITH_NODE_WEBSOCKET "Build with websocket node-type" "${WITH_DEFAULTS}" "WITH_WEB" OFF) cmake_dependent_option(WITH_NODE_ZEROMQ "Build with zeromq node-type" "${WITH_DEFAULTS}" "LIBZMQ_FOUND; NOT WITHOUT_GPL" OFF) -cmake_dependent_option(WITH_NODE_OPENDSS "Build with opendss node-type" "${WITH_DEFAULTS}" "OpenDSSC_FOUND" OFF) # Set a default for the build type if("${CMAKE_BUILD_TYPE}" STREQUAL "") @@ -299,8 +299,8 @@ add_feature_info(NODE_EXAMPLE WITH_NODE_EXAMPLE "Build with add_feature_info(NODE_EXEC WITH_NODE_EXEC "Build with exec node-type") add_feature_info(NODE_FILE WITH_NODE_FILE "Build with file node-type") add_feature_info(NODE_FPGA WITH_NODE_FPGA "Build with fpga node-type") -add_feature_info(NODE_IEC61850 WITH_NODE_IEC61850 "Build with iec61850 node-types") add_feature_info(NODE_IEC60870 WITH_NODE_IEC60870 "Build with iec60870 node-types") +add_feature_info(NODE_IEC61850 WITH_NODE_IEC61850 "Build with iec61850 node-types") add_feature_info(NODE_INFINIBAND WITH_NODE_INFINIBAND "Build with infiniband node-type") add_feature_info(NODE_INFLUXDB WITH_NODE_INFLUXDB "Build with influxdb node-type") add_feature_info(NODE_KAFKA WITH_NODE_KAFKA "Build with kafka node-type") @@ -309,6 +309,8 @@ add_feature_info(NODE_MODBUS WITH_NODE_MODBUS "Build with add_feature_info(NODE_MQTT WITH_NODE_MQTT "Build with mqtt node-type") add_feature_info(NODE_NANOMSG WITH_NODE_NANOMSG "Build with nanomsg node-type") add_feature_info(NODE_NGSI WITH_NODE_NGSI "Build with ngsi node-type") +add_feature_info(NODE_OPAL_AYSNC WITH_NODE_OPAL_ASYNC "Build with opal.async node-type") +add_feature_info(NODE_OPAL_ORCHESTRA WITH_NODE_OPAL_ORCHESTRA "Build with opal.orchestra node-type") add_feature_info(NODE_OPENDSS WITH_NODE_OPENDSS "Build with opendss node-type") add_feature_info(NODE_REDIS WITH_NODE_REDIS "Build with redis node-type") add_feature_info(NODE_RTP WITH_NODE_RTP "Build with rtp node-type") diff --git a/cmake/FindOpalOrchestra.cmake b/cmake/FindOpalOrchestra.cmake index 72ed54422..d77879e04 100644 --- a/cmake/FindOpalOrchestra.cmake +++ b/cmake/FindOpalOrchestra.cmake @@ -7,13 +7,13 @@ find_path(OPAL_ORCHESTRA_INCLUDE_DIR NAMES RTAPI.h PATHS - /usr/opalrt/common/bin + /usr/opalrt/common/include_target ) find_library(OPAL_ORCHESTRA_LIBRARY NAMES OpalOrchestra PATHS - /usr/opalrt/common/include + /usr/opalrt/common/bin ) include(FindPackageHandleStandardArgs) diff --git a/common/include/villas/fs.hpp b/common/include/villas/fs.hpp index 122514d56..5128af83e 100644 --- a/common/include/villas/fs.hpp +++ b/common/include/villas/fs.hpp @@ -5,12 +5,22 @@ * SPDX-License-Identifier: Apache-2.0 */ +#pragma once + #include #ifdef WITH_GHC_FS + +#include #include + namespace fs = ghc::filesystem; + +template <> class fmt::formatter : public fmt::ostream_formatter {}; + #else + #include namespace fs = std::filesystem; + #endif diff --git a/include/villas/nodes/opal_orchestra/ddf.hpp b/include/villas/nodes/opal_orchestra/ddf.hpp index a7393ce2e..f41168804 100644 --- a/include/villas/nodes/opal_orchestra/ddf.hpp +++ b/include/villas/nodes/opal_orchestra/ddf.hpp @@ -16,6 +16,7 @@ #include +#include #include #include #include @@ -148,7 +149,7 @@ class DataDefinitionFile { xmlNode *toXml() const; - void writeToFile(const std::filesystem::path &filename) const; + void writeToFile(const fs::path &filename) const; }; } // namespace orchestra diff --git a/lib/api/requests/graph.cpp b/lib/api/requests/graph.cpp index 5b113223e..9c8da2c1a 100644 --- a/lib/api/requests/graph.cpp +++ b/lib/api/requests/graph.cpp @@ -6,6 +6,7 @@ */ extern "C" { +#include #include } @@ -46,7 +47,12 @@ class GraphRequest : public Request { auto *graph = sn->getGraph(); char *data; - unsigned len; + +#if GRAPHVIZ_VERSION_MAJOR >= 13 + size_t len; +#else + unsigned int len; +#endif std::list supportedLayouts = { "circo", "dot", "fdp", "neato", "nop", "nop1", diff --git a/lib/config.cpp b/lib/config.cpp index 97715d0a6..f01e85822 100644 --- a/lib/config.cpp +++ b/lib/config.cpp @@ -327,7 +327,8 @@ json_t *Config::expandIncludes(json_t *in) { std::string text = json_string_value(str); static const std::string kw = "@include "; - if (!text.starts_with(kw)) + auto res = std::mismatch(kw.begin(), kw.end(), text.begin()); + if (res.first != kw.end()) return json_incref(str); else { std::string pattern = text.substr(kw.size()); diff --git a/lib/mapping.cpp b/lib/mapping.cpp index 8cac18073..965b943e2 100644 --- a/lib/mapping.cpp +++ b/lib/mapping.cpp @@ -87,9 +87,8 @@ int MappingEntry::parseString(const std::string &str) { throw RuntimeError("Failed to parse mapping expression: {}", str); } -MappingEntry::MappingEntry() - : node(nullptr), type(Type::UNKNOWN), length(0), offset(0), data(0), - nodeName() {} +MappingEntry::MappingEntry() // cppcheck-suppress uninitMemberVar + : node(nullptr), type(Type::UNKNOWN), length(0), offset(0), nodeName() {} int MappingEntry::parse(json_t *json) { const char *str; diff --git a/lib/nodes/opal_async.cpp b/lib/nodes/opal_async.cpp index 33a1e40bd..f3a5dcee6 100644 --- a/lib/nodes/opal_async.cpp +++ b/lib/nodes/opal_async.cpp @@ -7,6 +7,7 @@ #include #include +#include #include #include @@ -51,7 +52,7 @@ static std::thread awaiter; static std::mutex lock; // Protecting state and nodeMap static int state; -static std::map nodeMap; +static std::unordered_map nodeMap; static void waitForModelState(int state) { while (OpalGetAsyncModelState() != state) @@ -59,7 +60,7 @@ static void waitForModelState(int state) { } static void waitForAsyncSendRequests() { - auto logger = logging.get("node:opal"); + auto logger = Log::get("node:opal"); int ret; unsigned id; @@ -88,7 +89,7 @@ static void waitForAsyncSendRequests() { } static int dumpGlobal() { - auto logger = logging.get("node:opal"); + auto logger = Log::get("node:opal"); logger->debug("Controller ID: {}", params.controllerID); @@ -131,9 +132,7 @@ void LogSink::sink_it_(const spdlog::details::log_msg &msg) { buf.clear(); formatter_->format(msg, buf); - char *bufPtr; - - bufPtr = bufPtr.data(); + auto bufPtr = buf.data(); bufPtr[buf.size()] = '\0'; OpalPrint(bufPtr); @@ -349,7 +348,7 @@ void OpalAsyncNode::waitReady() { ready = false; } -int OpalAsyncNode::start(SuperNode *sn) { +int OpalAsyncNodeFactory::start(SuperNode *sn) { int ret, idsRecvLen, idsSendLen; auto *shmemAsyncNamePtr = std::getenv("OPAL_ASYNC_SHMEM_NAME"); @@ -365,7 +364,7 @@ int OpalAsyncNode::start(SuperNode *sn) { // Register OpalPrint sink for spdlog sink = std::make_shared(shmemSystemCtrlName); - logging.replaceStdSink(sink); + Log::getInstance().replaceStdSink(sink); // Open shared memory region created by the RT-LAB model. ret = OpalOpenAsyncMem(shmemAsyncSize, @@ -402,7 +401,7 @@ int OpalAsyncNode::start(SuperNode *sn) { return NodeFactory::start(sn); } -int OpalAsyncNode::stop() { +int OpalAsyncNodeFactory::stop() { int ret; logger->debug("Stopping waiter thread"); diff --git a/lib/nodes/opal_orchestra.cpp b/lib/nodes/opal_orchestra.cpp index 181ac7758..0bb804927 100644 --- a/lib/nodes/opal_orchestra.cpp +++ b/lib/nodes/opal_orchestra.cpp @@ -24,6 +24,7 @@ extern "C" { #include #include +#include #include #include #include @@ -248,7 +249,7 @@ class OpalOrchestraNode : public Node { publishMappings; double rate; - std::optional dataDefinitionFilename; + std::optional dataDefinitionFilename; std::chrono::seconds connectTimeout; std::optional @@ -499,7 +500,7 @@ class OpalOrchestraNode : public Node { int check() override { if (dataDefinitionFilename) { - if (!std::filesystem::exists(*dataDefinitionFilename) && + if (!fs::exists(*dataDefinitionFilename) && !dataDefinitionFileOverwrite) { throw RuntimeError("OPAL-RT Orchestra Data Definition file (DDF) at " "'{}' does not exist", diff --git a/lib/nodes/opal_orchestra/ddf.cpp b/lib/nodes/opal_orchestra/ddf.cpp index 0992772ba..ac0309b7e 100644 --- a/lib/nodes/opal_orchestra/ddf.cpp +++ b/lib/nodes/opal_orchestra/ddf.cpp @@ -11,6 +11,7 @@ extern "C" { #include } +#include #include #include #include @@ -367,8 +368,7 @@ xmlNode *DataDefinitionFile::toXml() const { return rootNode; } -void DataDefinitionFile::writeToFile( - const std::filesystem::path &filename) const { +void DataDefinitionFile::writeToFile(const fs::path &filename) const { // Create a new XML document auto *doc = xmlNewDoc(BAD_CAST "1.0"); auto *rootNode = toXml(); diff --git a/packaging/deps.sh b/packaging/deps.sh index 5254aee86..b1b65db09 100644 --- a/packaging/deps.sh +++ b/packaging/deps.sh @@ -62,6 +62,26 @@ should_build() { return 0 } +has_command() { + command -v "$1" >/dev/null 2>&1 +} + +has_git_svn() { + git svn --version > /dev/null 2>&1 +} + +check_cmake_version() { + local cmake_version + cmake_version=$(cmake --version | head -n1 | awk '{print $3}') + local required_version=$1 + + if [ "$(printf '%s\n%s\n' "$required_version" "$cmake_version" | sort -V | head -n1)" = "$required_version" ]; then + return 0 + else + return 1 + fi +} + ## Build configuration # Use shallow git clones to speed up downloads @@ -69,61 +89,72 @@ GIT_OPTS+=" --depth=1 --recurse-submodules --shallow-submodules --config advice. # Install destination PREFIX=${PREFIX:-/usr/local} +if [[ "${PREFIX}" == "/usr/local" ]]; then + PIP_PREFIX="$(pwd)/venv" + PATH="${PIP_PREFIX}/bin:${PREFIX}/bin:${PATH}" +else + PIP_PREFIX="${PREFIX}" + PATH="${PREFIX}/bin:${PATH}" +fi # Cross-compile TRIPLET=${TRIPLET:-$(gcc -dumpmachine)} ARCH=${ARCH:-$(uname -m)} # CMake -CMAKE_OPTS+=" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=${PREFIX}" +CMAKE_OPTS+=" -Wno-dev -G=Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=${PREFIX}" # Autotools CONFIGURE_OPTS+=" --host=${TRIPLET} --prefix=${PREFIX}" # Make -MAKE_THREADS=${MAKE_THREADS:-$(nproc)} -MAKE_OPTS+="--jobs=${MAKE_THREADS}" +PARALLEL=${PARALLEL:-$(nproc)} +MAKE_OPTS+=" -j ${PARALLEL}" + +# Ninja +NINJA_OPTS+=" -j ${PARALLEL}" # pkg-config PKG_CONFIG_PATH=${PKG_CONFIG_PATH:-}${PKG_CONFIG_PATH:+:}${PREFIX}/lib/pkgconfig:${PREFIX}/lib64/pkgconfig:${PREFIX}/share/pkgconfig export PKG_CONFIG_PATH -# IS_OPAL_RTLINUX=$(uname -r | grep -q opalrtlinux && echo true) -# if [ -n "${IS_OPAL_RTLINUX}" ]; then -# GIT_OPTS+=" -c http.sslVerify=false" -# fi - SOURCE_DIR=$(realpath $(dirname "${BASH_SOURCE[0]}")) # Build in a temporary directory TMPDIR=$(mktemp -d) +trap "rm -rf ${TMPDIR}" EXIT echo "Entering ${TMPDIR}" pushd ${TMPDIR} >/dev/null -# Enter python venv -python3 -m venv venv -. venv/bin/activate -python3 -m pip install --upgrade pip setuptools - -# Install meson -if ! command -v meson; then - # Note: meson 0.61.5 is the latest version which supports the CMake version on the target - pip3 install meson==0.61.5 +# Check for pkg-config +if ! has_command pkg-config; then + echo -e "Error: pkg-config is required to check for existing dependencies." + exit 1 fi -# Install ninja -if ! command -v ninja; then - curl -L https://github.com/ninja-build/ninja/releases/download/v1.11.1/ninja-linux.zip > ninja-linux.zip - unzip ninja-linux.zip - export PATH=${PATH}:. -fi +# Enter python venv +python3 -m venv ${PIP_PREFIX} +. ${PIP_PREFIX}/bin/activate + +# Install some build-tools +python3 -m pip install \ + --prefix=${PIP_PREFIX} \ + --upgrade \ + pip \ + setuptools \ + +python3 -m pip install \ + --prefix=${PIP_PREFIX} \ + cmake==3.31.6 \ + meson==1.9.1 \ + ninja==1.11.1.4 # Build & Install Criterion if ! pkg-config "criterion >= 2.4.1" && \ [ "${ARCH}" == "x86_64" ] && \ should_build "criterion" "for unit tests"; then - git clone ${GIT_OPTS} --branch v2.4.2 --recursive https://github.com/Snaipe/Criterion.git + git clone ${GIT_OPTS} --branch v2.4.3 --recursive https://github.com/Snaipe/Criterion.git pushd Criterion meson setup \ @@ -141,10 +172,16 @@ fi if ! pkg-config "jansson >= 2.13" && \ should_build "jansson" "for configuration parsing" "required"; then git clone ${GIT_OPTS} --branch v2.14.1 https://github.com/akheron/jansson.git - pushd jansson - autoreconf -i - ./configure ${CONFIGURE_OPTS} - make ${MAKE_OPTS} install + mkdir -p jansson/build + pushd jansson/build + cmake -DJANSSON_BUILD_SHARED_LIBS=ON \ + -DJANSSON_BUILD_STATIC_LIBS=OFF \ + -DJANSSON_WITHOUT_TESTS=ON \ + -DJANSSON_EXAMPLES=OFF \ + ${CMAKE_OPTS} .. + cmake --build . \ + --target install \ + --parallel ${PARALLEL} popd fi @@ -157,7 +194,7 @@ if ! ( pkg-config "lua >= 5.1" || \ { [[ -n "${RTLAB_ROOT:+x}" ]] && [[ -f "/usr/local/include/lua.h" ]]; } \ ) && should_build "lua" "for the lua hook"; then curl -L http://www.lua.org/ftp/lua-5.4.7.tar.gz | tar -xz - pushd lua-5.4.4 + pushd lua-5.4.7 make ${MAKE_OPTS} MYCFLAGS=-fPIC linux make ${MAKE_OPTS} MYCFLAGS=-fPIC INSTALL_TOP=${PREFIX} install popd @@ -166,7 +203,7 @@ fi # Build & Install mosquitto if ! pkg-config "libmosquitto >= 1.4.15" && \ should_build "mosquitto" "for the mqtt node-type"; then - git clone ${GIT_OPTS} --branch v2.0.21 https://github.com/eclipse/mosquitto.git + git clone ${GIT_OPTS} --branch v2.0.22 https://github.com/eclipse/mosquitto.git mkdir -p mosquitto/build pushd mosquitto/build cmake -DWITH_BROKER=OFF \ @@ -174,7 +211,9 @@ if ! pkg-config "libmosquitto >= 1.4.15" && \ -DWITH_APPS=OFF \ -DDOCUMENTATION=OFF \ ${CMAKE_OPTS} .. - make ${MAKE_OPTS} install + cmake --build . \ + --target install \ + --parallel ${PARALLEL} popd fi @@ -185,7 +224,9 @@ if ! pkg-config "librabbitmq >= 0.13.0" && \ mkdir -p rabbitmq-c/build pushd rabbitmq-c/build cmake ${CMAKE_OPTS} .. - make ${MAKE_OPTS} install + cmake --build . \ + --target install \ + --parallel ${PARALLEL} popd fi @@ -199,14 +240,16 @@ if ! pkg-config "libzmq >= 2.2.0" && \ -DZMQ_BUILD_TESTS=OFF \ -DENABLE_CPACK=OFF \ ${CMAKE_OPTS} .. - make ${MAKE_OPTS} install + cmake --build . \ + --target install \ + --parallel ${PARALLEL} popd fi # Build & Install EtherLab if ! pkg-config "libethercat >= 1.5.2" && \ should_build "ethercat" "for the ethercat node-type"; then - git clone ${GIT_OPTS} --branch 1.6.3 https://gitlab.com/etherlab.org/ethercat.git + git clone ${GIT_OPTS} --branch 1.6.8 https://gitlab.com/etherlab.org/ethercat.git pushd ethercat ./bootstrap ./configure --enable-userlib=yes --enable-kernel=no ${CONFIGURE_OPTS} @@ -217,7 +260,7 @@ fi # Build & Install libiec61850 if ! pkg-config "libiec61850 >= 1.6.0" && \ should_build "iec61850" "for the iec61850 node-type"; then - git clone ${GIT_OPTS} --branch v1.6.0 https://github.com/mz-automation/libiec61850.git + git clone ${GIT_OPTS} --branch v1.6.1 https://github.com/mz-automation/libiec61850.git pushd libiec61850/third_party/mbedtls/ curl -L https://github.com/Mbed-TLS/mbedtls/archive/refs/tags/v3.6.0.tar.gz | tar -xz @@ -228,34 +271,40 @@ if ! pkg-config "libiec61850 >= 1.6.0" && \ cmake -DBUILD_EXAMPLES=OFF \ -DBUILD_PYTHON_BINDINGS=OFF \ ${CMAKE_OPTS} .. - make ${MAKE_OPTS} install + cmake --build . \ + --target install \ + --parallel ${PARALLEL} popd fi # Build & Install lib60870 if ! pkg-config "lib60870 >= 2.3.1" && \ should_build "iec60870" "for the iec60870 node-type"; then - git clone ${GIT_OPTS} --branch v2.3.4 https://github.com/mz-automation/lib60870.git + git clone ${GIT_OPTS} --branch v2.3.6 https://github.com/mz-automation/lib60870.git mkdir -p lib60870/build pushd lib60870/build cmake -DBUILD_EXAMPLES=OFF \ -DBUILD_TESTS=OFF \ ${CMAKE_OPTS} ../lib60870-C - make ${MAKE_OPTS} install + cmake --build . \ + --target install \ + --parallel ${PARALLEL} popd fi # Build & Install librdkafka if ! pkg-config "rdkafka >= 1.5.0" && \ should_build "rdkafka" "for the kafka node-type"; then - git clone ${GIT_OPTS} --branch v2.8.0 https://github.com/edenhill/librdkafka.git + git clone ${GIT_OPTS} --branch v2.12.1 https://github.com/edenhill/librdkafka.git mkdir -p librdkafka/build pushd librdkafka/build cmake -DRDKAFKA_BUILD_TESTS=OFF \ -DRDKAFKA_BUILD_EXAMPLES=OFF \ -DWITH_CURL=OFF \ ${CMAKE_OPTS} .. - make ${MAKE_OPTS} install + cmake --build . \ + --target install \ + --parallel ${PARALLEL} popd fi @@ -263,10 +312,10 @@ fi if ! ( pkg-config "libcgraph >= 2.30" && \ pkg-config "libgvc >= 2.30" \ ) && should_build "graphviz" "for villas-graph"; then - git clone ${GIT_OPTS} --branch 2.50.0 https://gitlab.com/graphviz/graphviz.git - mkdir -p graphviz/build - pushd graphviz/build - cmake ${CMAKE_OPTS} .. + curl -L https://gitlab.com/api/v4/projects/4207231/packages/generic/graphviz-releases/14.0.2/graphviz-14.0.2.tar.gz | tar -xz + mkdir -p graphviz-14.0.2 + pushd graphviz-14.0.2 + ./configure --enable-shared ${CONFIGURE_OPTS} make ${MAKE_OPTS} install popd fi @@ -301,14 +350,16 @@ fi # Build & Install libconfig if ! pkg-config "libconfig >= 1.4.9" && \ should_build "libconfig" "for libconfig configuration syntax"; then - git clone ${GIT_OPTS} --branch v1.7.3 https://github.com/hyperrealm/libconfig.git - pushd libconfig - autoreconf -i - ./configure ${CONFIGURE_OPTS} \ - --disable-tests \ - --disable-examples \ - --disable-doc - make ${MAKE_OPTS} install + git clone ${GIT_OPTS} --branch v1.8.1 https://github.com/hyperrealm/libconfig.git + mkdir -p libconfig/build + pushd libconfig/build + cmake -DBUILD_EXAMPLES=OFF \ + -DBUILD_TESTS=OFF \ + -DBUILD_CXX=OFF \ + ${CMAKE_OPTS} .. + cmake --build . \ + --target install \ + --parallel ${PARALLEL} popd fi @@ -328,17 +379,18 @@ fi # Build & Install libre if ! pkg-config "libre >= 3.6.0" && \ should_build "libre" "for the rtp node-type"; then - git clone ${GIT_OPTS} --branch v3.21.0 https://github.com/baresip/re.git + git clone ${GIT_OPTS} --branch v4.2.0 https://github.com/baresip/re.git mkdir -p re/build pushd re/build - cmake -DUSE_LIBREM=OFF \ - -DUSE_BFCP=OFF \ + cmake -DUSE_BFCP=OFF \ -DUSE_PCP=OFF \ -DUSE_RTMP=OFF \ -DUSE_SIP=OFF \ -DLIBRE_BUILD_STATIC=OFF \ ${CMAKE_OPTS} .. - make ${MAKE_OPTS} install + cmake --build . \ + --target install \ + --parallel ${PARALLEL} popd fi @@ -346,7 +398,7 @@ fi if ! pkg-config "nanomsg >= 1.0.0" && \ should_build "nanomsg" "for the nanomsg node-type"; then # TODO: v1.2.1 seems to be broken: https://github.com/nanomsg/nanomsg/issues/1111 - git clone ${GIT_OPTS} --branch 1.2 https://github.com/nanomsg/nanomsg.git + git clone ${GIT_OPTS} --branch 1.2.2 https://github.com/nanomsg/nanomsg.git mkdir -p nanomsg/build pushd nanomsg/build cmake -DNN_TESTS=OFF \ @@ -355,7 +407,9 @@ if ! pkg-config "nanomsg >= 1.0.0" && \ -DNN_ENABLE_DOC=OFF \ -DNN_ENABLE_COVERAGE=OFF \ ${CMAKE_OPTS} .. - make ${MAKE_OPTS} install + cmake --build . \ + --target install \ + --parallel ${PARALLEL} popd fi @@ -366,27 +420,31 @@ if ! pkg-config "libxil >= 1.0.0" && \ mkdir -p libxil/build pushd libxil/build cmake ${CMAKE_OPTS} .. - make ${MAKE_OPTS} install + cmake --build . \ + --target install \ + --parallel ${PARALLEL} popd fi # Build & Install hiredis if ! pkg-config "hiredis >= 1.0.0" && \ should_build "hiredis" "for the redis node-type"; then - git clone ${GIT_OPTS} --branch v1.2.0 https://github.com/redis/hiredis.git + git clone ${GIT_OPTS} --branch v1.3.0 https://github.com/redis/hiredis.git mkdir -p hiredis/build pushd hiredis/build cmake -DDISABLE_TESTS=ON \ -DENABLE_SSL=ON \ ${CMAKE_OPTS} .. - make ${MAKE_OPTS} install + cmake --build . \ + --target install \ + --parallel ${PARALLEL} popd fi # Build & Install redis++ if ! pkg-config "redis++ >= 1.2.3" && \ should_build "redis++" "for the redis node-type"; then - git clone ${GIT_OPTS} --branch 1.3.14 https://github.com/sewenew/redis-plus-plus.git + git clone ${GIT_OPTS} --branch 1.3.15 https://github.com/sewenew/redis-plus-plus.git mkdir -p redis-plus-plus/build pushd redis-plus-plus/build @@ -397,27 +455,31 @@ if ! pkg-config "redis++ >= 1.2.3" && \ -DREDIS_PLUS_PLUS_BUILD_STATIC=OFF \ -DREDIS_PLUS_PLUS_CXX_STANDARD=17 \ ${REDISPP_CMAKE_OPTS} ${CMAKE_OPTS} .. - make ${MAKE_OPTS} install VERBOSE=1 + cmake --build . \ + --target install \ + --parallel ${PARALLEL} popd fi # Build & Install Fmtlib if ! pkg-config "fmt >= 6.1.2" && \ should_build "fmt" "for logging" "required"; then - git clone ${GIT_OPTS} --branch 11.0.2 --recursive https://github.com/fmtlib/fmt.git + git clone ${GIT_OPTS} --branch 12.1.0 --recursive https://github.com/fmtlib/fmt.git mkdir -p fmt/build pushd fmt/build cmake -DBUILD_SHARED_LIBS=1 \ -DFMT_TEST=OFF \ ${CMAKE_OPTS} .. - make ${MAKE_OPTS} install + cmake --build . \ + --target install \ + --parallel ${PARALLEL} popd fi # Build & Install spdlog if ! pkg-config "spdlog >= 1.8.2" && \ should_build "spdlog" "for logging" "required"; then - git clone ${GIT_OPTS} --branch v1.15.0 --recursive https://github.com/gabime/spdlog.git + git clone ${GIT_OPTS} --branch v1.16.0 --recursive https://github.com/gabime/spdlog.git mkdir -p spdlog/build pushd spdlog/build cmake -DSPDLOG_FMT_EXTERNAL=ON \ @@ -425,21 +487,25 @@ if ! pkg-config "spdlog >= 1.8.2" && \ -DSPDLOG_BUILD_SHARED=ON \ -DSPDLOG_BUILD_TESTS=OFF \ ${CMAKE_OPTS} .. - make ${MAKE_OPTS} install + cmake --build . \ + --target install \ + --parallel ${PARALLEL} popd fi # Build & Install libwebsockets if ! pkg-config "libwebsockets >= 4.3.0" && \ should_build "libwebsockets" "for the websocket node and VILLASweb" "required"; then - git clone ${GIT_OPTS} --branch v4.3.5 https://github.com/warmcat/libwebsockets.git + git clone ${GIT_OPTS} --branch v4.3.6 https://github.com/warmcat/libwebsockets.git mkdir -p libwebsockets/build pushd libwebsockets/build cmake -DLWS_WITH_IPV6=ON \ -DLWS_WITHOUT_TESTAPPS=ON \ -DLWS_WITHOUT_EXTENSIONS=OFF \ ${CMAKE_OPTS} .. - make ${MAKE_OPTS} install + cmake --build . \ + --target install \ + --parallel ${PARALLEL} popd fi @@ -464,7 +530,7 @@ fi # Build & Install libdatachannel if ! cmake --find-package -DNAME=LibDataChannel -DCOMPILER_ID=GNU -DLANGUAGE=CXX -DMODE=EXIST >/dev/null 2>/dev/null && \ should_build "libdatachannel" "for the webrtc node-type"; then - git clone ${GIT_OPTS} --recursive --branch v0.22.6 https://github.com/paullouisageneau/libdatachannel.git + git clone ${GIT_OPTS} --recursive --branch v0.23.2 https://github.com/paullouisageneau/libdatachannel.git mkdir -p libdatachannel/build pushd libdatachannel/build @@ -476,7 +542,9 @@ if ! cmake --find-package -DNAME=LibDataChannel -DCOMPILER_ID=GNU -DLANGUAGE=CXX -DNO_WEBSOCKET=ON \ ${CMAKE_DATACHANNEL_USE_NICE-} \ ${CMAKE_OPTS} .. - make ${MAKE_OPTS} install + cmake --build . \ + --target install \ + --parallel ${PARALLEL} popd fi @@ -494,7 +562,8 @@ fi # Build & Install OpenDSS if ! find /usr/{local/,}{lib,bin} -name "libOpenDSSC.so" | grep -q . && - should_build "opendss" "For opendss node-type"; then + should_build "opendss" "For opendss node-type" && + has_git_svn; then git svn clone -r 4020:4020 https://svn.code.sf.net/p/electricdss/code/trunk/VersionC OpenDSS-C mkdir -p OpenDSS-C/build pushd OpenDSS-C @@ -510,8 +579,12 @@ if ! find /usr/{local/,}{lib,bin} -name "libOpenDSSC.so" | grep -q . && cmake -DMyOutputType=DLL \ ${OPENDSS_CMAKE_OPTS} \ ${CMAKE_OPTS} .. - make ${MAKE_OPTS} install + cmake --build . \ + --target install \ + --parallel ${PARALLEL} popd + + echo "${PREFIX}/openDSSC/bin/" > /etc/ld.so.conf.d/opendssc.conf fi # Build & Install ghc::filesystem @@ -523,12 +596,13 @@ if ! cmake --find-package -DNAME=ghc_filesystem -DCOMPILER_ID=GNU -DLANGUAGE=CXX cmake -DGHC_FILESYSTEM_BUILD_TESTING=OFF \ -DGHC_FILESYSTEM_BUILD_EXAMPLES=OFF \ ${CMAKE_OPTS} .. - make ${MAKE_OPTS} install + cmake --build . \ + --target install \ + --parallel ${PARALLEL} popd fi popd >/dev/null -rm -rf ${TMPDIR} # Update linker cache if [ -z "${SKIP_LDCONFIG+x}${DEPS_SCAN+x}" ]; then diff --git a/packaging/docker/Dockerfile.debian b/packaging/docker/Dockerfile.debian index 047680a13..631e16f86 100644 --- a/packaging/docker/Dockerfile.debian +++ b/packaging/docker/Dockerfile.debian @@ -58,8 +58,6 @@ RUN apt-get update && \ ADD packaging/patches /deps/patches ADD packaging/deps.sh /deps RUN bash /deps/deps.sh -RUN echo "/usr/local/openDSSC/bin/" > /etc/ld.so.conf.d/opendssc.conf && \ - ldconfig # Expose ports for HTTP and WebSocket frontend EXPOSE 80 diff --git a/packaging/docker/Dockerfile.fedora b/packaging/docker/Dockerfile.fedora index 17a966d19..2beee634f 100644 --- a/packaging/docker/Dockerfile.fedora +++ b/packaging/docker/Dockerfile.fedora @@ -78,16 +78,13 @@ RUN echo /usr/local/lib >> /etc/ld.so.conf ADD packaging/patches /deps/patches ADD packaging/deps.sh /deps RUN bash /deps/deps.sh -RUN echo "/usr/local/openDSSC/bin/" > /etc/ld.so.conf.d/opendssc.conf && \ - ldconfig # Workaround for libnl3's search path for netem distributions RUN ln -s /usr/lib64/tc /usr/lib/tc +# Install Python dev tools for CI COPY ./python /python -RUN python -m venv /venv && \ - source /venv/bin/activate && \ - pip install /python[dev] && \ +RUN pip install /python[dev] && \ rm -r /python # Expose ports for HTTP and WebSocket frontend diff --git a/packaging/docker/Dockerfile.rocky b/packaging/docker/Dockerfile.rocky index ab3d653d6..384bf6d68 100644 --- a/packaging/docker/Dockerfile.rocky +++ b/packaging/docker/Dockerfile.rocky @@ -59,8 +59,6 @@ RUN dnf -y install \ ADD packaging/patches /deps/patches ADD packaging/deps.sh /deps RUN bash /deps/deps.sh -RUN echo "/usr/local/openDSSC/bin/" > /etc/ld.so.conf.d/opendssc.conf && \ - ldconfig # Workaround for libnl3's search path for netem distributions RUN ln -s /usr/lib64/tc /usr/lib/tc diff --git a/packaging/docker/Dockerfile.rocky9 b/packaging/docker/Dockerfile.rocky9 index d6e127243..f7dfffd40 100644 --- a/packaging/docker/Dockerfile.rocky9 +++ b/packaging/docker/Dockerfile.rocky9 @@ -54,8 +54,6 @@ RUN dnf -y install \ ADD packaging/patches /deps/patches ADD packaging/deps.sh /deps RUN bash /deps/deps.sh -RUN echo "/usr/local/openDSSC/bin/" > /etc/ld.so.conf.d/opendssc.conf && \ - ldconfig # Workaround for libnl3's search path for netem distributions RUN ln -s /usr/lib64/tc /usr/lib/tc diff --git a/packaging/docker/Dockerfile.ubuntu b/packaging/docker/Dockerfile.ubuntu index 730b693d3..5a4a0c506 100644 --- a/packaging/docker/Dockerfile.ubuntu +++ b/packaging/docker/Dockerfile.ubuntu @@ -65,8 +65,6 @@ RUN apt-get update && \ ADD packaging/patches /deps/patches ADD packaging/deps.sh /deps RUN bash /deps/deps.sh -RUN echo "/usr/local/openDSSC/bin/" > /etc/ld.so.conf.d/opendssc.conf && \ - ldconfig # Expose ports for HTTP and WebSocket frontend EXPOSE 80