1
1
# /usr/bin/env python
2
+ import platform
3
+ import re
2
4
import Options
3
5
import sys , os , shutil
4
6
from os .path import join , dirname , abspath
@@ -95,14 +97,14 @@ def configure(conf):
95
97
# Configure debug variant
96
98
conf .setenv ('debug' )
97
99
debug_env .set_variant ('debug' )
98
- debug_env .append_value ('CCFLAGS' , ['-DDEBUG' , '-g' , '-O0' , '-Wall' , '-Wextra' , '-m32' ])
99
- debug_env .append_value ('CXXFLAGS' , ['-DDEBUG' , '-g' , '-O0' , '-Wall' , '-Wextra' , '-m32' ])
100
+ debug_env .append_value ('CCFLAGS' , ['-DDEBUG' , '-g' , '-O0' , '-Wall' , '-Wextra' ])
101
+ debug_env .append_value ('CXXFLAGS' , ['-DDEBUG' , '-g' , '-O0' , '-Wall' , '-Wextra' ])
100
102
conf .write_config_header ("config.h" )
101
103
102
104
# Configure default variant
103
105
conf .setenv ('default' )
104
- conf .env .append_value ('CCFLAGS' , ['-DNDEBUG' , '-O3' , '-m32' ])
105
- conf .env .append_value ('CXXFLAGS' , ['-DNDEBUG' , '-O3' , '-m32' ])
106
+ conf .env .append_value ('CCFLAGS' , ['-DNDEBUG' , '-O3' ])
107
+ conf .env .append_value ('CXXFLAGS' , ['-DNDEBUG' , '-O3' ])
106
108
conf .write_config_header ("config.h" )
107
109
108
110
def build_udns (bld ):
@@ -137,6 +139,18 @@ def build_udns(bld):
137
139
bld .env_of_name ('debug' )["LIBPATH_UDNS" ] = debug_dir
138
140
bld .install_files ('${PREFIX}/include/node/' , 'deps/udns/udns.h' );
139
141
142
+ # XXX Remove this when v8 defaults x86_64 to native builds
143
+ def GuessArchitecture ():
144
+ id = platform .machine ()
145
+ if id .startswith ('arm' ):
146
+ return 'arm'
147
+ elif '64' in id :
148
+ return 'x64'
149
+ elif (not id ) or (not re .match ('(x|i[3-6])86' , id ) is None ):
150
+ return 'ia32'
151
+ else :
152
+ return None
153
+
140
154
141
155
def build_v8 (bld ):
142
156
deps_src = join (bld .path .abspath (),"deps" )
@@ -146,18 +160,22 @@ def build_v8(bld):
146
160
scons = os .path .join (cwd , 'tools/scons/scons.py' )
147
161
148
162
v8rule = 'cd %s && ' \
149
- 'python %s -Q mode=%s library=static snapshot=on'
163
+ 'python %s -Q mode=%s %s library=static snapshot=on'
164
+
165
+ arch = ""
166
+ if GuessArchitecture () == "x64" :
167
+ arch = "arch=x64"
150
168
151
169
v8 = bld .new_task_gen (
152
170
target = join ("deps/v8" , bld .env ["staticlib_PATTERN" ] % "v8" ),
153
- rule = v8rule % (v8dir_tgt , scons , "release" ),
171
+ rule = v8rule % (v8dir_tgt , scons , "release" , arch ),
154
172
before = "cxx" ,
155
173
install_path = None
156
174
)
157
175
bld .env ["CPPPATH_V8" ] = "deps/v8/include"
158
176
bld .env_of_name ('default' )["STATICLIB_V8" ] = "v8"
159
177
bld .env_of_name ('default' )["LIBPATH_V8" ] = v8dir_tgt
160
- bld .env_of_name ('default' )["LINKFLAGS_V8" ] = ["-pthread" , "-m32" ]
178
+ bld .env_of_name ('default' )["LINKFLAGS_V8" ] = ["-pthread" ]
161
179
162
180
### v8 debug
163
181
if bld .env ["USE_DEBUG" ]:
@@ -167,8 +185,8 @@ def build_v8(bld):
167
185
v8_debug = v8 .clone ("debug" )
168
186
bld .env_of_name ('debug' )["STATICLIB_V8" ] = "v8_g"
169
187
bld .env_of_name ('debug' )["LIBPATH_V8" ] = v8dir_tgt
170
- bld .env_of_name ('debug' )["LINKFLAGS_V8" ] = ["-pthread" , "-m32" ]
171
- v8_debug .rule = v8rule % (v8dir_tgt , scons , "debug" )
188
+ bld .env_of_name ('debug' )["LINKFLAGS_V8" ] = ["-pthread" ]
189
+ v8_debug .rule = v8rule % (v8dir_tgt , scons , "debug" , arch )
172
190
v8_debug .target = join ("deps/v8" , bld .env ["staticlib_PATTERN" ] % "v8_g" )
173
191
174
192
bld .install_files ('${PREFIX}/include/node/' , 'deps/v8/include/v8*' );
0 commit comments