1 ################################################################################
5 ################################################################################
7 NODEJS_VERSION
= $(call qstrip
,$(BR2_PACKAGE_NODEJS_VERSION_STRING
))
8 NODEJS_SOURCE
= node-v
$(NODEJS_VERSION
).
tar.xz
9 NODEJS_SITE
= http
://nodejs.org
/dist/v
$(NODEJS_VERSION
)
10 NODEJS_DEPENDENCIES
= host-python host-nodejs zlib \
11 $(call qstrip
,$(BR2_PACKAGE_NODEJS_MODULES_ADDITIONAL_DEPS
))
12 HOST_NODEJS_DEPENDENCIES
= host-python host-zlib
13 NODEJS_LICENSE
= MIT
(core code
); MIT
, Apache and BSD family licenses
(Bundled components
)
14 NODEJS_LICENSE_FILES
= LICENSE
23 ifeq ($(BR2_PACKAGE_OPENSSL
),y
)
24 NODEJS_DEPENDENCIES
+= openssl
25 NODEJS_CONF_OPTS
+= --shared-openssl
27 NODEJS_CONF_OPTS
+= --without-ssl
30 # 0.10.x does not have icu support
31 ifeq ($(findstring 0.10.
,$(NODEJS_VERSION
)),)
32 ifeq ($(BR2_PACKAGE_ICU
),y
)
33 NODEJS_DEPENDENCIES
+= icu
34 NODEJS_CONF_OPTS
+= --with-intl
=system-icu
36 NODEJS_CONF_OPTS
+= --with-intl
=none
40 ifneq ($(BR2_PACKAGE_NODEJS_NPM
),y
)
41 NODEJS_CONF_OPTS
+= --without-npm
44 # nodejs build system is based on python, but only support python-2.6 or
45 # python-2.7. So, we have to enforce PYTHON interpreter to be python2.
46 define HOST_NODEJS_CONFIGURE_CMDS
47 # The build system directly calls python. Work around this by forcing python2
48 # into PATH. See https://github.com/nodejs/node/issues/2735
50 ln
-sf
$(HOST_DIR
)/usr
/bin
/python2
$(@D
)/bin
/python
52 # Build with the static, built-in OpenSSL which is supplied as part of
53 # the nodejs source distribution. This is needed on the host because
54 # NPM is non-functional without it, and host-openssl isn't part of
57 $(HOST_CONFIGURE_OPTS
) \
58 PATH
=$(@D
)/bin
:$(BR_PATH
) \
59 PYTHON
=$(HOST_DIR
)/usr
/bin
/python2 \
60 $(HOST_DIR
)/usr
/bin
/python2 .
/configure \
61 --prefix=$(HOST_DIR
)/usr \
69 define HOST_NODEJS_BUILD_CMDS
70 $(HOST_MAKE_ENV
) PYTHON
=$(HOST_DIR
)/usr
/bin
/python2 \
72 $(HOST_CONFIGURE_OPTS
) \
73 PATH
=$(@D
)/bin
:$(BR_PATH
)
76 define HOST_NODEJS_INSTALL_CMDS
77 $(HOST_MAKE_ENV
) PYTHON
=$(HOST_DIR
)/usr
/bin
/python2 \
78 $(MAKE
) -C
$(@D
) install \
79 $(HOST_CONFIGURE_OPTS
) \
80 PATH
=$(@D
)/bin
:$(BR_PATH
)
85 else ifeq ($(BR2_x86_64
),y
)
87 else ifeq ($(BR2_mips
),y
)
89 else ifeq ($(BR2_mipsel
),y
)
91 else ifeq ($(BR2_arm
),y
)
93 # V8 needs to know what floating point ABI the target is using.
94 NODEJS_ARM_FP
= $(call qstrip
,$(BR2_GCC_TARGET_FLOAT_ABI
))
97 # MIPS architecture specific options
98 ifeq ($(BR2_mips
)$(BR2_mipsel
),y
)
99 ifeq ($(BR2_mips_32r6
),y
)
100 NODEJS_MIPS_ARCH_VARIANT
= r6
101 NODEJS_MIPS_FPU_MODE
= fp64
102 else ifeq ($(BR2_mips_32r2
),y
)
103 NODEJS_MIPS_ARCH_VARIANT
= r2
104 else ifeq ($(BR2_mips_32
),y
)
105 NODEJS_MIPS_ARCH_VARIANT
= r1
109 define NODEJS_CONFIGURE_CMDS
111 ln
-sf
$(HOST_DIR
)/usr
/bin
/python2
$(@D
)/bin
/python
114 $(TARGET_CONFIGURE_OPTS
) \
115 PATH
=$(@D
)/bin
:$(BR_PATH
) \
117 PYTHON
=$(HOST_DIR
)/usr
/bin
/python2 \
118 $(HOST_DIR
)/usr
/bin
/python2 .
/configure \
120 --dest-cpu
=$(NODEJS_CPU
) \
121 $(if
$(NODEJS_ARM_FP
),--with-arm-float-abi
=$(NODEJS_ARM_FP
)) \
122 $(if
$(NODEJS_MIPS_ARCH_VARIANT
),--with-mips-arch-variant
=$(NODEJS_MIPS_ARCH_VARIANT
)) \
123 $(if
$(NODEJS_MIPS_FPU_MODE
),--with-mips-fpu-mode
=$(NODEJS_MIPS_FPU_MODE
)) \
124 $(NODEJS_CONF_OPTS
) \
128 define NODEJS_BUILD_CMDS
129 $(TARGET_MAKE_ENV
) PYTHON
=$(HOST_DIR
)/usr
/bin
/python2 \
131 $(TARGET_CONFIGURE_OPTS
) \
132 PATH
=$(@D
)/bin
:$(BR_PATH
) \
137 # Build the list of modules to install based on the booleans for
138 # popular modules, as well as the "additional modules" list.
140 NODEJS_MODULES_LIST
= $(call qstrip
,\
141 $(if
$(BR2_PACKAGE_NODEJS_MODULES_EXPRESS
),express
) \
142 $(if
$(BR2_PACKAGE_NODEJS_MODULES_COFFEESCRIPT
),coffee-script
) \
143 $(BR2_PACKAGE_NODEJS_MODULES_ADDITIONAL
))
145 # Define NPM for other packages to use
146 NPM
= $(TARGET_CONFIGURE_OPTS
) \
148 npm_config_arch
=$(NODEJS_CPU
) \
149 npm_config_target_arch
=$(NODEJS_CPU
) \
150 npm_config_build_from_source
=true \
151 npm_config_nodedir
=$(BUILD_DIR
)/nodejs-
$(NODEJS_VERSION
) \
152 npm_config_prefix
=$(TARGET_DIR
)/usr \
153 $(HOST_DIR
)/usr
/bin
/npm
156 # We can only call NPM if there's something to install.
158 ifneq ($(NODEJS_MODULES_LIST
),)
159 define NODEJS_INSTALL_MODULES
160 # If you're having trouble with module installation, adding -d to the
161 # npm install call below and setting npm_config_rollback=false can both
162 # help in diagnosing the problem.
163 $(NPM
) install -g
$(NODEJS_MODULES_LIST
)
167 define NODEJS_INSTALL_TARGET_CMDS
168 $(TARGET_MAKE_ENV
) PYTHON
=$(HOST_DIR
)/usr
/bin
/python2 \
169 $(MAKE
) -C
$(@D
) install \
170 DESTDIR
=$(TARGET_DIR
) \
171 $(TARGET_CONFIGURE_OPTS
) \
172 PATH
=$(@D
)/bin
:$(BR_PATH
) \
174 $(NODEJS_INSTALL_MODULES
)
177 # node.js configure is a Python script and does not use autotools
178 $(eval
$(generic-package
))
179 $(eval
$(host-generic-package
))