From bb460d640464e048846129ba6765ef257b7b79ec Mon Sep 17 00:00:00 2001 From: Nicolas Benes Date: Thu, 11 Apr 2024 17:06:41 +0200 Subject: [PATCH 1/2] open62541: move to by-name --- .../open62541/default.nix => by-name/op/open62541/package.nix} | 0 pkgs/top-level/all-packages.nix | 2 -- 2 files changed, 2 deletions(-) rename pkgs/{development/libraries/open62541/default.nix => by-name/op/open62541/package.nix} (100%) diff --git a/pkgs/development/libraries/open62541/default.nix b/pkgs/by-name/op/open62541/package.nix similarity index 100% rename from pkgs/development/libraries/open62541/default.nix rename to pkgs/by-name/op/open62541/package.nix diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index b7444e309a67..a1a7b32ab9d7 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -23575,8 +23575,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; }; From b2f458b65901643ed512a70e9c1aa3971aaad10b Mon Sep 17 00:00:00 2001 From: Nicolas Benes Date: Sat, 25 May 2024 16:22:21 +0200 Subject: [PATCH 2/2] open62541: 1.3.10 -> 1.4.1 --- pkgs/by-name/op/open62541/package.nix | 76 +++++++++++++++------------ 1 file changed, 43 insertions(+), 33 deletions(-) diff --git a/pkgs/by-name/op/open62541/package.nix b/pkgs/by-name/op/open62541/package.nix index 0ddc010deb65..49099e7b0e73 100644 --- a/pkgs/by-name/op/open62541/package.nix +++ b/pkgs/by-name/op/open62541/package.nix @@ -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";