This repository has been archived by the owner on Oct 7, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
70 lines (56 loc) · 1.87 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
include $(TOPDIR)/rules.mk
PKG_NAME:=tele-aria2
PKG_NPM_NAME:=tele-aria2
PKG_VERSION:=0.2.2
PKG_RELEASE:=2
PKG_SOURCE:=$(PKG_NPM_NAME)-$(PKG_VERSION).tgz
PKG_SOURCE_URL:=https://registry.npmjs.org/$(PKG_NPM_NAME)/-/
PKG_HASH:=528f9194c20888499678d5724b06defa2a93a30d010e5935d755e96cee52c886
PKG_LICENSE:=MIT
PKG_LICENSE_FILES:=LICENSE
PKG_BUILD_DEPENDS:=node/host
PKG_BUILD_PARALLEL:=1
PKG_USE_MIPS16:=0
include $(INCLUDE_DIR)/package.mk
define Package/$(PKG_NAME)
SECTION:=net
CATEGORY:=Network
SUBMENU:=Telegram Bot
TITLE:=A Telegram bot for controlling your aria2 server (Nodejs)
URL:=https://www.npmjs.com/package/tele-aria2
DEPENDS:=+node
endef
define Package/$(PKG_NAME)/description
A Telegram bot for controlling your aria2 server (Nodejs)
endef
NODEJS_CPU:=$(subst powerpc,ppc,$(subst aarch64,arm64,$(subst x86_64,x64,$(subst i386,ia32,$(ARCH)))))
TMPNPM:=$(shell mktemp -u XXXXXXXXXX)
TARGET_CFLAGS+=$(FPIC)
TARGET_CPPFLAGS+=$(FPIC)
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-$(TMPNPM) \
npm_config_tmp=$(TMP_DIR)/npm-tmp-$(TMPNPM) \
npm install -g $(DL_DIR)/$(PKG_SOURCE)
rm -rf $(TMP_DIR)/npm-tmp-$(TMPNPM)
rm -rf $(TMP_DIR)/npm-cache-$(TMPNPM)
endef
define Package/$(PKG_NAME)/install
$(INSTALL_DIR) $(1)/usr/lib/node_modules
$(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/* $(1)/usr/lib/node_modules/
$(INSTALL_DIR) $(1)/usr/bin
$(LN) ../lib/node_modules/tele-aria2/dist/run.js $(1)/usr/bin/tele-aria2
endef
$(eval $(call BuildPackage,$(PKG_NAME)))