Browse Source

Modify node_addon configure api

v0.7.4-release
Ryan Dahl 15 years ago
parent
commit
7b8842b619
  1. 1
      doc/api.txt
  2. 20
      tools/wafadmin/Tools/node_addon.py

1
doc/api.txt

@ -1324,7 +1324,6 @@ def set_options(opt):
def configure(conf): def configure(conf):
conf.check_tool('compiler_cxx') conf.check_tool('compiler_cxx')
conf.check_tool('node_addon') conf.check_tool('node_addon')
conf.check_node_headers()
def build(bld): def build(bld):
obj = bld.new_task_gen('cxx', 'shlib', 'node_addon') obj = bld.new_task_gen('cxx', 'shlib', 'node_addon')

20
tools/wafadmin/Tools/node_addon.py

@ -1,14 +1,14 @@
import os import os
import TaskGen, Utils, Utils, Runner, Options, Build import TaskGen, Utils, Utils, Runner, Options, Build
from TaskGen import extension, taskgen, before, after, feature from TaskGen import extension, taskgen, before, after, feature
from Configure import conf from Configure import conf, conftest
@taskgen @taskgen
@before('apply_incpaths', 'apply_lib_vars', 'apply_type_vars') @before('apply_incpaths', 'apply_lib_vars', 'apply_type_vars')
@feature('node_addon') @feature('node_addon')
@before('apply_bundle') @before('apply_bundle')
def init_node_addon(self): def init_node_addon(self):
self.default_install_path = '${PREFIX}/lib/node/libraries' self.default_install_path = '${PREFIX_NODE}/lib/node/libraries'
self.uselib = self.to_list(getattr(self, 'uselib', '')) self.uselib = self.to_list(getattr(self, 'uselib', ''))
if not 'NODE' in self.uselib: self.uselib.append('NODE') if not 'NODE' in self.uselib: self.uselib.append('NODE')
self.env['MACBUNDLE'] = True self.env['MACBUNDLE'] = True
@ -20,15 +20,19 @@ def init_node_addon(self):
def node_addon_shlib_ext(self): def node_addon_shlib_ext(self):
self.env['shlib_PATTERN'] = "%s.node" self.env['shlib_PATTERN'] = "%s.node"
@conf def detect(conf):
def check_node_headers(conf):
join = os.path.join join = os.path.join
wafadmin = join(os.path.dirname(__file__), '..') abspath = os.path.abspath
libnode = join(wafadmin, '..') wafadmin = abspath(join(os.path.dirname(__file__), '..'))
lib = join(libnode, '..') libnode = abspath(join(wafadmin, '..'))
prefix = join(lib, '..') lib = abspath(join(libnode, '..'))
prefix = abspath(join(lib, '..'))
conf.env['PREFIX_NODE'] = prefix
conf.env['LIBPATH_NODE'] = lib conf.env['LIBPATH_NODE'] = lib
conf.env['CPPPATH_NODE'] = join(prefix, 'include/node') conf.env['CPPPATH_NODE'] = join(prefix, 'include/node')
conf.env['CPPFLAGS_NODE'] = '-D_GNU_SOURCE' conf.env['CPPFLAGS_NODE'] = '-D_GNU_SOURCE'
conf.env['CPPFLAGS_NODE'] = '-DEV_MULTIPLICITY=0' conf.env['CPPFLAGS_NODE'] = '-DEV_MULTIPLICITY=0'
found = os.path.exists(join(prefix, "bin/node"))
conf.check_message('node prefix', '', found, prefix)

Loading…
Cancel
Save