forked from openwrt/openwrt
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
127 lines (101 loc) · 3.17 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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
#
# Copyright (C) 2006-2016 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
include $(TOPDIR)/rules.mk
PKG_NAME:=node7
PKG_VERSION:=v7.10.0
PKG_RELEASE:=1
PKG_SOURCE:=node-$(PKG_VERSION).tar.xz
PKG_SOURCE_URL:=http://nodejs.org/dist/${PKG_VERSION}
# PKG_MD5SUM:=83e4b9a291a18a7ca1be29aadcabd561
PKG_BUILD_DEPENDS:=python/host node7/host
PKG_INSTALL:=1
PKG_USE_MIPS16:=0
PKG_BUILD_DIR:=$(BUILD_DIR)/node-$(PKG_VERSION)
HOST_BUILD_DIR:=$(BUILD_DIR_HOST)/node-$(PKG_VERSION)
MKTOOL=$(HOST_BUILD_DIR)/out/Release/mkpeephole
FILE_V8_GYP:=$(PKG_BUILD_DIR)/deps/v8/src/v8.gyp
PKG_BUILD_PARALLEL:=3
PKG_MAINTAINER:=John Crispin <blogic@openwrt.org>
PKG_LICENSE:=MIT
PKG_LICENSE_FILES:=LICENSE
include $(INCLUDE_DIR)/host-build.mk
include $(INCLUDE_DIR)/package.mk
define Package/node7
SECTION:=lang
CATEGORY:=Languages
SUBMENU:=Node.js-v7
TITLE:=Node.js is a platform built on Chrome's JavaScript runtime
URL:=http://nodejs.org/
DEPENDS:=+libstdcpp +libopenssl +zlib +USE_UCLIBC:libpthread +USE_UCLIBC:librt +NODEJS_ICU:icu
endef
define Package/node7/description
Node.js® is a JavaScript runtime built on Chrome's V8 JavaScript engine. Node.js uses
an event-driven, non-blocking I/O model that makes it lightweight and efficient. Node.js'
package ecosystem, npm, is the largest ecosystem of open source libraries in the world.
endef
define Package/node7/config
menu "Module Selection"
config NODEJS_ICU
bool "enable i18n features"
default y
endmenu
endef
NODEJS_CPU:=$(subst powerpc,ppc,$(subst aarch64,arm64,$(subst x86_64,x64,$(subst i386,ia32,$(ARCH)))))
MAKE_VARS += \
DESTCPU=$(NODEJS_CPU)
CONFIGURE_ARGS= \
--dest-cpu=$(NODEJS_CPU) \
--dest-os=linux \
--without-snapshot \
--shared-zlib \
--shared-openssl \
--prefix=/usr
ifeq ($(CONFIG_NODEJS_ICU),y)
CONFIGURE_ARGS+= \
--with-intl=system-icu
else
CONFIGURE_ARGS+= \
--with-intl=none
endif
ifeq ($(findstring mips,$(NODEJS_CPU)),mips)
ifeq ($(CONFIG_SOFT_FLOAT),y)
CONFIGURE_ARGS+= \
--with-mips-float-abi=soft
endif
endif
ifeq ($(findstring arm,$(NODEJS_CPU)),arm)
ifeq ($(CONFIG_SOFT_FLOAT),y)
CONFIGURE_ARGS+= \
--with-arm-float-abi=softfp
endif
endif
HOST_CONFIGURE_VARS:=
HOST_CONFIGURE_ARGS:= \
--dest-os=linux \
--without-snapshot \
--shared-zlib \
--prefix=$(STAGING_DIR_HOST) \
--without-intl
HOST_CONFIGURE_CMD:=python ./configure
define Build/Prepare
$(Build/Prepare/Default)
# using sed
$(SED) "s#<(mkpeephole_exec)#$(MKTOOL)#g" -i $(FILE_V8_GYP)
endef
define Host/Install
# NOOP
endef
define Package/node7/install
mkdir -p $(1)/usr/bin $(1)/usr/lib/node_modules/npm/{bin,lib,node_modules}
$(CP) $(PKG_INSTALL_DIR)/usr/bin/{node,npm} $(1)/usr/bin/
$(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/npm/{package.json,LICENSE,cli.js} $(1)/usr/lib/node_modules/npm
$(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/npm/bin/npm-cli.js $(1)/usr/lib/node_modules/npm/bin
$(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/npm/lib/* $(1)/usr/lib/node_modules/npm/lib/
$(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/npm/node_modules/* $(1)/usr/lib/node_modules/npm/node_modules/
endef
$(eval $(call HostBuild))
$(eval $(call BuildPackage,node7))