libiio: rework backend selection (fixes #5637)
authorMichael Heimpold <mhei@heimpold.de>
Sun, 4 Mar 2018 12:58:29 +0000 (13:58 +0100)
committerMichael Heimpold <mhei@heimpold.de>
Sun, 4 Mar 2018 13:21:46 +0000 (14:21 +0100)
Provide configuration items to select individual backends. This
also allows to fine-tune the package dependencies.
In order to address #5637, we make this dep unconditionally
until upstream allow to opt-in/opt-out libavahi support.

Signed-off-by: Michael Heimpold <mhei@heimpold.de>
libs/libiio/Makefile

index 5d4c059f0c035e5b070d627197b62e6cd1acdc13..2c0048c9c381d0874167f8ab019fd00ff4c806b9 100644 (file)
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=libiio
 PKG_VERSION:=0.14
-PKG_RELEASE:=1
+PKG_RELEASE:=2
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
 PKG_SOURCE_URL:=https://codeload.github.com/analogdevicesinc/libiio/tar.gz/v$(PKG_VERSION)?
@@ -25,16 +25,61 @@ PKG_INSTALL:=1
 
 CMAKE_INSTALL:=1
 
+PKG_CONFIG_DEPENDS:= \
+       CONFIG_IPV6 \
+       CONFIG_LIBIIO_LOCAL_BACKEND \
+       CONFIG_LIBIIO_NETWORK_BACKEND \
+       CONFIG_LIBIIO_USB_BACKEND \
+       CONFIG_LIBIIO_XML_BACKEND
+
 include $(INCLUDE_DIR)/package.mk
 include $(INCLUDE_DIR)/cmake.mk
 
+CMAKE_OPTIONS += -DWITH_DOC=OFF
+CMAKE_OPTIONS += -DENABLE_IPV6=$(if $(CONFIG_IPV6),ON,OFF)
+CMAKE_OPTIONS += -DENABLE_AIO=OFF
+CMAKE_OPTIONS += -DWITH_LOCAL_BACKEND=$(if $(CONFIG_LIBIIO_LOCAL_BACKEND),ON,OFF)
+CMAKE_OPTIONS += -DWITH_LOCAL_CONFIG=OFF
+CMAKE_OPTIONS += -DWITH_NETWORK_BACKEND=$(if $(CONFIG_LIBIIO_NETWORK_BACKEND),ON,OFF)
+# serial backend requires libserial which is not packaged yet
+CMAKE_OPTIONS += -DWITH_SERIAL_BACKEND=OFF
+CMAKE_OPTIONS += -DWITH_USB_BACKEND=$(if $(CONFIG_LIBIIO_USB_BACKEND),ON,OFF)
+CMAKE_OPTIONS += -DWITH_XML_BACKEND=$(if $(CONFIG_LIBIIO_XML_BACKEND),ON,OFF)
+
 define Package/libiio
   SECTION:=libs
   CATEGORY:=Libraries
   TITLE:=Library for interfacing with Linux IIO devices
   URL:=https://github.com/analogdevicesinc/libiio
-  DEPENDS:=+PACKAGE_libaio:libaio +PACKAGE_libusb-1.0:libusb-1.0 \
-           +PACKAGE_libavahi-client:libavahi-client +libxml2
+  DEPENDS:=\
+           +LIBIIO_USB_BACKEND:libusb-1.0 \
+           +LIBIIO_NETWORK_BACKEND:libavahi-client \
+           +LIBIIO_XML_BACKEND:libxml2
+  MENU:=1
+endef
+
+define Package/libiio/config
+config LIBIIO_LOCAL_BACKEND
+       bool "Enable local backend"
+       depends on PACKAGE_libiio
+       default y
+
+config LIBIIO_NETWORK_BACKEND
+       bool "Enable network backend"
+       depends on PACKAGE_libiio
+       select LIBIIO_XML_BACKEND
+       default n
+
+config LIBIIO_USB_BACKEND
+       bool "Enable USB backend"
+       depends on PACKAGE_libiio
+       select LIBIIO_XML_BACKEND
+       default n
+
+config LIBIIO_XML_BACKEND
+       bool "Enable XML backend"
+       depends on PACKAGE_libiio
+       default n
 endef
 
 define Package/libiio/description