libiio: new package
authorPaul Cercueil <paul.cercueil@analog.com>
Tue, 16 Dec 2014 09:34:06 +0000 (10:34 +0100)
committerThomas Petazzoni <thomas.petazzoni@free-electrons.com>
Sun, 21 Dec 2014 21:36:21 +0000 (22:36 +0100)
Libiio is a library to ease the development of software interfacing
Linux Industrial I/O (IIO) devices.

http://wiki.analog.com/resources/tools-software/linux-software/libiio

[Thomas:
 - Remove changelog from the commit log.
 - Rename init script to S99iiod instead of S99iiod.sh
 - Remove "status" command from init script, and implement "restart"
   instead.
 - Add dependency on thread support in toolchain.
 - Fixup indentation in the .mk file.
 - Fixup wrapping in the Config.in help text.]

Signed-off-by: Paul Cercueil <paul.cercueil@analog.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
package/Config.in
package/libiio/Config.in [new file with mode: 0644]
package/libiio/S99iiod [new file with mode: 0644]
package/libiio/libiio.hash [new file with mode: 0644]
package/libiio/libiio.mk [new file with mode: 0644]

index 5a7616bc27046816bdf52a9579af66fac17512d2..808ecd24ec0c1fee48dc2b3e6cbb035f985899f6 100644 (file)
@@ -710,6 +710,7 @@ menu "Hardware handling"
        source "package/libfreefare/Config.in"
        source "package/libftdi/Config.in"
        source "package/libhid/Config.in"
+       source "package/libiio/Config.in"
        source "package/libinput/Config.in"
        source "package/libiqrf/Config.in"
        source "package/libllcp/Config.in"
