mirror of https://github.com/tp4a/teleport
fix some bugs when automatic build on Linux.
parent
a2fdd126e8
commit
33a0c33663
|
@ -18,6 +18,10 @@ OPENSSL_VER = utils.cfg.ver.openssl
|
||||||
LIBUV_VER = utils.cfg.ver.libuv
|
LIBUV_VER = utils.cfg.ver.libuv
|
||||||
MBEDTLS_VER = utils.cfg.ver.mbedtls
|
MBEDTLS_VER = utils.cfg.ver.mbedtls
|
||||||
SQLITE_VER = utils.cfg.ver.sqlite
|
SQLITE_VER = utils.cfg.ver.sqlite
|
||||||
|
LIBSSH_VER = utils.cfg.ver.libssh
|
||||||
|
JSONCPP_VER = utils.cfg.ver.jsoncpp
|
||||||
|
MONGOOSE_VER = utils.cfg.ver.mongoose
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class BuilderBase:
|
class BuilderBase:
|
||||||
|
@ -31,6 +35,24 @@ class BuilderBase:
|
||||||
def _init_path(self):
|
def _init_path(self):
|
||||||
cc.e("this is a pure-virtual function.")
|
cc.e("this is a pure-virtual function.")
|
||||||
|
|
||||||
|
def build_jsoncpp(self):
|
||||||
|
file_name = 'jsoncpp-{}.zip'.format(JSONCPP_VER)
|
||||||
|
if not self._download_file('jsoncpp source tarball', 'https://github.com/open-source-parsers/jsoncpp/archive/{}.zip'.format(JSONCPP_VER), file_name):
|
||||||
|
return
|
||||||
|
self._build_jsoncpp(file_name)
|
||||||
|
|
||||||
|
def _build_jsoncpp(self, file_name):
|
||||||
|
cc.e("this is a pure-virtual function.")
|
||||||
|
|
||||||
|
def build_mongoose(self):
|
||||||
|
file_name = 'mongoose-{}.zip'.format(MONGOOSE_VER)
|
||||||
|
if not self._download_file('mongoose source tarball', 'https://github.com/cesanta/mongoose/archive/{}.zip'.format(MONGOOSE_VER), file_name):
|
||||||
|
return
|
||||||
|
self._build_mongoose(file_name)
|
||||||
|
|
||||||
|
def _build_mongoose(self, file_name):
|
||||||
|
cc.e("this is a pure-virtual function.")
|
||||||
|
|
||||||
def build_openssl(self):
|
def build_openssl(self):
|
||||||
file_name = 'openssl-{}.tar.gz'.format(OPENSSL_VER)
|
file_name = 'openssl-{}.tar.gz'.format(OPENSSL_VER)
|
||||||
if not self._download_file('openssl source tarball', 'https://www.openssl.org/source/{}'.format(file_name), file_name):
|
if not self._download_file('openssl source tarball', 'https://www.openssl.org/source/{}'.format(file_name), file_name):
|
||||||
|
@ -59,8 +81,8 @@ class BuilderBase:
|
||||||
cc.e("this is a pure-virtual function.")
|
cc.e("this is a pure-virtual function.")
|
||||||
|
|
||||||
def build_libssh(self):
|
def build_libssh(self):
|
||||||
file_name = 'libssh-master.zip'
|
file_name = 'libssh-{}.zip'.format(LIBSSH_VER)
|
||||||
if not self._download_file('mbedtls source tarball', 'https://git.libssh.org/projects/libssh.git/snapshot/master.zip', file_name):
|
if not self._download_file('libssh source tarball', 'https://git.libssh.org/projects/libssh.git/snapshot/libssh-{}.zip'.format(LIBSSH_VER), file_name):
|
||||||
return
|
return
|
||||||
self._build_libssh(file_name)
|
self._build_libssh(file_name)
|
||||||
|
|
||||||
|
@ -69,7 +91,7 @@ class BuilderBase:
|
||||||
|
|
||||||
def build_sqlite(self):
|
def build_sqlite(self):
|
||||||
file_name = 'sqlite-autoconf-{}.tar.gz'.format(SQLITE_VER)
|
file_name = 'sqlite-autoconf-{}.tar.gz'.format(SQLITE_VER)
|
||||||
if not self._download_file('mbedtls source tarball', 'http://sqlite.org/2016/{}'.format(file_name), file_name):
|
if not self._download_file('sqlite source tarball', 'http://sqlite.org/2016/{}'.format(file_name), file_name):
|
||||||
return
|
return
|
||||||
self._build_sqlite(file_name)
|
self._build_sqlite(file_name)
|
||||||
|
|
||||||
|
@ -93,6 +115,7 @@ class BuilderBase:
|
||||||
def fix_output(self):
|
def fix_output(self):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class BuilderWin(BuilderBase):
|
class BuilderWin(BuilderBase):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
|
@ -117,12 +140,31 @@ class BuilderLinux(BuilderBase):
|
||||||
self.OPENSSL_PATH_SRC = os.path.join(self.PATH_TMP, 'openssl-{}'.format(OPENSSL_VER))
|
self.OPENSSL_PATH_SRC = os.path.join(self.PATH_TMP, 'openssl-{}'.format(OPENSSL_VER))
|
||||||
self.LIBUV_PATH_SRC = os.path.join(self.PATH_TMP, 'libuv-{}'.format(LIBUV_VER))
|
self.LIBUV_PATH_SRC = os.path.join(self.PATH_TMP, 'libuv-{}'.format(LIBUV_VER))
|
||||||
self.MBEDTLS_PATH_SRC = os.path.join(self.PATH_TMP, 'mbedtls-mbedtls-{}'.format(MBEDTLS_VER))
|
self.MBEDTLS_PATH_SRC = os.path.join(self.PATH_TMP, 'mbedtls-mbedtls-{}'.format(MBEDTLS_VER))
|
||||||
self.LIBSSH_PATH_SRC = os.path.join(self.PATH_TMP, 'libssh-master')
|
self.LIBSSH_PATH_SRC = os.path.join(self.PATH_TMP, 'libssh-{}'.format(LIBSSH_VER))
|
||||||
self.SQLITE_PATH_SRC = os.path.join(self.PATH_TMP, 'sqlite-autoconf-{}'.format(SQLITE_VER))
|
self.SQLITE_PATH_SRC = os.path.join(self.PATH_TMP, 'sqlite-autoconf-{}'.format(SQLITE_VER))
|
||||||
|
|
||||||
|
self.JSONCPP_PATH_SRC = os.path.join(PATH_EXTERNAL, 'jsoncpp')
|
||||||
|
self.MONGOOSE_PATH_SRC = os.path.join(PATH_EXTERNAL, 'mongoose')
|
||||||
|
|
||||||
if not os.path.exists(self.PATH_TMP):
|
if not os.path.exists(self.PATH_TMP):
|
||||||
utils.makedirs(self.PATH_TMP)
|
utils.makedirs(self.PATH_TMP)
|
||||||
|
|
||||||
|
def _build_jsoncpp(self, file_name):
|
||||||
|
cc.n('prepare jsoncpp source code...')
|
||||||
|
if not os.path.exists(self.JSONCPP_PATH_SRC):
|
||||||
|
os.system('unzip "{}/{}" -d "{}"'.format(PATH_DOWNLOAD, file_name, PATH_EXTERNAL))
|
||||||
|
os.rename(os.path.join(PATH_EXTERNAL, 'jsoncpp-{}'.format(JSONCPP_VER)), self.JSONCPP_PATH_SRC)
|
||||||
|
else:
|
||||||
|
cc.w('already exists, skip.')
|
||||||
|
|
||||||
|
def _build_mongoose(self, file_name):
|
||||||
|
cc.n('prepare mongoose source code...')
|
||||||
|
if not os.path.exists(self.MONGOOSE_PATH_SRC):
|
||||||
|
os.system('unzip "{}/{}" -d "{}"'.format(PATH_DOWNLOAD, file_name, PATH_EXTERNAL))
|
||||||
|
os.rename(os.path.join(PATH_EXTERNAL, 'mongoose-{}'.format(MONGOOSE_VER)), self.MONGOOSE_PATH_SRC)
|
||||||
|
else:
|
||||||
|
cc.w('already exists, skip.')
|
||||||
|
|
||||||
def _build_openssl(self, file_name):
|
def _build_openssl(self, file_name):
|
||||||
if not os.path.exists(self.OPENSSL_PATH_SRC):
|
if not os.path.exists(self.OPENSSL_PATH_SRC):
|
||||||
os.system('tar -zxvf "{}/{}" -C "{}"'.format(PATH_DOWNLOAD, file_name, self.PATH_TMP))
|
os.system('tar -zxvf "{}/{}" -C "{}"'.format(PATH_DOWNLOAD, file_name, self.PATH_TMP))
|
||||||
|
@ -246,7 +288,7 @@ class BuilderLinux(BuilderBase):
|
||||||
if not os.path.exists(self.LIBSSH_PATH_SRC):
|
if not os.path.exists(self.LIBSSH_PATH_SRC):
|
||||||
# os.system('tar -zxvf "{}/{}" -C "{}"'.format(PATH_DOWNLOAD, file_name, PATH_TMP))
|
# os.system('tar -zxvf "{}/{}" -C "{}"'.format(PATH_DOWNLOAD, file_name, PATH_TMP))
|
||||||
os.system('unzip "{}/{}" -d "{}"'.format(PATH_DOWNLOAD, file_name, self.PATH_TMP))
|
os.system('unzip "{}/{}" -d "{}"'.format(PATH_DOWNLOAD, file_name, self.PATH_TMP))
|
||||||
os.rename(os.path.join(self.PATH_TMP, 'master'), os.path.join(self.PATH_TMP, 'libssh-master'))
|
# os.rename(os.path.join(self.PATH_TMP, 'master'), os.path.join(self.PATH_TMP, 'libssh-{}'.format(LIBSSH_VER)))
|
||||||
|
|
||||||
cc.n('build libssh...')
|
cc.n('build libssh...')
|
||||||
if os.path.exists(os.path.join(self.PATH_RELEASE, 'lib', 'libssh.a')):
|
if os.path.exists(os.path.join(self.PATH_RELEASE, 'lib', 'libssh.a')):
|
||||||
|
@ -285,8 +327,6 @@ class BuilderLinux(BuilderBase):
|
||||||
# # os.system('make install')
|
# # os.system('make install')
|
||||||
# os.chdir(old_p)
|
# os.chdir(old_p)
|
||||||
|
|
||||||
# TODO: need modify the `config.h.cmake` and comment out HAVE_OPENSSL_CRYPTO_CTR128_ENCRYPT.
|
|
||||||
|
|
||||||
cmake_define = ' -DCMAKE_INSTALL_PREFIX={}' \
|
cmake_define = ' -DCMAKE_INSTALL_PREFIX={}' \
|
||||||
' -D_OPENSSL_VERSION={}' \
|
' -D_OPENSSL_VERSION={}' \
|
||||||
' -DOPENSSL_INCLUDE_DIR={}/include' \
|
' -DOPENSSL_INCLUDE_DIR={}/include' \
|
||||||
|
@ -370,6 +410,9 @@ def main():
|
||||||
if builder is None:
|
if builder is None:
|
||||||
builder = gen_builder(ctx.host_os)
|
builder = gen_builder(ctx.host_os)
|
||||||
|
|
||||||
|
builder.build_jsoncpp()
|
||||||
|
builder.build_mongoose()
|
||||||
|
|
||||||
# builder.build_openssl()
|
# builder.build_openssl()
|
||||||
####builder.build_libuv()
|
####builder.build_libuv()
|
||||||
builder.build_mbedtls()
|
builder.build_mbedtls()
|
||||||
|
|
|
@ -23,4 +23,7 @@ openssl = 1.0.2h
|
||||||
libuv = 1.9.1
|
libuv = 1.9.1
|
||||||
mbedtls = 2.3.0
|
mbedtls = 2.3.0
|
||||||
sqlite = 3160200
|
sqlite = 3160200
|
||||||
|
libssh = 0.7.4
|
||||||
|
jsoncpp = 0.10.6
|
||||||
|
mongoose = 6.6
|
||||||
|
|
||||||
|
|
|
@ -295,7 +295,7 @@ void TsHttpRpc::_rpc_func_get_config(const Json::Value& json_param, ex_astr& buf
|
||||||
if (it->first.length() > 9 && 0 == wcsncmp(it->first.c_str(), L"protocol-", 9))
|
if (it->first.length() > 9 && 0 == wcsncmp(it->first.c_str(), L"protocol-", 9))
|
||||||
{
|
{
|
||||||
ex_wstr name;
|
ex_wstr name;
|
||||||
name.assign(it->first, 9);
|
name.assign(it->first, 9, it->first.length() - 9);
|
||||||
ex_astr _name;
|
ex_astr _name;
|
||||||
ex_wstr2astr(name, _name);
|
ex_wstr2astr(name, _name);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue