-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathinstall.py
More file actions
154 lines (132 loc) · 5.43 KB
/
install.py
File metadata and controls
154 lines (132 loc) · 5.43 KB
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
import os
import stat
import platform
import shutil
def rmtree(top):
for root, dirs, files in os.walk(top, topdown=False):
for name in files:
filename = os.path.join(root, name)
os.chmod(filename, stat.S_IWUSR)
os.remove(filename)
for name in dirs:
os.rmdir(os.path.join(root, name))
os.rmdir(top)
if os.path.exists(os.getcwd() + '/3rd'):
shutil.rmtree(os.getcwd() + '/3rd')
os.system('mkdir 3rd')
cur_path_ = os.getcwd() + '/3rd'
root_path = cur_path_[:cur_path_.rfind('/')]
print("root path ", root_path)
print("cur path", cur_path_)
os.chdir(cur_path_)
###################libevent###################################
print("download Libevent version release-2.0.22-stable")
if os.path.exists(cur_path_ + "/Libevent"):
rmtree(cur_path_ + "/Libevent")
#os.system('git clone https://gitee.com/pojol/Libevent.git')
os.system('git clone https://github.com/nmathewson/Libevent.git')
os.chdir(cur_path_ + "/Libevent")
os.system('git checkout release-2.0.22-stable')
if platform.system() == 'Linux':
os.system('./autogen.sh')
os.system('./configure --prefix=/' + root_path + '/lib/libevent')
os.system('make')
os.system('make install')
elif platform.system() == 'Darwin':
print("darwin")
#usr/local/Cellar/openssl/1.0.2j/include
os.system('./configure --prefix=/' + root_path + '/lib/libevent' + " CPPFLAGS=-I/usr/local/Cellar/openssl/1.0.2j/include LDFLAGS=-I/usr/local/Cellar/openssl/1.0.2j/lib")
os.system('make')
os.system('make install')
else:
pass
os.chdir(cur_path_)
'''
'''
#################glog####################################
print("download glog version 0.3.4")
if os.path.exists(cur_path_ + "/glog"):
rmtree(cur_path_ + "/glog")
#os.system('git clone https://gitee.com/pojol/glog.git')
os.system('git clone https://github.com/google/glog.git')
os.chdir(cur_path_ + "/glog")
os.system('git checkout v0.3.4')
if platform.system() == 'Linux':
os.system('./configure --prefix=/' + root_path + '/lib/glog')
os.system('make')
os.system('make install')
else:
pass
os.chdir(cur_path_)
###################protobuf############################
##################sol##############################
print("download sol2 version 2.16.0")
if os.path.exists(cur_path_ + "/sol2"):
rmtree(cur_path_ + "/sol2")
os.system('git clone https://github.com/ThePhD/sol2.git')
#os.system('git clone https://gitee.com/pojol/sol2.git')
os.chdir(cur_path_ + '/sol2')
os.system('git checkout v2.16.0')
os.chdir(cur_path_)
#########################hiredis##############################
print("download hiredis version 0.13.3")
if os.path.exists(cur_path_ + "/hiredis"):
rmtree(cur_path_ + "/hiredis")
os.system('git clone https://github.com/redis/hiredis.git')
#os.system('git clone https://gitee.com/pojol/hiredis.git')
os.chdir(cur_path_ + '/hiredis')
os.system('git checkout v0.13.3')
if platform.system() == 'Linux':
os.system('make')
os.system('cp -r ' + cur_path_ + '/hiredis' + ' ' + root_path + '/lib/hiredis')
else:
pass
os.chdir(cur_path_)
######################lua############################
print("download lua version 5.3.0")
if os.path.exists(cur_path_ + "/lua-5.3.4"):
rmtree(cur_path_ + "/lua-5.3.4")
os.system('wget -P ' + root_path + '/3rd http://www.lua.org/ftp/lua-5.3.4.tar.gz')
if platform.system() == 'Linux':
os.system('tar -xzvf ./lua-5.3.4.tar.gz')
os.chdir(cur_path_ + '/lua-5.3.4')
os.system('make linux')
os.system('mkdir ' + root_path + '/lib/lua')
os.system('cp -r ' + cur_path_ + '/lua-5.3.4/src/* ' + ' ' + root_path + '/lib/lua/')
os.chdir(cur_path_)
################### mysql connector ###################
os.system('wget -P ' + root_path + '/3rd https://cdn.mysql.com//Downloads/Connector-C/mysql-connector-c-6.1.11-linux-glibc2.12-x86_64.tar.gz')
if platform.system() == 'Linux':
os.system('tar -xzvf ' + root_path + '/3rd/mysql-connector-c-6.1.11-linux-glibc2.12-x86_64.tar.gz')
os.system('mkdir ' + root_path + '/lib/mysql_connector')
os.system('mkdir ' + root_path + '/lib/mysql_connector/include')
os.system('mkdir ' + root_path + '/lib/mysql_connector/lib')
os.system('cp -r ' + cur_path_ + '/mysql-connector-c-6.1.11-linux-glibc2.12-x86_64/include/*' + ' ' + root_path + '/lib/mysql_connector/include')
os.system('cp -r ' + cur_path_ + '/mysql-connector-c-6.1.11-linux-glibc2.12-x86_64/lib/*' + ' ' + root_path + '/lib/mysql_connector/lib')
pass
os.chdir(cur_path_)
########################fmtlib###########################
print("download fmtlib version 4.0.0")
if os.path.exists(cur_path_ + "/fmt"):
rmtree(cur_path_ + "/fmt")
if os.path.exists(root_path + "/lib/fmt"):
rmtree(root_path + "/lib/fmt")
os.system('git clone https://github.com/fmtlib/fmt.git')
#os.system('git clone https://gitee.com/pojol/fmt.git')
os.chdir(cur_path_ + '/fmt')
os.system('git checkout 4.0.0')
if platform.system() == 'Linux' or platform.system() == 'Darwin':
os.system('mkdir build')
os.chdir(cur_path_ + '/fmt/build')
os.system('cmake ..')
os.system('make')
os.chdir(root_path + "/lib")
os.system('mkdir fmt')
os.chdir(root_path + "/lib/fmt")
os.system('mkdir lib')
os.system('mkdir include')
os.chdir(root_path + "/lib/fmt/include")
os.system('mkdir fmt')
os.system('cp -rf ' + cur_path_ + '/fmt/build/fmt/libfmt.a' + ' ' + root_path + '/lib/fmt/lib/')
os.system('cp -rf ' + cur_path_ + '/fmt/fmt/*' + ' ' + root_path + '/lib/fmt/include/fmt')
os.chdir(root_path)