Skip to content

Commit

Permalink
Updated OpenSSL
Browse files Browse the repository at this point in the history
  • Loading branch information
EduMenges committed Jul 9, 2024
1 parent eae4811 commit fc41c99
Show file tree
Hide file tree
Showing 16 changed files with 133 additions and 75 deletions.
2 changes: 1 addition & 1 deletion AsyncIOManager
Submodule AsyncIOManager updated 1 files
+4 −4 CMakeLists.txt
5 changes: 1 addition & 4 deletions build/Android/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -126,10 +126,7 @@ set(OPENSSL_INCLUDE_DIR ${OPENSSL_ROOT_DIR}/include)
set(_OPENSSL_CACHE_ARGS
-DOPENSSL_USE_STATIC_LIBS:BOOL=ON
-DOPENSSL_ROOT_DIR:PATH=${OPENSSL_ROOT_DIR}
-DOPENSSL_INCLUDE_DIR:PATH=${OPENSSL_INCLUDE_DIR}
-DOPENSSL_LIBRARIES:PATH=${OPENSSL_ROOT_DIR}/lib
-DOPENSSL_CRYPTO_LIBRARY:FILEPATH=${OPENSSL_ROOT_DIR}/lib/libcrypto${CMAKE_STATIC_LIBRARY_SUFFIX}
-DOPENSSL_SSL_LIBRARY:FILEPATH=${OPENSSL_ROOT_DIR}/lib/libssl${CMAKE_STATIC_LIBRARY_SUFFIX}
-DOpenSSL_DIR:PATH=${OPENSSL_ROOT_DIR}/lib/cmake/OpenSSL
)

# rocksdb
Expand Down
2 changes: 1 addition & 1 deletion build/Android/Openssl-build/build-win.sh
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ export CC=clang
SCRIPT_PATH="${0%/*}"
CONFIGDIR="$SCRIPT_PATH/../../../openssl"
REALCONFIGDIR=$(cd "$CONFIGDIR" && pwd)
OPENSSL_CONFIGURE_CMD="${REALCONFIGDIR}/Configure $DEBUG_FLAGS no-asm no-shared $ABI --prefix=$BUILD_DIR --openssldir=$BUILD_DIR"
OPENSSL_CONFIGURE_CMD="${REALCONFIGDIR}/Configure $DEBUG_FLAGS no-asm no-shared $ABI --prefix=$BUILD_DIR --openssldir=$BUILD_DIR" --libdir=lib android-arm64

echo "Building OpenSSL"
echo $OPENSSL_CONFIGURE_CMD
Expand Down
2 changes: 1 addition & 1 deletion build/Android/Openssl-build/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export PATH=$LOCAL_ANDROID_NDK:$LOCAL_ANDROID_TOOLCHAIN:$LOCAL_PATH
CONFIGDIR=$(dirname $0)/../../../openssl
REALCONFIGDIR=$(realpath ${CONFIGDIR})

OPENSSL_CONFIGURE_CMD="${REALCONFIGDIR}/Configure $ABI $BUILD_TYPE no-asm no-shared --prefix=$BUILD_DIR --openssldir=$BUILD_DIR"
OPENSSL_CONFIGURE_CMD="${REALCONFIGDIR}/Configure $ABI $BUILD_TYPE no-asm no-shared --prefix=$BUILD_DIR --openssldir=$BUILD_DIR --libdir=lib"

echo "Building OpenSSL"
echo $OPENSSL_CONFIGURE_CMD
Expand Down
15 changes: 6 additions & 9 deletions build/CommonCompilerOptions.CMake
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ string(STRIP "${CMAKE_CXX_FLAGS}" CMAKE_CXX_FLAGS)

