[meta-oe,v2] libiio: update to version 0.23

Message ID 20220309085251.25969-1-ceggers@arri.de
State New
Headers show
Series [meta-oe,v2] libiio: update to version 0.23 | expand

Commit Message

Christian Eggers March 9, 2022, 8:52 a.m. UTC
- drop 0001-python-Do-not-verify-whether-libiio-is-installed-whe.patch
  (integrated upstream)
- new PACKAGECONFIG "xml_backend" (WITH_XML_BACKEND=off must be
explicitly provided if libxml2 is not available)
- new PACKAGECONFIG "dnssd" (HAVE_DNS_SD=off must be explicitly provided
if libavahi is not available)
- python library has been renamed (libiio --> pylibiio)

Signed-off-by: Christian Eggers <ceggers@arri.de>
---
Changes in v2:
--------------
- added 0001-CMake-Move-include-CheckCSourceCompiles-before-its-m.patch (taken
  from upstream)
- PACKAGECONFIG: don't disable xml_backend if either network_backend,
  serial_backend or usb_backend is enabled.

On Wednesday, 9 March 2022, 02:33:02 CET, Khem Raj wrote:
> this fails to configure see
> 
> https://errors.yoctoproject.org/Errors/Details/651289/
> 
> I think you need a patch something on these lines
> 
>   diff --git a/CMakeLists.txt b/CMakeLists.txt
>  index 91db382a..eed83a46 100644
>  --- a/CMakeLists.txt
>  +++ b/CMakeLists.txt
>  @@ -291,7 +291,7 @@ if (WITH_ZSTD)
>   endif (WITH_ZSTD)
> 
>   include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR})
>  -
>  +include(CheckCSourceCompiles)
>   if(WITH_NETWORK_BACKEND)
>      message(STATUS "Building with Network back end support")
>      if (WIN32)
> 
> 
> Try it out and test and resend if it fixes the problem.
Although I understand the problem, I am not able to reproduce it. So need
please test again on your CI for this.

regards,
Christian

 ...rify-whether-libiio-is-installed-whe.patch | 34 -----------------
 ...de-CheckCSourceCompiles-before-its-m.patch | 38 +++++++++++++++++++
 meta-oe/recipes-support/libiio/libiio_git.bb  | 26 +++++++------
 3 files changed, 53 insertions(+), 45 deletions(-)
 delete mode 100644 meta-oe/recipes-support/libiio/files/0001-python-Do-not-verify-whether-libiio-is-installed-whe.patch
 create mode 100644 meta-oe/recipes-support/libiio/libiio/0001-CMake-Move-include-CheckCSourceCompiles-before-its-m.patch

Patch

