aboutsummaryrefslogtreecommitdiff
path: root/libs/libiio/Makefile
blob: ba78a6878e743955c1b5bf1434ad4f6ce50ef7d5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
#
# Copyright (C) 2017-2018 Michael Heimpold <mhei@heimpold.de>
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#

include $(TOPDIR)/rules.mk

PKG_NAME:=libiio
PKG_VERSION:=0.25
PKG_RELEASE:=1

PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://codeload.github.com/analogdevicesinc/libiio/tar.gz/v$(PKG_VERSION)?
PKG_HASH:=21972599a3c143ab1f98002ad2b3f28f4aff927fde5f677478311cd4e517730c

PKG_LICENSE:=LGPL-2.1
PKG_LICENSE_FILES:=COPYING.txt

PKG_MAINTAINER:=Michael Heimpold <mhei@heimpold.de>

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)/nls.mk
include $(INCLUDE_DIR)/cmake.mk

CMAKE_OPTIONS += -DWITH_DOC=OFF
CMAKE_OPTIONS += -DENABLE_IPV6=$(if $(CONFIG_IPV6),ON,OFF)
CMAKE_OPTIONS += -DWITH_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:=\
           +zlib \
           +LIBIIO_USB_BACKEND:libusb-1.0 \
           +LIBIIO_NETWORK_BACKEND:libavahi-client \
           +LIBIIO_XML_BACKEND:libxml2 \
           $(ICONV_DEPENDS)
  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 y

config LIBIIO_USB_BACKEND
	bool "Enable USB backend"
	depends on PACKAGE_libiio
	select LIBIIO_XML_BACKEND
	default n

config LIBIIO_XML_BACKEND
	bool
	depends on PACKAGE_libiio
	default y
endef

define Package/libiio/description
  libiio is used to interface to the Linux Industrial Input/Output (IIO) Subsystem.
  The Linux IIO subsystem is intended to provide support for devices that in some
  sense are analog to digital or digital to analog converters (ADCs, DACs). This
  includes, but is not limited to ADCs, Accelerometers, Gyros, IMUs, Capacitance
  to Digital Converters (CDCs), Pressure Sensors, Color, Light and Proximity Sensors,
  Temperature Sensors, Magnetometers, DACs, DDS (Direct Digital Synthesis),
  PLLs (Phase Locked Loops), Variable/Programmable Gain Amplifiers (VGA, PGA),
  and RF transceivers. You can use libiio natively on an embedded Linux
  target (local mode), or use libiio to communicate remotely to that same target
  from a host Linux, Windows or MAC over USB or Ethernet or Serial.
endef

define Package/iiod
  SECTION:=net
  CATEGORY:=Network
  TITLE:=Linux IIO daemon
  URL:=https://github.com/analogdevicesinc/libiio
  DEPENDS:=+libiio
endef

define Package/iiod/description
  Daemon to access IIO devices via network.
endef

define Package/iio-utils
  SECTION:=utils
  CATEGORY:=Utilities
  TITLE:=Linux IIO tools
  URL:=https://github.com/analogdevicesinc/libiio
  DEPENDS:=+libiio
endef

define Package/iio-utils/description
  Command line tools for IIO devices.
endef

define Build/InstallDev
	$(INSTALL_DIR) $(1)/usr/include
	$(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/include/iio.h $(1)/usr/include/

	$(INSTALL_DIR) $(1)/usr/lib
	$(CP) $(PKG_INSTALL_DIR)/usr/lib/libiio.so* $(1)/usr/lib/

	$(INSTALL_DIR) $(1)/usr/lib/pkgconfig
	$(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/libiio.pc $(1)/usr/lib/pkgconfig/
	$(SED) 's,/usr/include,$$$${prefix}/include,g' $(1)/usr/lib/pkgconfig/libiio.pc
	$(SED) 's,/usr/lib,$$$${exec_prefix}/lib,g' $(1)/usr/lib/pkgconfig/libiio.pc
endef

define Package/libiio/install
	$(INSTALL_DIR) $(1)/usr/lib
	$(CP) $(PKG_INSTALL_DIR)/usr/lib/libiio.so.* $(1)/usr/lib/
endef

define Package/iiod/install
	$(INSTALL_DIR) $(1)/etc/init.d
	$(INSTALL_BIN) ./files/iiod.init $(1)/etc/init.d/iiod
	$(INSTALL_DIR) $(1)/usr/sbin
	$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/iiod $(1)/usr/sbin/
endef

define Package/iio-utils/install
	$(INSTALL_DIR) $(1)/usr/bin
	$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/* $(1)/usr/bin/
endef

$(eval $(call BuildPackage,libiio))
$(eval $(call BuildPackage,iiod))
$(eval $(call BuildPackage,iio-utils))