1 ################################################################################
5 ################################################################################
7 NODEJS_VERSION = 0.10.38
8 NODEJS_SOURCE = node-v$(NODEJS_VERSION).tar.gz
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
16 ifeq ($(BR2_PACKAGE_OPENSSL),y)
17 NODEJS_DEPENDENCIES += openssl
20 # nodejs build system is based on python, but only support python-2.6 or
21 # python-2.7. So, we have to enforce PYTHON interpreter to be python2.
22 define HOST_NODEJS_CONFIGURE_CMDS
23 # Build with the static, built-in OpenSSL which is supplied as part of
24 # the nodejs source distribution. This is needed on the host because
25 # NPM is non-functional without it, and host-openssl isn't part of
28 $(HOST_CONFIGURE_OPTS) \
29 PYTHON=$(HOST_DIR)/usr/bin/python2 \
30 $(HOST_DIR)/usr/bin/python2 ./configure \
31 --prefix=$(HOST_DIR)/usr \
39 define HOST_NODEJS_BUILD_CMDS
40 $(HOST_MAKE_ENV) PYTHON=$(HOST_DIR)/usr/bin/python2 \
42 $(HOST_CONFIGURE_OPTS)
45 define HOST_NODEJS_INSTALL_CMDS
46 $(HOST_MAKE_ENV) PYTHON=$(HOST_DIR)/usr/bin/python2 \
47 $(MAKE) -C $(@D) install \
48 $(HOST_CONFIGURE_OPTS)
53 else ifeq ($(BR2_x86_64),y)
55 else ifeq ($(BR2_mipsel),y)
57 else ifeq ($(BR2_arm),y)
59 # V8 needs to know what floating point ABI the target is using.
60 NODEJS_ARM_FP = $(call qstrip,$(BR2_GCC_TARGET_FLOAT_ABI))
63 define NODEJS_CONFIGURE_CMDS
65 $(TARGET_CONFIGURE_OPTS) \
67 PYTHON=$(HOST_DIR)/usr/bin/python2 \
68 $(HOST_DIR)/usr/bin/python2 ./configure \
72 $(if $(BR2_PACKAGE_OPENSSL),--shared-openssl,--without-ssl) \
73 $(if $(BR2_PACKAGE_NODEJS_NPM),,--without-npm) \
76 --dest-cpu=$(NODEJS_CPU) \
77 $(if $(NODEJS_ARM_FP),--with-arm-float-abi=$(NODEJS_ARM_FP)) \
82 define NODEJS_BUILD_CMDS
83 $(TARGET_MAKE_ENV) PYTHON=$(HOST_DIR)/usr/bin/python2 \
85 $(TARGET_CONFIGURE_OPTS) \
90 # Build the list of modules to install based on the booleans for
91 # popular modules, as well as the "additional modules" list.
93 NODEJS_MODULES_LIST= $(call qstrip,\
94 $(if $(BR2_PACKAGE_NODEJS_MODULES_EXPRESS),express) \
95 $(if $(BR2_PACKAGE_NODEJS_MODULES_COFFEESCRIPT),coffee-script) \
96 $(BR2_PACKAGE_NODEJS_MODULES_ADDITIONAL))
99 # We can only call NPM if there's something to install.
101 ifneq ($(NODEJS_MODULES_LIST),)
102 define NODEJS_INSTALL_MODULES
103 # If you're having trouble with module installation, adding -d to the
104 # npm install call below and setting npm_config_rollback=false can both
105 # help in diagnosing the problem.
106 (cd $(TARGET_DIR)/usr/lib && mkdir -p node_modules && \
107 $(TARGET_CONFIGURE_OPTS) \
109 npm_config_arch=$(NODEJS_CPU) \
110 npm_config_nodedir=$(BUILD_DIR)/nodejs-$(NODEJS_VERSION) \
111 $(HOST_DIR)/usr/bin/npm install \
112 $(NODEJS_MODULES_LIST) \
117 define NODEJS_INSTALL_TARGET_CMDS
118 $(TARGET_MAKE_ENV) PYTHON=$(HOST_DIR)/usr/bin/python2 \
119 $(MAKE) -C $(@D) install \
120 DESTDIR=$(TARGET_DIR) \
121 $(TARGET_CONFIGURE_OPTS) \
123 $(NODEJS_INSTALL_MODULES)
126 # node.js configure is a Python script and does not use autotools
127 $(eval $(generic-package))
128 $(eval $(host-generic-package))