Permalink
Browse files

updated build script to try to detect node binary architecture. fixes #…

  • Loading branch information...
1 parent ab0b163 commit 81ea80a1382cfada27f63c7eadd2c3bfadbf40a3 @einaros einaros committed Feb 21, 2012
Showing with 32 additions and 9 deletions.
  1. +2 −1 History.md
  2. +5 −2 Makefile
  3. +4 −2 lib/BufferUtil.js
  4. +4 −2 lib/Validation.js
  5. +17 −2 wscript
View
@@ -1,8 +1,9 @@
-v0.4.7 - In development
+v0.4.7 - Feb 21st 2012
=====================
* Exposed bytesReceived from websocket client object, which makes it possible to implement bandwidth sampling. [einaros]
* Updated browser based file upload example to include and output per websocket channel bandwidth sampling. [einaros]
+* Changed build scripts to check which architecture is currently in use. Required after the node.js changes to have prebuilt packages target ia32 by default. [einaros]
v0.4.6 - Feb 9th 2012
=====================
View
@@ -4,6 +4,9 @@ ALL_INTEGRATION = $(shell find test/ -name '*.integration.js')
all:
node-waf configure build
+clean:
+ node-waf clean
+
run-tests:
@./node_modules/.bin/mocha \
-t 2000 \
@@ -27,9 +30,9 @@ benchmark:
@node bench/parser.benchmark.js
autobahn:
- @NODE_PATH=lib node test/autobahn.js
+ @NODE_PATH=lib node test/autobahn.js
autobahn-server:
- @NODE_PATH=lib node test/autobahn-server.js
+ @NODE_PATH=lib node test/autobahn-server.js
.PHONY: test
View
@@ -7,11 +7,13 @@
/**
* Node version 0.4 and 0.6 compatibility
*/
-
+
try {
module.exports = require('../build/Release/bufferutil');
} catch (e) { try {
module.exports = require('../build/default/bufferutil');
} catch (e) {
+ console.error('bufferutil.node has either not been built (run make),');
+ console.error('or your node install has changed architecture (run make clean && make).')
throw e;
-}}
+}}
View
@@ -7,11 +7,13 @@
/**
* Node version 0.4 and 0.6 compatibility
*/
-
+
try {
module.exports = require('../build/Release/validation');
} catch (e) { try {
module.exports = require('../build/default/validation');
} catch (e) {
+ console.error('validation.node has either not been built (run make),');
+ console.error('or your node install has changed architecture (run make clean && make).')
throw e;
-}}
+}}
View
19 wscript
@@ -1,15 +1,30 @@
+import subprocess
+
srcdir = '.'
blddir = 'build'
VERSION = '0.4.6'
+def node_arch():
+ cmd = [ 'node', '-e', 'console.log(process.arch)' ]
+ p = subprocess.Popen(cmd, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+ out = p.communicate()[0].split('\n')[0]
+ return out
+
def set_options(opt):
opt.tool_options('compiler_cxx')
def configure(conf):
conf.check_tool('compiler_cxx')
conf.check_tool('node_addon')
- conf.env.append_value('CCFLAGS', ['-O3'])
- conf.env.append_value('CXXFLAGS', ['-O3'])
+ arch = node_arch()
+ arch_mappings = {'ia32': 'i386', 'x64': 'x86_64'}
+ flags = ['-O3']
+ if arch in arch_mappings:
+ arch = arch_mappings[arch]
+ flags += ['-arch', arch]
+ conf.env.append_value('CCFLAGS', flags)
+ conf.env.append_value('CXXFLAGS', flags)
+ conf.env.append_value('LINKFLAGS', flags)
def build(bld):
obj = bld.new_task_gen('cxx', 'shlib', 'node_addon')

0 comments on commit 81ea80a

Please sign in to comment.