Skip to content

Commit 8ddf930

Browse files
committed
Build natively on x64.
Had to add some waf hackery to override V8's architecture choice. They probably have a reason for defaulting still to IA32, but all tests are passing for me, and it makes it easier on users-and I think chrome is using x64 builds too. So let's go for it!
1 parent 82d986d commit 8ddf930

File tree

3 files changed

+28
-11
lines changed

3 files changed

+28
-11
lines changed

deps/udns/Makefile.in

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ NAMEPFX = $(NAME)-$(VERS)
5252

5353
CC = @CC@
5454
RANLIB = @RANLIB@
55-
CFLAGS = @CFLAGS@ -m32
55+
CFLAGS = @CFLAGS@
5656
CDEFS = @CDEFS@
5757
PICFLAGS = -fPIC
5858
AWK = awk

src/object_wrap.h

-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ class ObjectWrap {
3737
assert(handle->InternalFieldCount() > 0);
3838
handle_ = v8::Persistent<v8::Object>::New(handle);
3939
handle_->SetInternalField(0, v8::External::New(this));
40-
handle_->Set(v8::String::NewSymbol("nodeId"), v8::Integer::New((int32_t)this));
4140
MakeWeak();
4241
}
4342

wscript

+27-9
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
# /usr/bin/env python
2+
import platform
3+
import re
24
import Options
35
import sys, os, shutil
46
from os.path import join, dirname, abspath
@@ -95,14 +97,14 @@ def configure(conf):
9597
# Configure debug variant
9698
conf.setenv('debug')
9799
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'])
100102
conf.write_config_header("config.h")
101103

102104
# Configure default variant
103105
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'])
106108
conf.write_config_header("config.h")
107109

108110
def build_udns(bld):
@@ -137,6 +139,18 @@ def build_udns(bld):
137139
bld.env_of_name('debug')["LIBPATH_UDNS"] = debug_dir
138140
bld.install_files('${PREFIX}/include/node/', 'deps/udns/udns.h');
139141

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+
140154

141155
def build_v8(bld):
142156
deps_src = join(bld.path.abspath(),"deps")
@@ -146,18 +160,22 @@ def build_v8(bld):
146160
scons = os.path.join(cwd, 'tools/scons/scons.py')
147161

148162
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"
150168

151169
v8 = bld.new_task_gen(
152170
target = join("deps/v8", bld.env["staticlib_PATTERN"] % "v8"),
153-
rule=v8rule % (v8dir_tgt, scons, "release"),
171+
rule=v8rule % (v8dir_tgt, scons, "release", arch),
154172
before="cxx",
155173
install_path = None
156174
)
157175
bld.env["CPPPATH_V8"] = "deps/v8/include"
158176
bld.env_of_name('default')["STATICLIB_V8"] = "v8"
159177
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"]
161179

162180
### v8 debug
163181
if bld.env["USE_DEBUG"]:
@@ -167,8 +185,8 @@ def build_v8(bld):
167185
v8_debug = v8.clone("debug")
168186
bld.env_of_name('debug')["STATICLIB_V8"] = "v8_g"
169187
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)
172190
v8_debug.target = join("deps/v8", bld.env["staticlib_PATTERN"] % "v8_g")
173191

174192
bld.install_files('${PREFIX}/include/node/', 'deps/v8/include/v8*');

0 commit comments

Comments
 (0)