set(_CMAKE_COMMON_CACHE_ARGS
-DBUILD_SHARED_LIBS:BOOL=OFF
-DBUILD_TESTING:BOOL=OFF
-DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE}
-DCMAKE_C_FLAGS_DEBUG:STRING=${CMAKE_C_FLAGS_DEBUG}
-DCMAKE_C_FLAGS_RELEASE:STRING=${CMAKE_C_FLAGS_RELEASE}
Expand All @@ -54,22 +55,15 @@ set(_CMAKE_COMMON_CACHE_ARGS
-DCMAKE_CXX_FLAGS_RELEASE:STRING=${CMAKE_CXX_FLAGS_RELEASE}
-DCMAKE_CXX_FLAGS:STRING=${CMAKE_CXX_FLAGS}
-DCMAKE_CXX_STANDARD:STRING=${CMAKE_CXX_STANDARD}
-DCMAKE_FIND_PACKAGE_PREFER_CONFIG:BOOL=ON
-DCMAKE_POLICY_DEFAULT_CMP0074:STRING=NEW
-DCMAKE_POLICY_DEFAULT_CMP0144:STRING=NEW
-DCMAKE_POSITION_INDEPENDENT_CODE:BOOL=ON
-DCMAKE_TOOLCHAIN_FILE:FILEPATH=${CMAKE_TOOLCHAIN_FILE}
-DCMAKE_VS_GLOBALS:STRING=${CMAKE_VS_GLOBALS}
-DCMAKE_FIND_PACKAGE_PREFER_CONFIG:BOOL=ON
${_MSVC_RUNTIME_LIBRARY}
)

if(";${CMAKE_VS_PLATFORM_NAME};${MSVC_C_ARCHITECTURE_ID};${MSVC_CXX_ARCHITECTURE_ID};"
MATCHES ";(Win64|Itanium|x64|IA64);")
set(CMAKE_ASM${ASM_DIALECT}_COMPILER_INIT ml64)
else()
set(CMAKE_ASM${ASM_DIALECT}_COMPILER_INIT ml)
endif()

set(THIRDPARTY_DIR "${PROJECT_SRC_FOLDER}")

