Skip to content

Commit

Permalink
add package node-simcom
Browse files Browse the repository at this point in the history
  • Loading branch information
vagrant committed Sep 23, 2018
1 parent b0ef0cf commit 886d917
Showing 1 changed file with 69 additions and 0 deletions.
69 changes: 69 additions & 0 deletions node-simcom/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#

include $(TOPDIR)/rules.mk

PKG_NPM_NAME:=simcom
PKG_NAME:=node-$(PKG_NPM_NAME)
PKG_VERSION:=0.3.0
PKG_RELEASE:=1

PKG_SOURCE:=$(PKG_NPM_NAME)-$(PKG_VERSION).tgz
PKG_SOURCE_URL:=http://registry.npmjs.org/$(PKG_NPM_NAME)/-/
PKG_HASH:=7b339392b803f9b9a4f4706c94622caba8f4769a

PKG_BUILD_DEPENDS:=node/host
PKG_USE_MIPS16:=0

PKG_MAINTAINER:=Wittawas Nakkasem <[email protected]>
PKG_LICENSE:=MIT
PKG_LICENSE_FILES:=LICENSE.md

include $(INCLUDE_DIR)/package.mk

define Package/node-simcom
SUBMENU:=Node.js
SECTION:=lang
CATEGORY:=Languages
TITLE:=Talk to GSM modem SIMCOM via Node
URL:=https://www.npmjs.org/package/simcom
DEPENDS:=+node
endef

define Package/node-simcom/description
Talk to GSM modem SIMCOM via Node
endef

NODEJS_CPU:=$(subst powerpc,ppc,$(subst aarch64,arm64,$(subst x86_64,x64,$(subst i386,ia32,$(ARCH)))))

define Build/Prepare
$(INSTALL_DIR) $(PKG_BUILD_DIR)
endef

define Build/Compile
$(MAKE_VARS) \
$(MAKE_FLAGS) \
npm_config_arch=$(NODEJS_CPU) \
npm_config_target_arch=$(NODEJS_CPU) \
npm_config_build_from_source=true \
npm_config_nodedir=$(STAGING_DIR)/usr/ \
npm_config_prefix=$(PKG_INSTALL_DIR)/usr/ \
npm_config_cache=$(TMP_DIR)/npm-cache \
npm_config_tmp=$(TMP_DIR)/npm-tmp \
NODE_PATH="$(PKG_INSTALL_DIR)/usr/lib/node_modules/$(PKG_NPM_NAME)/node_modules" \
npm install -g $(DL_DIR)/$(PKG_SOURCE)
rm -rf $(TMP_DIR)/npm-tmp
rm -rf $(TMP_DIR)/npm-cache
endef

define Package/node-simcom/install
$(INSTALL_DIR) $(1)/usr/lib/node
$(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/* $(1)/usr/lib/node/
$(INSTALL_DIR) $(1)/usr/bin
$(LN) ../lib/node/simcom/simcom.js $(1)/usr/bin/simcom
$(LN) ../lib/node/simcom/bin/pub.js $(1)/usr/bin/simcom_pub
$(LN) ../lib/node/simcom/bin/sub.js $(1)/usr/bin/simcom_sub
endef

$(eval $(call BuildPackage,node-simcom))

0 comments on commit 886d917

Please sign in to comment.