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.

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