lede-packages-rs

git clone git://archive.git.mtrnord.blog/MTRNord/lede-packages-rs.git
Log | Files | Refs | README | LICENSE

Makefile (1796B)


      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 
      8 include $(TOPDIR)/rules.mk
      9 
     10 PKG_NPM_NAME:=serialport
     11 PKG_NAME:=node-$(PKG_NPM_NAME)
     12 PKG_VERSION:=3.0.0
     13 PKG_RELEASE:=3
     14 
     15 PKG_SOURCE:=$(PKG_NPM_NAME)-$(PKG_VERSION).tgz
     16 PKG_SOURCE_URL:=http://registry.npmjs.org/$(PKG_NPM_NAME)/-/
     17 PKG_MD5SUM:=ea20a17746dd64e72d5f6f2019d9e28d
     18 
     19 PKG_BUILD_DEPENDS:=node/host
     20 PKG_NODE_VERSION:=4.4.5
     21 
     22 PKG_MAINTAINER:=John Crispin <blogic@openwrt.org>
     23 PKG_LICENSE:=Custom
     24 PKG_LICENSE_FILES:=LICENSE
     25 
     26 include $(INCLUDE_DIR)/package.mk
     27 
     28 define Package/node-serialport
     29   DEPENDS:=+node
     30   SUBMENU:=Node.js
     31   SECTION:=lang
     32   CATEGORY:=Languages
     33   TITLE:=Node.js package to access serial ports for reading and writing
     34   URL:=https://www.npmjs.org/package/serialport
     35 endef
     36 
     37 define Package/node-serialport/description
     38  Node.js package to access serial ports for reading and writing OR Welcome your robotic JavaScript overlords. Better yet, program them!
     39 endef
     40 
     41 define Build/Prepare
     42 	/bin/tar xzf $(DL_DIR)/$(PKG_SOURCE) -C $(PKG_BUILD_DIR) --strip-components 1
     43 	$(Build/Patch)
     44 endef
     45 
     46 CPU:=$(subst x86_64,x64,$(subst i386,ia32,$(ARCH)))
     47 
     48 EXTRA_LDFLAGS="-L$(TOOLCHAIN_DIR)/lib/ -Wl,-rpath-link $(TOOLCHAIN_DIR)/lib/" \
     49 
     50 define Build/Compile
     51 	$(MAKE_FLAGS) \
     52 	npm_config_arch=$(CONFIG_ARCH) \
     53 	npm_config_nodedir=$(BUILD_DIR)/node-v$(PKG_NODE_VERSION)/ \
     54 	npm_config_cache=$(BUILD_DIR)/node-v$(PKG_NODE_VERSION)/npm-cache \
     55 	PREFIX="$(PKG_INSTALL_DIR)/usr/" \
     56 	npm install --build-from-source --target_arch=$(CPU) -g $(PKG_BUILD_DIR)
     57 endef
     58 
     59 define Package/node-serialport/install
     60 	mkdir -p $(1)/usr/lib/node/
     61 	$(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/* $(1)/usr/lib/node/
     62 endef
     63 
     64 $(eval $(call BuildPackage,node-serialport))
     65