Merge pull request #11353 from kvuorine/fwknop-fixes
[feed/packages.git] / lang / node / Makefile
1 #
2 # Copyright (C) 2006-2017 OpenWrt.org
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_NAME:=node
11 PKG_VERSION:=v12.18.4
12 PKG_RELEASE:=1
13
14 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
15 PKG_SOURCE_URL:=https://nodejs.org/dist/$(PKG_VERSION)
16 PKG_HASH:=25f03cb18e53b6d0959d0c219e701a85eb4693f526bdda7c72bc6199b364f609
17
18 PKG_MAINTAINER:=John Crispin <blogic@openwrt.org>, Adrian Panella <ianchi74@outlook.com>
19 PKG_LICENSE:=MIT
20 PKG_LICENSE_FILES:=LICENSE
21 PKG_CPE_ID:=cpe:/a:nodejs:node.js
22
23 HOST_BUILD_DEPENDS:=python3/host
24 HOST_BUILD_PARALLEL:=1
25
26 PKG_BUILD_DEPENDS:=python3/host
27 PKG_BUILD_PARALLEL:=1
28 PKG_INSTALL:=1
29 PKG_USE_MIPS16:=0
30 PKG_ASLR_PIE:=0
31
32 include $(INCLUDE_DIR)/host-build.mk
33 include $(INCLUDE_DIR)/package.mk
34
35 define Package/node
36 SECTION:=lang
37 CATEGORY:=Languages
38 SUBMENU:=Node.js
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
44 endef
45
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
55 endef
56
57 define Package/node-npm
58 SECTION:=lang
59 CATEGORY:=Languages
60 SUBMENU:=Node.js
61 TITLE:=NPM stands for Node Package Manager
62 URL:=https://www.npmjs.com/
63 DEPENDS:=+node
64 endef
65
66 define Package/node-npm/description
67 NPM is the package manager for NodeJS
68 endef
69
70 define Package/node/config
71 if PACKAGE_node
72 choice
73 prompt "i18n features"
74 default NODEJS_ICU_NONE
75 help
76 Select i18n features
77
78 config NODEJS_ICU_NONE
79 bool "Disable"
80
81 config NODEJS_ICU_SMALL
82 depends on !BIG_ENDIAN
83 bool "small-icu"
84
85 config NODEJS_ICU_SYSTEM
86 depends on ARCH_64BIT&&!BIG_ENDIAN
87 bool "system-icu"
88 endchoice
89 endif
90 endef
91
92 NODEJS_CPU:=$(subst powerpc,ppc,$(subst aarch64,arm64,$(subst x86_64,x64,$(subst i386,ia32,$(ARCH)))))
93
94 ifneq ($(CONFIG_ARCH_64BIT),y)
95 FORCE_32BIT:=-m32
96 endif
97
98 MAKE_VARS+= \
99 DESTCPU=$(NODEJS_CPU) \
100 LD_LIBRARY_PATH=$(STAGING_DIR_HOSTPKG)/share/icu/current/lib
101
102 CONFIGURE_VARS:= \
103 CC="$(TARGET_CC) $(TARGET_OPTIMIZATION)" \
104 CXX="$(TARGET_CXX) $(TARGET_OPTIMIZATION)" \
105 CC_host="$(HOSTCC) $(FORCE_32BIT)" \
106 CXX_host="$(HOSTCXX) $(FORCE_32BIT)"
107
108 CONFIGURE_ARGS:= \
109 --dest-cpu=$(NODEJS_CPU) \
110 --dest-os=linux \
111 --cross-compiling \
112 --shared-zlib \
113 --shared-openssl \
114 --shared-nghttp2 \
115 --shared-libuv \
116 --shared-http-parser \
117 --shared-cares \
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) \
126 --prefix=/usr
127
128 HOST_CONFIGURE_VARS:=
129
130 HOST_CONFIGURE_ARGS:= \
131 --dest-os=$(if $(findstring Darwin,$(HOST_OS)),mac,linux) \
132 --with-intl=none \
133 --prefix=$(STAGING_DIR_HOSTPKG)
134
135 define Build/InstallDev
136 $(INSTALL_DIR) $(1)/usr/include
137 $(CP) $(PKG_INSTALL_DIR)/usr/include/* $(1)/usr/include/
138 endef
139
140 define Package/node/install
141 $(INSTALL_DIR) $(1)/usr/bin
142 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/node $(1)/usr/bin/
143 endef
144
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
151 endef
152
153 $(eval $(call HostBuild))
154 $(eval $(call BuildPackage,node))
155 $(eval $(call BuildPackage,node-npm))