Browse files

waf: predict target arch for OSX

  • Loading branch information...
1 parent f89beaf commit 85a86b5fd64ee4f5502552096dcc5f616158d7d6 @indutny indutny committed Jan 27, 2012
Showing with 10 additions and 3 deletions.
  1. +10 −3 tools/wafadmin/Tools/node_addon.py
View
13 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

0 comments on commit 85a86b5

Please sign in to comment.