diff --git a/meta-oe/recipes-support/libiio/files/0001-python-Do-not-verify-whether-libiio-is-installed-whe.patch b/meta-oe/recipes-support/libiio/files/0001-python-Do-not-verify-whether-libiio-is-installed-whe.patch
deleted file mode 100644
index 4d3dcd5cedd4..000000000000
--- a/meta-oe/recipes-support/libiio/files/0001-python-Do-not-verify-whether-libiio-is-installed-whe.patch
+++ /dev/null
@@ -1,34 +0,0 @@ 
-From 717b0f46b23ddc042da481d1d446bdd1c6c49142 Mon Sep 17 00:00:00 2001
-From: Julien Malik <julien.malik@unseenlabs.fr>
-Date: Mon, 27 Jul 2020 14:34:44 +0200
-Subject: [PATCH] python: Do not verify whether libiio is installed when
- cross-compiling
-
-This should fix #561
-
-Signed-off-by: Julien Malik <julien.malik@paraiso.me>
----
- bindings/python/setup.py.cmakein | 7 +++++++
- 1 file changed, 7 insertions(+)
-
-diff --git a/bindings/python/setup.py.cmakein b/bindings/python/setup.py.cmakein
-index cd14e2e..96d58a8 100644
---- a/bindings/python/setup.py.cmakein
-+++ b/bindings/python/setup.py.cmakein
-@@ -54,6 +54,13 @@ class InstallWrapper(install):
-         install.run(self)
- 
-     def _check_libiio_installed(self):
-+        cross_compiling = ("${CMAKE_CROSSCOMPILING}" == "TRUE")
-+        if cross_compiling:
-+            # When cross-compiling, we generally cannot dlopen
-+            # the libiio shared lib from the build platform.
-+            # Simply skip this check in that case.
-+            return
-+
-         from platform import system as _system
-         from ctypes import CDLL as _cdll
-         from ctypes.util import find_library
--- 
-2.25.1
-
diff --git a/meta-oe/recipes-support/libiio/libiio/0001-CMake-Move-include-CheckCSourceCompiles-before-its-m.patch b/meta-oe/recipes-support/libiio/libiio/0001-CMake-Move-include-CheckCSourceCompiles-before-its-m.patch
new file mode 100644
index 000000000000..a2cfd47f1809
--- /dev/null
+++ b/meta-oe/recipes-support/libiio/libiio/0001-CMake-Move-include-CheckCSourceCompiles-before-its-m.patch
@@ -0,0 +1,38 @@ 
+From 758ba58c81273d9075a539216f8a322935c2e434 Mon Sep 17 00:00:00 2001
+From: Paul Cercueil <paul@crapouillou.net>
+Date: Fri, 12 Nov 2021 16:49:21 +0000
+Subject: [PATCH] CMake: Move include(CheckCSourceCompiles) before its macros
+ are used
+
+Move include(CheckCSourceCompiles) before any of the
+check_c_source_compiles() macros is called.
+
+This fixes a CMake error when compiling with WITH_NETWORK_GET_BUFFER
+disabled.
+
+Upstream-Status: Accepted [https://github.com/analogdevicesinc/libiio/commit/758ba58c81273d9075a539216f8a322935c2e434]
+
+Signed-off-by: Paul Cercueil <paul@crapouillou.net>
+---
+ CMakeLists.txt | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 7437136c8210..05b4feff233b 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -296,9 +296,10 @@ if(WITH_NETWORK_BACKEND)
+ 	endif()
+ 
+ 	if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
++		include(CheckCSourceCompiles)
++
+ 		option(WITH_NETWORK_GET_BUFFER "Enable experimental zero-copy transfers" OFF)
+ 		if (WITH_NETWORK_GET_BUFFER)
+-			include(CheckCSourceCompiles)
+ 			check_c_source_compiles("#define _GNU_SOURCE=1\n#include <fcntl.h>\nint main(void) { return O_TMPFILE; }"
+ 				HAS_O_TMPFILE)
+ 
+-- 
+2.34.1
+
diff --git a/meta-oe/recipes-support/libiio/libiio_git.bb b/meta-oe/recipes-support/libiio/libiio_git.bb
index 2c22838bbf21..bb253f421ab1 100644
--- a/meta-oe/recipes-support/libiio/libiio_git.bb
+++ b/meta-oe/recipes-support/libiio/libiio_git.bb
@@ -4,11 +4,11 @@  SECTION = "libs"
 LICENSE = "LGPL-2.1-or-later"
 LIC_FILES_CHKSUM = "file://COPYING.txt;md5=7c13b3376cea0ce68d2d2da0a1b3a72c"
 
-SRCREV = "565bf68eccfdbbf22cf5cb6d792e23de564665c7"
-PV = "0.21+git${SRCPV}"
+SRCREV = "92d6a35f3d8d721cda7d6fe664b435311dd368b4"
+PV = "0.23"
 
 SRC_URI = "git://github.com/analogdevicesinc/libiio.git;protocol=https;branch=master \
-           file://0001-python-Do-not-verify-whether-libiio-is-installed-whe.patch \
+           file://0001-CMake-Move-include-CheckCSourceCompiles-before-its-m.patch \
 "
 UPSTREAM_CHECK_GITTAGREGEX = "v(?P<pver>\d+(\.\d+)+)"
 
@@ -28,16 +28,19 @@  EXTRA_OECMAKE = " \
     ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', '-DWITH_SYSTEMD=ON -DSYSTEMD_UNIT_INSTALL_DIR=${systemd_system_unitdir}', '', d)} \
 "
 
-PACKAGECONFIG ??= "usb_backend network_backend serial_backend"
-
-NETWORK_BACKEND_DEPENDENCIES = "\
-    libxml2 \
-    ${@bb.utils.contains('DISTRO_FEATURES', 'zeroconf', 'avahi', '', d)} \
+PACKAGECONFIG ??= " \
+    usb_backend network_backend serial_backend xml_backend \
+    ${@bb.utils.contains('DISTRO_FEATURES', 'zeroconf', 'dnssd', '', d)} \
 "
 
-PACKAGECONFIG[usb_backend] = "-DWITH_USB_BACKEND=ON,-DWITH_USB_BACKEND=OFF,libusb1 libxml2"
-PACKAGECONFIG[network_backend] = "-DWITH_NETWORK_BACKEND=ON,-DWITH_NETWORK_BACKEND=OFF, ${NETWORK_BACKEND_DEPENDENCIES}"
-PACKAGECONFIG[serial_backend] = "-DWITH_SERIAL_BACKEND=ON,-DWITH_SERIAL_BACKEND=off,libserialport libxml2"
+# network_backend, serial_backend and usb_backend depend on xml_backend, so don't switch it off
+XML_BACKEND_DISABLE = "${@bb.utils.contains_any('PACKAGECONFIG', 'network_backend serial_backend usb_backend', '', '-DWITH_XML_BACKEND=off', d)}"
+
+PACKAGECONFIG[usb_backend] = "-DWITH_USB_BACKEND=ON -DWITH_XML_BACKEND=ON,-DWITH_USB_BACKEND=OFF,libusb1 libxml2"
+PACKAGECONFIG[network_backend] = "-DWITH_NETWORK_BACKEND=ON -DWITH_XML_BACKEND=ON,-DWITH_NETWORK_BACKEND=OFF,libxml2"
+PACKAGECONFIG[serial_backend] = "-DWITH_SERIAL_BACKEND=ON -DWITH_XML_BACKEND=ON,-DWITH_SERIAL_BACKEND=off,libserialport libxml2"
+PACKAGECONFIG[xml_backend] = "-DWITH_XML_BACKEND=ON,${XML_BACKEND_DISABLE},libxml2"
+PACKAGECONFIG[dnssd] = "-DHAVE_DNS_SD=ON,-DHAVE_DNS_SD=off,avahi"
 PACKAGECONFIG[libiio-python3] = "-DPYTHON_BINDINGS=ON,-DPYTHON_BINDINGS=OFF"
 
 PACKAGES =+ "${PN}-iiod ${PN}-tests ${PN}-${PYTHON_PN}"
@@ -70,6 +73,7 @@  do_compile() {
     cmake_do_compile
 }
 
+PIP_INSTALL_PACKAGE = "pylibiio"
 do_install() {
     if ${@bb.utils.contains('PACKAGECONFIG', 'libiio-python3', 'true', 'false', d)}; then
         setuptools3_do_install