luaposix: bump to version 31
[buildroot-gz.git] / package / nodejs / nodejs.mk
blob874c5f19d29d2f87def4f9e2cafffdc3ae397f97
1 ################################################################################
3 # nodejs
5 ################################################################################
7 NODEJS_VERSION = 0.8.22
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 \
11 $(call qstrip,$(BR2_PACKAGE_NODEJS_MODULES_ADDITIONAL_DEPS))
12 HOST_NODEJS_DEPENDENCIES = host-python
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
18 endif
20 define HOST_NODEJS_CONFIGURE_CMDS
21 # Build with the static, built-in OpenSSL which is supplied as part of
22 # the nodejs source distribution. This is needed on the host because
23 # NPM is non-functional without it, and host-openssl isn't part of
24 # buildroot.
25 (cd $(@D); \
26 ./configure \
27 --prefix=$(HOST_DIR)/usr \
28 --without-snapshot \
29 --without-dtrace \
30 --without-etw \
32 endef
34 define HOST_NODEJS_BUILD_CMDS
35 $(HOST_MAKE_ENV) $(MAKE) -C $(@D)
36 endef
38 define HOST_NODEJS_INSTALL_CMDS
39 $(HOST_MAKE_ENV) $(MAKE) -C $(@D) install
40 endef
42 ifeq ($(BR2_i386),y)
43 NODEJS_CPU=ia32
44 else ifeq ($(BR2_x86_64),y)
45 NODEJS_CPU=x64
46 else ifeq ($(BR2_arm),y)
47 NODEJS_CPU=arm
48 # V8 needs to know what floating point ABI the target is using. There's also
49 # a 'hard' option which we're not exposing here at the moment, because
50 # buildroot itself doesn't really support it at present.
51 ifeq ($(BR2_SOFT_FLOAT),y)
52 NODEJS_ARM_FP=soft
53 else
54 NODEJS_ARM_FP=softfp
55 endif
56 endif
58 define NODEJS_CONFIGURE_CMDS
59 (cd $(@D); \
60 $(TARGET_CONFIGURE_OPTS) \
61 LD="$(TARGET_CXX)" \
62 ./configure \
63 --prefix=/usr \
64 --without-snapshot \
65 $(if $(BR2_PACKAGE_OPENSSL),--shared-openssl,--without-ssl) \
66 $(if $(BR2_PACKAGE_NODEJS_NPM),,--without-npm) \
67 --without-dtrace \
68 --without-etw \
69 --dest-cpu=$(NODEJS_CPU) \
70 $(if $(NODEJS_ARM_FP),--with-arm-float-abi=$(NODEJS_ARM_FP)) \
71 --dest-os=linux \
73 endef
75 define NODEJS_BUILD_CMDS
76 $(TARGET_MAKE_ENV) $(MAKE) $(TARGET_CONFIGURE_OPTS) -C $(@D)
77 endef
80 # Build the list of modules to install based on the booleans for
81 # popular modules, as well as the "additional modules" list.
83 NODEJS_MODULES_LIST= $(call qstrip,\
84 $(if $(BR2_PACKAGE_NODEJS_MODULES_EXPRESS),express) \
85 $(if $(BR2_PACKAGE_NODEJS_MODULES_COFFEESCRIPT),coffee-script) \
86 $(BR2_PACKAGE_NODEJS_MODULES_ADDITIONAL))
89 # We can only call NPM if there's something to install.
91 ifneq ($(NODEJS_MODULES_LIST),)
92 define NODEJS_INSTALL_MODULES
93 # If you're having trouble with module installation, adding -d to the
94 # npm install call below and setting npm_config_rollback=false can both
95 # help in diagnosing the problem.
96 (cd $(TARGET_DIR)/usr/lib && mkdir -p node_modules && \
97 $(TARGET_CONFIGURE_OPTS) \
98 LD="$(TARGET_CXX)" \
99 npm_config_arch=$(NODEJS_CPU) \
100 npm_config_nodedir=$(BUILD_DIR)/nodejs-$(NODEJS_VERSION) \
101 $(HOST_DIR)/usr/bin/npm install \
102 $(NODEJS_MODULES_LIST) \
104 endef
105 endif
107 define NODEJS_INSTALL_TARGET_CMDS
108 $(MAKE) $(TARGET_CONFIGURE_OPTS) -C $(@D) DESTDIR=$(TARGET_DIR) install
109 $(NODEJS_INSTALL_MODULES)
110 endef
112 # node.js configure is a Python script and does not use autotools
113 $(eval $(generic-package))
114 $(eval $(host-generic-package))