Merge pull request #309053 from panicgh/open62541

open62541: 1.3.10 -> 1.4.1
This commit is contained in:
Sandro 2024-06-04 14:32:24 +02:00 committed by GitHub
commit 49e2a0af22
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 43 additions and 35 deletions

View File

@ -1,7 +1,6 @@
{ stdenv
, lib
, fetchFromGitHub
, fetchpatch
, cmake
, pkg-config
, check
@ -19,8 +18,6 @@
, openssl
, mbedtls
, withPubSub ? false
# for passthru.tests only
, open62541
}:
@ -33,44 +30,35 @@ in
stdenv.mkDerivation (finalAttrs: {
pname = "open62541";
version = "1.3.10";
version = "1.4.1";
src = fetchFromGitHub {
owner = "open62541";
repo = "open62541";
rev = "v${finalAttrs.version}";
hash = "sha256-FekO0cKgpYulMXz4r0/TUPz2tawC4k3Sq07Og4xqh4I=";
hash = "sha256-An8Yg6VSelNV/7poLEOjeiIb0+eMoQWG7sYqhytEKMA=";
fetchSubmodules = true;
};
patches = [
(fetchpatch {
name = "Ensure-absolute-paths-in-pkg-config-file.patch";
url = "https://github.com/open62541/open62541/commit/023d4b6b8bdec987f8f3ffee6c09801bbee4fa2d.patch";
sha256 = "sha256-mq4h32js2RjI0Ljown/01SXA3gc+7+zX8meIcvDPvoA=";
})
];
cmakeFlags = [
"-DOPEN62541_VERSION=v${finalAttrs.version}"
(lib.cmakeFeature "OPEN62541_VERSION" finalAttrs.src.rev)
(lib.cmakeFeature "UA_NAMESPACE_ZERO" "FULL")
(lib.cmakeBool "BUILD_SHARED_LIBS" (!stdenv.hostPlatform.isStatic))
"-DBUILD_SHARED_LIBS=${if stdenv.hostPlatform.isStatic then "OFF" else "ON"}"
"-DUA_NAMESPACE_ZERO=FULL"
# Note comment near doCheck
(lib.cmakeBool "UA_BUILD_UNIT_TESTS" finalAttrs.finalPackage.doCheck)
(lib.cmakeBool "UA_ENABLE_ALLOW_REUSEADDR" finalAttrs.finalPackage.doCheck)
"-DUA_BUILD_UNIT_TESTS=${if finalAttrs.finalPackage.doCheck then "ON" else "OFF"}"
]
++ lib.optional withExamples "-DUA_BUILD_EXAMPLES=ON"
++ lib.optional (withEncryption != false)
"-DUA_ENABLE_ENCRYPTION=${lib.toUpper withEncryption}"
++ lib.optional withPubSub "-DUA_ENABLE_PUBSUB=ON"
;
(lib.cmakeBool "UA_BUILD_EXAMPLES" withExamples)
] ++ lib.optionals (withEncryption != false) [
(lib.cmakeFeature "UA_ENABLE_ENCRYPTION" (lib.toUpper withEncryption))
];
nativeBuildInputs = [
cmake
pkg-config
python3Packages.python
]
++ lib.optionals withDoc (with python3Packages; [
] ++ lib.optionals withDoc (with python3Packages; [
sphinx
sphinx_rtd_theme
graphviz-nox
@ -80,7 +68,11 @@ stdenv.mkDerivation (finalAttrs: {
buildFlags = [ "all" ] ++ lib.optional withDoc "doc";
doCheck = true;
# Tests must normally be disabled because they require
# -DUA_ENABLE_ALLOW_REUSEADDR=ON. The option must not be used in production,
# since it is a security risk.
# See https://github.com/open62541/open62541/issues/6407
doCheck = false;
checkInputs = [
check
@ -92,14 +84,30 @@ stdenv.mkDerivation (finalAttrs: {
enableParallelChecking = false;
preCheck = let
disabledTests = lib.optionals withPubSub [
# "Cannot set socket option IP_ADD_MEMBERSHIP"
"pubsub_publish"
disabledTests = [
# error "Could not create a raw Ethernet socket (are you root?)"
"check_eventloop_eth"
# Cannot set socket option IP_ADD_MEMBERSHIP
"check_pubsub_publish"
"check_pubsub_publish_json"
"check_pubsub_connection_udp"
"check_pubsub_get_state"
"check_pubsub_publish_rt_levels"
"check_pubsub_publisherid"
"check_pubsub_subscribe"
"check_pubsub_publishspeed"
"check_pubsub_subscribe_config_freeze"
"check_pubsub_subscribe_rt_levels"
"check_pubsub_multiple_subscribe_rt_levels"
"check_pubsub_config_freeze"
"check_pubsub_publish_rt_levels"
# Could not find the interface
"check_pubsub_connection_ethernet"
"check_pubsub_connection_ethernet_etf"
"check_pubsub_publish_ethernet_etf"
"check_pubsub_informationmodel"
"check_pubsub_informationmodel_methods"
];
regex = "^(${builtins.concatStringsSep "|" disabledTests})\$";
in lib.optionalString (disabledTests != []) ''
@ -131,14 +139,16 @@ stdenv.mkDerivation (finalAttrs: {
passthru.updateScript = nix-update-script { };
passthru.tests = let
open62541Full = encBackend: open62541.override {
open62541Full = encBackend: (open62541.overrideAttrs (_: {
doCheck = true;
})).override {
withDoc = true;
# if (withExamples && withPubSub), one of the example currently fails to build
# if withExamples, one of the example currently fails to build
#withExamples = true;
withEncryption = encBackend;
withPubSub = true;
};
in {
open62541WithTests = finalAttrs.finalPackage.overrideAttrs (_: { doCheck = true; });
open62541Full = open62541Full false;
open62541Full-openssl = open62541Full "openssl";
open62541Full-mbedtls = open62541Full "mbedtls";

View File

@ -23557,8 +23557,6 @@ with pkgs;
ookla-speedtest = callPackage ../tools/networking/ookla-speedtest { };
open62541 = callPackage ../development/libraries/open62541 { };
openalSoft = callPackage ../development/libraries/openal-soft {
inherit (darwin.apple_sdk.frameworks) CoreServices AudioUnit AudioToolbox;
};