From f663d91e269c7a796270fb4288aa8c574038ffdb Mon Sep 17 00:00:00 2001 From: Vivien Loriot Date: Mon, 22 Apr 2024 15:31:27 +0200 Subject: [PATCH] opcua: init at 0.10.0-dev --- pkgs/default.nix | 1 + pkgs/epnix/support/opcua/default.nix | 53 +++++++++++++++++++++++++ pkgs/epnix/support/opcua/dir_xml2.patch | 29 ++++++++++++++ 3 files changed, 83 insertions(+) create mode 100644 pkgs/epnix/support/opcua/default.nix create mode 100644 pkgs/epnix/support/opcua/dir_xml2.patch diff --git a/pkgs/default.nix b/pkgs/default.nix index f25b8e18..7a8353de 100644 --- a/pkgs/default.nix +++ b/pkgs/default.nix @@ -42,6 +42,7 @@ in ipac = callPackage ./epnix/support/ipac {}; modbus = callPackage ./epnix/support/modbus {}; mrfioc2 = callPackage ./epnix/support/mrfioc2 {}; + opcua = callPackage ./epnix/support/opcua {}; pvxs = callPackage ./epnix/support/pvxs {}; seq = callPackage ./epnix/support/seq {}; snmp = callPackage ./epnix/support/snmp {}; diff --git a/pkgs/epnix/support/opcua/default.nix b/pkgs/epnix/support/opcua/default.nix new file mode 100644 index 00000000..73eaa9f3 --- /dev/null +++ b/pkgs/epnix/support/opcua/default.nix @@ -0,0 +1,53 @@ +{ + lib, + epnixLib, + mkEpicsPackage, + fetchFromGitHub, + pkg-config, + epnix, + open62541, + openssl, + libxml2, + local_config_site ? {}, + local_release ? {}, +}: +mkEpicsPackage { + pname = "opcua"; + version = "0.10.0-dev"; + varname = "OPCUA"; + + src = fetchFromGitHub { + owner = "epics-modules"; + repo = "opcua"; + rev = "3d10053"; + hash = "sha256-EQra8PesO7Rlhj+pBlAfiqh5yjJwRkuh7gbGziY58iI="; + }; + + inherit local_release; + local_config_site = + local_config_site + // { + OPEN62541 = "${open62541}"; + OPEN62541_DEPLOY_MODE = "PROVIDED"; + OPEN62541_LIB_DIR = "${open62541}/lib"; + OPEN62541_SHRLIB_DIR = "${open62541}/lib"; + #for the moment, we're not able to use the last version of openssl to manage a safety connection with the open62541 librairy + OPEN62541_USE_CRYPTO = "NO"; + OPEN62541_USE_XMLPARSER = "YES"; + }; + + patches = [./dir_xml2.patch]; + + depsBuildBuild = [pkg-config]; + nativeBuildInputs = [pkg-config open62541 openssl libxml2]; + buildInputs = [open62541 openssl libxml2]; + propagatedNativeBuildInputs = [pkg-config]; + propagatedBuildInputs = [libxml2] ++ (with epnix.support; [gtest]); + + meta = { + description = "EPICS support for communication with OPC UA protocol"; + homepage = "https://github.com/epics-modules/opcua"; + license = epnixLib.licenses.epics; + maintainers = with epnixLib.maintainers; [vivien]; + }; +} diff --git a/pkgs/epnix/support/opcua/dir_xml2.patch b/pkgs/epnix/support/opcua/dir_xml2.patch new file mode 100644 index 00000000..1184c861 --- /dev/null +++ b/pkgs/epnix/support/opcua/dir_xml2.patch @@ -0,0 +1,29 @@ +diff --git a/devOpcuaSup/open62541/Makefile.config b/devOpcuaSup/open62541/Makefile.config +index d1b82cb..5d81dc2 100644 +--- a/devOpcuaSup/open62541/Makefile.config ++++ b/devOpcuaSup/open62541/Makefile.config +@@ -25,7 +25,7 @@ USR_CXXFLAGS += -DHAS_XMLPARSER + ifneq ($(filter -D_MINGW,$(OP_SYS_CPPFLAGS)),) + USR_INCLUDES += -I$(MSYSTEM_PREFIX)/include/libxml2 + else +-USR_INCLUDES += -I/usr/include/libxml2 ++USR_INCLUDES += `pkg-config --cflags libxml-2.0` + endif + + opcua_SRCS += Session.cpp +diff --git a/unitTestApp/src/Makefile b/unitTestApp/src/Makefile +index c52a727..8c2556b 100644 +--- a/unitTestApp/src/Makefile ++++ b/unitTestApp/src/Makefile +@@ -28,9 +28,9 @@ USR_CXXFLAGS += -DHAS_SECURITY + endif + ifeq ($($(CLIENT)_USE_XMLPARSER),YES) + USR_CXXFLAGS += -DHAS_XMLPARSER +-USR_INCLUDES_Linux += -I/usr/include/libxml2 ++USR_INCLUDES += `pkg-config --cflags libxml-2.0` + ifneq ($(filter -D_MINGW,$(OP_SYS_CPPFLAGS)),) +-USR_INCLUDES += -I$(MSYSTEM_PREFIX)/include/libxml2 ++USR_INCLUDES += `pkg-config --cflags libxml-2.0` + USR_SYS_LIBS += xml2 + endif + endif