summaryrefslogtreecommitdiffstats
path: root/meta-networking
diff options
context:
space:
mode:
authorRomain Naour <romain.naour@smile.fr>2020-09-24 16:50:42 +0200
committerKhem Raj <raj.khem@gmail.com>2020-09-24 12:42:04 -0700
commit25b91b3d2b906334877f4b05e19b82bd302aa129 (patch)
tree4d0654727ee81bc4ebbe804c34e4bc2808789586 /meta-networking
parentac313b638068aabc88f0fa9d1888380e94100f31 (diff)
downloadmeta-openembedded-25b91b3d2b906334877f4b05e19b82bd302aa129.tar.gz
libiec61850: add recipe for libiec61850
IEC 61850 is an international standard for communication systems in Substation Automation Systems (SAS) and management of Decentralized Energy Resources (DER). It is seen as one of the communication standards of the emerging Smart Grid. Add two upstream patch fixing build issues with musl libc. Enable the libiec61850 python binding (pyiec61850) that require a fix to find the correct PYTHON_SITE_DIR path while cross-compiling. Signed-off-by: Romain Naour <romain.naour@smile.fr> Signed-off-by: Khem Raj <raj.khem@gmail.com>
Diffstat (limited to 'meta-networking')
-rw-r--r--meta-networking/recipes-connectivity/libiec61850/files/0001-use-poll.h-instead-of-sys-poll.h.patch33
-rw-r--r--meta-networking/recipes-connectivity/libiec61850/files/0002-serial_port_linux-Add-missing-include-sys-time.h.patch32
-rw-r--r--meta-networking/recipes-connectivity/libiec61850/files/0003-pyiec61850-don-t-break-CMAKE_INSTALL_PATH-by-trying-.patch37
-rw-r--r--meta-networking/recipes-connectivity/libiec61850/libiec61850_1.4.2.1.bb39
4 files changed, 141 insertions, 0 deletions
diff --git a/meta-networking/recipes-connectivity/libiec61850/files/0001-use-poll.h-instead-of-sys-poll.h.patch b/meta-networking/recipes-connectivity/libiec61850/files/0001-use-poll.h-instead-of-sys-poll.h.patch
new file mode 100644
index 000000000..a04473d21
--- /dev/null
+++ b/meta-networking/recipes-connectivity/libiec61850/files/0001-use-poll.h-instead-of-sys-poll.h.patch
@@ -0,0 +1,33 @@
1From 4cad505fc98240eb66eaabfae61a9694f8158dda Mon Sep 17 00:00:00 2001
2From: Romain Naour <romain.naour@smile.fr>
3Date: Tue, 7 Apr 2020 20:58:37 +0200
4Subject: [PATCH] use <poll.h> instead of <sys/poll.h>
5
6The manpage of poll(2) states that the prototype of poll is defined
7in <poll.h>. Use that header file instead of <sys/poll.h> to allow
8compilation against musl-libc.
9
10Upstream status: Pending
11https://github.com/mz-automation/libiec61850/pull/228
12
13Signed-off-by: Romain Naour <romain.naour@smile.fr>
14---
15 hal/ethernet/linux/ethernet_linux.c | 2 +-
16 1 file changed, 1 insertion(+), 1 deletion(-)
17
18diff --git a/hal/ethernet/linux/ethernet_linux.c b/hal/ethernet/linux/ethernet_linux.c
19index c3ab2e2..9aa5c28 100644
20--- a/hal/ethernet/linux/ethernet_linux.c
21+++ b/hal/ethernet/linux/ethernet_linux.c
22@@ -23,7 +23,7 @@
23
24 #include <sys/socket.h>
25 #include <sys/ioctl.h>
26-#include <sys/poll.h>
27+#include <poll.h>
28 #include <linux/if_packet.h>
29 #include <linux/if_ether.h>
30 #include <linux/if_arp.h>
31--
322.21.1
33
diff --git a/meta-networking/recipes-connectivity/libiec61850/files/0002-serial_port_linux-Add-missing-include-sys-time.h.patch b/meta-networking/recipes-connectivity/libiec61850/files/0002-serial_port_linux-Add-missing-include-sys-time.h.patch
new file mode 100644
index 000000000..e1b8ca15b
--- /dev/null
+++ b/meta-networking/recipes-connectivity/libiec61850/files/0002-serial_port_linux-Add-missing-include-sys-time.h.patch
@@ -0,0 +1,32 @@
1From 661405eb6066b67dfe51d5ff9635e29f86bdd238 Mon Sep 17 00:00:00 2001
2From: Romain Naour <romain.naour@smile.fr>
3Date: Tue, 7 Apr 2020 21:02:54 +0200
4Subject: [PATCH] serial_port_linux: Add missing include sys/time.h
5
6POSIX says `struct timeval` is defined if <sys/time.h> is included.
7
8Adding this header allow to build against musl-libc.
9
10Upstream status: Pending
11https://github.com/mz-automation/libiec61850/pull/228
12
13Signed-off-by: Romain Naour <romain.naour@smile.fr>
14---
15 hal/serial/linux/serial_port_linux.c | 1 +
16 1 file changed, 1 insertion(+)
17
18diff --git a/hal/serial/linux/serial_port_linux.c b/hal/serial/linux/serial_port_linux.c
19index e6308c0..15e5794 100644
20--- a/hal/serial/linux/serial_port_linux.c
21+++ b/hal/serial/linux/serial_port_linux.c
22@@ -29,6 +29,7 @@
23 #include <termios.h>
24 #include <fcntl.h>
25 #include <unistd.h>
26+#include <sys/time.h>
27
28 #include "hal_serial.h"
29 #include "hal_time.h"
30--
312.21.1
32
diff --git a/meta-networking/recipes-connectivity/libiec61850/files/0003-pyiec61850-don-t-break-CMAKE_INSTALL_PATH-by-trying-.patch b/meta-networking/recipes-connectivity/libiec61850/files/0003-pyiec61850-don-t-break-CMAKE_INSTALL_PATH-by-trying-.patch
new file mode 100644
index 000000000..65567610b
--- /dev/null
+++ b/meta-networking/recipes-connectivity/libiec61850/files/0003-pyiec61850-don-t-break-CMAKE_INSTALL_PATH-by-trying-.patch
@@ -0,0 +1,37 @@
1From 89f326a427c7ad13c115e2d3f2ac27807aa5a795 Mon Sep 17 00:00:00 2001
2From: Romain Naour <romain.naour@smile.fr>
3Date: Fri, 10 Jul 2020 17:08:34 +0200
4Subject: [PATCH] pyiec61850: don't break CMAKE_INSTALL_PATH by trying to find
5 python modules install path (site-packages)
6
7https://stackoverflow.com/questions/1242904/finding-python-site-packages-directory-with-cmake
8
9Signed-off-by: Romain Naour <romain.naour@smile.fr>
10---
11 pyiec61850/CMakeLists.txt | 11 ++---------
12 1 file changed, 2 insertions(+), 9 deletions(-)
13
14diff --git a/pyiec61850/CMakeLists.txt b/pyiec61850/CMakeLists.txt
15index 159ef4b..d1732a1 100644
16--- a/pyiec61850/CMakeLists.txt
17+++ b/pyiec61850/CMakeLists.txt
18@@ -31,14 +31,7 @@ endif()
19
20 swig_link_libraries(iec61850 ${PYTHON_LIBRARIES} ${LIBS})
21
22-# Finding python modules install path
23-execute_process(
24- COMMAND ${PYTHON_EXECUTABLE} -c
25- "from distutils.sysconfig import get_python_lib; import sys; sys.stdout.write(get_python_lib())"
26- OUTPUT_VARIABLE PYTHON_SITE_DIR
27-)
28-
29-install(FILES ${CMAKE_CURRENT_BINARY_DIR}/iec61850.py DESTINATION ${PYTHON_SITE_DIR})
30-install(TARGETS _iec61850 LIBRARY DESTINATION ${PYTHON_SITE_DIR})
31+install(FILES ${CMAKE_CURRENT_BINARY_DIR}/iec61850.py DESTINATION /usr/lib/python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}/site-packages)
32+install(TARGETS _iec61850 LIBRARY DESTINATION /usr/lib/python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}/site-packages)
33
34 add_test(test_pyiec61850 ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_LIST_DIR}/test_pyiec61850.py)
35--
362.21.3
37
diff --git a/meta-networking/recipes-connectivity/libiec61850/libiec61850_1.4.2.1.bb b/meta-networking/recipes-connectivity/libiec61850/libiec61850_1.4.2.1.bb
new file mode 100644
index 000000000..18cb0cd8e
--- /dev/null
+++ b/meta-networking/recipes-connectivity/libiec61850/libiec61850_1.4.2.1.bb
@@ -0,0 +1,39 @@
1SUMMARY = "Open source iec61850 implementation"
2DESCRIPTION = "IEC 61850 is an international standard for \
3communication systems in Substation Automation Systems \
4(SAS) and management of Decentralized Energy Resources \
5(DER). It is seen as one of the communication standards \
6of the emerging Smart Grid. \
7The project libIEC61850 provides a server and client \
8library for the IEC 61850/MMS, IEC 61850/GOOSE and IEC \
961850-9-2/Sampled Values communication protocols \
10written in C. It is available under the GPLv3 license."
11HOMEPAGE = "http://libiec61850.com"
12SECTION = "console/network"
13LICENSE = "GPLv3"
14LIC_FILES_CHKSUM = "file://COPYING;md5=d32239bcb673463ab874e80d47fae504"
15DEPENDS = "swig-native python3"
16SRCREV = "d798814fb463115a835da597535a625b68a39cff"
17
18SRC_URI = "git://github.com/mz-automation/${BPN}.git;branch=v1.4 \
19 file://0001-use-poll.h-instead-of-sys-poll.h.patch \
20 file://0002-serial_port_linux-Add-missing-include-sys-time.h.patch \
21 file://0003-pyiec61850-don-t-break-CMAKE_INSTALL_PATH-by-trying-.patch \
22"
23
24S = "${WORKDIR}/git"
25
26inherit cmake pkgconfig python3-dir python3native siteinfo
27
28EXTRA_OECMAKE = " \
29 -DBUILD_EXAMPLES=OFF \
30 -DBUILD_PYTHON_BINDINGS=ON \
31"
32
33RDEPENDS_${PN}-python = " python3-core "
34RDEPENDS_${PN} = " python3-core "
35
36FILES_${PN} += " \
37 ${libdir}/${PYTHON_DIR}/site-packages/iec61850.py \
38 ${libdir}/${PYTHON_DIR}/site-packages/_iec61850.so \
39"