Makefile 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. #
  2. # Copyright (C) 2014 Arduino LLC
  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_NPM_NAME:=arduino-firmata
  9. PKG_NAME:=node-$(PKG_NPM_NAME)
  10. PKG_VERSION:=0.3.3
  11. PKG_RELEASE:=5
  12. PKG_SOURCE_PROTO:=git
  13. PKG_SOURCE_URL:=https://github.com/shokai/node-arduino-firmata.git
  14. PKG_SOURCE_VERSION:=16e76007edf218d72df590adbd711ac6b7432845
  15. PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_SOURCE_VERSION)
  16. PKG_SOURCE:=$(PKG_NAME)-$(PKG_SOURCE_VERSION).tar.gz
  17. PKG_BUILD_DEPENDS:=node/host
  18. PKG_NODE_VERSION:=4.4.5
  19. PKG_MAINTAINER:=John Crispin <blogic@openwrt.org>
  20. PKG_LICENSE:=MIT
  21. PKG_LICENSE_FILES:=LICENSE.txt
  22. include $(INCLUDE_DIR)/package.mk
  23. define Package/node-arduino-firmata
  24. DEPENDS:=+node
  25. SUBMENU:=Node.js
  26. SECTION:=lang
  27. CATEGORY:=Languages
  28. DEPENDS:=+node +node-serialport
  29. TITLE:=Node.js package to access serial ports for reading and writing
  30. URL:=https://www.npmjs.org/package/serialport
  31. endef
  32. define Package/node-arduino-firmata/description
  33. Node.js package to access serial ports for reading and writing OR Welcome your robotic JavaScript overlords. Better yet, program them!
  34. endef
  35. define Build/Prepare
  36. /bin/tar xzf $(DL_DIR)/$(PKG_SOURCE) -C $(PKG_BUILD_DIR) --strip-components 1
  37. $(Build/Patch)
  38. endef
  39. EXTRA_LDFLAGS="-L$(TOOLCHAIN_DIR)/lib/ -Wl,-rpath-link $(TOOLCHAIN_DIR)/lib/" \
  40. define Build/Compile
  41. $(MAKE_FLAGS) \
  42. npm_config_arch=$(CONFIG_ARCH) \
  43. npm_config_nodedir=$(BUILD_DIR)/node-v$(PKG_NODE_VERSION)/ \
  44. npm_config_cache=$(BUILD_DIR)/node-v$(PKG_NODE_VERSION)/npm-cache \
  45. PREFIX="$(PKG_INSTALL_DIR)/usr/" \
  46. npm install -g $(PKG_BUILD_DIR)
  47. endef
  48. define Package/node-arduino-firmata/install
  49. mkdir -p $(1)/usr/lib/node
  50. $(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/* $(1)/usr/lib/node
  51. rm -rf $(1)/usr/lib/node/arduino-firmata/node_modules/serialport/
  52. $(CP) ./files/* $(1)/
  53. endef
  54. $(eval $(call BuildPackage,node-arduino-firmata))