tdweb: do not link with libssl, only with libcrypto

GitOrigin-RevId: fb7cd454c3b368381fd65150979e6233a452eb8c
This commit is contained in:
Arseny Smirnov 2019-06-28 13:03:06 +02:00
parent fe00a7e7cf
commit d22a6751db
3 changed files with 38 additions and 1 deletions

View File

@ -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

View File

@ -48,7 +48,11 @@ set(TDNET_SOURCE
add_library(tdnet STATIC ${TDNET_SOURCE})
target_include_directories(tdnet PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>)
target_include_directories(tdnet SYSTEM PRIVATE $<BUILD_INTERFACE:${OPENSSL_INCLUDE_DIR}>)
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)

View File

@ -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> SslStream::create(CSlice host, CSlice cert_file, VerifyPeer verify_peer) {
return Status::Error("Not supported in emscripten");
}
SslStream::SslStream(unique_ptr<detail::SslStreamImpl> 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