forked from theturtle32/WebSocket-Node
-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.js
31 lines (29 loc) · 1.4 KB
/
install.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
var spawn = require('child_process').spawn
, exec = require('child_process').exec
, fs = require('fs')
, version = JSON.parse(fs.readFileSync(__dirname + '/package.json', 'utf8')).version
, verbose = process.env['npm_package_config_verbose'] != null ? process.env['npm_package_config_verbose'] === 'true' : false;
console.log('[websocket v%s] Attempting to compile native extensions.', version);
var gyp = exec('node-gyp rebuild', {cwd: __dirname});
gyp.stdout.on('data', function(data) {
if (verbose) process.stdout.write(data);
});
gyp.stderr.on('data', function(data) {
if (verbose) process.stdout.write(data);
});
gyp.on('exit', function(code) {
if (code !== 0) {
console.log("[websocket v%s]", version);
console.log(' Native code compile failed!!');
console.log(' Please note that this module DOES NOT REQUIRE the native components');
console.log(' and will still work without them, though not quite as efficiently.');
console.log('');
console.log(' On Windows, native extensions require Visual Studio and Python.');
console.log(' On Unix, native extensions require Python, make and a C++ compiler.');
console.log(' Start npm with --websocket:verbose to show compilation output (if any).');
}
else {
console.log('[websocket v%s] Native extension compilation successful!', version);
}
process.exit();
});