From 85a86b5fd64ee4f5502552096dcc5f616158d7d6 Mon Sep 17 00:00:00 2001 From: Fedor Indutny Date: Fri, 27 Jan 2012 20:23:32 +0600 Subject: [PATCH] waf: predict target arch for OSX --- tools/wafadmin/Tools/node_addon.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/tools/wafadmin/Tools/node_addon.py b/tools/wafadmin/Tools/node_addon.py index afe25951fe0..6ea65aec363 100644 --- a/tools/wafadmin/Tools/node_addon.py +++ b/tools/wafadmin/Tools/node_addon.py @@ -1,5 +1,5 @@ import os -import TaskGen, Utils, Utils, Runner, Options, Build +import TaskGen, Utils, Runner, Options, Build from TaskGen import extension, taskgen, before, after, feature from Configure import conf, conftest @@ -26,6 +26,7 @@ def detect(conf): conf.env['PREFIX_NODE'] = get_prefix() prefix = conf.env['PREFIX_NODE'] lib = join(prefix, 'lib') + nodebin = join(prefix, 'bin', 'node') conf.env['LIBPATH_NODE'] = lib conf.env['CPPPATH_NODE'] = join(prefix, 'include', 'node') @@ -49,14 +50,20 @@ def detect(conf): found = os.path.exists(conf.env['NODE_PATH']) conf.check_message('node path', '', found, conf.env['NODE_PATH']) - found = os.path.exists(join(prefix, 'bin', 'node')) + found = os.path.exists(nodebin) conf.check_message('node prefix', '', found, prefix) ## On Cygwin we need to link to the generated symbol definitions if Options.platform.startswith('cygwin'): conf.env['LIB_NODE'] = 'node' ## On Mac OSX we need to use mac bundles - if Options.platform == 'darwin': conf.check_tool('osx') + if Options.platform == 'darwin': + if 'i386' in Utils.cmd_output(['file', nodebin]): + conf.env.append_value('CPPFLAGS_NODE', ['-arch', 'i386']) + conf.env.append_value('CXXFLAGS_NODE', ['-arch', 'i386']) + conf.env.append_value('LINKFLAGS', ['-arch', 'i386']) + conf.env['DEST_CPU'] = 'i386' + conf.check_tool('osx') def get_node_path(): join = os.path.join