package/dhcp/S80dhcp-server: allow empty INTERFACES
[buildroot-gz.git] / package / nodejs / nodejs.mk
blobaf47b269c86d8cdc4ebfee4e0ae000b5fae5c7f2
1 ################################################################################
3 # nodejs
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
10 else
11 NODEJS_SOURCE = node-v$(NODEJS_VERSION).tar.gz
12 endif
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
22 endif
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
30 # buildroot.
31 (cd $(@D); \
32 $(HOST_CONFIGURE_OPTS) \
33 PYTHON=$(HOST_DIR)/usr/bin/python2 \
34 $(HOST_DIR)/usr/bin/python2 ./configure \
35 --prefix=$(HOST_DIR)/usr \
36 --without-snapshot \
37 --without-dtrace \
38 --without-etw \
39 --shared-zlib \
41 endef
43 define HOST_NODEJS_BUILD_CMDS
44 $(HOST_MAKE_ENV) PYTHON=$(HOST_DIR)/usr/bin/python2 \
45 $(MAKE) -C $(@D) \
46 $(HOST_CONFIGURE_OPTS)
47 endef
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)
53 endef
55 ifeq ($(BR2_i386),y)
56 NODEJS_CPU = ia32
57 else ifeq ($(BR2_x86_64),y)
58 NODEJS_CPU = x64
59 else ifeq ($(BR2_mips),y)
60 NODEJS_CPU = mips
61 else ifeq ($(BR2_mipsel),y)
62 NODEJS_CPU = mipsel
63 else ifeq ($(BR2_arm),y)
64 NODEJS_CPU = arm
65 # V8 needs to know what floating point ABI the target is using.
66 NODEJS_ARM_FP = $(call qstrip,$(BR2_GCC_TARGET_FLOAT_ABI))
67 endif
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
78 endif
79 endif
81 define NODEJS_CONFIGURE_CMDS
82 (cd $(@D); \
83 $(TARGET_CONFIGURE_OPTS) \
84 LD="$(TARGET_CXX)" \
85 PYTHON=$(HOST_DIR)/usr/bin/python2 \
86 $(HOST_DIR)/usr/bin/python2 ./configure \
87 --prefix=/usr \
88 --without-snapshot \
89 --shared-zlib \
90 $(if $(BR2_PACKAGE_OPENSSL),--shared-openssl,--without-ssl) \
91 $(if $(BR2_PACKAGE_NODEJS_NPM),,--without-npm) \
92 --without-dtrace \
93 --without-etw \
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)) \
98 --dest-os=linux \
100 endef
102 define NODEJS_BUILD_CMDS
103 $(TARGET_MAKE_ENV) PYTHON=$(HOST_DIR)/usr/bin/python2 \
104 $(MAKE) -C $(@D) \
105 $(TARGET_CONFIGURE_OPTS) \
106 LD="$(TARGET_CXX)"
107 endef
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) \
120 LD="$(TARGET_CXX)" \
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)
137 endef
138 endif
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) \
145 LD="$(TARGET_CXX)"
146 $(NODEJS_INSTALL_MODULES)
147 endef
149 # node.js configure is a Python script and does not use autotools
150 $(eval $(generic-package))
151 $(eval $(host-generic-package))