diff --git a/package/libiio/Config.in b/package/libiio/Config.in
new file mode 100644 (file)
index 0000000..292ca5a
--- /dev/null
@@ -0,0 +1,47 @@
+config BR2_PACKAGE_LIBIIO
+       bool "libiio"
+       depends on BR2_TOOLCHAIN_HAS_THREADS
+       select BR2_PACKAGE_LIBIIO_LOCAL_BACKEND if !BR2_PACKAGE_LIBIIO_NETWORK_BACKEND
+       help
+         Libiio is a library to ease the development of software
+         interfacing Linux Industrial I/O (IIO) devices.
+
+         http://wiki.analog.com/resources/tools-software/linux-software/libiio
+
+if BR2_PACKAGE_LIBIIO
+
+config BR2_PACKAGE_LIBIIO_LOCAL_BACKEND
+       bool "Local backend"
+       default y
+       help
+         Enable the local backend of the library.
+
+config BR2_PACKAGE_LIBIIO_NETWORK_BACKEND
+       bool "Network backend"
+       select BR2_PACKAGE_LIBXML2
+       default y
+       help
+         Enable the network backend of the library.
+
+config BR2_PACKAGE_LIBIIO_IIOD
+       bool "IIO Daemon"
+       select BR2_PACKAGE_LIBIIO_LOCAL_BACKEND
+       depends on BR2_TOOLCHAIN_HAS_THREADS
+       default y
+       help
+         Install the IIO Daemon.
+
+comment "IIO Daemon needs a toolchain w/ threads"
+       depends on !BR2_TOOLCHAIN_HAS_THREADS
+
+config BR2_PACKAGE_LIBIIO_TESTS
+       bool "Install test programs"
+       select BR2_PACKAGE_LIBIIO_LOCAL_BACKEND
+       select BR2_PACKAGE_LIBIIO_NETWORK_BACKEND
+       help
+         Install the test programs (iio_info, iio_genxml, iio_readdev).
+
+endif
+
+comment "libiio needs a toolchain w/ threads"
+       depends on !BR2_TOOLCHAIN_HAS_THREADS
diff --git a/package/libiio/S99iiod b/package/libiio/S99iiod
new file mode 100644 (file)
index 0000000..df2f763
--- /dev/null
@@ -0,0 +1,30 @@
+#!/bin/sh
+
+# Server-side demuxing by default
+IIOD_OPTS=-D
+
+[ -r /etc/default/iiod ] && . /etc/default/iiod
+
+case "$1" in
+       start)
+               echo "Starting IIO Server Daemon"
+               start-stop-daemon -S -b -q -m -p /var/run/iiod.pid -x /usr/sbin/iiod -- $IIOD_OPTS
+               exit $?
+               ;;
+
+       stop)
+               echo "Stopping IIO Server Daemon"
+               start-stop-daemon -K -q -p /var/run/iiod.pid 2>/dev/null
+               exit $?
+               ;;
+
+       restart)
+               $0 stop
+               sleep 1
+               $0 start
+               ;;
+
+       *)
+               echo "Usage: $0 {start|stop|restart}"
+               exit 1
+esac
diff --git a/package/libiio/libiio.hash b/package/libiio/libiio.hash
new file mode 100644 (file)
index 0000000..bbca4c8
--- /dev/null
@@ -0,0 +1,2 @@
+# From https://github.com/analogdevicesinc/libiio/archive/v0.3/
+sha256 a3571bbf7e80b9e0a8d6bd4b39a5bcd18f80a3d36c4a6f2092dfeefc98e20e07        libiio-v0.3.tar.gz
diff --git a/package/libiio/libiio.mk b/package/libiio/libiio.mk
new file mode 100644 (file)
index 0000000..abcddba
--- /dev/null
@@ -0,0 +1,50 @@
+################################################################################
+#
+# libiio
+#
+################################################################################
+
+LIBIIO_VERSION = v0.3
+LIBIIO_SITE = $(call github,analogdevicesinc,libiio,$(LIBIIO_VERSION))
+LIBIIO_INSTALL_STAGING = YES
+LIBIIO_LICENSE = LGPLv2.1+
+LIBIIO_LICENSE_FILES = COPYING
+
+LIBIIO_CONF_OPTS = -DENABLE_IPV6=$(if $(BR2_INET_IPV6),ON,OFF) \
+       -DWITH_LOCAL_BACKEND=$(if $(BR2_PACKAGE_LIBIIO_LOCAL_BACKEND),ON,OFF) \
+       -DWITH_TESTS=$(if $(BR2_PACKAGE_LIBIIO_TESTS),ON,OFF)
+
+ifeq ($(BR2_PACKAGE_LIBIIO_NETWORK_BACKEND),y)
+LIBIIO_DEPENDENCIES += libxml2
+LIBIIO_CONF_OPTS += -DWITH_NETWORK_BACKEND=ON
+else
+LIBIIO_CONF_OPTS += -DWITH_NETWORK_BACKEND=OFF
+endif
+
+ifeq ($(BR2_PACKAGE_LIBIIO_IIOD),y)
+LIBIIO_DEPENDENCIES += host-flex host-bison
+LIBIIO_CONF_OPTS += -DWITH_IIOD=ON
+else
+LIBIIO_CONF_OPTS += -DWITH_IIOD=OFF
+endif
+
+# Avahi support in libiio requires avahi-client, which needs avahi-daemon
+ifeq ($(BR2_PACKAGE_AVAHI)$(BR2_PACKAGE_AVAHI_DAEMON),yy)
+LIBIIO_DEPENDENCIES += avahi
+endif
+
+ifeq ($(BR2_PACKAGE_LIBIIO_IIOD),y)
+define LIBIIO_INSTALL_INIT_SYSV
+       $(INSTALL) -D -m 0755 package/libiio/S99iiod \
+               $(TARGET_DIR)/etc/init.d/S99iiod
+endef
+define LIBIIO_INSTALL_INIT_SYSTEMD
+       $(INSTALL) -d $(TARGET_DIR)/etc/systemd/system/multi-user.target.wants
+       $(INSTALL) -D -m 0644 $(@D)/debian/iiod.service \
+               $(TARGET_DIR)/lib/systemd/system/iiod.service
+       ln -fs /lib/systemd/system/iiod.service \
+               $(TARGET_DIR)/etc/systemd/system/multi-user.target.wants/iiod.service
+endef
+endif
+
+$(eval $(cmake-package))