This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

Add node-waf to help with building addons.

  • Loading branch information...
ry committed Oct 4, 2009
1 parent 13793ae commit 39e6d959d74220762c20ae4d207972bc4a6118e9
Showing with 51 additions and 0 deletions.
  1. +17 −0 bin/node-waf
  2. +34 −0 tools/wafadmin/Tools/node_addon.py
View
@@ -0,0 +1,17 @@
+#!/usr/bin/env python
+import os, sys
+
+
+join = os.path.join
+bindir = os.path.dirname(__file__)
+prefix = join(bindir, "..")
+wafdir = join(prefix, "lib", "node")
+
+w = join(wafdir, 'wafadmin')
+t = join(w, 'Tools')
+sys.path = [w, t] + sys.path
+
+import Scripting
+VERSION="1.5.9"
+Scripting.prepare(t, os.getcwd(), VERSION, wafdir)
+sys.exit(0)
@@ -0,0 +1,34 @@
+import os
+import TaskGen, Utils, Utils, Runner, Options, Build
+from TaskGen import extension, taskgen, before, after, feature
+from Configure import conf
+
+@taskgen
+@before('apply_incpaths', 'apply_lib_vars', 'apply_type_vars')
+@feature('node_addon')
+@before('apply_bundle')
+def init_node_addon(self):
+ self.default_install_path = '${PREFIX}/lib/node/libraries'
+ self.uselib = self.to_list(getattr(self, 'uselib', ''))
+ if not 'NODE' in self.uselib: self.uselib.append('NODE')
+ self.env['MACBUNDLE'] = True
+
+@taskgen
+@before('apply_link', 'apply_lib_vars', 'apply_type_vars')
+@after('apply_bundle')
+@feature('node_addon')
+def node_addon_shlib_ext(self):
+ self.env['shlib_PATTERN'] = "%s.node"
+
+@conf
+def check_node_headers(conf):
+ join = os.path.join
+ wafadmin = join(os.path.dirname(__file__), '..')
+ libnode = join(wafadmin, '..')
+ lib = join(libnode, '..')
+ prefix = join(lib, '..')
+ conf.env['LIBPATH_NODE'] = lib
+ conf.env['CPPPATH_NODE'] = join(prefix, 'include/node')
+ conf.env['CPPFLAGS_NODE'] = '-D_GNU_SOURCE'
+ conf.env['CPPFLAGS_NODE'] = '-DEV_MULTIPLICITY=0'
+

0 comments on commit 39e6d95

Please sign in to comment.