.adjust build script for Windows.

pull/173/head
Apex Liu 2019-01-05 02:39:33 +08:00
parent e58ca64e3f
commit c16d32e6d5
4 changed files with 23 additions and 12 deletions

View File

@ -161,7 +161,10 @@ class BuilderWin(BuilderBase):
os.chdir(self.OPENSSL_PATH_SRC)
os.system('""{}" Configure VC-WIN32"'.format(env.perl))
os.system(r'ms\do_nasm')
os.system(r'"{}\VC\bin\vcvars32.bat" && nmake -f ms\nt.mak'.format(env.visual_studio_path))
# for vs2015
# utils.sys_exec(r'"{}\VC\bin\vcvars32.bat" && nmake -f ms\nt.mak'.format(env.visual_studio_path), direct_output=True)
# for vs2017 community
utils.sys_exec(r'"{}VC\Auxiliary\Build\vcvars32.bat" && nmake -f ms\nt.mak'.format(env.visual_studio_path), direct_output=True)
for f in _chk_output:
if not os.path.exists(f):
@ -175,9 +178,17 @@ class BuilderWin(BuilderBase):
utils.unzip(os.path.join(PATH_DOWNLOAD, file_name), PATH_EXTERNAL)
os.rename(os.path.join(PATH_EXTERNAL, 'libssh-{}'.format(env.ver_libssh)), self.LIBSSH_PATH_SRC)
# cc.n('fix libssh source code... ', end='')
# utils.ensure_file_exists(os.path.join(PATH_EXTERNAL, 'fix-external', 'libssh', 'src', 'sftp.c'))
# utils.copy_file(os.path.join(PATH_EXTERNAL, 'fix-external', 'libssh', 'src'), os.path.join(self.LIBSSH_PATH_SRC, 'src'), 'sftp.c')
cc.n('fix libssh source code... ', end='')
utils.ensure_file_exists(os.path.join(PATH_EXTERNAL, 'fix-external', 'libssh', 'src', 'sftp.c'))
utils.copy_file(os.path.join(PATH_EXTERNAL, 'fix-external', 'libssh', 'src'), os.path.join(self.LIBSSH_PATH_SRC, 'src'), 'sftp.c')
s_name = 'libssh-{}'.format(env.ver_libssh)
utils.ensure_file_exists(os.path.join(PATH_EXTERNAL, 'fix-external', 'libssh', s_name, 'src', 'session.c'))
utils.ensure_file_exists(os.path.join(PATH_EXTERNAL, 'fix-external', 'libssh', s_name, 'src', 'libcrypto.c'))
utils.ensure_file_exists(os.path.join(PATH_EXTERNAL, 'fix-external', 'libssh', s_name, 'src', 'libcrypto-compat.c'))
utils.copy_file(os.path.join(PATH_EXTERNAL, 'fix-external', 'libssh', s_name, 'src'), os.path.join(self.LIBSSH_PATH_SRC, 'src'), 'session.c')
utils.copy_file(os.path.join(PATH_EXTERNAL, 'fix-external', 'libssh', s_name, 'src'), os.path.join(self.LIBSSH_PATH_SRC, 'src'), 'libcrypto.c')
utils.copy_file(os.path.join(PATH_EXTERNAL, 'fix-external', 'libssh', s_name, 'src'), os.path.join(self.LIBSSH_PATH_SRC, 'src'), 'libcrypto-compat.c')
out_file_lib = os.path.join(self.LIBSSH_PATH_SRC, 'lib', ctx.target_path, 'ssh.lib')
out_file_dll = os.path.join(self.LIBSSH_PATH_SRC, 'lib', ctx.target_path, 'ssh.dll')

View File

@ -111,7 +111,7 @@ class Env(object):
if self.nasm is None or not os.path.exists(self.nasm):
if warn_miss_tool:
cc.w(' - can not locate `nasm`, so I can build openssl.')
cc.w(' - can not locate `nasm`, so I can not build openssl.')
else:
_nasm_path = os.path.abspath(os.path.join(self.nasm, '..'))
os.environ['path'] = os.environ['path'] + ';' + _nasm_path
@ -123,12 +123,12 @@ class Env(object):
if self.perl is None or not os.path.exists(self.perl):
if warn_miss_tool:
cc.w(' - can not locate `perl`, so I can build openssl.')
cc.w(' - can not locate `perl`, so I can not build openssl.')
self.visual_studio_path = self._get_visual_studio_path()
if self.visual_studio_path is None or not os.path.exists(self.visual_studio_path):
if warn_miss_tool:
cc.w(' - can not locate Visual Studio installation, so I can build openssl.')
cc.w(' - can not locate Visual Studio installation, so I can build nothing.')
if 'msbuild' in _tmp:
self.msbuild = _tmp['msbuild']
@ -215,7 +215,6 @@ class Env(object):
# return p[0] if p is not None else None
def _get_visual_studio_path(self):
p = None
p = self._winreg_read(winreg.HKEY_LOCAL_MACHINE, r'SOFTWARE\WOW6432Node\Microsoft\VisualStudio\SxS\VS7', r'15.0')
return p[0] if p is not None else None

View File

@ -269,6 +269,7 @@ def ensure_file_exists(filename):
def sys_exec(cmd, direct_output=False, output_codec=None):
print(cmd)
if output_codec is None:
if env.is_win:
output_codec = 'gb2312'

10
external/readme.md vendored
View File

@ -4,7 +4,7 @@ teleport项目用到的第三方库
- openssl
https://www.openssl.org
openssl-1.0.2h
openssl-1.0.2p
请按openssl文档所述编译出openssl的静态库。要编译openssl需要
- perl 建议安装ActivePerl http://www.activestate.com/ActivePerl
- nasm http://www.nasm.us
@ -17,15 +17,15 @@ teleport项目用到的第三方库
注意teleport项目使用源代码直接编译因此解压缩源代码到此即可。
- mongoose
https://github.com/cesanta/mongoose
mongoose 6.6
mongoose 6.12
注意teleport项目使用源代码直接编译因此解压缩源代码到此即可。
- sqlite3
http://sqlite.org/download.html
sqlite3-amalgamation-3150200
sqlite3-autoconf-3250000
注意teleport项目使用源代码直接编译因此解压缩源代码到此即可。
- mbedtls
https://github.com/ARMmbed/mbedtls
mbedtls-mbedtls-2.2.1
mbedtls-mbedtls-2.12.0
注意teleport项目使用源代码直接编译因此解压缩源代码到此即可。
- libssh
https://git.libssh.org/projects/libssh.git/snapshot
@ -33,7 +33,7 @@ teleport项目用到的第三方库
Windows平台使用预制的libssh-static工程进行编译。
- libuv
https://github.com/libuv/libuv
v1.11.0.zip
v1.23.0.zip
注意teleport项目使用源代码直接编译因此解压缩源代码到此即可。