Set the stage for making the builtin modules more dynamic.
Note: this only converts crypto and net, I will add more extensions in a
later commit.
* node.h: Add utility macro for converting macro values to strings.
* node.h: Include the actual module name inside the module structure, not
just the file it was built from.
* node.h: New Macro, NODE_MODULE_DECL, for declaring an external reference
to a module structure.
* node_extensions.cc: New File, implements get_builtin_module, which
iterates over the module structures that are compiled into node.
* node.cc(node::Binding): Use the new module lookup function to find
modules.
* node_{net,crypto}.c: Add NODE_MODULEs to generate the module structure.
Some compile time variables like the cflags and prefix have been moved to
the node_config.h.in, in the anticipation that they will be removed at
somepoint.
Those variables have following defaults :
- NODE_PREFIX is relative to the current path of the node_addon.py file
It is used as the base path of node include files.
- NODE_PATH is ~/.node_libraries
It's where modules are installed when calling `node-waf install`
Note .js files must be explicitely installed by the module's wscript.
Usage :
NODE_PREFIX=/usr/local NODE_PATH=~/.node_libraries node-waf configure
Done by not evaluating the code in the first tick.
This breaks one test in test-error-reporting.js but I believe this to be a
V8 error and I have reported it in
http://code.google.com/p/v8/issues/detail?id=764
C-Ares doesn't go through the Name Service Switch (NSS) and thus can't
resolve certain classes of names. Generally this doesn't matter and the
whole idea of NSS is rather annoying. Nevertheless until C-Ares gets better
support, adding this hack to go through getaddrinfo() for .local domain look
up.
This reverts commit 9926dacd14.