summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIgor Pashev <igor.pashev@nexenta.com>2012-11-01 23:38:31 +0400
committerIgor Pashev <igor.pashev@nexenta.com>2012-11-01 23:38:31 +0400
commitafdcd6d18fea7311230246f3269d3ad24608da9c (patch)
treebc717e9aadec90e83e2bbbd1f337192ab7767e09
parent9a102cdbd6daa0ed61a78f70a6f25ad48d5baab4 (diff)
downloadcibs-pkgs-afdcd6d18fea7311230246f3269d3ad24608da9c.tar.gz
Node.js 0.8.x (in progress)
-rw-r--r--nodejs/Makefile45
-rw-r--r--nodejs/nodejs-dev.p5m90
-rw-r--r--nodejs/nodejs.p5m12
-rw-r--r--nodejs/patches/01-shared-c-ares.patch288
-rw-r--r--nodejs/patches/02-rename-node-to-nodejs.patch34
-rw-r--r--nodejs/patches/03-waf.patch16
-rw-r--r--nodejs/patches/04-lib-path.patch24
7 files changed, 509 insertions, 0 deletions
diff --git a/nodejs/Makefile b/nodejs/Makefile
new file mode 100644
index 0000000..372da78
--- /dev/null
+++ b/nodejs/Makefile
@@ -0,0 +1,45 @@
+include /usr/share/cibs/rules/ips.mk
+include /usr/share/cibs/rules/archive.mk
+include /usr/share/cibs/rules/patch.mk
+include /usr/share/cibs/rules/copy.mk
+include /usr/share/cibs/rules/64.mk
+# Not autotools, but similar:
+include /usr/share/cibs/rules/autotools.mk
+
+# Must run from current directory:
+configure := ./configure
+
+# Flock wrapper even does not return erro on failure:
+export LINK = $(CXX)
+
+name := nodejs
+version := 0.8.14
+home := http://nodejs.org
+archive := node-v$(version).tar.gz
+download := http://nodejs.org/dist/v$(version)/$(archive)
+checksum := \
+ md5:284fd2c7578064c339d9cf6a3a475ac7 \
+ sha1:47a1186004f6ce5e25a8555429d72b15519bc7f1 \
+ sha256:e5ce2aadb4df3ea4ca7a021106ffe09d286474476454038e9ed0135eac18e6d0 \
+ size:11861540
+
+summary := event-based server-side javascript engine
+license := BSD
+license-file :=
+
+build-depends += \
+ library/libv8-headers \
+ library/c-ares \
+ library/libev \
+ library/openssl-headers
+
+# Node.js configure is a autotools lookalike confuserator:
+configure-options := \
+ --dest-os=solaris \
+ --prefix=/usr \
+ --without-npm \
+ --shared-v8 \
+ --shared-zlib \
+ --shared-openssl \
+ --no-ssl2
+
diff --git a/nodejs/nodejs-dev.p5m b/nodejs/nodejs-dev.p5m
new file mode 100644
index 0000000..05ad56d
--- /dev/null
+++ b/nodejs/nodejs-dev.p5m
@@ -0,0 +1,90 @@
+set name=pkg.fmri value=pkg:/developer/$(name)/$(name)-dev@$(ips-version)
+set name=pkg.summary value="$(summary), development files"
+set name=info.upstream-url value="$(home)"
+set name=info.source-url value="$(download)"
+license $(license-file) license="$(license)"
+
+# Move headers into usr/include/nodejs:
+<transform dir -> edit path /node /nodejs >
+<transform file path=(.+/include)/node/(.+) -> \
+ emit file %<1>/node/%<2> path=%<1>/nodejs/%<2> >
+<transform file path=(.+/include)/node/(.+) -> \
+ drop >
+
+dir path=usr/include
+dir path=usr/include/node
+dir path=usr/include/node/uv-private
+file path=usr/include/node/uv-private/uv-unix.h
+file path=usr/include/node/uv-private/eio.h
+file path=usr/include/node/uv-private/ngx-queue.h
+file path=usr/include/node/uv-private/ev.h
+file path=usr/include/node/uv-private/uv-win.h
+file path=usr/include/node/uv-private/tree.h
+file path=usr/include/node/eio-emul.h
+file path=usr/include/node/node.h
+file path=usr/include/node/node_buffer.h
+file path=usr/include/node/ev-emul.h
+file path=usr/include/node/node_object_wrap.h
+file path=usr/include/node/node_version.h
+file path=usr/include/node/uv.h
+
+# Move WAF into usr/share/nodejs:
+<transform dir -> edit path /lib/node/ /share/nodejs/ >
+<transform file path=(.+/lib)/node/(.+) -> \
+ emit file %<1>/node/%<2> path=usr/share/nodejs/%<2> >
+<transform file path=(.+/lib)/node/(.+) -> \
+ drop >
+
+dir path=usr/lib/node/wafadmin
+dir path=usr/lib/node/wafadmin/Tools
+file path=usr/lib/node/wafadmin/pproc.py
+file path=usr/lib/node/wafadmin/py3kfixes.py
+file path=usr/lib/node/wafadmin/TaskGen.py
+file path=usr/lib/node/wafadmin/__init__.py
+file path=usr/lib/node/wafadmin/Logs.py
+file path=usr/lib/node/wafadmin/Task.py
+file path=usr/lib/node/wafadmin/Configure.py
+file path=usr/lib/node/wafadmin/Build.py
+file path=usr/lib/node/wafadmin/Scripting.py
+file path=usr/lib/node/wafadmin/Utils.py
+file path=usr/lib/node/wafadmin/ansiterm.py
+file path=usr/lib/node/wafadmin/Runner.py
+file path=usr/lib/node/wafadmin/Tools/compiler_d.py
+file path=usr/lib/node/wafadmin/Tools/winres.py
+file path=usr/lib/node/wafadmin/Tools/compiler_cc.py
+file path=usr/lib/node/wafadmin/Tools/nasm.py
+file path=usr/lib/node/wafadmin/Tools/xlcxx.py
+file path=usr/lib/node/wafadmin/Tools/preproc.py
+file path=usr/lib/node/wafadmin/Tools/icpc.py
+file path=usr/lib/node/wafadmin/Tools/gdc.py
+file path=usr/lib/node/wafadmin/Tools/unittestw.py
+file path=usr/lib/node/wafadmin/Tools/gcc.py
+file path=usr/lib/node/wafadmin/Tools/osx.py
+file path=usr/lib/node/wafadmin/Tools/node_addon.py
+file path=usr/lib/node/wafadmin/Tools/cc.py
+file path=usr/lib/node/wafadmin/Tools/d.py
+file path=usr/lib/node/wafadmin/Tools/config_c.py
+file path=usr/lib/node/wafadmin/Tools/ar.py
+file path=usr/lib/node/wafadmin/Tools/ccroot.py
+file path=usr/lib/node/wafadmin/Tools/suncc.py
+file path=usr/lib/node/wafadmin/Tools/intltool.py
+file path=usr/lib/node/wafadmin/Tools/gas.py
+file path=usr/lib/node/wafadmin/Tools/compiler_cxx.py
+file path=usr/lib/node/wafadmin/Tools/icc.py
+file path=usr/lib/node/wafadmin/Tools/dmd.py
+file path=usr/lib/node/wafadmin/Tools/libtool.py
+file path=usr/lib/node/wafadmin/Tools/__init__.py
+file path=usr/lib/node/wafadmin/Tools/python.py
+file path=usr/lib/node/wafadmin/Tools/xlc.py
+file path=usr/lib/node/wafadmin/Tools/misc.py
+file path=usr/lib/node/wafadmin/Tools/gxx.py
+file path=usr/lib/node/wafadmin/Tools/suncxx.py
+file path=usr/lib/node/wafadmin/Tools/gob2.py
+file path=usr/lib/node/wafadmin/Tools/cxx.py
+file path=usr/lib/node/wafadmin/Tools/gnu_dirs.py
+file path=usr/lib/node/wafadmin/Node.py
+file path=usr/lib/node/wafadmin/Environment.py
+file path=usr/lib/node/wafadmin/Options.py
+file path=usr/lib/node/wafadmin/Constants.py
+file path=usr/bin/node-waf
+
diff --git a/nodejs/nodejs.p5m b/nodejs/nodejs.p5m
new file mode 100644
index 0000000..cbd8f09
--- /dev/null
+++ b/nodejs/nodejs.p5m
@@ -0,0 +1,12 @@
+set name=pkg.fmri value=pkg:/runtime/$(name)@$(ips-version)
+set name=pkg.summary value="$(summary)"
+set name=info.upstream-url value="$(home)"
+set name=info.source-url value="$(download)"
+license $(license-file) license="$(license)"
+
+file usr/bin/node path=usr/bin/nodejs
+link path=usr/bin/node target=nodejs
+
+file usr/share/man/man1/node.1 path=usr/share/man/man1/nodejs.1
+link path=usr/share/man/man1/node.1 target=nodejs.1
+
diff --git a/nodejs/patches/01-shared-c-ares.patch b/nodejs/patches/01-shared-c-ares.patch
new file mode 100644
index 0000000..220f2c7
--- /dev/null
+++ b/nodejs/patches/01-shared-c-ares.patch
@@ -0,0 +1,288 @@
+diff -dubr source/configure cares/configure
+--- source/configure 2012-10-26 00:49:32.000000000 +0400
++++ cares/configure 2012-11-01 21:18:15.766658414 +0400
+@@ -460,6 +460,8 @@
+ 'cflags': [],
+ }
+
++output['libraries'] += ['-lcares']
++
+ configure_node(output)
+ configure_libz(output)
+ configure_v8(output)
+diff -dubr source/deps/uv/config-unix.mk cares/deps/uv/config-unix.mk
+--- source/deps/uv/config-unix.mk 2012-10-26 00:49:32.000000000 +0400
++++ cares/deps/uv/config-unix.mk 2012-11-01 21:24:35.522262825 +0400
+@@ -47,7 +47,7 @@
+ ifeq (SunOS,$(uname_S))
+ EV_CONFIG=config_sunos.h
+ EIO_CONFIG=config_sunos.h
+-CPPFLAGS += -Isrc/ares/config_sunos -D__EXTENSIONS__ -D_XOPEN_SOURCE=500
++CPPFLAGS += -D__EXTENSIONS__ -D_XOPEN_SOURCE=500
+ LINKFLAGS+=-lsocket -lnsl -lkstat
+ OBJS += src/unix/sunos.o
+ endif
+@@ -65,7 +65,6 @@
+ EV_CONFIG=config_linux.h
+ EIO_CONFIG=config_linux.h
+ CSTDFLAG += -D_GNU_SOURCE
+-CPPFLAGS += -Isrc/ares/config_linux
+ LINKFLAGS+=-ldl -lrt
+ OBJS += src/unix/linux/linux-core.o \
+ src/unix/linux/inotify.o \
+@@ -75,7 +74,6 @@
+ ifeq (FreeBSD,$(uname_S))
+ EV_CONFIG=config_freebsd.h
+ EIO_CONFIG=config_freebsd.h
+-CPPFLAGS += -Isrc/ares/config_freebsd
+ LINKFLAGS+=-lkvm
+ OBJS += src/unix/freebsd.o
+ OBJS += src/unix/kqueue.o
+@@ -84,7 +82,6 @@
+ ifeq (DragonFly,$(uname_S))
+ EV_CONFIG=config_freebsd.h
+ EIO_CONFIG=config_freebsd.h
+-CPPFLAGS += -Isrc/ares/config_freebsd
+ LINKFLAGS+=
+ OBJS += src/unix/freebsd.o
+ OBJS += src/unix/kqueue.o
+@@ -93,7 +90,6 @@
+ ifeq (NetBSD,$(uname_S))
+ EV_CONFIG=config_netbsd.h
+ EIO_CONFIG=config_netbsd.h
+-CPPFLAGS += -Isrc/ares/config_netbsd
+ LINKFLAGS+=
+ OBJS += src/unix/netbsd.o
+ OBJS += src/unix/kqueue.o
+@@ -102,7 +98,6 @@
+ ifeq (OpenBSD,$(uname_S))
+ EV_CONFIG=config_openbsd.h
+ EIO_CONFIG=config_openbsd.h
+-CPPFLAGS += -Isrc/ares/config_openbsd
+ LINKFLAGS+=-lkvm
+ OBJS += src/unix/openbsd.o
+ OBJS += src/unix/kqueue.o
+@@ -113,7 +108,6 @@
+ EIO_CONFIG=config_cygwin.h
+ # We drop the --std=c89, it hides CLOCK_MONOTONIC on cygwin
+ CSTDFLAG = -D_GNU_SOURCE
+-CPPFLAGS += -Isrc/ares/config_cygwin
+ LINKFLAGS+=
+ OBJS += src/unix/cygwin.o
+ endif
+@@ -131,7 +125,7 @@
+ RUNNER_LIBS=
+ RUNNER_SRC=test/runner-unix.c
+
+-uv.a: $(OBJS) src/cares.o src/fs-poll.o src/uv-common.o src/unix/ev/ev.o src/unix/uv-eio.o src/unix/eio/eio.o $(CARES_OBJS)
++uv.a: $(OBJS) src/cares.o src/fs-poll.o src/uv-common.o src/unix/ev/ev.o src/unix/uv-eio.o src/unix/eio/eio.o
+ $(AR) rcs uv.a $^
+
+ src/%.o: src/%.c include/uv.h include/uv-private/uv-unix.h
+@@ -157,7 +151,6 @@
+
+
+ clean-platform:
+- -rm -f src/ares/*.o
+ -rm -f src/unix/*.o
+ -rm -f src/unix/ev/*.o
+ -rm -f src/unix/eio/*.o
+@@ -165,7 +158,6 @@
+ -rm -rf test/run-tests.dSYM run-benchmarks.dSYM
+
+ distclean-platform:
+- -rm -f src/ares/*.o
+ -rm -f src/unix/*.o
+ -rm -f src/unix/ev/*.o
+ -rm -f src/unix/eio/*.o
+diff -dubr source/deps/uv/include/uv.h cares/deps/uv/include/uv.h
+--- source/deps/uv/include/uv.h 2012-10-26 00:49:32.000000000 +0400
++++ cares/deps/uv/include/uv.h 2012-11-01 21:17:00.331361102 +0400
+@@ -55,7 +55,7 @@
+ #include <stdint.h> /* int64_t */
+ #include <sys/types.h> /* size_t */
+
+-#include "ares.h"
++#include <ares.h>
+
+ #if defined(__unix__) || defined(__POSIX__) || defined(__APPLE__)
+ # include "uv-private/uv-unix.h"
+diff -dubr source/deps/uv/Makefile cares/deps/uv/Makefile
+--- source/deps/uv/Makefile 2012-10-26 00:49:32.000000000 +0400
++++ cares/deps/uv/Makefile 2012-11-01 21:19:24.730021729 +0400
+@@ -26,51 +26,6 @@
+
+ CPPFLAGS += -Iinclude -Iinclude/uv-private
+
+-CARES_OBJS =
+-CARES_OBJS += src/ares/ares__close_sockets.o
+-CARES_OBJS += src/ares/ares__get_hostent.o
+-CARES_OBJS += src/ares/ares__read_line.o
+-CARES_OBJS += src/ares/ares__timeval.o
+-CARES_OBJS += src/ares/ares_cancel.o
+-CARES_OBJS += src/ares/ares_data.o
+-CARES_OBJS += src/ares/ares_destroy.o
+-CARES_OBJS += src/ares/ares_expand_name.o
+-CARES_OBJS += src/ares/ares_expand_string.o
+-CARES_OBJS += src/ares/ares_fds.o
+-CARES_OBJS += src/ares/ares_free_hostent.o
+-CARES_OBJS += src/ares/ares_free_string.o
+-CARES_OBJS += src/ares/ares_gethostbyaddr.o
+-CARES_OBJS += src/ares/ares_gethostbyname.o
+-CARES_OBJS += src/ares/ares_getnameinfo.o
+-CARES_OBJS += src/ares/ares_getopt.o
+-CARES_OBJS += src/ares/ares_getsock.o
+-CARES_OBJS += src/ares/ares_init.o
+-CARES_OBJS += src/ares/ares_library_init.o
+-CARES_OBJS += src/ares/ares_llist.o
+-CARES_OBJS += src/ares/ares_mkquery.o
+-CARES_OBJS += src/ares/ares_nowarn.o
+-CARES_OBJS += src/ares/ares_options.o
+-CARES_OBJS += src/ares/ares_parse_a_reply.o
+-CARES_OBJS += src/ares/ares_parse_aaaa_reply.o
+-CARES_OBJS += src/ares/ares_parse_mx_reply.o
+-CARES_OBJS += src/ares/ares_parse_ns_reply.o
+-CARES_OBJS += src/ares/ares_parse_ptr_reply.o
+-CARES_OBJS += src/ares/ares_parse_srv_reply.o
+-CARES_OBJS += src/ares/ares_parse_txt_reply.o
+-CARES_OBJS += src/ares/ares_process.o
+-CARES_OBJS += src/ares/ares_query.o
+-CARES_OBJS += src/ares/ares_search.o
+-CARES_OBJS += src/ares/ares_send.o
+-CARES_OBJS += src/ares/ares_strcasecmp.o
+-CARES_OBJS += src/ares/ares_strdup.o
+-CARES_OBJS += src/ares/ares_strerror.o
+-CARES_OBJS += src/ares/ares_timeout.o
+-CARES_OBJS += src/ares/ares_version.o
+-CARES_OBJS += src/ares/ares_writev.o
+-CARES_OBJS += src/ares/bitncmp.o
+-CARES_OBJS += src/ares/inet_net_pton.o
+-CARES_OBJS += src/ares/inet_ntop.o
+-
+ ifneq (,$(findstring MINGW,$(uname_S)))
+ include config-mingw.mk
+ else
+@@ -82,9 +37,6 @@
+
+ all: uv.a
+
+-$(CARES_OBJS): %.o: %.c
+- $(CC) -o $*.o -c $(CFLAGS) $(CPPFLAGS) $< -DHAVE_CONFIG_H
+-
+ test/run-tests$(E): test/*.h test/run-tests.c $(RUNNER_SRC) test/runner-unix.c $(TESTS) uv.a
+ $(CC) $(CPPFLAGS) $(RUNNER_CFLAGS) -o test/run-tests test/run-tests.c \
+ test/runner.c $(RUNNER_SRC) $(TESTS) uv.a $(RUNNER_LIBS) $(RUNNER_LINKFLAGS)
+diff -dubr source/deps/uv/src/uv-common.c cares/deps/uv/src/uv-common.c
+--- source/deps/uv/src/uv-common.c 2012-10-26 00:49:32.000000000 +0400
++++ cares/deps/uv/src/uv-common.c 2012-11-01 21:17:00.332151637 +0400
+@@ -28,10 +28,8 @@
+ #include <stdlib.h> /* malloc */
+ #include <string.h> /* memset */
+
+-/* use inet_pton from c-ares if necessary */
+-#include "ares_config.h"
+-#include "ares/inet_net_pton.h"
+-#include "ares/inet_ntop.h"
++#include <ares.h>
++#include <arpa/inet.h>
+
+ #define XX(uc, lc) case UV_##uc: return sizeof(uv_##lc##_t);
+
+@@ -182,20 +180,20 @@
+
+ addr.sin6_family = AF_INET6;
+ addr.sin6_port = htons(port);
+- ares_inet_pton(AF_INET6, ip, &addr.sin6_addr);
++ inet_pton(AF_INET6, ip, &addr.sin6_addr);
+
+ return addr;
+ }
+
+
+ int uv_ip4_name(struct sockaddr_in* src, char* dst, size_t size) {
+- const char* d = ares_inet_ntop(AF_INET, &src->sin_addr, dst, size);
++ const char* d = inet_ntop(AF_INET, &src->sin_addr, dst, size);
+ return d != dst;
+ }
+
+
+ int uv_ip6_name(struct sockaddr_in6* src, char* dst, size_t size) {
+- const char* d = ares_inet_ntop(AF_INET6, &src->sin6_addr, dst, size);
++ const char* d = inet_ntop(AF_INET6, &src->sin6_addr, dst, size);
+ return d != dst;
+ }
+
+diff -dubr source/deps/uv/uv.gyp cares/deps/uv/uv.gyp
+--- source/deps/uv/uv.gyp 2012-10-26 00:49:32.000000000 +0400
++++ cares/deps/uv/uv.gyp 2012-11-01 21:17:00.332535345 +0400
+@@ -53,70 +53,6 @@
+ 'src/fs-poll.c',
+ 'src/uv-common.c',
+ 'src/uv-common.h',
+- 'src/ares/ares_cancel.c',
+- 'src/ares/ares__close_sockets.c',
+- 'src/ares/ares_data.c',
+- 'src/ares/ares_data.h',
+- 'src/ares/ares_destroy.c',
+- 'src/ares/ares_dns.h',
+- 'src/ares/ares_expand_name.c',
+- 'src/ares/ares_expand_string.c',
+- 'src/ares/ares_fds.c',
+- 'src/ares/ares_free_hostent.c',
+- 'src/ares/ares_free_string.c',
+- 'src/ares/ares_getenv.h',
+- 'src/ares/ares_gethostbyaddr.c',
+- 'src/ares/ares_gethostbyname.c',
+- 'src/ares/ares__get_hostent.c',
+- 'src/ares/ares_getnameinfo.c',
+- 'src/ares/ares_getopt.c',
+- 'src/ares/ares_getopt.h',
+- 'src/ares/ares_getsock.c',
+- 'src/ares/ares_init.c',
+- 'src/ares/ares_ipv6.h',
+- 'src/ares/ares_library_init.c',
+- 'src/ares/ares_library_init.h',
+- 'src/ares/ares_llist.c',
+- 'src/ares/ares_llist.h',
+- 'src/ares/ares_mkquery.c',
+- 'src/ares/ares_nowarn.c',
+- 'src/ares/ares_nowarn.h',
+- 'src/ares/ares_options.c',
+- 'src/ares/ares_parse_aaaa_reply.c',
+- 'src/ares/ares_parse_a_reply.c',
+- 'src/ares/ares_parse_mx_reply.c',
+- 'src/ares/ares_parse_ns_reply.c',
+- 'src/ares/ares_parse_ptr_reply.c',
+- 'src/ares/ares_parse_srv_reply.c',
+- 'src/ares/ares_parse_txt_reply.c',
+- 'src/ares/ares_platform.h',
+- 'src/ares/ares_private.h',
+- 'src/ares/ares_process.c',
+- 'src/ares/ares_query.c',
+- 'src/ares/ares__read_line.c',
+- 'src/ares/ares_rules.h',
+- 'src/ares/ares_search.c',
+- 'src/ares/ares_send.c',
+- 'src/ares/ares_setup.h',
+- 'src/ares/ares_strcasecmp.c',
+- 'src/ares/ares_strcasecmp.h',
+- 'src/ares/ares_strdup.c',
+- 'src/ares/ares_strdup.h',
+- 'src/ares/ares_strerror.c',
+- 'src/ares/ares_timeout.c',
+- 'src/ares/ares__timeval.c',
+- 'src/ares/ares_version.c',
+- 'src/ares/ares_writev.c',
+- 'src/ares/ares_writev.h',
+- 'src/ares/bitncmp.c',
+- 'src/ares/bitncmp.h',
+- 'src/ares/inet_net_pton.c',
+- 'src/ares/inet_net_pton.h',
+- 'src/ares/inet_ntop.c',
+- 'src/ares/inet_ntop.h',
+- 'src/ares/nameser.h',
+- 'src/ares/setup_once.h',
+- 'src/ares/windows_port.c',
+ ],
+ 'conditions': [
+ [ 'OS=="win"', {
diff --git a/nodejs/patches/02-rename-node-to-nodejs.patch b/nodejs/patches/02-rename-node-to-nodejs.patch
new file mode 100644
index 0000000..8e6c9e5
--- /dev/null
+++ b/nodejs/patches/02-rename-node-to-nodejs.patch
@@ -0,0 +1,34 @@
+diff -dubr source/doc/node.1 rename/doc/node.1
+--- source/doc/node.1 2012-10-26 00:49:56.000000000 +0400
++++ rename/doc/node.1 2012-11-01 21:57:48.271896703 +0400
+@@ -2,12 +2,12 @@
+
+
+ .SH "NAME"
+-node \- Server-side JavaScript
++nodejs \- Server-side JavaScript
+
+ .SH SYNOPSIS
+
+
+-.B node
++.B nodejs
+ [
+ .B \-v
+ ]
+diff -dubr source/tools/wafadmin/Tools/node_addon.py rename/tools/wafadmin/Tools/node_addon.py
+--- source/tools/wafadmin/Tools/node_addon.py 2012-10-26 00:49:32.000000000 +0400
++++ rename/tools/wafadmin/Tools/node_addon.py 2012-11-01 21:59:05.441880615 +0400
+@@ -26,10 +26,10 @@
+ conf.env['PREFIX_NODE'] = get_prefix()
+ prefix = conf.env['PREFIX_NODE']
+ lib = join(prefix, 'lib')
+- nodebin = join(prefix, 'bin', 'node')
++ nodebin = join(prefix, 'bin', 'nodejs')
+
+ conf.env['LIBPATH_NODE'] = lib
+- conf.env['CPPPATH_NODE'] = join(prefix, 'include', 'node')
++ conf.env['CPPPATH_NODE'] = join(prefix, 'include', 'nodejs')
+
+ conf.env.append_value('CPPFLAGS_NODE', '-D_GNU_SOURCE')
+
diff --git a/nodejs/patches/03-waf.patch b/nodejs/patches/03-waf.patch
new file mode 100644
index 0000000..0eda3dc
--- /dev/null
+++ b/nodejs/patches/03-waf.patch
@@ -0,0 +1,16 @@
+diff -dubr source/tools/node-waf waf/tools/node-waf
+--- source/tools/node-waf 2012-10-26 00:49:32.000000000 +0400
++++ waf/tools/node-waf 2012-11-01 23:20:51.438482412 +0400
+@@ -5,7 +5,11 @@
+ join = os.path.join
+ bindir = os.path.dirname(os.path.realpath(__file__))
+ prefix = join(bindir, "..")
+-wafdir = join(prefix, "lib", "node")
++if os.environ.has_key('PREFIX_NODE'):
++ prefix = os.environ['PREFIX_NODE']
++else:
++ prefix = "/usr"
++wafdir = join(prefix, "share", "nodejs")
+
+ w = join(wafdir, 'wafadmin')
+ t = join(w, 'Tools')
diff --git a/nodejs/patches/04-lib-path.patch b/nodejs/patches/04-lib-path.patch
new file mode 100644
index 0000000..c3ff124
--- /dev/null
+++ b/nodejs/patches/04-lib-path.patch
@@ -0,0 +1,24 @@
+diff -dubr source/lib/module.js libpath/lib/module.js
+--- source/lib/module.js 2012-10-26 00:49:32.000000000 +0400
++++ libpath/lib/module.js 2012-11-01 23:30:34.638509805 +0400
+@@ -493,7 +493,7 @@
+ };
+
+ Module._initPaths = function() {
+- var paths = [path.resolve(process.execPath, '..', '..', 'lib', 'node')];
++ var paths = ['/usr/lib/nodejs'];
+
+ if (process.env['HOME']) {
+ paths.unshift(path.resolve(process.env['HOME'], '.node_libraries'));
+diff -dubr source/tools/wafadmin/Tools/node_addon.py libpath/tools/wafadmin/Tools/node_addon.py
+--- source/tools/wafadmin/Tools/node_addon.py 2012-11-01 23:22:54.032306132 +0400
++++ libpath/tools/wafadmin/Tools/node_addon.py 2012-11-01 23:29:37.203544596 +0400
+@@ -70,7 +70,7 @@
+ nodePath = None
+ if not os.environ.has_key('NODE_PATH'):
+ if not os.environ.has_key('HOME'):
+- nodePath = join(get_prefix(), 'lib', 'node')
++ nodePath = join(get_prefix(), 'lib', 'nodejs')
+ else:
+ nodePath = join(os.environ['HOME'], '.node_libraries')
+ else: