* Re: [ptxdist] Integration of node.js
2014-12-10 8:38 ` Alexander Raimondi
@ 2014-12-10 14:15 ` Alexander Stein
0 siblings, 0 replies; 5+ messages in thread
From: Alexander Stein @ 2014-12-10 14:15 UTC (permalink / raw)
To: ptxdist; +Cc: Alexander Raimondi
[-- Attachment #1: Type: text/plain, Size: 1110 bytes --]
Hello Alexander :),
On Wednesday 10 December 2014 09:38:58, Alexander Raimondi wrote:
> Hi Jean-Claude
>
> Yes, I can give you my current work state. It is attached as tar.gz
Thanks for your current work. By coincidence I need to take a look at nodejs myself :)
> You will find:
> - A patch that will add support for node.js to a local project (not
> into ptxdist itself)
> - A local_src directory with a build script
>
> Everything is based on ptxdist 14.1.0 (from phytec)
>
> Some comments
> - I only tested node +ssl +npm (no ssl doesn't compile for some reason)
Thanks for your effor so far. I've done some work based on it, e.g. compile without ssl is patched.
I also cleaned up the rules a bit, including moving to cross. Feel free to try and comment.
Best regards,
Alexander
--
Dipl.-Inf. Alexander Stein
SYS TEC electronic GmbH
Am Windrad 2
08468 Heinsdorfergrund
Tel.: 03765 38600-1156
Fax: 03765 38600-4100
Email: alexander.stein@systec-electronic.com
Website: www.systec-electronic.com
Managing Director: Dipl.-Phys. Siegmar Schmidt
Commercial registry: Amtsgericht Chemnitz, HRB 28082
[-- Attachment #2: 0001-Add-node.js.patch --]
[-- Type: text/x-patch, Size: 10790 bytes --]
From 118e006c128ff7c873b898bf3869bd7e0c3c9cd7 Mon Sep 17 00:00:00 2001
From: Alexander Stein <alexander.stein@systec-electronic.com>
Date: Wed, 10 Dec 2014 15:09:40 +0100
Subject: [PATCH 1/1] Add node.js
Signed-off-by: Alexander Stein <alexander.stein@systec-electronic.com>
---
.../0001-node.cc-Fix-without-ssl-compilation.patch | 38 +++++
patches/node-v0.10.33/series | 4 +
rules/cross-node.in | 13 ++
rules/cross-node.make | 31 +++++
rules/node.in | 30 ++++
rules/node.make | 154 +++++++++++++++++++++
6 files changed, 270 insertions(+)
create mode 100644 patches/node-v0.10.33/0001-node.cc-Fix-without-ssl-compilation.patch
create mode 100644 patches/node-v0.10.33/series
create mode 100644 rules/cross-node.in
create mode 100644 rules/cross-node.make
create mode 100644 rules/node.in
create mode 100644 rules/node.make
diff --git a/patches/node-v0.10.33/0001-node.cc-Fix-without-ssl-compilation.patch b/patches/node-v0.10.33/0001-node.cc-Fix-without-ssl-compilation.patch
new file mode 100644
index 0000000..c7ac4d5
--- /dev/null
+++ b/patches/node-v0.10.33/0001-node.cc-Fix-without-ssl-compilation.patch
@@ -0,0 +1,38 @@
+From: Alexander Stein <alexander.stein@systec-electronic.com>
+Date: Wed, 10 Dec 2014 11:56:59 +0100
+Subject: [PATCH] node.cc: Fix --without-ssl compilation
+
+The SSL parts of code were not encapsulated correctly.
+
+Signed-off-by: Alexander Stein <alexander.stein@systec-electronic.com>
+---
+ src/node.cc | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/src/node.cc b/src/node.cc
+index 18c743f..0d67745 100644
+--- a/src/node.cc
++++ b/src/node.cc
+@@ -82,7 +82,6 @@ typedef int mode_t;
+ #include "node_script.h"
+ #include "v8_typed_array.h"
+
+-#include "node_crypto.h"
+ #include "util.h"
+
+ using namespace v8;
+@@ -2579,12 +2578,14 @@ static void ParseArgs(int argc, char **argv) {
+ p = 1 + strchr(arg, '=');
+ max_stack_size = atoi(p);
+ argv[i] = const_cast<char*>("");
++#if HAVE_OPENSSL
+ } else if (strcmp(arg, "--enable-ssl2") == 0) {
+ SSL2_ENABLE = true;
+ argv[i] = const_cast<char*>("");
+ } else if (strcmp(arg, "--enable-ssl3") == 0) {
+ SSL3_ENABLE = true;
+ argv[i] = const_cast<char*>("");
++#endif
+ } else if (strcmp(arg, "--help") == 0 || strcmp(arg, "-h") == 0) {
+ PrintHelp();
+ exit(0);
diff --git a/patches/node-v0.10.33/series b/patches/node-v0.10.33/series
new file mode 100644
index 0000000..a75a360
--- /dev/null
+++ b/patches/node-v0.10.33/series
@@ -0,0 +1,4 @@
+# generated by git-ptx-patches
+#tag:base --start-number 1
+0001-node.cc-Fix-without-ssl-compilation.patch
+# 43e6493f1a10493aadadef4852982922 - git-ptx-patches magic
diff --git a/rules/cross-node.in b/rules/cross-node.in
new file mode 100644
index 0000000..5e467e0
--- /dev/null
+++ b/rules/cross-node.in
@@ -0,0 +1,13 @@
+## SECTION=crosstools
+
+config CROSS_NODE
+ bool
+ help
+ Fast, scalable network application scripting environment
+
+ Node.js® is a platform built on Chrome's JavaScript runtime for
+ easily building fast, scalable network applications. Node.js uses
+ an event-driven, non-blocking I/O model that makes it lightweight
+ and efficient, perfect for data-intensive real-time applications
+ that run across distributed devices.
+
diff --git a/rules/cross-node.make b/rules/cross-node.make
new file mode 100644
index 0000000..5077742
--- /dev/null
+++ b/rules/cross-node.make
@@ -0,0 +1,31 @@
+# -*-makefile-*-
+#
+# Copyright (C) 2014 by Alex Raimondi <raimondi@miromico.ch>
+#
+# See CREDITS for details about who has contributed to this project.
+#
+# For further information about the PTXdist project and license conditions
+# see the README file.
+#
+
+#
+# We provide this package
+#
+CROSS_PACKAGES-$(PTXCONF_CROSS_NODE) += cross-node
+
+#
+# autoconf
+#
+CROSS_NODE_CONF_OPT := --prefix=/usr \
+ --without-snapshot \
+ --dest-os=linux
+
+$(STATEDIR)/host-node.prepare:
+ @$(call targetinfo)
+ @$(call clean, $(CROSS_NODE_DIR)/config.cache)
+ cd $(CROSS_NODE_DIR) && \
+ $(CROSS_NODE_PATH) $(CROSS_NODE_ENV) \
+ ./configure $(CROSS_NODE_CONF_OPT)
+ @$(call touch)
+
+# vim: syntax=make
diff --git a/rules/node.in b/rules/node.in
new file mode 100644
index 0000000..47fe839
--- /dev/null
+++ b/rules/node.in
@@ -0,0 +1,30 @@
+## SECTION=networking
+
+menuconfig NODE
+ tristate
+ prompt "node "
+ select CROSS_NODE
+ help
+ Fast, scalable network application scripting environment
+
+ Node.js® is a platform built on Chrome's JavaScript runtime for
+ easily building fast, scalable network applications. Node.js uses
+ an event-driven, non-blocking I/O model that makes it lightweight
+ and efficient, perfect for data-intensive real-time applications
+ that run across distributed devices.
+
+if NODE
+
+config NODE_SSL
+ tristate
+ prompt "SSL support"
+ help
+ Enable support for ssl
+
+config NODE_NPM
+ tristate
+ prompt "Include npm packet manager"
+ help
+ Include packet manager
+
+endif
diff --git a/rules/node.make b/rules/node.make
new file mode 100644
index 0000000..b711eec
--- /dev/null
+++ b/rules/node.make
@@ -0,0 +1,154 @@
+# -*-makefile-*-
+#
+# Copyright (C) 2014 by Alex Raimondi <raimondi@miromico.ch>
+#
+# See CREDITS for details about who has contributed to this project.
+#
+# For further information about the PTXdist project and license conditions
+# see the README file.
+#
+
+#
+# We provide this package
+#
+PACKAGES-$(PTXCONF_NODE) += node
+
+#
+# Paths and names
+#
+NODE_VERSION := 0.10.33
+NODE_MD5 := 626ca8a4f8fec4df49c78ed53d46f1f7
+NODE := node-v$(NODE_VERSION)
+NODE_SUFFIX := tar.gz
+NODE_URL := http://nodejs.org/dist/v$(NODE_VERSION)/$(NODE).$(NODE_SUFFIX)
+NODE_SOURCE := $(SRCDIR)/$(NODE).$(NODE_SUFFIX)
+NODE_DIR := $(BUILDDIR)/$(NODE)
+NODE_LICENSE := MIT
+
+# ----------------------------------------------------------------------------
+# Get
+# ----------------------------------------------------------------------------
+
+#$(NODE_SOURCE):
+# @$(call targetinfo)
+# @$(call get, NODE)
+
+# ----------------------------------------------------------------------------
+# Prepare
+# ----------------------------------------------------------------------------
+
+#NODE_PATH := PATH=$(CROSS_PATH)
+NODE_ENV := $(CROSS_ENV)
+
+#
+# autoconf
+#
+#NODE_AUTOCONF := \
+# $(CROSS_AUTOCONF_USR)
+# --libdir=/usr/lib/lighttpd \
+# --$(call ptx/endis, PTXCONF_GLOBAL_LARGE_FILE)-lfs \
+# $(GLOBAL_IPV6_OPTION) \
+# --without-libev \
+# --$(call ptx/wwo, PTXCONF_LIGHTTPD_MYSQL)-mysql \
+# --$(call ptx/wwo, PTXCONF_LIGHTTPD_LDAP)-ldap \
+# --$(call ptx/wwo, PTXCONF_LIGHTTPD_ATTR)-attr \
+# --without-valgrind \
+# --$(call ptx/wwo, PTXCONF_LIGHTTPD_OPENSSL)-openssl \
+# --$(call ptx/wwo, PTXCONF_LIGHTTPD_KERBEROS)-kerberos5 \
+# --$(call ptx/wwo, PTXCONF_LIGHTTPD_PCRE)-pcre \
+# --$(call ptx/wwo, PTXCONF_LIGHTTPD_ZLIB)-zlib \
+# --$(call ptx/wwo, PTXCONF_LIGHTTPD_BZ2LIB)-bzip2 \
+# --$(call ptx/wwo, PTXCONF_LIGHTTPD_FAM)-fam \
+# --$(call ptx/wwo, PTXCONF_LIGHTTPD_WEBDAV_PROPS)-webdav-props \
+# --$(call ptx/wwo, PTXCONF_LIGHTTPD_WEBDAV_LOCKS)-webdav-locks \
+# --$(call ptx/wwo, PTXCONF_LIGHTTPD_GDBM)-gdbm \
+# --$(call ptx/wwo, PTXCONF_LIGHTTPD_MEMCACHE)-memcache \
+# --$(call ptx/wwo, PTXCONF_LIGHTTPD_LUA)-lua
+
+#NODE_CONF_ENV := $(CROSS_ENV)
+
+#
+# autoconf
+#
+#NODE_CONF_TOOL := autoconf
+NODE_CONF_OPT := --prefix=/usr \
+ --without-snapshot \
+ --dest-cpu=arm \
+ --dest-os=linux
+
+ifndef PTXCONF_NODE_SSL
+NODE_CONF_OPT += --without-ssl
+endif
+
+ifndef PTXCONF_NODE_NPM
+NODE_CONF_OPT += --without-npm
+endif
+
+$(STATEDIR)/node.prepare:
+ @echo $(NODE_CONF_OPT)
+ @$(call targetinfo)
+ @$(call clean, $(NODE_DIR)/config.cache)
+ cd $(NODE_DIR) && \
+ $(NODE_PATH) $(NODE_ENV) \
+ ./configure $(NODE_CONF_OPT)
+ @$(call touch)
+
+# ----------------------------------------------------------------------------
+# Compile
+# ----------------------------------------------------------------------------
+
+#$(STATEDIR)/node.compile:
+# @$(call targetinfo)
+# @$(call world/compile, NODE)
+# @$(call touch)
+
+# ----------------------------------------------------------------------------
+# Install
+# ----------------------------------------------------------------------------
+
+#$(STATEDIR)/node.install:
+# @$(call targetinfo)
+# @$(call world/install, NODE)
+# @$(call touch)
+
+# ----------------------------------------------------------------------------
+# Target-Install
+# ----------------------------------------------------------------------------
+
+$(STATEDIR)/node.targetinstall:
+ @$(call targetinfo)
+
+ @$(call install_init, node)
+ @$(call install_fixup, node,PRIORITY,optional)
+ @$(call install_fixup, node,SECTION,base)
+ @$(call install_fixup, node,AUTHOR,"Alex Raimondi <raimondi@miromico.ch>")
+ @$(call install_fixup, node,DESCRIPTION,missing)
+
+ @$(call install copy, node, 0, 0, 0755, /usr/share/nodejs)
+ @$(call install_copy, node, 0, 0, 0755, $(NODE_DIR)/node, /usr/bin/node)
+ @$(call install_copy, node, 0, 0, 0755, $(NODE_DIR)/node, /usr/bin/nodejs)
+ @$(call install_link, node, ../lib/node_modules/npm/bin/npm-cli.js, /usr/bin/npm)
+
+ @$(call install_tree, node, 0, 0, $(NODE_DIR)/deps/npm/node_modules, /usr/lib/node_modules/npm/node_modules)
+ @$(call install_tree, node, 0, 0, $(NODE_DIR)/deps/npm/lib, /usr/lib/node_modules/npm/lib)
+ @$(call install_tree, node, 0, 0, $(NODE_DIR)/deps/npm/bin, /usr/lib/node_modules/npm/bin)
+ @$(call install_tree, node, 0, 0, $(NODE_DIR)/lib, /usr/lib/nodejs)
+ @$(call install_tree, node, 0, 0, $(NODE_DIR)/deps/npm/scripts, /usr/lib/node_modules/npm/scripts)
+
+ @for i in $(shell cd $(NODE_DIR)/deps && find npm -maxdepth 1 -type f); do \
+ $(call install_copy, node, 0, 0, 0755, -, /usr/lib/node_modules/$$i); \
+ done
+
+ @$(call install_finish, node)
+
+ @$(call touch)
+
+# ----------------------------------------------------------------------------
+# Clean
+# ----------------------------------------------------------------------------
+
+#$(STATEDIR)/node.clean:
+# @$(call targetinfo)
+# @$(call clean_pkg, NODE)
+
+# vim: syntax=make
--
2.0.4
[-- Attachment #3: Type: text/plain, Size: 48 bytes --]
--
ptxdist mailing list
ptxdist@pengutronix.de
^ permalink raw reply [flat|nested] 5+ messages in thread