diff --git a/build/builder/build-external.py b/build/builder/build-external.py index d80faf0..e46d3f4 100644 --- a/build/builder/build-external.py +++ b/build/builder/build-external.py @@ -23,7 +23,7 @@ class BuilderBase: self._init_path() def _init_path(self): - cc.e("this is a pure-virtual function.") + cc.e("_init_path() pure-virtual function.") def build_jsoncpp(self): file_name = 'jsoncpp-{}.zip'.format(env.ver_jsoncpp) @@ -33,7 +33,7 @@ class BuilderBase: return utils.download_file('jsoncpp source tarball', 'https://github.com/open-source-parsers/jsoncpp/archive/{}.zip'.format(env.ver_jsoncpp), PATH_DOWNLOAD, file_name) def _build_jsoncpp(self, file_name): - cc.e("this is a pure-virtual function.") + cc.e("_build_jsoncpp() pure-virtual function.") def build_mongoose(self): file_name = 'mongoose-{}.zip'.format(env.ver_mongoose) @@ -43,7 +43,7 @@ class BuilderBase: return utils.download_file('mongoose source tarball', 'https://github.com/cesanta/mongoose/archive/{}.zip'.format(env.ver_mongoose), PATH_DOWNLOAD, file_name) def _build_mongoose(self, file_name): - cc.e("this is a pure-virtual function.") + cc.e("_build_mongoose() pure-virtual function.") def build_openssl(self): file_name = 'openssl-{}.zip'.format(env.ver_ossl) @@ -54,7 +54,7 @@ class BuilderBase: return utils.download_file('openssl source tarball', 'https://github.com/openssl/openssl/archive/OpenSSL_{}.zip'.format(_alt_ver), PATH_DOWNLOAD, file_name) def _build_openssl(self, file_name): - cc.e("this is a pure-virtual function.") + cc.e("_build_openssl() pure-virtual function.") # _alt_ver = '_'.join(env.ver_ossl.split('.')) # if not utils.download_file('openssl source tarball', 'https://github.com/openssl/openssl/archive/OpenSSL_{}.zip'.format(_alt_ver), PATH_DOWNLOAD, file_name): # cc.e("can not download openssl source tarball.") @@ -90,7 +90,7 @@ class BuilderBase: return utils.download_file('mbedtls source tarball', 'https://www.zlib.net/zlib{}.zip'.format(env.ver_zlib_number), PATH_DOWNLOAD, file_name) def _build_zlib(self, file_name): - cc.e("this is a pure-virtual function.") + cc.e("_build_zlib() pure-virtual function.") def build_libssh(self): file_name = 'libssh-{}.zip'.format(env.ver_libssh) @@ -100,13 +100,13 @@ class BuilderBase: return utils.download_file('libssh source tarball', 'https://git.libssh.org/projects/libssh.git/snapshot/libssh-{}.zip'.format(env.ver_libssh), PATH_DOWNLOAD, file_name) def _build_libssh(self, file_name): - cc.e("this is a pure-virtual function.") + cc.e("_build_libssh() pure-virtual function.") def prepare_python(self): self._prepare_python() def _prepare_python(self): - cc.e("this is a pure-virtual function.") + cc.e("_prepare_python() pure-virtual function.") def fix_output(self): pass @@ -611,6 +611,7 @@ class BuilderMacOS(BuilderBase): self.LIBUV_PATH_SRC = os.path.join(self.PATH_TMP, 'libuv-{}'.format(env.ver_libuv)) self.MBEDTLS_PATH_SRC = os.path.join(self.PATH_TMP, 'mbedtls-mbedtls-{}'.format(env.ver_mbedtls)) self.LIBSSH_PATH_SRC = os.path.join(self.PATH_TMP, 'libssh-{}'.format(env.ver_libssh)) + self.ZLIB_PATH_SRC = os.path.join(self.PATH_TMP, 'zlib-{}'.format(env.ver_zlib)) self.JSONCPP_PATH_SRC = os.path.join(PATH_EXTERNAL, 'jsoncpp') self.MONGOOSE_PATH_SRC = os.path.join(PATH_EXTERNAL, 'mongoose') @@ -619,6 +620,8 @@ class BuilderMacOS(BuilderBase): utils.makedirs(self.PATH_TMP) def _build_jsoncpp(self, file_name): + if not self._download_jsoncpp(file_name): + return cc.n('prepare jsoncpp source code...', end='') if not os.path.exists(self.JSONCPP_PATH_SRC): cc.v('') @@ -628,6 +631,8 @@ class BuilderMacOS(BuilderBase): cc.w('already exists, skip.') def _build_mongoose(self, file_name): + if not self._download_mongoose(file_name): + return cc.n('prepare mongoose source code...', end='') if not os.path.exists(self.MONGOOSE_PATH_SRC): cc.v('') @@ -637,7 +642,10 @@ class BuilderMacOS(BuilderBase): cc.w('already exists, skip.') def _build_openssl(self, file_name): - if not super()._build_openssl(file_name): + cc.w('skip build openssl again.') + return + + if not self._download_openssl(file_name): return cc.n('prepare openssl source code...', end='') @@ -665,6 +673,8 @@ class BuilderMacOS(BuilderBase): os.chdir(old_p) def _build_libuv(self, file_name): + if not self._download_libuv(file_name): + return cc.n('prepare libuv source code...', end='') if not os.path.exists(self.LIBUV_PATH_SRC): os.system('unzip "{}/{}" -d "{}"'.format(PATH_DOWNLOAD, file_name, self.PATH_TMP)) @@ -687,6 +697,8 @@ class BuilderMacOS(BuilderBase): os.chdir(old_p) def _build_mbedtls(self, file_name): + if not self._download_mbedtls(file_name): + return if not os.path.exists(self.MBEDTLS_PATH_SRC): os.system('unzip "{}/{}" -d "{}"'.format(PATH_DOWNLOAD, file_name, self.PATH_TMP)) @@ -731,6 +743,11 @@ class BuilderMacOS(BuilderBase): os.chdir(old_p) def _build_libssh(self, file_name): + cc.n('skip build libssh on macOS.') + return + + if not self._download_libssh(file_name): + return if not os.path.exists(self.LIBSSH_PATH_SRC): os.system('unzip "{}/{}" -d "{}"'.format(PATH_DOWNLOAD, file_name, self.PATH_TMP)) @@ -748,7 +765,6 @@ class BuilderMacOS(BuilderBase): ' -DOPENSSL_LIBRARIES={path_release}/lib' \ ' -DWITH_SFTP=ON' \ ' -DWITH_SERVER=ON' \ - ' -DWITH_STATIC_LIB=ON' \ ' -DWITH_GSSAPI=OFF' \ ' -DWITH_ZLIB=OFF' \ ' -DWITH_PCAP=OFF' \ @@ -758,6 +774,8 @@ class BuilderMacOS(BuilderBase): ' -DWITH_NACL=OFF' \ ''.format(path_release=self.PATH_RELEASE) + # ' -DWITH_STATIC_LIB=ON' + try: utils.cmake(build_path, 'Release', False, cmake_define) except: @@ -771,6 +789,41 @@ class BuilderMacOS(BuilderBase): # utils.copy_file(os.path.join(self.LIBSSH_PATH_SRC, 'build', 'src', 'threads'), os.path.join(self.PATH_RELEASE, 'lib'), 'libssh_threads.a') utils.copy_ex(os.path.join(self.LIBSSH_PATH_SRC, 'include'), os.path.join(self.PATH_RELEASE, 'include'), 'libssh') + def _build_zlib(self, file_name): + # cc.w('skip build zlib again.') + if not self._download_zlib(file_name): + return + if not os.path.exists(self.ZLIB_PATH_SRC): + os.system('unzip "{}/{}" -d "{}"'.format(PATH_DOWNLOAD, file_name, self.PATH_TMP)) + + cc.n('build zlib...', end='') + out_file = os.path.join(self.PATH_RELEASE, 'lib', 'libz.a') + if os.path.exists(out_file): + cc.w('already exists, skip.') + return + cc.v('') + + build_path = os.path.join(self.ZLIB_PATH_SRC, 'build') + + cmake_define = ' -DCMAKE_INSTALL_PREFIX={path_release}' \ + ' ..'.format(path_release=self.PATH_RELEASE) + + old_p = os.getcwd() + try: + utils.cmake(build_path, 'Release', False, cmake_define=cmake_define, cmake_pre_define='CFLAGS="-fPIC"') + os.chdir(build_path) + utils.sys_exec('make install') + except: + pass + os.chdir(old_p) + + utils.ensure_file_exists(out_file) + files = os.listdir(os.path.join(self.PATH_RELEASE, 'lib')) + for i in files: + if i.startswith('libz.so'): + # use os.unlink() because some file should be a link. + os.unlink(os.path.join(self.PATH_RELEASE, 'lib', i)) + def _prepare_python(self): pass diff --git a/client/tp-player/tp-player.pro b/client/tp-player/tp-player.pro index 3b95bae..ba65483 100644 --- a/client/tp-player/tp-player.pro +++ b/client/tp-player/tp-player.pro @@ -47,6 +47,18 @@ else:win32:CONFIG(debug, debug|release): { DESTDIR = $$PWD/../../out/client/x86/Debug } + +macx:CONFIG(release, debug|release): { + DEFINES += QT_NO_DEBUG_OUTPUT + LIBS += -L$$PWD/../../external/zlib/build/release/ -lzlib + DESTDIR = $$PWD/../../out/client/x86/Release +} +else:macx:CONFIG(debug, debug|release): { + LIBS += -L$$PWD/../../external/zlib/build/debug/ -lzlibd + DESTDIR = $$PWD/../../out/client/x86/Debug +} + + INCLUDEPATH += $$PWD/../../external/zlib INCLUDEPATH += $$PWD/../../external/zlib/build DEPENDPATH += $$PWD/../../external/zlib diff --git a/client/tp_assist_macos/TP-Assist.xcodeproj/project.pbxproj b/client/tp_assist_macos/TP-Assist.xcodeproj/project.pbxproj index 6222092..2a18ea2 100644 --- a/client/tp_assist_macos/TP-Assist.xcodeproj/project.pbxproj +++ b/client/tp_assist_macos/TP-Assist.xcodeproj/project.pbxproj @@ -37,8 +37,9 @@ 7AA2CD541F6AB9F10074C92B /* json_writer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7AA2CD501F6AB9F10074C92B /* json_writer.cpp */; }; 7AA2CD571F6ABA2E0074C92B /* mongoose.c in Sources */ = {isa = PBXBuildFile; fileRef = 7AA2CD561F6ABA2E0074C92B /* mongoose.c */; }; 7AA2CD591F6AC0DA0074C92B /* site in Resources */ = {isa = PBXBuildFile; fileRef = 7AA2CD581F6AC0DA0074C92B /* site */; }; - 7AF9BF272199E3DE00BE5DBC /* libssl.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 7AF9BF1F2199E31A00BE5DBC /* libssl.a */; }; - 7AF9BF292199E3DF00BE5DBC /* libcrypto.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 7AF9BF282199E3DF00BE5DBC /* libcrypto.a */; }; + 7AAE4B242390EE5C007EDDE7 /* libmbedtls.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 7AF9BF222199E32B00BE5DBC /* libmbedtls.a */; }; + 7AAE4B252390EE7D007EDDE7 /* libmbedcrypto.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 7AF9BF232199E32B00BE5DBC /* libmbedcrypto.a */; }; + 7AAE4B262390EE7D007EDDE7 /* libmbedx509.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 7AF9BF212199E32B00BE5DBC /* libmbedx509.a */; }; A1B7B9DD1DB53ED200809327 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = A1B7B9DF1DB53ED200809327 /* Localizable.strings */; }; A1D700071A5DCE8D003563E4 /* AboutWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = A1D700061A5DCE8D003563E4 /* AboutWindowController.m */; }; C149EBFE15D5214600B1F558 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C149EBFD15D5214600B1F558 /* Cocoa.framework */; }; @@ -107,11 +108,10 @@ 7AA2CD501F6AB9F10074C92B /* json_writer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = json_writer.cpp; path = ../../../../external/jsoncpp/src/lib_json/json_writer.cpp; sourceTree = ""; }; 7AA2CD561F6ABA2E0074C92B /* mongoose.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = mongoose.c; path = ../../../../external/mongoose/mongoose.c; sourceTree = ""; }; 7AA2CD581F6AC0DA0074C92B /* site */ = {isa = PBXFileReference; lastKnownFileType = folder; path = site; sourceTree = ""; }; - 7AF9BF1F2199E31A00BE5DBC /* libssl.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libssl.a; path = ../../external/macos/release/lib/libssl.a; sourceTree = ""; }; + 7AAE4B232390E642007EDDE7 /* mongoose.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = mongoose.h; path = ../../../../external/mongoose/mongoose.h; sourceTree = ""; }; 7AF9BF212199E32B00BE5DBC /* libmbedx509.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libmbedx509.a; path = ../../external/macos/release/lib/libmbedx509.a; sourceTree = ""; }; 7AF9BF222199E32B00BE5DBC /* libmbedtls.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libmbedtls.a; path = ../../external/macos/release/lib/libmbedtls.a; sourceTree = ""; }; 7AF9BF232199E32B00BE5DBC /* libmbedcrypto.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libmbedcrypto.a; path = ../../external/macos/release/lib/libmbedcrypto.a; sourceTree = ""; }; - 7AF9BF282199E3DF00BE5DBC /* libcrypto.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libcrypto.a; path = ../../external/macos/release/lib/libcrypto.a; sourceTree = ""; }; A1B7B9D31DB5361700809327 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/MainMenu.xib; sourceTree = ""; }; A1B7B9DE1DB53ED200809327 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/Localizable.strings; sourceTree = ""; }; A1B7B9E01DB53ED700809327 /* Base */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = Base; path = Base.lproj/Localizable.strings; sourceTree = ""; }; @@ -143,8 +143,9 @@ buildActionMask = 2147483647; files = ( C149EBFE15D5214600B1F558 /* Cocoa.framework in Frameworks */, - 7AF9BF292199E3DF00BE5DBC /* libcrypto.a in Frameworks */, - 7AF9BF272199E3DE00BE5DBC /* libssl.a in Frameworks */, + 7AAE4B262390EE7D007EDDE7 /* libmbedx509.a in Frameworks */, + 7AAE4B252390EE7D007EDDE7 /* libmbedcrypto.a in Frameworks */, + 7AAE4B242390EE5C007EDDE7 /* libmbedtls.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -225,6 +226,7 @@ 7AA2CD551F6ABA000074C92B /* mongoose */ = { isa = PBXGroup; children = ( + 7AAE4B232390E642007EDDE7 /* mongoose.h */, 7AA2CD561F6ABA2E0074C92B /* mongoose.c */, ); name = mongoose; @@ -248,13 +250,6 @@ path = csrc; sourceTree = ""; }; - 7AF9BF1E2199E0DD00BE5DBC /* mbedtls */ = { - isa = PBXGroup; - children = ( - ); - name = mbedtls; - sourceTree = ""; - }; A12D9BE61BCF2C72004F52A6 /* apple-scpt */ = { isa = PBXGroup; children = ( @@ -286,11 +281,9 @@ C149EBFC15D5214600B1F558 /* Frameworks */ = { isa = PBXGroup; children = ( - 7AF9BF282199E3DF00BE5DBC /* libcrypto.a */, 7AF9BF232199E32B00BE5DBC /* libmbedcrypto.a */, 7AF9BF222199E32B00BE5DBC /* libmbedtls.a */, 7AF9BF212199E32B00BE5DBC /* libmbedx509.a */, - 7AF9BF1F2199E31A00BE5DBC /* libssl.a */, C149EBFD15D5214600B1F558 /* Cocoa.framework */, C149EBFF15D5214600B1F558 /* Other Frameworks */, ); @@ -310,7 +303,6 @@ C149EC0315D5214600B1F558 /* src */ = { isa = PBXGroup; children = ( - 7AF9BF1E2199E0DD00BE5DBC /* mbedtls */, 7A45423D2196E32800FEB5B4 /* cfg */, 7AD3E8741F6A7CC600D2EB48 /* csrc */, A12D9BE61BCF2C72004F52A6 /* apple-scpt */, @@ -367,7 +359,7 @@ C149EBF015D5214600B1F558 /* Project object */ = { isa = PBXProject; attributes = { - LastUpgradeCheck = 0930; + LastUpgradeCheck = 1120; ORGANIZATIONNAME = TP4A; TargetAttributes = { C149EBF815D5214600B1F558 = { @@ -606,13 +598,14 @@ C149EC1815D5214600B1F558 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - CODE_SIGN_IDENTITY = ""; + CODE_SIGN_IDENTITY = "-"; COMBINE_HIDPI_IMAGES = YES; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "src/TP-Assist-Prefix.pch"; GCC_PREPROCESSOR_DEFINITIONS = ( "DEBUG=1", MG_ENABLE_SSL, + "MG_SSL_IF=MG_SSL_IF_MBEDTLS", ); HEADER_SEARCH_PATHS = ( ../../common/teleport, @@ -634,7 +627,7 @@ C149EC1915D5214600B1F558 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - CODE_SIGN_IDENTITY = ""; + CODE_SIGN_IDENTITY = "-"; COMBINE_HIDPI_IMAGES = YES; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "src/TP-Assist-Prefix.pch"; diff --git a/client/tp_assist_macos/src/Base.lproj/AboutWindowController.xib b/client/tp_assist_macos/src/Base.lproj/AboutWindowController.xib index f9946ed..60f1162 100644 --- a/client/tp_assist_macos/src/Base.lproj/AboutWindowController.xib +++ b/client/tp_assist_macos/src/Base.lproj/AboutWindowController.xib @@ -1,8 +1,8 @@ - + - + @@ -19,61 +19,61 @@ - - + + - + - + - + - - - + + + - + + + + + + + + + + - + - - - - - - - - - - + diff --git a/client/tp_assist_macos/src/Base.lproj/Localizable.strings b/client/tp_assist_macos/src/Base.lproj/Localizable.strings index 532603b..4773301 100644 --- a/client/tp_assist_macos/src/Base.lproj/Localizable.strings +++ b/client/tp_assist_macos/src/Base.lproj/Localizable.strings @@ -8,7 +8,7 @@ //============================================= // for About Window //============================================= -"version" = "Version: "; -"app_full_name" = "Teleport Assist for macOS"; +"version" = ""; +"app_full_name" = "Teleport Assist"; "copyright" = "Copyright © 2017~2019, tp4a.com. All rights reserved."; "visit_tp4a_website" = "Visit Teleport Website" diff --git a/client/tp_assist_macos/src/csrc/ts_env.cpp b/client/tp_assist_macos/src/csrc/ts_env.cpp index fc196d9..b5c9173 100644 --- a/client/tp_assist_macos/src/csrc/ts_env.cpp +++ b/client/tp_assist_macos/src/csrc/ts_env.cpp @@ -32,3 +32,11 @@ bool TsEnv::init(const char* cfg_file, const char* res_path) return true; } + +extern "C" { +int mg_ssl_if_mbed_random(void *ctx, unsigned char *buf, size_t len) { + (void) ctx; + while (len--) *buf++ = (arc4random() % 255); + return 0; +} +} diff --git a/client/tp_assist_macos/src/zh-Hans.lproj/Localizable.strings b/client/tp_assist_macos/src/zh-Hans.lproj/Localizable.strings index aed4793..9ebc70b 100644 --- a/client/tp_assist_macos/src/zh-Hans.lproj/Localizable.strings +++ b/client/tp_assist_macos/src/zh-Hans.lproj/Localizable.strings @@ -13,7 +13,7 @@ // for About Window //============================================= "about " = "关于 "; -"version" = "版本:"; -"app_full_name" = "Teleport助手 - macOS"; +"version" = ""; +"app_full_name" = "Teleport助手"; "copyright" = "© 2017~2019,tp4a.com。保留所有权利。"; "visit_tp4a_website" = "访问 Teleport 网站";