From 686106d544ecc3b6ffd4db2b665d3bc879a58d8c Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Mon, 24 Sep 2012 16:22:07 -0400 Subject: ok --- node_modules/mongodb/install.js | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 node_modules/mongodb/install.js (limited to 'node_modules/mongodb/install.js') diff --git a/node_modules/mongodb/install.js b/node_modules/mongodb/install.js new file mode 100644 index 0000000..f9f2a57 --- /dev/null +++ b/node_modules/mongodb/install.js @@ -0,0 +1,40 @@ +var spawn = require('child_process').spawn, + exec = require('child_process').exec; + +process.stdout.write("================================================================================\n"); +process.stdout.write("= =\n"); +process.stdout.write("= To install with C++ bson parser do =\n"); +process.stdout.write("= =\n"); +process.stdout.write("================================================================================\n"); + +// Check if we want to build the native code +var build_native = process.env['npm_package_config_native'] != null ? process.env['npm_package_config_native'] : 'false'; +build_native = build_native == 'true' ? true : false; +// If we are building the native bson extension ensure we use gmake if available +if(build_native) { + // Check if we need to use gmake + exec('which gmake', function(err, stdout, stderr) { + // Set up spawn command + var make = null; + // No gmake build using make + if(err != null) { + make = spawn('make', ['total']); + } else { + make = spawn('gmake', ['total']); + } + + // Execute spawn + make.stdout.on('data', function(data) { + process.stdout.write(data); + }) + + make.stderr.on('data', function(data) { + process.stdout.write(data); + }) + + make.on('exit', function(code) { + process.stdout.write('child process exited with code ' + code + "\n"); + }) + }); +} + -- cgit v1.2.3-70-g09d2