2 # Copyright (C) 2006-2017 OpenWrt.org
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
8 include $(TOPDIR
)/rules.mk
14 PKG_SOURCE
:=$(PKG_NAME
)-$(PKG_VERSION
).
tar.xz
15 PKG_SOURCE_URL
:=https
://nodejs.org
/dist/$(PKG_VERSION
)
16 PKG_HASH
:=25f03cb18e53b6d0959d0c219e701a85eb4693f526bdda7c72bc6199b364f609
18 PKG_MAINTAINER
:=John Crispin
<blogic@openwrt.org
>, Adrian Panella
<ianchi74@outlook.com
>
20 PKG_LICENSE_FILES
:=LICENSE
21 PKG_CPE_ID
:=cpe
:/a
:nodejs
:node.js
23 HOST_BUILD_DEPENDS
:=python3
/host
24 HOST_BUILD_PARALLEL
:=1
26 PKG_BUILD_DEPENDS
:=python3
/host
32 include $(INCLUDE_DIR
)/host-build.mk
33 include $(INCLUDE_DIR
)/package.mk
39 TITLE
:=Node.js is a platform built on Chrome
's JavaScript runtime
40 URL:=https://nodejs.org/
41 DEPENDS:=@(HAS_FPU||KERNEL_MIPS_FPU_EMULATOR) @!arc @!armeb @!powerpc \
42 +libstdcpp +libopenssl +zlib +libnghttp2 +libuv +libhttp-parser \
43 +libcares +libatomic +NODEJS_ICU_SYSTEM:icu +NODEJS_ICU_SYSTEM:icu-full-data
46 define Package/node/description
47 Node.jsĀ® is a JavaScript runtime built on Chrome's V8 JavaScript engine. Node.js uses
48 an event-driven
, non-blocking I
/O model that makes it lightweight and efficient. Node.js
'
49 package ecosystem, npm, is the largest ecosystem of open source libraries in the world.
50 *** The following preparations must be made on the host side. ***
51 1. gcc 6.3 or higher is required.
52 2. To build a 32-bit target, gcc-multilib, g++-multilib are required.
53 3. Requires libatomic package. (If necessary, install the 32-bit library at the same time.)
54 ex) sudo apt-get install gcc-multilib g++-multilib
57 define Package/node-npm
61 TITLE:=NPM stands for Node Package Manager
62 URL:=https://www.npmjs.com/
66 define Package/node-npm/description
67 NPM is the package manager for NodeJS
70 define Package/node/config
73 prompt "i18n features"
74 default NODEJS_ICU_NONE
78 config NODEJS_ICU_NONE
81 config NODEJS_ICU_SMALL
82 depends on !BIG_ENDIAN
85 config NODEJS_ICU_SYSTEM
86 depends on ARCH_64BIT&&!BIG_ENDIAN
92 NODEJS_CPU:=$(subst powerpc,ppc,$(subst aarch64,arm64,$(subst x86_64,x64,$(subst i386,ia32,$(ARCH)))))
94 ifneq ($(CONFIG_ARCH_64BIT),y)
99 DESTCPU=$(NODEJS_CPU) \
100 LD_LIBRARY_PATH=$(STAGING_DIR_HOSTPKG)/share/icu/current/lib
103 CC="$(TARGET_CC) $(TARGET_OPTIMIZATION)" \
104 CXX="$(TARGET_CXX) $(TARGET_OPTIMIZATION)" \
105 CC_host="$(HOSTCC) $(FORCE_32BIT)" \
106 CXX_host="$(HOSTCXX) $(FORCE_32BIT)"
109 --dest-cpu=$(NODEJS_CPU) \
116 --shared-http-parser \
118 $(if $(CONFIG_NODEJS_ICU_SMALL),, \
119 --with-intl=$(if $(CONFIG_NODEJS_ICU_SYSTEM),system-icu,none)) \
120 $(if $(findstring mips,$(NODEJS_CPU)), \
121 $(if $(CONFIG_SOFT_FLOAT),--with-mips-float-abi=soft)) \
122 $(if $(findstring +neon,$(CONFIG_CPU_TYPE)),--with-arm-fpu=neon) \
123 $(if $(findstring +vfp",$(CONFIG_CPU_TYPE)),--with-arm-fpu=vfp) \
124 $(if $(findstring +vfpv3",$(CONFIG_CPU_TYPE)),--with-arm-fpu=vfpv3-d16) \
125 $(if $(findstring +vfpv4",$(CONFIG_CPU_TYPE)),--with-arm-fpu=vfpv3) \
128 HOST_CONFIGURE_VARS:=
130 HOST_CONFIGURE_ARGS:= \
131 --dest-os=$(if $(findstring Darwin,$(HOST_OS)),mac,linux) \
133 --prefix=$(STAGING_DIR_HOSTPKG)
135 define Build/InstallDev
136 $(INSTALL_DIR) $(1)/usr/include
137 $(CP) $(PKG_INSTALL_DIR)/usr/include/* $(1)/usr/include/
140 define Package/node/install
141 $(INSTALL_DIR) $(1)/usr/bin
142 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/node $(1)/usr/bin/
145 define Package/node-npm/install
146 $(INSTALL_DIR) $(1)/usr/lib/node_modules
147 $(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/* $(1)/usr/lib/node_modules/
148 $(INSTALL_DIR) $(1)/usr/bin
149 $(LN) ../lib/node_modules/npm/bin/npm-cli.js $(1)/usr/bin/npm
150 $(LN) ../lib/node_modules/npm/bin/npx-cli.js $(1)/usr/bin/npx
153 $(eval $(call HostBuild))
154 $(eval $(call BuildPackage,node))
155 $(eval $(call BuildPackage,node-npm))