1 ################################################################################
5 ################################################################################
7 NODEJS_VERSION
= $(call qstrip
,$(BR2_PACKAGE_NODEJS_VERSION_STRING
))
8 ifeq ($(BR2_PACKAGE_NODEJS_5_X
),y
)
9 NODEJS_SOURCE
= node-v
$(NODEJS_VERSION
).
tar.xz
11 NODEJS_SOURCE
= node-v
$(NODEJS_VERSION
).
tar.gz
13 NODEJS_SITE
= http
://nodejs.org
/dist/v
$(NODEJS_VERSION
)
14 NODEJS_DEPENDENCIES
= host-python host-nodejs zlib \
15 $(call qstrip
,$(BR2_PACKAGE_NODEJS_MODULES_ADDITIONAL_DEPS
))
16 HOST_NODEJS_DEPENDENCIES
= host-python host-zlib
17 NODEJS_LICENSE
= MIT
(core code
); MIT
, Apache and BSD family licenses
(Bundled components
)
18 NODEJS_LICENSE_FILES
= LICENSE
20 ifeq ($(BR2_PACKAGE_OPENSSL
),y
)
21 NODEJS_DEPENDENCIES
+= openssl
24 # nodejs build system is based on python, but only support python-2.6 or
25 # python-2.7. So, we have to enforce PYTHON interpreter to be python2.
26 define HOST_NODEJS_CONFIGURE_CMDS
27 # Build with the static, built-in OpenSSL which is supplied as part of
28 # the nodejs source distribution. This is needed on the host because
29 # NPM is non-functional without it, and host-openssl isn't part of
32 $(HOST_CONFIGURE_OPTS
) \
33 PYTHON
=$(HOST_DIR
)/usr
/bin
/python2 \
34 $(HOST_DIR
)/usr
/bin
/python2 .
/configure \
35 --prefix=$(HOST_DIR
)/usr \
43 define HOST_NODEJS_BUILD_CMDS
44 $(HOST_MAKE_ENV
) PYTHON
=$(HOST_DIR
)/usr
/bin
/python2 \
46 $(HOST_CONFIGURE_OPTS
)
49 define HOST_NODEJS_INSTALL_CMDS
50 $(HOST_MAKE_ENV
) PYTHON
=$(HOST_DIR
)/usr
/bin
/python2 \
51 $(MAKE
) -C
$(@D
) install \
52 $(HOST_CONFIGURE_OPTS
)
57 else ifeq ($(BR2_x86_64
),y
)
59 else ifeq ($(BR2_mips
),y
)
61 else ifeq ($(BR2_mipsel
),y
)
63 else ifeq ($(BR2_arm
),y
)
65 # V8 needs to know what floating point ABI the target is using.
66 NODEJS_ARM_FP
= $(call qstrip
,$(BR2_GCC_TARGET_FLOAT_ABI
))
69 # MIPS architecture specific options
70 ifeq ($(BR2_mips
)$(BR2_mipsel
),y
)
71 ifeq ($(BR2_mips_32r6
),y
)
72 NODEJS_MIPS_ARCH_VARIANT
= r6
73 NODEJS_MIPS_FPU_MODE
= fp64
74 else ifeq ($(BR2_mips_32r2
),y
)
75 NODEJS_MIPS_ARCH_VARIANT
= r2
76 else ifeq ($(BR2_mips_32
),y
)
77 NODEJS_MIPS_ARCH_VARIANT
= r1
81 define NODEJS_CONFIGURE_CMDS
83 $(TARGET_CONFIGURE_OPTS
) \
85 PYTHON
=$(HOST_DIR
)/usr
/bin
/python2 \
86 $(HOST_DIR
)/usr
/bin
/python2 .
/configure \
90 $(if
$(BR2_PACKAGE_OPENSSL
),--shared-openssl
,--without-ssl
) \
91 $(if
$(BR2_PACKAGE_NODEJS_NPM
),,--without-npm
) \
94 --dest-cpu
=$(NODEJS_CPU
) \
95 $(if
$(NODEJS_ARM_FP
),--with-arm-float-abi
=$(NODEJS_ARM_FP
)) \
96 $(if
$(NODEJS_MIPS_ARCH_VARIANT
),--with-mips-arch-variant
=$(NODEJS_MIPS_ARCH_VARIANT
)) \
97 $(if
$(NODEJS_MIPS_FPU_MODE
),--with-mips-fpu-mode
=$(NODEJS_MIPS_FPU_MODE
)) \
102 define NODEJS_BUILD_CMDS
103 $(TARGET_MAKE_ENV
) PYTHON
=$(HOST_DIR
)/usr
/bin
/python2 \
105 $(TARGET_CONFIGURE_OPTS
) \
110 # Build the list of modules to install based on the booleans for
111 # popular modules, as well as the "additional modules" list.
113 NODEJS_MODULES_LIST
= $(call qstrip
,\
114 $(if
$(BR2_PACKAGE_NODEJS_MODULES_EXPRESS
),express
) \
115 $(if
$(BR2_PACKAGE_NODEJS_MODULES_COFFEESCRIPT
),coffee-script
) \
116 $(BR2_PACKAGE_NODEJS_MODULES_ADDITIONAL
))
118 # Define NPM for other packages to use
119 NPM
= $(TARGET_CONFIGURE_OPTS
) \
121 npm_config_arch
=$(NODEJS_CPU
) \
122 npm_config_target_arch
=$(NODEJS_CPU
) \
123 npm_config_build_from_source
=true \
124 npm_config_nodedir
=$(BUILD_DIR
)/nodejs-
$(NODEJS_VERSION
) \
125 npm_config_prefix
=$(TARGET_DIR
)/usr \
126 $(HOST_DIR
)/usr
/bin
/npm
129 # We can only call NPM if there's something to install.
131 ifneq ($(NODEJS_MODULES_LIST
),)
132 define NODEJS_INSTALL_MODULES
133 # If you're having trouble with module installation, adding -d to the
134 # npm install call below and setting npm_config_rollback=false can both
135 # help in diagnosing the problem.
136 $(NPM
) install -g
$(NODEJS_MODULES_LIST
)
140 define NODEJS_INSTALL_TARGET_CMDS
141 $(TARGET_MAKE_ENV
) PYTHON
=$(HOST_DIR
)/usr
/bin
/python2 \
142 $(MAKE
) -C
$(@D
) install \
143 DESTDIR
=$(TARGET_DIR
) \
144 $(TARGET_CONFIGURE_OPTS
) \
146 $(NODEJS_INSTALL_MODULES
)
149 # node.js configure is a Python script and does not use autotools
150 $(eval
$(generic-package
))
151 $(eval
$(host-generic-package
))