This repository has been archived by the owner on Feb 4, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
install
executable file
·70 lines (63 loc) · 2.12 KB
/
install
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#!/usr/local/bin/node
// Includes
var sys = require('sys');
var spawn = require('child_process').spawn;
var fs = require("fs");
var Observable = require("./lib/Observable").Observable;
var o = new Observable();
// Tasks
o.on('install',function(){
process.chdir("./deps/node-mysql");
var mysql = spawn('/usr/local/bin/node-waf',['configure','build']);
mysql.stderr.addListener('data',function(data){
process.stdout.write(data);
});
mysql.stdout.addListener('data',function(data){
process.stdout.write(data);
});
mysql.addListener('exit',o.relay('node_mysql_complete'));
});
// When we're done installing mysql
o.on('node_mysql_complete',function(){
process.chdir("../node-memcache");
var memcache_patch = spawn('git',['apply','../patches/node-memcache.patch']);
memcache_patch.addListener('exit',o.relay('node_memcache_patch'));
});
// When we're done patching
o.on('node_memcache_patch',function(){
var memcache = spawn('/usr/local/bin/node-waf',['configure','build']);
memcache.stderr.addListener('data',function(data){
process.stdout.write(data);
});
memcache.stdout.addListener('data',function(data){
process.stdout.write(data);
});
memcache.addListener('exit',o.relay('node_memcache_complete'));
});
// Install the crypt module
o.on('node_memcache_complete',function(){
process.chdir("../node-crypto");
var crypt = spawn("/usr/local/bin/node-waf",['configure','build']);
crypt.stderr.addListener('data',function(d){process.stdout.write(d);});
crypt.stdout.addListener('data',function(d){process.stdout.write(d);});
crypt.addListener('exit',o.relay('node_crypt_complete'));
});
// When we're done with memcache
o.on('node_crypt_complete',function(){
var i;
var lib_path;
for( i = 0; i < require.paths.length; i++){
if(require.paths[i].match('.node_libraries')){
lib_path = require.paths[i];
}
}
if(!lib_path){
throw new Error("I do not know where to link this");
}
try{fs.unlinkSync(lib_path + "/lnmm")}catch(e){}
fs.symlinkSync(__dirname, lib_path + "/lnmm" );
sys.puts("Linking to " + lib_path + "/lnmm");
sys.puts("Done!");
});
// run.
o.fire('install');