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
|
|
|
|
2015-06-27 04:01:34 +02:00
|
|
|
NODEJS_VERSION = $(call qstrip,$(BR2_PACKAGE_NODEJS_VERSION_STRING))
|
2013-03-07 16:31:16 +01:00
|
|
|
NODEJS_SOURCE = node-v$(NODEJS_VERSION).tar.gz
|
|
|
|
NODEJS_SITE = http://nodejs.org/dist/v$(NODEJS_VERSION)
|
2014-08-15 19:20:03 +02:00
|
|
|
NODEJS_DEPENDENCIES = host-python host-nodejs zlib \
|
2014-10-25 08:20:44 +02:00
|
|
|
$(call qstrip,$(BR2_PACKAGE_NODEJS_MODULES_ADDITIONAL_DEPS))
|
2014-08-15 19:20:03 +02:00
|
|
|
HOST_NODEJS_DEPENDENCIES = host-python host-zlib
|
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
|
|
|
|
|
|
|
|
ifeq ($(BR2_PACKAGE_OPENSSL),y)
|
2015-03-31 09:21:57 +02:00
|
|
|
NODEJS_DEPENDENCIES += openssl
|
2013-03-07 16:31:16 +01:00
|
|
|
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
|
|
|
|
# Build with the static, built-in OpenSSL which is supplied as part of
|
|
|
|
# the nodejs source distribution. This is needed on the host because
|
|
|
|
# NPM is non-functional without it, and host-openssl isn't part of
|
|
|
|
# buildroot.
|
|
|
|
(cd $(@D); \
|
2014-04-15 00:09:47 +02:00
|
|
|
$(HOST_CONFIGURE_OPTS) \
|
2014-04-15 00:09:48 +02:00
|
|
|
PYTHON=$(HOST_DIR)/usr/bin/python2 \
|
|
|
|
$(HOST_DIR)/usr/bin/python2 ./configure \
|
2013-03-07 16:31:16 +01:00
|
|
|
--prefix=$(HOST_DIR)/usr \
|
|
|
|
--without-snapshot \
|
|
|
|
--without-dtrace \
|
|
|
|
--without-etw \
|
2014-08-15 19:20:03 +02:00
|
|
|
--shared-zlib \
|
2013-03-07 16:31:16 +01:00
|
|
|
)
|
|
|
|
endef
|
|
|
|
|
|
|
|
define HOST_NODEJS_BUILD_CMDS
|
2014-09-06 19:00:54 +02:00
|
|
|
$(HOST_MAKE_ENV) PYTHON=$(HOST_DIR)/usr/bin/python2 \
|
|
|
|
$(MAKE) -C $(@D) \
|
|
|
|
$(HOST_CONFIGURE_OPTS)
|
2013-03-07 16:31:16 +01:00
|
|
|
endef
|
|
|
|
|
|
|
|
define HOST_NODEJS_INSTALL_CMDS
|
2014-09-06 19:00:54 +02:00
|
|
|
$(HOST_MAKE_ENV) PYTHON=$(HOST_DIR)/usr/bin/python2 \
|
|
|
|
$(MAKE) -C $(@D) install \
|
|
|
|
$(HOST_CONFIGURE_OPTS)
|
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
|
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.
|
|
|
|
NODEJS_ARM_FP = $(call qstrip,$(BR2_GCC_TARGET_FLOAT_ABI))
|
2013-03-07 16:31:16 +01:00
|
|
|
endif
|
|
|
|
|
|
|
|
define NODEJS_CONFIGURE_CMDS
|
|
|
|
(cd $(@D); \
|
|
|
|
$(TARGET_CONFIGURE_OPTS) \
|
|
|
|
LD="$(TARGET_CXX)" \
|
2014-04-15 00:09:48 +02:00
|
|
|
PYTHON=$(HOST_DIR)/usr/bin/python2 \
|
|
|
|
$(HOST_DIR)/usr/bin/python2 ./configure \
|
2013-03-07 16:31:16 +01:00
|
|
|
--prefix=/usr \
|
|
|
|
--without-snapshot \
|
2014-08-15 19:20:03 +02:00
|
|
|
--shared-zlib \
|
2014-11-17 12:41:56 +01:00
|
|
|
$(if $(BR2_PACKAGE_OPENSSL),--shared-openssl,--without-ssl) \
|
2013-03-07 16:31:16 +01:00
|
|
|
$(if $(BR2_PACKAGE_NODEJS_NPM),,--without-npm) \
|
|
|
|
--without-dtrace \
|
|
|
|
--without-etw \
|
|
|
|
--dest-cpu=$(NODEJS_CPU) \
|
|
|
|
$(if $(NODEJS_ARM_FP),--with-arm-float-abi=$(NODEJS_ARM_FP)) \
|
|
|
|
--dest-os=linux \
|
|
|
|
)
|
|
|
|
endef
|
|
|
|
|
|
|
|
define NODEJS_BUILD_CMDS
|
2014-04-15 00:09:48 +02:00
|
|
|
$(TARGET_MAKE_ENV) PYTHON=$(HOST_DIR)/usr/bin/python2 \
|
|
|
|
$(MAKE) -C $(@D) \
|
2014-04-15 00:09:47 +02:00
|
|
|
$(TARGET_CONFIGURE_OPTS) \
|
|
|
|
LD="$(TARGET_CXX)"
|
2013-03-07 16:31:16 +01:00
|
|
|
endef
|
|
|
|
|
|
|
|
#
|
|
|
|
# Build the list of modules to install based on the booleans for
|
|
|
|
# popular modules, as well as the "additional modules" list.
|
|
|
|
#
|
|
|
|
NODEJS_MODULES_LIST= $(call qstrip,\
|
|
|
|
$(if $(BR2_PACKAGE_NODEJS_MODULES_EXPRESS),express) \
|
|
|
|
$(if $(BR2_PACKAGE_NODEJS_MODULES_COFFEESCRIPT),coffee-script) \
|
|
|
|
$(BR2_PACKAGE_NODEJS_MODULES_ADDITIONAL))
|
|
|
|
|
2015-07-02 11:43:27 +02:00
|
|
|
# Define NPM for other packages to use
|
|
|
|
NPM = $(TARGET_CONFIGURE_OPTS) \
|
|
|
|
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) \
|
|
|
|
$(HOST_DIR)/usr/bin/npm
|
|
|
|
|
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.
|
|
|
|
(cd $(TARGET_DIR)/usr/lib && mkdir -p node_modules && \
|
2015-07-02 11:43:27 +02:00
|
|
|
$(NPM) install $(NODEJS_MODULES_LIST) \
|
2013-03-07 16:31:16 +01:00
|
|
|
)
|
2015-07-02 11:43:25 +02:00
|
|
|
|
|
|
|
# Symlink all executables in $(TARGET_DIR)/usr/lib/node_modules/.bin to
|
|
|
|
# $(TARGET_DIR)/usr/bin so they are accessible from the command line
|
|
|
|
cd $(TARGET_DIR)/usr/bin; \
|
|
|
|
for f in ../../usr/lib/node_modules/.bin/*; do \
|
|
|
|
[ -f "$${f}" -a -x "$${f}" ] || continue; \
|
|
|
|
ln -sf "$${f}" "$${f##*/}" || exit 1; \
|
|
|
|
done
|
2013-03-07 16:31:16 +01:00
|
|
|
endef
|
|
|
|
endif
|
|
|
|
|
|
|
|
define NODEJS_INSTALL_TARGET_CMDS
|
2014-04-15 00:09:48 +02:00
|
|
|
$(TARGET_MAKE_ENV) PYTHON=$(HOST_DIR)/usr/bin/python2 \
|
|
|
|
$(MAKE) -C $(@D) install \
|
2014-04-15 00:09:47 +02:00
|
|
|
DESTDIR=$(TARGET_DIR) \
|
|
|
|
$(TARGET_CONFIGURE_OPTS) \
|
|
|
|
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))
|