diff --git a/example/web/build-openssl.sh b/example/web/build-openssl.sh index faf4f657..ec339d54 100755 --- a/example/web/build-openssl.sh +++ b/example/web/build-openssl.sh @@ -15,6 +15,7 @@ cd openssl-$OPENSSL emconfigure ./Configure linux-generic32 no-shared no-dso no-engine no-unit-test no-ui || exit 1 sed -i.bak 's/CROSS_COMPILE=.*/CROSS_COMPILE=/g' Makefile || exit 1 sed -i.bak 's/-ldl //g' Makefile || exit 1 +sed -i.bak 's/-O3/-Os/g' Makefile || exit 1 echo "Building OpenSSL..." emmake make depend || exit 1 emmake make -j 4 || exit 1 diff --git a/tdnet/CMakeLists.txt b/tdnet/CMakeLists.txt index ab81cecd..ed15325d 100644 --- a/tdnet/CMakeLists.txt +++ b/tdnet/CMakeLists.txt @@ -48,7 +48,11 @@ set(TDNET_SOURCE add_library(tdnet STATIC ${TDNET_SOURCE}) target_include_directories(tdnet PUBLIC $) target_include_directories(tdnet SYSTEM PRIVATE $) -target_link_libraries(tdnet PUBLIC tdutils tdactor PRIVATE ${CMAKE_DL_LIBS} ${OPENSSL_LIBRARIES} ${ZLIB_LIBRARIES}) +target_link_libraries(tdnet PUBLIC tdutils tdactor PRIVATE ${CMAKE_DL_LIBS} ${ZLIB_LIBRARIES}) +target_link_libraries(tdnet PRIVATE ${OPENSSL_CRYPTO_LIBRARY}) +if (NOT EMSCRIPTEN) + target_link_libraries(tdnet PRIVATE ${OPENSSL_SSL_LIBRARY}) +endif() if (WIN32) target_link_libraries(tdnet PRIVATE Crypt32) diff --git a/tdnet/td/net/SslStream.cpp b/tdnet/td/net/SslStream.cpp index b737b34b..3f0c93b9 100644 --- a/tdnet/td/net/SslStream.cpp +++ b/tdnet/td/net/SslStream.cpp @@ -6,6 +6,7 @@ // #include "td/net/SslStream.h" +#if !TD_EMSCRIPTEN #include "td/utils/common.h" #include "td/utils/logging.h" #include "td/utils/misc.h" @@ -541,3 +542,34 @@ size_t SslStream::flow_write(Slice slice) { } } // namespace td +#else +namespace td { +namespace detail { +class SslStreamImpl { +}; +} +SslStream::SslStream() = default; +SslStream::SslStream(SslStream &&) = default; +SslStream &SslStream::operator=(SslStream &&) = default; +SslStream::~SslStream() = default; + +Result SslStream::create(CSlice host, CSlice cert_file, VerifyPeer verify_peer) { + return Status::Error("Not supported in emscripten"); +} +SslStream::SslStream(unique_ptr impl) : impl_(std::move(impl)) { +} +ByteFlowInterface &SslStream::read_byte_flow() { + UNREACHABLE(); +} +ByteFlowInterface &SslStream::write_byte_flow() { + UNREACHABLE(); +} +size_t SslStream::flow_read(MutableSlice slice) { + UNREACHABLE(); +} +size_t SslStream::flow_write(Slice slice) { + UNREACHABLE(); +} + +} // namespace td +#endif