nodejs: new package
PATCH v5 2/2 nodejs: new package
Based off of patches posted by (and Signed-off-by:) Jonathan Liu <[email protected]>
--- package/Config.in | 1 + package/nodejs/Config.in | 78 +++++++++++++++++++++ package/nodejs/nodejs-v8-gregs-fix.patch | 29 ++++++++ package/nodejs/nodejs.mk | 109 ++++++++++++++++++++++++++++++ 4 files changed, 217 insertions(+), 0 deletions(-) create mode 100644 package/nodejs/Config.in create mode 100644 package/nodejs/nodejs-v8-gregs-fix.patch create mode 100644 package/nodejs/nodejs.mk
package/Config.in +1 -0
@@ -314,6 +314,7 @@ source "package/cpanminus/Config.in" endmenu endif source "package/microperl/Config.in" +source "package/nodejs/Config.in" source "package/php/Config.in" source "package/python/Config.in" source "package/python3/Config.in"
package/nodejs/Config.in new file +78 -0
78 lines not on this page · raw message
package/nodejs/nodejs-v8-gregs-fix.patch new file +29 -0
@@ -0,0 +1,29 @@ +Fix compilation for ARM/uClibc +Patch from Remi Duraffort <[email protected]>, taken from +https://code.google.com/p/v8/source/detail?r=12094 + +Signed-off-by: Daniel Price <[email protected]> + +--- a/deps/v8/src/platform-linux.cc ++++ b/deps/v8/src/platform-linux.cc +@@ -1025,7 +1025,8 @@ static void ProfilerSignalHandler(int signal, siginfo_t* info, void* context) { + sample->fp = reinterpret_cast<Address>(mcontext.gregs[REG_RBP]); + #elif V8_HOST_ARCH_ARM + // An undefined macro evaluates to 0, so this applies to Android's Bionic also. +-#if (__GLIBC__ < 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ <= 3)) ++#if (__GLIBC__ < 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ <= 3) && \ ++ !defined(__UCLIBC__)) + sample->pc = reinterpret_cast<Address>(mcontext.gregs[R15]); + sample->sp = reinterpret_cast<Address>(mcontext.gregs[R13]); + sample->fp = reinterpret_cast<Address>(mcontext.gregs[R11]); +@@ -1033,7 +1034,8 @@ static void ProfilerSignalHandler(int signal, siginfo_t* info, void* context) { + sample->pc = reinterpret_cast<Address>(mcontext.arm_pc); + sample->sp = reinterpret_cast<Address>(mcontext.arm_sp); + sample->fp = reinterpret_cast<Address>(mcontext.arm_fp); +-#endif // (__GLIBC__ < 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ <= 3)) ++#endif // (__GLIBC__ < 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ <= 3) && ++ // !defined(__UCLIBC__)) + #elif V8_HOST_ARCH_MIPS + sample->pc = reinterpret_cast<Address>(mcontext.pc); + sample->sp = reinterpret_cast<Address>(mcontext.gregs[29]); +
package/nodejs/nodejs.mk new file +109 -0
109 lines not on this page · raw message
Signature · 1 line
1.7.6.5
PATCH v5 2/2 nodejs: new package
Dear Daniel Price,
Quoted 12 lines · Daniel Price
package/nodejs/Config.in new file +6
-0@@ -0,0 +1,78 @@ +config BR2_PACKAGE_NODEJS + bool "nodejs" + depends on BR2_INET_IPV6 + depends on BR2_LARGEFILE + depends on BR2_TOOLCHAIN_HAS_THREADS + depends on BR2_INSTALL_LIBSTDCPP
package/nodejs/Config.in line 16
Quoted 10 lines
package/nodejs/Config.in new file +10
-0+ depends on BR2_arm || BR2_i386 || BR2_x86_64 + # uses fork() + depends on BR2_USE_MMU + help + Event-driven I/O server-side JavaScript environment based on V8. + + http://nodejs.org/ + +comment "nodejs requires a toolchain with C++, IPv6, large files, and threading" + depends on !BR2_INSTALL_LIBSTDCPP || !BR2_LARGEFILE || !BR2_TOOLCHAIN_HAS_THREADS || !BR2_INET_IPV6
We generally want lines like this to be split on two lines:
comment "nodejs requires a toolchain with C++, IPv6, large files, and threading"
depends on !BR2_INSTALL_LIBSTDCPP || !BR2_LARGEFILE || \ !BR2_TOOLCHAIN_HAS_THREADS || !BR2_INET_IPV6
Quoted 9 lines
package/nodejs/nodejs.mk new file +3
-0@@ -0,0 +1,109 @@ +############################################################# +# +# nodejs
package/nodejs/nodejs.mk line 13
Quoted 10 lines
package/nodejs/nodejs.mk new file +10
-0+# +############################################################# + +NODEJS_VERSION = 0.8.21 +NODEJS_SOURCE = node-v$(NODEJS_VERSION).tar.gz +NODEJS_SITE = http://nodejs.org/dist/v$(NODEJS_VERSION) +NODEJS_DEPENDENCIES = host-python host-nodejs \ + $(call qstrip,$(BR2_PACKAGE_NODEJS_MODULES_ADDITIONAL_DEPS)) +HOST_NODEJS_DEPENDENCIES = host-python +NODEJS_LICENSE = MIT
Please add:
NODEJS_LICENSE_FILES = LICENSE
That said, as the LICENSE file explains, nodejs source code includes some code from various other projects, under other licenses. Maybe the licensing experts should tell us what value NODEJS_LICENSE should have here. Yann? Luca? See
https://github.com/joyent/node/blob/master/LICENSE if you don't want to download the whole nodejs source code.
Quoted 9 lines
package/nodejs/nodejs.mk new file +9
-0+define HOST_NODEJS_INSTALL_CMDS + $(HOST_MAKE_ENV) $(MAKE) -C $(@D) install +endef + +ifeq ($(BR2_i386),y) +NODEJS_CPU=ia32 +else ifeq ($(BR2_x86_64),y) +NODEJS_CPU=x64 +else ifeq ($(BR2_arm),y)
package/nodejs/nodejs.mk line 55
Quoted 10 lines
package/nodejs/nodejs.mk new file +10
-0+NODEJS_CPU=arm +# V8 needs to know what floating point ABI the target is using. There's also +# a 'hard' option which we're not exposing here at the moment, because +# buildroot itself doesn't really support it at present. +ifeq ($(BR2_SOFT_FLOAT),y) +NODEJS_ARM_FP=soft +else +NODEJS_ARM_FP=softfp +endif +endif
In fact, using BR2_SOFT_FLOAT doesn't work very well: on ARM, with an external toolchain, BR2_SOFT_FLOAT will always be 'y', and therefore, when NodeJS is built with a hard-float toolchain like Linaro ARM toolchains, it doesn't work at runtime.
But that's not your fault, it's the Buildroot infrastructure that doesn't handle this very well. So keep this as it is for now.
package/nodejs/nodejs.mk line 86
Quoted 9 lines
package/nodejs/nodejs.mk new file +9
-0+# +# Build the list of modules to install based on the booleans for +# popular modules, as well as the "additional modules" list. +# qstrip the whole thing to remove whitespace. +# +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))
When reviewing the previous version, I did suggest to use qstrip only where needed, and to remove useless commas:
NODEJS_MODULES_LIST = \ $(if $(BR2_PACKAGE_NODEJS_MODULES_EXPRESS),express) \ $(if $(BR2_PACKAGE_NODEJS_MODULES_COFFEESCRIPT),coffee-script) \ $(call qstrip,$(BR2_PACKAGE_NODEJS_MODULES_ADDITIONAL))
Quoted 8 lines
package/nodejs/nodejs.mk new file +8
-0+define NODEJS_INSTALL_TARGET_CMDS + $(MAKE) $(TARGET_CONFIGURE_OPTS) -C $(@D) DESTDIR=$(TARGET_DIR) install + + # 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. + if [[ -n "$(NODEJS_MODULES_LIST)" ]]; then \ + echo "Installing modules: $(NODEJS_MODULES_LIST)"; \
package/nodejs/nodejs.mk line 105
Quoted 10 lines
package/nodejs/nodejs.mk new file +10
-0+ (cd $(TARGET_DIR)/usr/lib; \ + $(TARGET_CONFIGURE_OPTS) \ + LD="$(TARGET_CXX)" \ + npm_config_arch=$(NODEJS_CPU) \ + npm_config_nodedir=$(BUILD_DIR)/nodejs-$(NODEJS_VERSION) \ + $(HOST_DIR)/usr/bin/npm install \ + $(NODEJS_MODULES_LIST) \ + ) \ + fi +endef
Here as well, I already suggested doing this in a different way, when reviewing the v4 of your patch. I don't like the shell based testing of NODEJS_MODULES_LIST. It's much more common in Buildroot to do something like:
ifneq ($(NODEJS_MODULES_LIST),)
define NODEJS_INSTALL_MODULES
(cd $(TARGET_DIR)/usr/lib; ...
endef
endif
define NODEJS_INSTALL_TARGET_CMDS
$(MAKE) $(TARGET_CONFIGURE_OPTS) -C $(@D) DESTDIR=$(TARGET_DIR) install $(NODEJS_INSTALL_MODULES)
endef
Also, get rid of the 'echo' when installing modules.
Once those things are fixed, then I think the patch will be good to go!
Thanks a lot for your work!
Thomas
Signature · 4 lines
Thomas Petazzoni, Free Electrons Kernel, drivers, real-time and embedded Linux development, consulting, training and support. http://free-electrons.com
PATCH v5 2/2 nodejs: new package
Daniel, Thomas, Luca, All,
Quoted 1 line · On Monday 04 March 2013 Thomas Petazzoni wrote:
On Thu, 28 Feb 2013 17:56:07 -0800, Daniel Price wrote:
[--SNIP--]
Quoted 22 lines
Quoted 9 lines
package/nodejs/nodejs.mk new file +3
-0@@ -0,0 +1,109 @@ +############################################################# +# +# nodejspackage/nodejs/nodejs.mk line 13
Quoted 10 lines
package/nodejs/nodejs.mk new file +10
-0+# +############################################################# + +NODEJS_VERSION = 0.8.21 +NODEJS_SOURCE = node-v$(NODEJS_VERSION).tar.gz +NODEJS_SITE = http://nodejs.org/dist/v$(NODEJS_VERSION) +NODEJS_DEPENDENCIES = host-python host-nodejs \ + $(call qstrip,$(BR2_PACKAGE_NODEJS_MODULES_ADDITIONAL_DEPS)) +HOST_NODEJS_DEPENDENCIES = host-python +NODEJS_LICENSE = MITPlease add:
Quoted 8 lines
NODEJS_LICENSE_FILES= LICENSEThat said, as the LICENSE file explains, nodejs source code includes some code from various other projects, under other licenses. Maybe the licensing experts should tell us what value
NODEJS_LICENSEshould have here. Yann? Luca? See
https://github.com/joyent/node/blob/master/LICENSE if you don't want to download the whole nodejs source code.
First: I am not an authoritative licensing expert.
What I would state would be something like:
NODEJS_LICENSE = MIT (core code); non-copyleft BSD-like (bundled libraries)
In any case, I'd leave it to the user (or his/her legal department) to sort out the exact licensing terms by looking at the LICENSE file, which as Thomas mentionned, shall be referenced by the NODEJS_LICENSE_FILES variable.
IIRC, the licensing infrastrucutre in Buildroot is not meant to be authoritative, and should be regarded by the user only as a guide.
Regards,
Yann E. MORIN.
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------. | Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: | | +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ | | +33 223 225 172 `------------.-------: X AGAINST | \e/ There is no | | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. | '------------------------------^-------^------------------^--------------------'
PATCH v5 2/2 nodejs: new package
Quoted 28 lines · Yann E. MORIN
Daniel, Thomas, Luca, All,
Quoted 1 line · On Monday 04 March 2013 Thomas Petazzoni wrote:
On Thu, 28 Feb 2013 17:56:07 -0800, Daniel Price wrote:
[--SNIP--]
Quoted 23 lines
Quoted 9 lines
package/nodejs/nodejs.mk new file +3
-0@@ -0,0 +1,109 @@ +############################################################# +# +# nodejspackage/nodejs/nodejs.mk line 13
Quoted 10 lines
package/nodejs/nodejs.mk new file +10
-0+# +############################################################# + +NODEJS_VERSION = 0.8.21 +NODEJS_SOURCE = node-v$(NODEJS_VERSION).tar.gz +NODEJS_SITE = http://nodejs.org/dist/v$(NODEJS_VERSION) +NODEJS_DEPENDENCIES = host-python host-nodejs \ + $(call qstrip,$(BR2_PACKAGE_NODEJS_MODULES_ADDITIONAL_DEPS)) +HOST_NODEJS_DEPENDENCIES = host-python +NODEJS_LICENSE = MITPlease add:
NODEJS_LICENSE_FILES= LICENSE
Quoted 7 lines
Quoted 6 lines
That said, as the LICENSE file explains, nodejs source code includes some code from various other projects, under other licenses. Maybe the licensing experts should tell us what value
NODEJS_LICENSEshould have here. Yann? Luca? See
https://github.com/joyent/node/blob/master/LICENSE if you don't want to download the whole nodejs source code.First: I am not an authoritative licensing expert.
Neither me...
Quoted 10 lines
What I would state would be something like:
NODEJS_LICENSE= MIT (core code); non-copyleft BSD-like (bundled libraries)In any case, I'd leave it to the user (or his/her legal department) to sort out the exact licensing terms by looking at the LICENSE file, which as Thomas mentionned, shall be referenced by the
NODEJS_LICENSE_FILESvariable.IIRC, the licensing infrastrucutre in Buildroot is not meant to be authoritative, and should be regarded by the user only as a guide.
I fully agree with Yann.
It is very important that Buildroot does not present the license in a simplified way. The user should not think the license is MIT when it is instead
MIT and something else.
The ideal license description should be correct, concise and complete. When it is
not possible (such as in this case), it should be correct and concise, although
unavoidably incomplete.
So, I would to the least write:
NODEJS_LICENSE = MIT and others
but Yann's proposal is much more informative.
Luca
PATCH v5 2/2 nodejs: new package
Quoted 6 lines · Luca Ceresoli
Quoted 5 lines · Yann E. MORIN
What I would state would be something like:
NODEJS_LICENSE= MIT (core code); non-copyleft BSD-like (bundled libraries)
<snip>
Quoted 5 lines
So, I would to the least write:
NODEJS_LICENSE= MIT and others
but Yann's proposal is much more informative.
Thank you for the suggestions. I will catalog all of the licenses and summarize as you suggested for the next version of the patch.
-dp
--
Daniel.Price at gmail.com; Twitter: @danielbprice
PATCH v5 2/2 nodejs: new package
In reply to Luca CeresoliDear Luca Ceresoli,
Quoted 6 lines · Luca Ceresoli
unavoidably incomplete.
So, I would to the least write:
NODEJS_LICENSE= MIT and others
but Yann's proposal is much more informative.
I agree that Yann's proposal is much more informative. "others" is very vague. Knowing that the "other" licenses are BSD-like tells the user that the entire nodejs stuff is under a non-copyleft license, which is quite important.
Thomas
Signature · 4 lines
Thomas Petazzoni, Free Electrons Kernel, drivers, real-time and embedded Linux development, consulting, training and support. http://free-electrons.com
PATCH v5 2/2 nodejs: new package
In reply to Thomas PetazzoniQuoted 4 lines · Thomas Petazzoni
package/nodejs/Config.in line 16
Quoted 2 lines
package/nodejs/Config.in new file +2
-0+comment "nodejs requires a toolchain with C++, IPv6, large files, and threading" + depends on !BR2_INSTALL_LIBSTDCPP || !BR2_LARGEFILE || !BR2_TOOLCHAIN_HAS_THREADS || !BR2_INET_IPV6We generally want lines like this to be split on two lines:
Will fix.
Quoted 4 lines
Quoted 1 line
+NODEJS_LICENSE = MIT
Please add:
Quoted 8 lines
NODEJS_LICENSE_FILES= LICENSEThat said, as the LICENSE file explains, nodejs source code includes some code from various other projects, under other licenses. Maybe the licensing experts should tell us what value
NODEJS_LICENSEshould have here. Yann? Luca? See
https://github.com/joyent/node/blob/master/LICENSE if you don't want to download the whole nodejs source code.
I'll fix as per the subsequent suggestions. Thanks for flagging this.
Quoted 7 lines
In fact, using
BR2_SOFT_FLOATdoesn't work very well: on ARM, with an external toolchain,BR2_SOFT_FLOATwill always be 'y', and therefore, when NodeJS is built with a hard-float toolchain like Linaro ARM toolchains, it doesn't work at runtime.But that's not your fault, it's the Buildroot infrastructure that doesn't handle this very well. So keep this as it is for now.
I will eventually be using an external toolchain (I think) for an Armada XP board... so I assume I'll want hard float there? I'm happy to solve this some other way if there are any suggestions?
The other idea I had is to have a menuconfig item which just tells the user to specify what they want. I thought that seemed bad, because I had a hard time understanding this setting, but maybe it's better since it would actually work?
Quoted 13 lines
package/nodejs/nodejs.mk line 86
Quoted 9 lines
package/nodejs/nodejs.mk new file +9
-0+# +# Build the list of modules to install based on the booleans for +# popular modules, as well as the "additional modules" list. +# qstrip the whole thing to remove whitespace. +# +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))When reviewing the previous version, I did suggest to use qstrip only where needed, and to remove useless commas:
Quoted 4 lines
NODEJS_MODULES_LIST = \
$(if $(BR2_PACKAGE_NODEJS_MODULES_EXPRESS),express) \
$(if $(BR2_PACKAGE_NODEJS_MODULES_COFFEESCRIPT),coffee-script) \
$(call qstrip,$(BR2_PACKAGE_NODEJS_MODULES_ADDITIONAL))I tried to clarify with the comment I added: the qstrip of everything is important when you mix in the shell. Otherwise you wind up with
something like: if [[ -n " " ]], and the -n test fails. At least,
that's what I saw. That said, your other suggestion about using makefile defines should eliminate this problem, so I can switch over. The useless commas were an oversight, sorry.
Quoted 4 lines
Here as well, I already suggested doing this in a different way, when reviewing the v4 of your patch. I don't like the shell based testing of
NODEJS_MODULES_LIST. It's much more common in Buildroot to do something like:
Ok-- I took as a suggestion, and didn't know this was so much against the project's style. Will fix as per your direction.
Quoted 1 line
Also, get rid of the 'echo' when installing modules.
Ok.
Quoted 3 lines
Once those things are fixed, then I think the patch will be good to go!
Thanks a lot for your work!
Thanks for your hard work in reviewing it, and making it easy for a new contributor.
-dp
--
Daniel.Price at gmail.com; Twitter: @danielbprice
PATCH v5 2/2 nodejs: new package
Dear Daniel Price,
Quoted 8 lines · Daniel Price
Quoted 7 lines
In fact, using
BR2_SOFT_FLOATdoesn't work very well: on ARM, with an external toolchain,BR2_SOFT_FLOATwill always be 'y', and therefore, when NodeJS is built with a hard-float toolchain like Linaro ARM toolchains, it doesn't work at runtime.But that's not your fault, it's the Buildroot infrastructure that doesn't handle this very well. So keep this as it is for now.
Quoted 8 lines
I will eventually be using an external toolchain (I think) for an Armada XP board... so I assume I'll want hard float there? I'm happy to solve this some other way if there are any suggestions?
The other idea I had is to have a menuconfig item which just tells the user to specify what they want. I thought that seemed bad, because I had a hard time understanding this setting, but maybe it's better since it would actually work?
I don't -yet- have a precise view on how to solve this. As you can see in http://elinux.org/Buildroot:DeveloperDaysELCE2012, the topic of floating point support has already been discussed in the past:
"""
FP stuff: we now have a single SOFT_FLOAT option, but actually there's a lot more variation: neon, vfpv3, softfp, .... To support this well, we can add a lot of extra config options to semi-automatically select the correct float options based on the subarchitecture. There is some cross-dependency with the external toolchains, but it's doable. There should still be an option to manually override the float options for exotic cases. ARM thumb adds another layer of complexity. Someone should take the lead on making this easier.
"""
So some work is needed to figure out the right way to handle this, taking into account both the needs of internal/Crosstool-NG backends, and the needs of the external backend.
Quoted 8 lines
Quoted 7 lines
When reviewing the previous version, I did suggest to use qstrip only where needed, and to remove useless commas:
NODEJS_MODULES_LIST = \ $(if $(BR2_PACKAGE_NODEJS_MODULES_EXPRESS),express) \ $(if $(BR2_PACKAGE_NODEJS_MODULES_COFFEESCRIPT),coffee-script) \ $(call qstrip,$(BR2_PACKAGE_NODEJS_MODULES_ADDITIONAL))
Quoted 5 lines
I tried to clarify with the comment I added: the qstrip of everything is important when you mix in the shell. Otherwise you wind up with
something like: if [[ -n " " ]], and the -n test fails. At least,
that's what I saw. That said, your other suggestion about using makefile defines should eliminate this problem, so I can switch over.
Aah, I see, ok. If it works with the make-based test on NODEJS_MODULES_LIST rather than the shell-based test, then it would be better.
Quoted 2 lines
Thanks for your hard work in reviewing it, and making it easy for a new contributor.
Thanks to you! It's not common to see a new contributor going through 5 versions of a patch set and still being responsive and willing to fix issues! :-)
Best regards,
Thomas
Signature · 4 lines
Thomas Petazzoni, Free Electrons Kernel, drivers, real-time and embedded Linux development, consulting, training and support. http://free-electrons.com