if(NOT EXISTS "${THIRDPARTY_DIR}/build")
Expand All @@ -82,4 +76,7 @@ set(BOOST_INCLUDE_LIBRARIES date_time filesystem log program_options random rege
list(JOIN BOOST_INCLUDE_LIBRARIES "," BOOST_INCLUDE_LIBRARIES_COMMA_SEPARATED)

string(REPLACE " " ";" BOOST_B2_FLAGS "${CMAKE_CXX_FLAGS}")
list(TRANSFORM BOOST_B2_FLAGS PREPEND "cxxflags=")
list(TRANSFORM BOOST_B2_FLAGS PREPEND "cxxflags=")

# OpenSSL
set(OPENSSL_VARIANT $<IF:$<CONFIG:Debug>,--debug,--release>)
22 changes: 9 additions & 13 deletions build/CommonTargets.CMake
Original file line number Diff line number Diff line change
Expand Up @@ -308,11 +308,10 @@ ExternalProject_Add(SQLiteModernCpp
SOURCE_DIR "${THIRDPARTY_DIR}/SQLiteModernCpp"
CMAKE_CACHE_ARGS
-DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR>
${_CMAKE_COMMON_CACHE_ARGS}
-DHUNTER_ENABLED:BOOL=OFF
-Dsqlite3_DIR:PATH=${_FINDPACKAGE_SQLITE3_CONFIG_DIR}
-DBUILD_TESTING:BOOL=OFF
-DENABLE_INSTALL:BOOL=ON
${_CMAKE_COMMON_CACHE_ARGS}
DEPENDS sqlite3
)

Expand Down Expand Up @@ -349,7 +348,7 @@ ExternalProject_Add(libp2p
${_BOOST_CACHE_ARGS}
${_OPENSSL_CACHE_ARGS}
${_CMAKE_COMMON_CACHE_ARGS}
-DCMAKE_CXX_FLAGS:STRING=${CMAKE_CXX_FLAGS}\ -I\ ${_FINDPACKAGE_GSL_INCLUDE_DIR}\ -I\ ${_FINDPACKAGE_SQLITE3_INCLUDE_DIR}\ -I\ ${OPENSSL_INCLUDE_DIR}
-DCMAKE_CXX_FLAGS:STRING=${CMAKE_CXX_FLAGS}\ -I\ ${_FINDPACKAGE_GSL_INCLUDE_DIR}\ -I\ ${_FINDPACKAGE_SQLITE3_INCLUDE_DIR}
DEPENDS Boost Microsoft.GSL openssl cares ${PROTOBUF_TARGET} fmt yaml-cpp soralog tsl_hat_trie Boost.DI SQLiteModernCpp grpc
)
set(_FINDPACKAGE_libp2p_CONFIG_DIR "${CMAKE_CURRENT_BINARY_DIR}/libp2p/lib/cmake/libp2p")
Expand Down Expand Up @@ -404,7 +403,7 @@ ExternalProject_Add(ipfs-lite-cpp
${_BOOST_CACHE_ARGS}
${_OPENSSL_CACHE_ARGS}
${ipfs-lite-cpp_EXTRA_PARAM}
-DCMAKE_CXX_FLAGS:STRING=${CMAKE_CXX_FLAGS}\ -I\ ${_FINDPACKAGE_GSL_INCLUDE_DIR}\ -I\ ${OPENSSL_INCLUDE_DIR}
-DCMAKE_CXX_FLAGS:STRING=${CMAKE_CXX_FLAGS}\ -I\ ${_FINDPACKAGE_GSL_INCLUDE_DIR}
DEPENDS Microsoft.GSL spdlog tsl_hat_trie libp2p grpc ${PROTOBUF_TARGET} rocksdb Boost.DI
)
set(_FINDPACKAGE_IPFS_LITE_CONFIG_DIR "${CMAKE_CURRENT_BINARY_DIR}/ipfs-lite-cpp/cmake/ipfs-lite-cpp")
Expand Down Expand Up @@ -438,7 +437,7 @@ ExternalProject_Add(ipfs-pubsub
${_BOOST_CACHE_ARGS}
${_OPENSSL_CACHE_ARGS}
${ipfs-pubsub_EXTRA_PARAM}
-DCMAKE_CXX_FLAGS:STRING=${CMAKE_CXX_FLAGS}\ -I\ ${_FINDPACKAGE_GSL_INCLUDE_DIR}\ -I\ ${OPENSSL_INCLUDE_DIR}
-DCMAKE_CXX_FLAGS:STRING=${CMAKE_CXX_FLAGS}\ -I\ ${_FINDPACKAGE_GSL_INCLUDE_DIR}
DEPENDS Microsoft.GSL spdlog tsl_hat_trie libp2p Boost.DI ipfs-lite-cpp
)
set(_FINDPACKAGE_IPFS_PUBSUB_CONFIG_DIR "${CMAKE_CURRENT_BINARY_DIR}/ipfs-pubsub/lib/cmake/ipfs-pubsub")
Expand Down Expand Up @@ -471,7 +470,7 @@ ExternalProject_Add(ipfs-bitswap-cpp
${_BOOST_CACHE_ARGS}
${_OPENSSL_CACHE_ARGS}
${ipfs-bitswap-cpp_EXTRA_PARAM}
-DCMAKE_CXX_FLAGS:STRING=${CMAKE_CXX_FLAGS}\ -I\ ${Boost_INCLUDE_DIR}\ -I\ ${_FINDPACKAGE_GSL_INCLUDE_DIR}\ -I\ ${_FINDPACKAGE_SPDLOG_INCLUDE_DIR}\ -I\ ${OPENSSL_INCLUDE_DIR}\ -I\ ${Protobuf_INCLUDE_DIR}
-DCMAKE_CXX_FLAGS:STRING=${CMAKE_CXX_FLAGS}\ -I\ ${_FINDPACKAGE_GSL_INCLUDE_DIR}
DEPENDS Microsoft.GSL spdlog libp2p Boost
)
set(_FINDPACKAGE_IPFS_BITSWAP_CONFIG_DIR "${CMAKE_CURRENT_BINARY_DIR}/ipfs-bitswap-cpp/lib/cmake/ipfs-bitswap-cpp")
Expand Down Expand Up @@ -619,35 +618,32 @@ ExternalProject_Add(wallet-core
${_BOOST_CACHE_ARGS}
${_OPENSSL_CACHE_ARGS}
${_GRPC_CACHE_ARGS}
-DCMAKE_CXX_FLAGS:STRING=${CMAKE_CXX_FLAGS}\ -I\ ${OPENSSL_INCLUDE_DIR}
PATCH_COMMAND ${_WALLET_CORE_GENERATE_SCRIPT} --target-os=${_WALLET_CORE_ARCH} --arch-abi=${WALLET_CORE_ARCH_ABI} --protobuf-dir=${PROTOBUF_HOST_PREFIX} --out-dir=<INSTALL_DIR> --plugin-dir=${ProtobufPlugin_DIR}/bin
DEPENDS Boost grpc openssl protobuf-plugin
)

# ----------------------BUILD EXTERNAL PROJECT------------------
# LIBSSH2
# libssh2
ExternalProject_Add(libssh2
PREFIX libssh2
SOURCE_DIR "${THIRDPARTY_DIR}/libssh2"
CMAKE_CACHE_ARGS
-DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR>
${_CMAKE_COMMON_CACHE_ARGS}
-DBUILD_EXAMPLES:BOOL=OFF
-DBUILD_SHARED_LIBS:BOOL=OFF
-DBUILD_STATIC_LIBS:BOOL=ON
-DBUILD_TESTING:BOOL=OFF
-DCRYPTO_BACKEND:STRING=OpenSSL
-DZLIB_ROOT:PATH=${ZLIB_ROOT}
-DZLIB_USE_STATIC_LIBS:BOOL=ON
-DCRYPTO_BACKEND:STRING=OpenSSL
${_OPENSSL_CACHE_ARGS}
${_CMAKE_COMMON_CACHE_ARGS}
DEPENDS openssl zlib
)

set(_FINDPACKAGE_LIBSSH2_CONFIG_DIR "${CMAKE_CURRENT_BINARY_DIR}/libssh2/lib/cmake/libssh2")
set(_FINDPACKAGE_LIBSSH2_LIBRARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/libssh2/lib")
set(_FINDPACKAGE_LIBSSH2_INCLUDE_DIR "${CMAKE_CURRENT_BINARY_DIR}/libssh2/include")

# AsyncIOManager
ExternalProject_Add(AsyncIOManager
PREFIX AsyncIOManager
SOURCE_DIR "${THIRDPARTY_DIR}/AsyncIOManager"
Expand Down Expand Up @@ -681,7 +677,7 @@ ExternalProject_Add(AsyncIOManager
${_BOOST_CACHE_ARGS}
${_OPENSSL_CACHE_ARGS}
${_CMAKE_COMMON_CACHE_ARGS}
DEPENDS libssh2 openssl ipfs-lite-cpp ipfs-bitswap-cpp grpc ${PROTOBUF_TARGET} Boost
DEPENDS libssh2 openssl ipfs-lite-cpp ipfs-bitswap-cpp grpc ${PROTOBUF_TARGET} Boost MNN
)
set(_FINDPACKAGE_ASIOMGR_CONFIG_DIR "${CMAKE_CURRENT_BINARY_DIR}/AsyncIOManager/lib/cmake/AsyncIOManager")
set(_FINDPACKAGE_ASIOMGR_LIBRARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/AsyncIOManager/lib")
Expand Down
7 changes: 2 additions & 5 deletions build/Linux/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,10 @@ set(_BOOST_CACHE_ARGS
# OpenSSL
set(OPENSSL_ROOT_DIR "${CMAKE_CURRENT_BINARY_DIR}/openssl/build/${CMAKE_SYSTEM_NAME}")

set(OPENSSL_VARIANT "$<$<CONFIG:Debug>:-d >")

ExternalProject_Add(openssl
PREFIX openssl
SOURCE_DIR "${THIRDPARTY_DIR}/openssl"
CONFIGURE_COMMAND <SOURCE_DIR>/config ${OPENSSL_VARIANT}-fPIC --prefix=${OPENSSL_ROOT_DIR} --openssldir=${OPENSSL_ROOT_DIR} --static -static
CONFIGURE_COMMAND <SOURCE_DIR>/Configure ${OPENSSL_VARIANT} -fPIC --prefix=${OPENSSL_ROOT_DIR} --openssldir=${OPENSSL_ROOT_DIR} --libdir=lib -static linux-${CMAKE_SYSTEM_PROCESSOR}-clang
BUILD_COMMAND make build_libs
BUILD_IN_SOURCE FALSE
INSTALL_COMMAND make install_dev
Expand All @@ -50,8 +48,7 @@ set(OPENSSL_INCLUDE_DIR ${OPENSSL_ROOT_DIR}/include)
set(_OPENSSL_CACHE_ARGS
-DOPENSSL_USE_STATIC_LIBS:BOOL=ON
-DOPENSSL_ROOT_DIR:PATH=${OPENSSL_ROOT_DIR}
-DOPENSSL_INCLUDE_DIR:PATH=${OPENSSL_INCLUDE_DIR}
-DOPENSSL_LIBRARIES:PATH=${OPENSSL_ROOT_DIR}/lib
-DOpenSSL_DIR:PATH=${OPENSSL_ROOT_DIR}/lib/cmake/OpenSSL
)

# ed25519 crypto
Expand Down
6 changes: 2 additions & 4 deletions build/OSX/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,11 @@ set(_BOOST_CACHE_ARGS

# OpenSSL
set(OPENSSL_ROOT_DIR "${CMAKE_CURRENT_BINARY_DIR}/openssl/build/${CMAKE_SYSTEM_NAME}")
set(OPENSSL_VARIANT "$<IF:$<CONFIG:Debug>,--debug,--release>")

ExternalProject_Add(openssl
PREFIX openssl
SOURCE_DIR "${THIRDPARTY_DIR}/openssl"
CONFIGURE_COMMAND <SOURCE_DIR>/Configure darwin64-x86_64-cc ${OPENSSL_VARIANT} -static --prefix=${OPENSSL_ROOT_DIR} --openssldir=${OPENSSL_ROOT_DIR} -mmacosx-version-min=12.1
CONFIGURE_COMMAND <SOURCE_DIR>/Configure ${OPENSSL_VARIANT} --prefix=${OPENSSL_ROOT_DIR} --openssldir=${OPENSSL_ROOT_DIR} -mmacosx-version-min=12.1 --libdir=lib -static darwin64-${CMAKE_SYSTEM_PROCESSOR}-cc
BUILD_COMMAND make build_libs
BUILD_IN_SOURCE FALSE
INSTALL_COMMAND make install_dev
Expand All @@ -95,8 +94,7 @@ set(OPENSSL_INCLUDE_DIR ${OPENSSL_ROOT_DIR}/include)
set(_OPENSSL_CACHE_ARGS
-DOPENSSL_USE_STATIC_LIBS:BOOL=ON
-DOPENSSL_ROOT_DIR:PATH=${OPENSSL_ROOT_DIR}
-DOPENSSL_INCLUDE_DIR:PATH=${OPENSSL_INCLUDE_DIR}
-DOPENSSL_LIBRARIES:PATH=${OPENSSL_ROOT_DIR}/lib
-DOpenSSL_DIR:PATH=${OPENSSL_ROOT_DIR}/lib/cmake/OpenSSL
)

# MoltenVK
Expand Down
5 changes: 2 additions & 3 deletions build/Windows/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ set(OPENSSL_ROOT_DIR "${CMAKE_CURRENT_BINARY_DIR}/openssl/build/${CMAKE_SYSTEM_N
ExternalProject_Add(openssl
PREFIX openssl
SOURCE_DIR "${THIRDPARTY_DIR}/openssl"
CONFIGURE_COMMAND perl ${THIRDPARTY_DIR}/openssl/Configure $<IF:$<CONFIG:Debug>,--debug,--release> enable-capieng no-shared no-asm --prefix=${OPENSSL_ROOT_DIR} --openssldir=${OPENSSL_ROOT_DIR} VC-WIN64A
CONFIGURE_COMMAND perl ${THIRDPARTY_DIR}/openssl/Configure ${OPENSSL_VARIANT} enable-capieng no-shared no-asm --prefix=${OPENSSL_ROOT_DIR} --openssldir=${OPENSSL_ROOT_DIR} --libdir=lib -static VC-WIN64A
BUILD_COMMAND nmake build_libs
BUILD_IN_SOURCE false
INSTALL_COMMAND nmake install_dev
Expand All @@ -96,8 +96,7 @@ set(_OPENSSL_CACHE_ARGS
-DOPENSSL_USE_STATIC_LIBS:BOOL=ON
-DOPENSSL_MSVC_STATIC_RT:BOOL=ON
-DOPENSSL_ROOT_DIR:PATH=${OPENSSL_ROOT_DIR}
-DOPENSSL_INCLUDE_DIR:PATH=${OPENSSL_INCLUDE_DIR}
-DOPENSSL_LIBRARIES:PATH=${OPENSSL_ROOT_DIR}/lib
-DOpenSSL_DIR:PATH=${OPENSSL_ROOT_DIR}/lib/cmake/OpenSSL
)

# ed25519 crypto
Expand Down
6 changes: 2 additions & 4 deletions build/iOS/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ ExternalProject_Add(openssl
PREFIX openssl
SOURCE_DIR "${THIRDPARTY_DIR}/openssl"
CONFIGURE_COMMAND ""
BUILD_COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/Openssl-build/build-libssl.sh ${BOOST_BUILD_VARIANT} --version=1.1.1g --targets=ios64-cross-arm64 --src-dir=${THIRDPARTY_DIR}/openssl --build-dir=${OPENSSL_ROOT_DIR}
BUILD_COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/Openssl-build/build-libssl.sh $<$<CONFIG:Debug>:--debug> --version=3.3.1 --targets=ios64-cross-arm64 --src-dir=${THIRDPARTY_DIR}/openssl --build-dir=${OPENSSL_ROOT_DIR}
INSTALL_COMMAND ""
UPDATE_COMMAND ""
)
Expand All @@ -89,9 +89,7 @@ set(OPENSSL_INCLUDE_DIR ${OPENSSL_ROOT_DIR}/include)
set(_OPENSSL_CACHE_ARGS
-DOPENSSL_USE_STATIC_LIBS:BOOL=ON
-DOPENSSL_ROOT_DIR:PATH=${OPENSSL_ROOT_DIR}
-DOPENSSL_INCLUDE_DIR:PATH=${OPENSSL_INCLUDE_DIR}
-DOPENSSL_CRYPTO_LIBRARY:FILEPATH=${OPENSSL_ROOT_DIR}/lib/libcrypto${CMAKE_STATIC_LIBRARY_SUFFIX}
-DOPENSSL_SSL_LIBRARY:FILEPATH=${OPENSSL_ROOT_DIR}/lib/libssl${CMAKE_STATIC_LIBRARY_SUFFIX}
-DOpenSSL_DIR:PATH=${OPENSSL_ROOT_DIR}/lib/cmake/OpenSSL
)

# MoltenVK
Expand Down
Loading

0 comments on commit fc41c99

Please sign in to comment.