2013-06-06 01:53:30 +02:00
|
|
|
################################################################################
|
2013-03-07 16:31:16 +01:00
|
|
|
#
|
|
|
|
# nodejs
|
|
|
|
#
|
2013-06-06 01:53:30 +02:00
|
|
|
################################################################################
|
2013-03-07 16:31:16 +01:00
|
|
|
|
2021-08-27 18:33:55 +02:00
|
|
|
NODEJS_VERSION = 12.22.5
|
2015-10-19 23:59:08 +02:00
|
|
|
NODEJS_SOURCE = node-v$(NODEJS_VERSION).tar.xz
|
2013-03-07 16:31:16 +01:00
|
|
|
NODEJS_SITE = http://nodejs.org/dist/v$(NODEJS_VERSION)
|
2017-07-18 13:45:42 +02:00
|
|
|
NODEJS_DEPENDENCIES = host-python host-nodejs c-ares \
|
2019-10-16 18:57:05 +02:00
|
|
|
libuv zlib nghttp2 \
|
2014-10-25 08:20:44 +02:00
|
|
|
$(call qstrip,$(BR2_PACKAGE_NODEJS_MODULES_ADDITIONAL_DEPS))
|
2020-07-27 13:51:55 +02:00
|
|
|
HOST_NODEJS_DEPENDENCIES = host-icu host-libopenssl host-python host-zlib
|
2020-06-08 12:32:10 +02:00
|
|
|
NODEJS_INSTALL_STAGING = YES
|
2013-03-07 16:31:16 +01:00
|
|
|
NODEJS_LICENSE = MIT (core code); MIT, Apache and BSD family licenses (Bundled components)
|
|
|
|
NODEJS_LICENSE_FILES = LICENSE
|
2021-02-06 12:16:14 +01:00
|
|
|
NODEJS_CPE_ID_VENDOR = nodejs
|
|
|
|
NODEJS_CPE_ID_PRODUCT = node.js
|
2013-03-07 16:31:16 +01:00
|
|
|
|
2016-06-03 21:15:43 +02:00
|
|
|
NODEJS_CONF_OPTS = \
|
|
|
|
--without-snapshot \
|
|
|
|
--shared-zlib \
|
2017-07-18 13:45:41 +02:00
|
|
|
--shared-cares \
|
2017-07-18 13:45:43 +02:00
|
|
|
--shared-libuv \
|
2019-03-14 14:38:13 +01:00
|
|
|
--shared-nghttp2 \
|
2016-06-03 21:15:43 +02:00
|
|
|
--without-dtrace \
|
|
|
|
--without-etw \
|
2019-10-16 18:57:05 +02:00
|
|
|
--cross-compiling \
|
2016-06-03 21:15:43 +02:00
|
|
|
--dest-os=linux
|
|
|
|
|
2013-03-07 16:31:16 +01:00
|
|
|
ifeq ($(BR2_PACKAGE_OPENSSL),y)
|
2015-03-31 09:21:57 +02:00
|
|
|
NODEJS_DEPENDENCIES += openssl
|
2016-06-03 21:15:45 +02:00
|
|
|
NODEJS_CONF_OPTS += --shared-openssl
|
|
|
|
else
|
|
|
|
NODEJS_CONF_OPTS += --without-ssl
|
2013-03-07 16:31:16 +01:00
|
|
|
endif
|
|
|
|
|
2016-06-03 12:41:16 +02:00
|
|
|
ifeq ($(BR2_PACKAGE_ICU),y)
|
|
|
|
NODEJS_DEPENDENCIES += icu
|
2016-06-03 21:15:44 +02:00
|
|
|
NODEJS_CONF_OPTS += --with-intl=system-icu
|
|
|
|
else
|
|
|
|
NODEJS_CONF_OPTS += --with-intl=none
|
2016-06-03 12:41:16 +02:00
|
|
|
endif
|
|
|
|
|
2016-06-03 21:15:46 +02:00
|
|
|
ifneq ($(BR2_PACKAGE_NODEJS_NPM),y)
|
|
|
|
NODEJS_CONF_OPTS += --without-npm
|
|
|
|
endif
|
|
|
|
|
2014-04-15 00:09:48 +02:00
|
|
|
# nodejs build system is based on python, but only support python-2.6 or
|
|
|
|
# python-2.7. So, we have to enforce PYTHON interpreter to be python2.
|
2013-03-07 16:31:16 +01:00
|
|
|
define HOST_NODEJS_CONFIGURE_CMDS
|
2016-03-03 23:29:27 +01:00
|
|
|
# The build system directly calls python. Work around this by forcing python2
|
|
|
|
# into PATH. See https://github.com/nodejs/node/issues/2735
|
|
|
|
mkdir -p $(@D)/bin
|
2017-07-05 13:14:19 +02:00
|
|
|
ln -sf $(HOST_DIR)/bin/python2 $(@D)/bin/python
|
2016-03-03 23:29:27 +01:00
|
|
|
|
2013-03-07 16:31:16 +01:00
|
|
|
(cd $(@D); \
|
2014-04-15 00:09:47 +02:00
|
|
|
$(HOST_CONFIGURE_OPTS) \
|
2016-03-03 23:29:27 +01:00
|
|
|
PATH=$(@D)/bin:$(BR_PATH) \
|
2017-07-05 13:14:19 +02:00
|
|
|
PYTHON=$(HOST_DIR)/bin/python2 \
|
|
|
|
$(HOST_DIR)/bin/python2 ./configure \
|
2017-07-05 13:14:18 +02:00
|
|
|
--prefix=$(HOST_DIR) \
|
2013-03-07 16:31:16 +01:00
|
|
|
--without-snapshot \
|
|
|
|
--without-dtrace \
|
|
|
|
--without-etw \
|
2018-08-19 18:51:58 +02:00
|
|
|
--shared-openssl \
|
|
|
|
--shared-openssl-includes=$(HOST_DIR)/include/openssl \
|
|
|
|
--shared-openssl-libpath=$(HOST_DIR)/lib \
|
2014-08-15 19:20:03 +02:00
|
|
|
--shared-zlib \
|
2019-10-16 18:57:05 +02:00
|
|
|
--no-cross-compiling \
|
2020-07-27 13:51:55 +02:00
|
|
|
--with-intl=system-icu \
|
2013-03-07 16:31:16 +01:00
|
|
|
)
|
|
|
|
endef
|
|
|
|
|
2019-10-16 18:57:05 +02:00
|
|
|
NODEJS_HOST_TOOLS_V8 = \
|
2019-10-22 23:18:46 +02:00
|
|
|
torque \
|
|
|
|
gen-regexp-special-case \
|
|
|
|
bytecode_builtins_list_generator
|
2019-10-16 18:57:05 +02:00
|
|
|
NODEJS_HOST_TOOLS_NODE = mkcodecache
|
|
|
|
NODEJS_HOST_TOOLS = $(NODEJS_HOST_TOOLS_V8) $(NODEJS_HOST_TOOLS_NODE)
|
|
|
|
|
2020-07-27 13:51:55 +02:00
|
|
|
HOST_NODEJS_CXXFLAGS = $(HOST_CXXFLAGS) -DU_DISABLE_RENAMING=1
|
|
|
|
|
2013-03-07 16:31:16 +01:00
|
|
|
define HOST_NODEJS_BUILD_CMDS
|
2017-07-05 13:14:19 +02:00
|
|
|
$(HOST_MAKE_ENV) PYTHON=$(HOST_DIR)/bin/python2 \
|
2014-09-06 19:00:54 +02:00
|
|
|
$(MAKE) -C $(@D) \
|
2016-03-03 23:29:27 +01:00
|
|
|
$(HOST_CONFIGURE_OPTS) \
|
2020-07-27 13:51:55 +02:00
|
|
|
CXXFLAGS="$(HOST_NODEJS_CXXFLAGS)" \
|
2019-11-27 21:36:48 +01:00
|
|
|
LDFLAGS.host="$(HOST_LDFLAGS)" \
|
2017-06-20 10:39:01 +02:00
|
|
|
NO_LOAD=cctest.target.mk \
|
2016-03-03 23:29:27 +01:00
|
|
|
PATH=$(@D)/bin:$(BR_PATH)
|
2013-03-07 16:31:16 +01:00
|
|
|
endef
|
|
|
|
|
|
|
|
define HOST_NODEJS_INSTALL_CMDS
|
2017-07-05 13:14:19 +02:00
|
|
|
$(HOST_MAKE_ENV) PYTHON=$(HOST_DIR)/bin/python2 \
|
2014-09-06 19:00:54 +02:00
|
|
|
$(MAKE) -C $(@D) install \
|
2016-03-03 23:29:27 +01:00
|
|
|
$(HOST_CONFIGURE_OPTS) \
|
2020-07-27 13:51:55 +02:00
|
|
|
CXXFLAGS="$(HOST_NODEJS_CXXFLAGS)" \
|
2019-11-27 21:36:48 +01:00
|
|
|
LDFLAGS.host="$(HOST_LDFLAGS)" \
|
2017-06-20 10:39:01 +02:00
|
|
|
NO_LOAD=cctest.target.mk \
|
2016-03-03 23:29:27 +01:00
|
|
|
PATH=$(@D)/bin:$(BR_PATH)
|
2019-03-14 14:38:11 +01:00
|
|
|
|
2019-10-16 18:57:05 +02:00
|
|
|
$(foreach f,$(NODEJS_HOST_TOOLS), \
|
|
|
|
$(INSTALL) -m755 -D $(@D)/out/Release/$(f) $(HOST_DIR)/bin/$(f)
|
|
|
|
)
|
2013-03-07 16:31:16 +01:00
|
|
|
endef
|
|
|
|
|
|
|
|
ifeq ($(BR2_i386),y)
|
.mk files: bulk aligment and whitespace cleanup of assignments
The Buildroot coding style defines one space around make assignments and
does not align the assignment symbols.
This patch does a bulk fix of offending packages. The package
infrastructures (or more in general assignments to calculated variable
names, like $(2)_FOO) are not touched.
Alignment of line continuation characters (\) is kept as-is.
The sed command used to do this replacement is:
find * -name "*.mk" | xargs sed -i \
-e 's#^\([A-Z0-9a-z_]\+\)\s*\([?:+]\?=\)\s*$#\1 \2#'
-e 's#^\([A-Z0-9a-z_]\+\)\s*\([?:+]\?=\)\s*\([^\\]\+\)$#\1 \2 \3#'
-e 's#^\([A-Z0-9a-z_]\+\)\s*\([?:+]\?=\)\s*\([^\\ \t]\+\s*\\\)\s*$#\1 \2 \3#'
-e 's#^\([A-Z0-9a-z_]\+\)\s*\([?:+]\?=\)\(\s*\\\)#\1 \2\3#'
Brief explanation of this command:
^\([A-Z0-9a-z_]\+\) a regular variable at the beginning of the line
\([?:+]\?=\) any assignment character =, :=, ?=, +=
\([^\\]\+\) any string not containing a line continuation
\([^\\ \t]\+\s*\\\) string, optional whitespace, followed by a
line continuation character
\(\s*\\\) optional whitespace, followed by a line
continuation character
Hence, the first subexpression handles empty assignments, the second
handles regular assignments, the third handles regular assignments with
line continuation, and the fourth empty assignments with line
continuation.
This expression was tested on following test text: (initial tab not
included)
FOO = spaces before
FOO = spaces before and after
FOO = tab before
FOO = tab and spaces before
FOO = tab after
FOO = tab and spaces after
FOO = spaces and tab after
FOO = \
FOO = bar \
FOO = bar space \
FOO = \
GENIMAGE_DEPENDENCIES = host-pkgconf libconfuse
FOO += spaces before
FOO ?= spaces before and after
FOO :=
FOO =
FOO =
FOO =
FOO =
$(MAKE1) CROSS_COMPILE=$(TARGET_CROSS) -C
AT91BOOTSTRAP3_DEFCONFIG = \
AXEL_DISABLE_I18N=--i18n=0
After this bulk change, following manual fixups were done:
- fix line continuation alignment in cegui06 and spice (the sed
expression leaves the number of whitespace between the value and line
continuation character intact, but the whitespace before that could have
changed, causing misalignment.
- qt5base was reverted, as this package uses extensive alignment which
actually makes the code more readable.
Finally, the end result was manually reviewed.
Signed-off-by: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>
Cc: Yann E. Morin <yann.morin.1998@free.fr>
Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
2014-10-07 09:06:03 +02:00
|
|
|
NODEJS_CPU = ia32
|
2013-03-07 16:31:16 +01:00
|
|
|
else ifeq ($(BR2_x86_64),y)
|
.mk files: bulk aligment and whitespace cleanup of assignments
The Buildroot coding style defines one space around make assignments and
does not align the assignment symbols.
This patch does a bulk fix of offending packages. The package
infrastructures (or more in general assignments to calculated variable
names, like $(2)_FOO) are not touched.
Alignment of line continuation characters (\) is kept as-is.
The sed command used to do this replacement is:
find * -name "*.mk" | xargs sed -i \
-e 's#^\([A-Z0-9a-z_]\+\)\s*\([?:+]\?=\)\s*$#\1 \2#'
-e 's#^\([A-Z0-9a-z_]\+\)\s*\([?:+]\?=\)\s*\([^\\]\+\)$#\1 \2 \3#'
-e 's#^\([A-Z0-9a-z_]\+\)\s*\([?:+]\?=\)\s*\([^\\ \t]\+\s*\\\)\s*$#\1 \2 \3#'
-e 's#^\([A-Z0-9a-z_]\+\)\s*\([?:+]\?=\)\(\s*\\\)#\1 \2\3#'
Brief explanation of this command:
^\([A-Z0-9a-z_]\+\) a regular variable at the beginning of the line
\([?:+]\?=\) any assignment character =, :=, ?=, +=
\([^\\]\+\) any string not containing a line continuation
\([^\\ \t]\+\s*\\\) string, optional whitespace, followed by a
line continuation character
\(\s*\\\) optional whitespace, followed by a line
continuation character
Hence, the first subexpression handles empty assignments, the second
handles regular assignments, the third handles regular assignments with
line continuation, and the fourth empty assignments with line
continuation.
This expression was tested on following test text: (initial tab not
included)
FOO = spaces before
FOO = spaces before and after
FOO = tab before
FOO = tab and spaces before
FOO = tab after
FOO = tab and spaces after
FOO = spaces and tab after
FOO = \
FOO = bar \
FOO = bar space \
FOO = \
GENIMAGE_DEPENDENCIES = host-pkgconf libconfuse
FOO += spaces before
FOO ?= spaces before and after
FOO :=
FOO =
FOO =
FOO =
FOO =
$(MAKE1) CROSS_COMPILE=$(TARGET_CROSS) -C
AT91BOOTSTRAP3_DEFCONFIG = \
AXEL_DISABLE_I18N=--i18n=0
After this bulk change, following manual fixups were done:
- fix line continuation alignment in cegui06 and spice (the sed
expression leaves the number of whitespace between the value and line
continuation character intact, but the whitespace before that could have
changed, causing misalignment.
- qt5base was reverted, as this package uses extensive alignment which
actually makes the code more readable.
Finally, the end result was manually reviewed.
Signed-off-by: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>
Cc: Yann E. Morin <yann.morin.1998@free.fr>
Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
2014-10-07 09:06:03 +02:00
|
|
|
NODEJS_CPU = x64
|
2015-12-08 15:18:14 +01:00
|
|
|
else ifeq ($(BR2_mips),y)
|
|
|
|
NODEJS_CPU = mips
|
2013-12-17 02:16:15 +01:00
|
|
|
else ifeq ($(BR2_mipsel),y)
|
.mk files: bulk aligment and whitespace cleanup of assignments
The Buildroot coding style defines one space around make assignments and
does not align the assignment symbols.
This patch does a bulk fix of offending packages. The package
infrastructures (or more in general assignments to calculated variable
names, like $(2)_FOO) are not touched.
Alignment of line continuation characters (\) is kept as-is.
The sed command used to do this replacement is:
find * -name "*.mk" | xargs sed -i \
-e 's#^\([A-Z0-9a-z_]\+\)\s*\([?:+]\?=\)\s*$#\1 \2#'
-e 's#^\([A-Z0-9a-z_]\+\)\s*\([?:+]\?=\)\s*\([^\\]\+\)$#\1 \2 \3#'
-e 's#^\([A-Z0-9a-z_]\+\)\s*\([?:+]\?=\)\s*\([^\\ \t]\+\s*\\\)\s*$#\1 \2 \3#'
-e 's#^\([A-Z0-9a-z_]\+\)\s*\([?:+]\?=\)\(\s*\\\)#\1 \2\3#'
Brief explanation of this command:
^\([A-Z0-9a-z_]\+\) a regular variable at the beginning of the line
\([?:+]\?=\) any assignment character =, :=, ?=, +=
\([^\\]\+\) any string not containing a line continuation
\([^\\ \t]\+\s*\\\) string, optional whitespace, followed by a
line continuation character
\(\s*\\\) optional whitespace, followed by a line
continuation character
Hence, the first subexpression handles empty assignments, the second
handles regular assignments, the third handles regular assignments with
line continuation, and the fourth empty assignments with line
continuation.
This expression was tested on following test text: (initial tab not
included)
FOO = spaces before
FOO = spaces before and after
FOO = tab before
FOO = tab and spaces before
FOO = tab after
FOO = tab and spaces after
FOO = spaces and tab after
FOO = \
FOO = bar \
FOO = bar space \
FOO = \
GENIMAGE_DEPENDENCIES = host-pkgconf libconfuse
FOO += spaces before
FOO ?= spaces before and after
FOO :=
FOO =
FOO =
FOO =
FOO =
$(MAKE1) CROSS_COMPILE=$(TARGET_CROSS) -C
AT91BOOTSTRAP3_DEFCONFIG = \
AXEL_DISABLE_I18N=--i18n=0
After this bulk change, following manual fixups were done:
- fix line continuation alignment in cegui06 and spice (the sed
expression leaves the number of whitespace between the value and line
continuation character intact, but the whitespace before that could have
changed, causing misalignment.
- qt5base was reverted, as this package uses extensive alignment which
actually makes the code more readable.
Finally, the end result was manually reviewed.
Signed-off-by: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>
Cc: Yann E. Morin <yann.morin.1998@free.fr>
Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
2014-10-07 09:06:03 +02:00
|
|
|
NODEJS_CPU = mipsel
|
2013-03-07 16:31:16 +01:00
|
|
|
else ifeq ($(BR2_arm),y)
|
.mk files: bulk aligment and whitespace cleanup of assignments
The Buildroot coding style defines one space around make assignments and
does not align the assignment symbols.
This patch does a bulk fix of offending packages. The package
infrastructures (or more in general assignments to calculated variable
names, like $(2)_FOO) are not touched.
Alignment of line continuation characters (\) is kept as-is.
The sed command used to do this replacement is:
find * -name "*.mk" | xargs sed -i \
-e 's#^\([A-Z0-9a-z_]\+\)\s*\([?:+]\?=\)\s*$#\1 \2#'
-e 's#^\([A-Z0-9a-z_]\+\)\s*\([?:+]\?=\)\s*\([^\\]\+\)$#\1 \2 \3#'
-e 's#^\([A-Z0-9a-z_]\+\)\s*\([?:+]\?=\)\s*\([^\\ \t]\+\s*\\\)\s*$#\1 \2 \3#'
-e 's#^\([A-Z0-9a-z_]\+\)\s*\([?:+]\?=\)\(\s*\\\)#\1 \2\3#'
Brief explanation of this command:
^\([A-Z0-9a-z_]\+\) a regular variable at the beginning of the line
\([?:+]\?=\) any assignment character =, :=, ?=, +=
\([^\\]\+\) any string not containing a line continuation
\([^\\ \t]\+\s*\\\) string, optional whitespace, followed by a
line continuation character
\(\s*\\\) optional whitespace, followed by a line
continuation character
Hence, the first subexpression handles empty assignments, the second
handles regular assignments, the third handles regular assignments with
line continuation, and the fourth empty assignments with line
continuation.
This expression was tested on following test text: (initial tab not
included)
FOO = spaces before
FOO = spaces before and after
FOO = tab before
FOO = tab and spaces before
FOO = tab after
FOO = tab and spaces after
FOO = spaces and tab after
FOO = \
FOO = bar \
FOO = bar space \
FOO = \
GENIMAGE_DEPENDENCIES = host-pkgconf libconfuse
FOO += spaces before
FOO ?= spaces before and after
FOO :=
FOO =
FOO =
FOO =
FOO =
$(MAKE1) CROSS_COMPILE=$(TARGET_CROSS) -C
AT91BOOTSTRAP3_DEFCONFIG = \
AXEL_DISABLE_I18N=--i18n=0
After this bulk change, following manual fixups were done:
- fix line continuation alignment in cegui06 and spice (the sed
expression leaves the number of whitespace between the value and line
continuation character intact, but the whitespace before that could have
changed, causing misalignment.
- qt5base was reverted, as this package uses extensive alignment which
actually makes the code more readable.
Finally, the end result was manually reviewed.
Signed-off-by: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>
Cc: Yann E. Morin <yann.morin.1998@free.fr>
Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
2014-10-07 09:06:03 +02:00
|
|
|
NODEJS_CPU = arm
|
2015-01-12 21:52:01 +01:00
|
|
|
# V8 needs to know what floating point ABI the target is using.
|
2018-09-12 12:22:53 +02:00
|
|
|
NODEJS_ARM_FP = $(GCC_TARGET_FLOAT_ABI)
|
2019-11-27 21:36:47 +01:00
|
|
|
# it also wants to know which FPU to use, but only has support for
|
|
|
|
# vfp, vfpv3, vfpv3-d16 and neon.
|
|
|
|
ifeq ($(BR2_ARM_FPU_VFPV2),y)
|
|
|
|
NODEJS_ARM_FPU = vfp
|
|
|
|
# vfpv4 is a superset of vfpv3
|
|
|
|
else ifeq ($(BR2_ARM_FPU_VFPV3)$(BR2_ARM_FPU_VFPV4),y)
|
|
|
|
NODEJS_ARM_FPU = vfpv3
|
|
|
|
# vfpv4-d16 is a superset of vfpv3-d16
|
|
|
|
else ifeq ($(BR2_ARM_FPU_VFPV3D16)$(BR2_ARM_FPU_VFPV4D16),y)
|
|
|
|
NODEJS_ARM_FPU = vfpv3-d16
|
|
|
|
else ifeq ($(BR2_ARM_FPU_NEON),y)
|
|
|
|
NODEJS_ARM_FPU = neon
|
|
|
|
endif
|
2019-11-27 21:36:46 +01:00
|
|
|
else ifeq ($(BR2_aarch64),y)
|
|
|
|
NODEJS_CPU = arm64
|
2013-03-07 16:31:16 +01:00
|
|
|
endif
|
|
|
|
|
2015-12-08 15:24:47 +01:00
|
|
|
# MIPS architecture specific options
|
|
|
|
ifeq ($(BR2_mips)$(BR2_mipsel),y)
|
2016-09-30 11:36:49 +02:00
|
|
|
ifeq ($(BR2_MIPS_CPU_MIPS32R6),y)
|
2015-12-08 15:24:47 +01:00
|
|
|
NODEJS_MIPS_ARCH_VARIANT = r6
|
|
|
|
NODEJS_MIPS_FPU_MODE = fp64
|
2016-09-30 11:36:49 +02:00
|
|
|
else ifeq ($(BR2_MIPS_CPU_MIPS32R2),y)
|
2015-12-08 15:24:47 +01:00
|
|
|
NODEJS_MIPS_ARCH_VARIANT = r2
|
2016-09-30 11:36:49 +02:00
|
|
|
else ifeq ($(BR2_MIPS_CPU_MIPS32),y)
|
2015-12-08 15:24:47 +01:00
|
|
|
NODEJS_MIPS_ARCH_VARIANT = r1
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
2019-03-17 21:48:00 +01:00
|
|
|
NODEJS_LDFLAGS = $(TARGET_LDFLAGS)
|
|
|
|
|
|
|
|
ifeq ($(BR2_TOOLCHAIN_HAS_LIBATOMIC),y)
|
|
|
|
NODEJS_LDFLAGS += -latomic
|
|
|
|
endif
|
|
|
|
|
2013-03-07 16:31:16 +01:00
|
|
|
define NODEJS_CONFIGURE_CMDS
|
2016-03-03 23:29:27 +01:00
|
|
|
mkdir -p $(@D)/bin
|
2017-07-05 13:14:19 +02:00
|
|
|
ln -sf $(HOST_DIR)/bin/python2 $(@D)/bin/python
|
2016-03-03 23:29:27 +01:00
|
|
|
|
2013-03-07 16:31:16 +01:00
|
|
|
(cd $(@D); \
|
|
|
|
$(TARGET_CONFIGURE_OPTS) \
|
2016-03-03 23:29:27 +01:00
|
|
|
PATH=$(@D)/bin:$(BR_PATH) \
|
2019-03-17 21:48:00 +01:00
|
|
|
LDFLAGS="$(NODEJS_LDFLAGS)" \
|
2013-03-07 16:31:16 +01:00
|
|
|
LD="$(TARGET_CXX)" \
|
2017-07-05 13:14:19 +02:00
|
|
|
PYTHON=$(HOST_DIR)/bin/python2 \
|
|
|
|
$(HOST_DIR)/bin/python2 ./configure \
|
2013-03-07 16:31:16 +01:00
|
|
|
--prefix=/usr \
|
|
|
|
--dest-cpu=$(NODEJS_CPU) \
|
|
|
|
$(if $(NODEJS_ARM_FP),--with-arm-float-abi=$(NODEJS_ARM_FP)) \
|
2019-11-27 21:36:47 +01:00
|
|
|
$(if $(NODEJS_ARM_FPU),--with-arm-fpu=$(NODEJS_ARM_FPU)) \
|
2015-12-08 15:24:47 +01:00
|
|
|
$(if $(NODEJS_MIPS_ARCH_VARIANT),--with-mips-arch-variant=$(NODEJS_MIPS_ARCH_VARIANT)) \
|
|
|
|
$(if $(NODEJS_MIPS_FPU_MODE),--with-mips-fpu-mode=$(NODEJS_MIPS_FPU_MODE)) \
|
2016-06-03 21:15:43 +02:00
|
|
|
$(NODEJS_CONF_OPTS) \
|
2013-03-07 16:31:16 +01:00
|
|
|
)
|
2019-03-14 14:38:11 +01:00
|
|
|
|
2019-10-16 18:57:05 +02:00
|
|
|
$(foreach f,$(NODEJS_HOST_TOOLS_V8), \
|
|
|
|
$(SED) "s#<(PRODUCT_DIR)/<(EXECUTABLE_PREFIX)$(f)<(EXECUTABLE_SUFFIX)#$(HOST_DIR)/bin/$(f)#" \
|
|
|
|
$(@D)/tools/v8_gypfiles/v8.gyp
|
|
|
|
)
|
|
|
|
$(foreach f,$(NODEJS_HOST_TOOLS_NODE), \
|
|
|
|
$(SED) "s#<(PRODUCT_DIR)/<(EXECUTABLE_PREFIX)$(f)<(EXECUTABLE_SUFFIX)#$(HOST_DIR)/bin/$(f)#" \
|
|
|
|
-i $(@D)/node.gyp
|
|
|
|
)
|
2013-03-07 16:31:16 +01:00
|
|
|
endef
|
|
|
|
|
|
|
|
define NODEJS_BUILD_CMDS
|
2017-07-05 13:14:19 +02:00
|
|
|
$(TARGET_MAKE_ENV) PYTHON=$(HOST_DIR)/bin/python2 \
|
2014-04-15 00:09:48 +02:00
|
|
|
$(MAKE) -C $(@D) \
|
2014-04-15 00:09:47 +02:00
|
|
|
$(TARGET_CONFIGURE_OPTS) \
|
2017-06-20 10:39:01 +02:00
|
|
|
NO_LOAD=cctest.target.mk \
|
2016-03-03 23:29:27 +01:00
|
|
|
PATH=$(@D)/bin:$(BR_PATH) \
|
2019-03-17 21:48:00 +01:00
|
|
|
LDFLAGS="$(NODEJS_LDFLAGS)" \
|
2014-04-15 00:09:47 +02:00
|
|
|
LD="$(TARGET_CXX)"
|
2013-03-07 16:31:16 +01:00
|
|
|
endef
|
|
|
|
|
|
|
|
#
|
2017-05-06 15:19:13 +02:00
|
|
|
# Build the list of modules to install.
|
2013-03-07 16:31:16 +01:00
|
|
|
#
|
|
|
|
NODEJS_MODULES_LIST= $(call qstrip,\
|
|
|
|
$(BR2_PACKAGE_NODEJS_MODULES_ADDITIONAL))
|
|
|
|
|
2015-07-02 11:43:27 +02:00
|
|
|
# Define NPM for other packages to use
|
|
|
|
NPM = $(TARGET_CONFIGURE_OPTS) \
|
2019-03-17 21:48:00 +01:00
|
|
|
LDFLAGS="$(NODEJS_LDFLAGS)" \
|
2015-07-02 11:43:27 +02:00
|
|
|
LD="$(TARGET_CXX)" \
|
|
|
|
npm_config_arch=$(NODEJS_CPU) \
|
|
|
|
npm_config_target_arch=$(NODEJS_CPU) \
|
|
|
|
npm_config_build_from_source=true \
|
|
|
|
npm_config_nodedir=$(BUILD_DIR)/nodejs-$(NODEJS_VERSION) \
|
2015-10-28 16:59:53 +01:00
|
|
|
npm_config_prefix=$(TARGET_DIR)/usr \
|
package/nodejs: use per-build cache directories
When two Buildroot builds run in parallel, and they both happen to call
npm at roughly the same time, the two npm instances may conflict when
accessing the npm cache, which is by default ~/.npm
Although npm is supposed to lock access to the cache, it seems it does
sometimes fail to do so properly, bailling out in error, when it would
never ever crash at all when not running in parallel. We suspect that
the sequence leading to such failures are something like:
npm-1 npm-2
lock(retry=few, sleep=short) .
does-stuff() .
. lock(retry=few, sleep=short)
. # can't lock local cache
. download-module()
. # can't download
. exit(1)
unlock()
As per the docs [0], few = 10, short = 10. So if the first npm (npm-1)
takes more than 100s (which can happen behind slow links and/or big
modules that contain native code that is compiled), then the second npm
(npm-2) will bail out (the download would fail if there is no network
access, for example, and only local modules are used).
Point npm to use a per-build cache directory, so they no longer compete
across builds.
That would still need some care when we do top-level parallel builds,
though.
Note also that the conflicts are not totally eliminated: two or more npm
instances may still compete for some other resource that has not yet
been identified.
But, at least, the conflict window has been drastically shortened now,
to the point where it now seldom occurs.
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
2018-10-13 17:05:58 +02:00
|
|
|
npm_config_cache=$(BUILD_DIR)/.npm-cache \
|
2017-07-05 13:14:19 +02:00
|
|
|
$(HOST_DIR)/bin/npm
|
2015-07-02 11:43:27 +02:00
|
|
|
|
2013-03-07 16:31:16 +01:00
|
|
|
#
|
|
|
|
# We can only call NPM if there's something to install.
|
|
|
|
#
|
|
|
|
ifneq ($(NODEJS_MODULES_LIST),)
|
|
|
|
define NODEJS_INSTALL_MODULES
|
|
|
|
# If you're having trouble with module installation, adding -d to the
|
|
|
|
# npm install call below and setting npm_config_rollback=false can both
|
|
|
|
# help in diagnosing the problem.
|
2015-10-28 16:59:53 +01:00
|
|
|
$(NPM) install -g $(NODEJS_MODULES_LIST)
|
2013-03-07 16:31:16 +01:00
|
|
|
endef
|
|
|
|
endif
|
|
|
|
|
2020-06-08 12:32:10 +02:00
|
|
|
define NODEJS_INSTALL_STAGING_CMDS
|
|
|
|
$(TARGET_MAKE_ENV) PYTHON=$(HOST_DIR)/bin/python2 \
|
|
|
|
$(MAKE) -C $(@D) install \
|
|
|
|
DESTDIR=$(STAGING_DIR) \
|
|
|
|
$(TARGET_CONFIGURE_OPTS) \
|
|
|
|
NO_LOAD=cctest.target.mk \
|
|
|
|
PATH=$(@D)/bin:$(BR_PATH) \
|
|
|
|
LDFLAGS="$(NODEJS_LDFLAGS)" \
|
|
|
|
LD="$(TARGET_CXX)"
|
|
|
|
endef
|
|
|
|
|
2013-03-07 16:31:16 +01:00
|
|
|
define NODEJS_INSTALL_TARGET_CMDS
|
2017-07-05 13:14:19 +02:00
|
|
|
$(TARGET_MAKE_ENV) PYTHON=$(HOST_DIR)/bin/python2 \
|
2014-04-15 00:09:48 +02:00
|
|
|
$(MAKE) -C $(@D) install \
|
2014-04-15 00:09:47 +02:00
|
|
|
DESTDIR=$(TARGET_DIR) \
|
|
|
|
$(TARGET_CONFIGURE_OPTS) \
|
2017-06-20 10:39:01 +02:00
|
|
|
NO_LOAD=cctest.target.mk \
|
2016-03-03 23:29:27 +01:00
|
|
|
PATH=$(@D)/bin:$(BR_PATH) \
|
2019-03-17 21:48:00 +01:00
|
|
|
LDFLAGS="$(NODEJS_LDFLAGS)" \
|
2014-04-15 00:09:47 +02:00
|
|
|
LD="$(TARGET_CXX)"
|
2013-03-07 16:31:16 +01:00
|
|
|
$(NODEJS_INSTALL_MODULES)
|
|
|
|
endef
|
|
|
|
|
|
|
|
# node.js configure is a Python script and does not use autotools
|
|
|
|
$(eval $(generic-package))
|
|
|
|
$(eval $(host-generic-package))
|