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 \
66 $(if
$(BR2_PACKAGE_NODEJS_V8_ARCH_SUPPORTS
),--with-intl
=none
) \
70 define HOST_NODEJS_BUILD_CMDS
71 $(HOST_MAKE_ENV
) PYTHON
=$(HOST_DIR
)/usr
/bin
/python2 \
73 $(HOST_CONFIGURE_OPTS
) \
74 PATH
=$(@D
)/bin
:$(BR_PATH
)
77 define HOST_NODEJS_INSTALL_CMDS
78 $(HOST_MAKE_ENV
) PYTHON
=$(HOST_DIR
)/usr
/bin
/python2 \
79 $(MAKE
) -C
$(@D
) install \
80 $(HOST_CONFIGURE_OPTS
) \
81 PATH
=$(@D
)/bin
:$(BR_PATH
)
86 else ifeq ($(BR2_x86_64
),y
)
88 else ifeq ($(BR2_mips
),y
)
90 else ifeq ($(BR2_mipsel
),y
)
92 else ifeq ($(BR2_arm
),y
)
94 else ifeq ($(BR2_aarch64
),y
)
96 # V8 needs to know what floating point ABI the target is using.
97 NODEJS_ARM_FP
= $(call qstrip
,$(BR2_GCC_TARGET_FLOAT_ABI
))
100 # MIPS architecture specific options
101 ifeq ($(BR2_mips
)$(BR2_mipsel
),y
)
102 ifeq ($(BR2_MIPS_CPU_MIPS32R6
),y
)
103 NODEJS_MIPS_ARCH_VARIANT
= r6
104 NODEJS_MIPS_FPU_MODE
= fp64
105 else ifeq ($(BR2_MIPS_CPU_MIPS32R2
),y
)
106 NODEJS_MIPS_ARCH_VARIANT
= r2
107 else ifeq ($(BR2_MIPS_CPU_MIPS32
),y
)
108 NODEJS_MIPS_ARCH_VARIANT
= r1
112 define NODEJS_CONFIGURE_CMDS
114 ln
-sf
$(HOST_DIR
)/usr
/bin
/python2
$(@D
)/bin
/python
117 $(TARGET_CONFIGURE_OPTS
) \
118 PATH
=$(@D
)/bin
:$(BR_PATH
) \
120 PYTHON
=$(HOST_DIR
)/usr
/bin
/python2 \
121 $(HOST_DIR
)/usr
/bin
/python2 .
/configure \
123 --dest-cpu
=$(NODEJS_CPU
) \
124 $(if
$(NODEJS_ARM_FP
),--with-arm-float-abi
=$(NODEJS_ARM_FP
)) \
125 $(if
$(NODEJS_MIPS_ARCH_VARIANT
),--with-mips-arch-variant
=$(NODEJS_MIPS_ARCH_VARIANT
)) \
126 $(if
$(NODEJS_MIPS_FPU_MODE
),--with-mips-fpu-mode
=$(NODEJS_MIPS_FPU_MODE
)) \
127 $(NODEJS_CONF_OPTS
) \
131 define NODEJS_BUILD_CMDS
132 $(TARGET_MAKE_ENV
) PYTHON
=$(HOST_DIR
)/usr
/bin
/python2 \
134 $(TARGET_CONFIGURE_OPTS
) \
135 PATH
=$(@D
)/bin
:$(BR_PATH
) \
140 # Build the list of modules to install based on the booleans for
141 # popular modules, as well as the "additional modules" list.
143 NODEJS_MODULES_LIST
= $(call qstrip
,\
144 $(if
$(BR2_PACKAGE_NODEJS_MODULES_EXPRESS
),express
) \
145 $(if
$(BR2_PACKAGE_NODEJS_MODULES_COFFEESCRIPT
),coffee-script
) \
146 $(BR2_PACKAGE_NODEJS_MODULES_ADDITIONAL
))
148 # Define NPM for other packages to use
149 NPM
= $(TARGET_CONFIGURE_OPTS
) \
151 npm_config_arch
=$(NODEJS_CPU
) \
152 npm_config_target_arch
=$(NODEJS_CPU
) \
153 npm_config_build_from_source
=true \
154 npm_config_nodedir
=$(BUILD_DIR
)/nodejs-
$(NODEJS_VERSION
) \
155 npm_config_prefix
=$(TARGET_DIR
)/usr \
156 $(HOST_DIR
)/usr
/bin
/npm
159 # We can only call NPM if there's something to install.
161 ifneq ($(NODEJS_MODULES_LIST
),)
162 define NODEJS_INSTALL_MODULES
163 # If you're having trouble with module installation, adding -d to the
164 # npm install call below and setting npm_config_rollback=false can both
165 # help in diagnosing the problem.
166 $(NPM
) install -g
$(NODEJS_MODULES_LIST
)
170 define NODEJS_INSTALL_TARGET_CMDS
171 $(TARGET_MAKE_ENV
) PYTHON
=$(HOST_DIR
)/usr
/bin
/python2 \
172 $(MAKE
) -C
$(@D
) install \
173 DESTDIR
=$(TARGET_DIR
) \
174 $(TARGET_CONFIGURE_OPTS
) \
175 PATH
=$(@D
)/bin
:$(BR_PATH
) \
177 $(NODEJS_INSTALL_MODULES
)
180 # node.js configure is a Python script and does not use autotools
181 $(eval
$(generic-package
))
182 $(eval
$(host-generic-package
))