You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

388 lines
10 KiB

  1. #
  2. # Copyright (C) 2015-2018 OpenWrt.org
  3. #
  4. # This is free software, licensed under the GNU General Public License v2.
  5. # See /LICENSE for more information.
  6. #
  7. include $(TOPDIR)/rules.mk
  8. PKG_NAME:=libupm
  9. PKG_VERSION:=2.0.0
  10. PKG_RELEASE:=3
  11. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
  12. PKG_SOURCE_URL:=https://codeload.github.com/intel-iot-devkit/upm/tar.gz/v$(PKG_VERSION)?
  13. PKG_HASH:=7dd2f4165b71e071d100b58d6a392f3cf57b0f257c82ffabf49e931b5ed6bc23
  14. PKG_BUILD_DIR:=$(BUILD_DIR)/upm-$(PKG_VERSION)
  15. PKG_MAINTAINER:=John Crispin <blogic@openwrt.org>, Hirokazu MORIKAWA <morikw2@gmail.com>
  16. PKG_LICENSE:=MIT
  17. PKG_LICENSE_FILES:=LICENSE
  18. CMAKE_INSTALL:=1
  19. CMAKE_BINARY_SUBDIR:=build
  20. PKG_USE_MIPS16:=0
  21. PKG_BUILD_PARALLEL:=1
  22. PYTHON3_PKG_BUILD:=0
  23. include $(INCLUDE_DIR)/package.mk
  24. include $(INCLUDE_DIR)/cmake.mk
  25. include ../../lang/python/python3-package.mk
  26. UPM_MODULES:= \
  27. a110x abp ad8232 adafruitms1438 adafruitss adc121c021 adis16448 ads1x15 adxl335 adxl345 \
  28. adxrs610 am2315 apa102 apds9002 apds9930 at42qt1070 bh1749 bh1750 bh1792 biss0001 bma220 \
  29. bma250e bmg160 bmi160 bmm150 bmp280 bmpx8x bmx055 bno055 button buzzer cjq4435 collision \
  30. cwlsxxa dfrec dfrorp dfrph ds1307 ds1808lc ds18b20 ds2413 ecezo ecs1030 \
  31. ehr eldriver electromagnet emg enc03r flex gas gp2y0a gprs \
  32. gsr guvas12d h3lis331dl hcsr04 hdc1000 hdxxvxta hka5 hlg150h hm11 hmc5883l hmtrp hp20x \
  33. ht9170 htu21d hx711 ili9341 ims ina132 interfaces isd1820 itg3200 jhd1313m1 joystick12 kx122 \
  34. kxcjk1013 kxtj3 l298 l3gd20 lcd lcdks lcm1602 ldt0028 led lidarlitev3 light linefinder lis2ds12 \
  35. lis3dh lm35 lol loudness lp8860 lpd8806 lsm303agr lsm303d lsm303dlh lsm6ds3h lsm6dsl lsm9ds0 \
  36. m24lr64e mag3110 max30100 max31723 max31855 max44000 max44009 max5487 maxds3231m maxsonarez \
  37. mb704x mcp2515 mcp9808 md mg811 mhz16 mic micsv89 mlx90614 mma7361 mma7455 mma7660 mma8x5x \
  38. mmc35240 moisture mpl3115a2 mpr121 mpu9150 mq303a ms5611 ms5803 my9221 nlgpio16 nmea_gps \
  39. nrf24l01 nrf8001 nunchuck o2 otp538u p9813 pca9685 pn532 ppd42ns pulsensor relay rf22 \
  40. rfr359f rgbringcoder rhusb rn2903 rotary rotaryencoder rpr220 rsc scam sensortemplate \
  41. servo sht1x si1132 si114x si7005 slide sm130 smartdrive speaker ssd1351 st7735 stepmotor \
  42. sx1276 sx6119 t6713 ta12200 tca9548a tcs3414cs tcs37727 teams temperature \
  43. tex00 th02 tm1637 tmp006 tsl2561 ttp223 uartat uln200xa ultrasonic urm37 utilities vdiv \
  44. veml6070 water waterlevel wfs wheelencoder wt5001 xbee yg1006 zfm20 \
  45. vcap t3311 hwxpxx h803x ozw curieimu
  46. # (require libbacnet) tb7300 t8100 e50hx bacnetmstp
  47. # (require libtinyb) 2jciebu01_ble 2jciebu01_usb
  48. CMAKE_OPTIONS=-DBUILDSWIGNODE=$(if $(CONFIG_PACKAGE_libmraa-node),ON,OFF)
  49. define Package/libupm/Default
  50. SECTION:=libs
  51. CATEGORY:=Libraries
  52. SUBMENU:=IoT
  53. URL:=https://github.com/intel-iot-devkit/upm
  54. DEPENDS:=+libmraa +librt
  55. endef
  56. define Package/libupm/Default/description
  57. UPM is a high level repository that provides software drivers for a wide variety
  58. of commonly used sensors and actuators. These software drivers interact with the
  59. underlying hardware platform through calls to MRAA APIs.
  60. MRAA that allows you to use various sensors on platforms such as the Intel Galileo,
  61. Intel Edison, Minnowboard MAX and others.
  62. endef
  63. define Package/libupm
  64. $(call Package/libupm/Default)
  65. TITLE:=Intel IoT sensor library - Full
  66. DEPENDS+=+libjpeg +libmodbus +openzwave
  67. DEPENDS+= $(foreach module, $(UPM_MODULES), +libupm-$(module))
  68. DEPENDS+= $(foreach module, $(UPM_MODULES), +libupm-$(module)-node)
  69. DEPENDS+= $(foreach module, $(UPM_MODULES), +libupm-$(module)-python3)
  70. endef
  71. define Package/libupm/description
  72. $(call Package/libupm/Default/description)
  73. This package contains sensor libraries
  74. endef
  75. define Package/libupm/install/Default
  76. $(INSTALL_DIR) $(1)/usr/lib/
  77. $(CP) $(PKG_INSTALL_DIR)/usr/lib/libupm*-$(2).so* $(1)/usr/lib/ ;
  78. endef
  79. define Package/libupm/install/Default-node
  80. $(INSTALL_DIR) $(1)/usr/lib/node/
  81. $(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/jsupm_$(2) $(1)/usr/lib/node/ ;
  82. endef
  83. define Package/libupm/install/Default-python3
  84. $(INSTALL_DIR) $(1)/usr/lib/python$(PYTHON3_VERSION)/site-packages/upm
  85. $(CP) $(CMAKE_BINARY_DIR)/$(if $(filter interfaces, $(2)),,src/)$(2)/python$(PYTHON3_VERSION)/pyupm_$(2).py \
  86. $(1)/usr/lib/python$(PYTHON3_VERSION)/site-packages/upm/
  87. $(CP) $(PKG_INSTALL_DIR)/usr/lib/python$(PYTHON3_VERSION)/site-packages/upm/_pyupm_$(2).so \
  88. $(1)/usr/lib/python$(PYTHON3_VERSION)/site-packages/upm/ ;
  89. endef
  90. define Package/libupm/install
  91. $(foreach module, $(UPM_MODULES), \
  92. $(call Package/libupm/install/Default,$(1),$(module)) \
  93. $(call Package/libupm/install/Default-node,$(1),$(module)) \
  94. $(call Package/libupm/install/Default-python3,$(1),$(module)))
  95. endef
  96. define UpmPackage
  97. define UpmPackage/depends
  98. ifeq ($$(1),adafruitms1438)
  99. DEPENDS+=+libupm-pca9685
  100. endif
  101. ifeq ($$(1),ads1x15)
  102. DEPENDS+=+libupm-interfaces
  103. endif
  104. ifeq ($$(1),apa102)
  105. DEPENDS+=+libupm-utilities
  106. endif
  107. ifeq ($(1),bh1749)
  108. DEPENDS+=+libupm-utilities
  109. endif
  110. ifeq ($$(1),bh1750)
  111. DEPENDS+=+libupm-utilities
  112. endif
  113. ifeq ($(1),bh1792)
  114. DEPENDS+=+libupm-utilities
  115. endif
  116. ifeq ($$(1),bma250e)
  117. DEPENDS+=+libupm-utilities
  118. endif
  119. ifeq ($$(1),bmg160)
  120. DEPENDS+=+libupm-utilities
  121. endif
  122. ifeq ($$(1),bmi160)
  123. DEPENDS+=+libupm-utilities
  124. endif
  125. ifeq ($$(1),bmm150)
  126. DEPENDS+=+libupm-utilities
  127. endif
  128. ifeq ($$(1),bmp280)
  129. DEPENDS+=+libupm-interfaces +libupm-utilities
  130. endif
  131. ifeq ($$(1),bmpx8x)
  132. DEPENDS+=+libupm-interfaces +libupm-utilities
  133. endif
  134. ifeq ($$(1),bmx055)
  135. DEPENDS+=+libupm-utilities +libupm-bma250e +libupm-bmg160 +libupm-bmm150
  136. endif
  137. ifeq ($$(1),bno055)
  138. DEPENDS+=+libupm-utilities
  139. endif
  140. ifeq ($$(1),buzzer)
  141. DEPENDS+=+libupm-utilities
  142. endif
  143. ifeq ($$(1),cjq4435)
  144. DEPENDS+=+libupm-utilities
  145. endif
  146. ifeq ($$(1),dfrec)
  147. DEPENDS+=+libupm-utilities +libupm-ds18b20
  148. endif
  149. ifeq ($$(1),ds18b20)
  150. DEPENDS+=+libupm-utilities
  151. endif
  152. ifeq ($$(1),dfrorp)
  153. DEPENDS+=+libupm-utilities
  154. endif
  155. ifeq ($$(1),ds1808lc)
  156. DEPENDS+=+libupm-interfaces
  157. endif
  158. ifeq ($$(1),ecezo)
  159. DEPENDS+=+libupm-utilities
  160. endif
  161. ifeq ($$(1),enc03r)
  162. DEPENDS+=+libupm-utilities
  163. endif
  164. ifeq ($$(1),guvas12d)
  165. DEPENDS+=+libupm-utilities
  166. endif
  167. ifeq ($$(1),hcsr04)
  168. DEPENDS+=+libupm-utilities
  169. endif
  170. ifeq ($$(1),hka5)
  171. DEPENDS+=+libupm-utilities
  172. endif
  173. ifeq ($$(1),hlg150h)
  174. DEPENDS+=+libupm-interfaces
  175. endif
  176. ifeq ($$(1),ims)
  177. DEPENDS+=+libupm-utilities
  178. endif
  179. ifeq ($$(1),jhd1313m1)
  180. DEPENDS+=+libupm-utilities +libupm-lcm1602
  181. endif
  182. ifeq ($$(1),kxtj3)
  183. DEPENDS+=+libupm-utilities
  184. endif
  185. ifeq ($$(1),lcm1602)
  186. DEPENDS+=+libupm-utilities
  187. endif
  188. ifeq ($$(1),lcdks)
  189. DEPENDS+=+libupm-utilities +libupm-lcm1602
  190. endif
  191. ifeq ($$(1),lis2ds12)
  192. DEPENDS+=+libupm-utilities
  193. endif
  194. ifeq ($$(1),lis3dh)
  195. DEPENDS+=+libupm-utilities
  196. endif
  197. ifeq ($$(1),lp8860)
  198. DEPENDS+=+libupm-interfaces
  199. endif
  200. ifeq ($$(1),lsm303agr)
  201. DEPENDS+=+libupm-utilities
  202. endif
  203. ifeq ($$(1),lsm303d)
  204. DEPENDS+=+libupm-utilities
  205. endif
  206. ifeq ($$(1),lsm6ds3h)
  207. DEPENDS+=+libupm-utilities
  208. endif
  209. ifeq ($$(1),lsm6dsl)
  210. DEPENDS+=+libupm-utilities
  211. endif
  212. ifeq ($$(1),m24lr64e)
  213. DEPENDS+=+libupm-utilities
  214. endif
  215. ifeq ($$(1),max30100)
  216. DEPENDS+=+libupm-utilities
  217. endif
  218. ifeq ($$(1),max44009)
  219. DEPENDS+=+libupm-interfaces
  220. endif
  221. ifeq ($$(1),mb704x)
  222. DEPENDS+=+libupm-utilities
  223. endif
  224. ifeq ($$(1),mcp2515)
  225. DEPENDS+=+libupm-utilities
  226. endif
  227. ifeq ($$(1),md)
  228. DEPENDS+=+libupm-utilities
  229. endif
  230. ifeq ($$(1),mma7361)
  231. DEPENDS+=+libupm-utilities
  232. endif
  233. ifeq ($$(1),ms5611)
  234. DEPENDS+=+libupm-interfaces
  235. endif
  236. ifeq ($$(1),ms5803)
  237. DEPENDS+=+libupm-utilities
  238. endif
  239. ifeq ($$(1),my9221)
  240. DEPENDS+=+libupm-utilities
  241. endif
  242. ifeq ($$(1),nmea_gps)
  243. DEPENDS+=+libupm-utilities +libatomic
  244. endif
  245. ifeq ($$(1),nunchuck)
  246. DEPENDS+=+libupm-utilities
  247. endif
  248. ifeq ($$(1),otp538u)
  249. DEPENDS+=+libupm-utilities
  250. endif
  251. ifeq ($$(1),p9813)
  252. DEPENDS+=+libupm-utilities
  253. endif
  254. ifeq ($$(1),ppd42ns)
  255. DEPENDS+=+libupm-utilities
  256. endif
  257. ifeq ($$(1),rn2903)
  258. DEPENDS+=+libupm-utilities
  259. endif
  260. ifeq ($$(1),rsc)
  261. DEPENDS+=+libupm-utilities
  262. endif
  263. ifeq ($$(1),servo)
  264. DEPENDS+=+libupm-utilities
  265. endif
  266. ifeq ($$(1),sht1x)
  267. DEPENDS+=+libupm-utilities
  268. endif
  269. ifeq ($$(1),si1132)
  270. DEPENDS+=+libupm-interfaces
  271. endif
  272. ifeq ($$(1),si7005)
  273. DEPENDS+=+libupm-interfaces
  274. endif
  275. ifeq ($$(1),speaker)
  276. DEPENDS+=+libupm-utilities
  277. endif
  278. ifeq ($$(1),t6713)
  279. DEPENDS+=+libupm-interfaces
  280. endif
  281. ifeq ($$(1),tsl2561)
  282. DEPENDS+=+libupm-utilities
  283. endif
  284. ifeq ($$(1),uartat)
  285. DEPENDS+=+libupm-utilities
  286. endif
  287. ifeq ($$(1),uln200xa)
  288. DEPENDS+=+libupm-utilities
  289. endif
  290. ifeq ($$(1),urm37)
  291. DEPENDS+=+libupm-utilities
  292. endif
  293. ifeq ($$(1),wfs)
  294. DEPENDS+=+libupm-utilities
  295. endif
  296. ifeq ($$(1),zfm20)
  297. DEPENDS+=+libupm-utilities
  298. endif
  299. ifeq ($$(1),vcap)
  300. DEPENDS+=+libjpeg
  301. endif
  302. ifeq ($$(1),t3311)
  303. DEPENDS+=+libmodbus
  304. endif
  305. ifeq ($$(1),ozw)
  306. DEPENDS+=+openzwave
  307. endif
  308. ifeq ($$(1),hwxpxx)
  309. DEPENDS+=+libmodbus
  310. endif
  311. ifeq ($$(1),h803x)
  312. DEPENDS+=+libmodbus
  313. endif
  314. endef
  315. define Package/libupm-$(1)
  316. $(call Package/libupm/Default)
  317. $(call UpmPackage/depends,$(1))
  318. TITLE:=$(1) C/C++ library
  319. endef
  320. define Package/libupm-$(1)/description
  321. $(call Package/libupm/Default/description)
  322. This package contains $(1) sensor C/C++ library
  323. endef
  324. define Package/libupm-$(1)-node
  325. $(call Package/libupm/Default)
  326. $(call UpmPackage/depends,$(1))
  327. TITLE:=$(1) Node.js library
  328. DEPENDS+=+libupm-$(1) +libmraa-node
  329. endef
  330. define Package/libupm-$(1)-node/description
  331. $(call Package/libupm/Default/description)
  332. This package contains $(1) sensor Node.js library
  333. endef
  334. define Package/libupm-$(1)-python3
  335. $(call Package/libupm/Default)
  336. $(call UpmPackage/depends,$(1))
  337. TITLE:=$(1) Python3 library
  338. DEPENDS+=+libupm-$(1) +libmraa-python3 +python3-light
  339. endef
  340. define Package/libupm-$(1)-python3/description
  341. $(call Package/libupm/Default/description)
  342. This package contains $(1) sensor Python3 library
  343. endef
  344. define Package/libupm-$(1)/install
  345. $(call Package/libupm/install/Default,$$(1),$(1))
  346. endef
  347. define Package/libupm-$(1)-node/install
  348. $(call Package/libupm/install/Default-node,$$(1),$(1))
  349. endef
  350. define Package/libupm-$(1)-python3/install
  351. $(call Package/libupm/install/Default-python3,$$(1),$(1))
  352. endef
  353. endef
  354. $(eval $(call BuildPackage,libupm))
  355. $(foreach module, $(UPM_MODULES), \
  356. $(eval $(call UpmPackage,$(module))) \
  357. $(eval $(call BuildPackage,libupm-$(module))) \
  358. $(eval $(call BuildPackage,libupm-$(module)-node)) \
  359. $(eval $(call BuildPackage,libupm-$(module)-python3)))