vcpkg/ports/wolfssl/portfile.cmake
ycdev1 6e31ee33cc
[wolfssl] Build wolfssl with HAVE_EX_DATA and NO_WOLFSSL_STUB to enable async use and coexistence with openssl without link error (#38994)
Async applications using wolfssl need to associate extra data
(application context) with the ssl session and context. This is used in
verification callback.
NO_WOLFSSL_STUB is needed to prevent a link time error resulting from
duplicate symbols when linking to both wolfssl and openssl at the same
time

---------

Co-authored-by: Kai Pastor <dg0yt@darc.de>
Co-authored-by: Monica <liuyumei01@beyondsoft.com>
2024-06-06 01:31:12 -07:00

59 lines
1.9 KiB
CMake

vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO wolfssl/wolfssl
REF v5.7.0-stable
SHA512 52cc7bdda7e3cfbea7c60fad1e2b1565d7057607bbb66014ef03643a75e78777d10d53799fba314bab37e245b7e8a60e29c6f4177070ed44536a898e04b27b44
HEAD_REF master
PATCHES
)
if ("dtls" IN_LIST FEATURES)
set(ENABLE_DTLS yes)
else()
set(ENABLE_DTLS no)
endif()
vcpkg_cmake_get_vars(cmake_vars_file)
include("${cmake_vars_file}")
foreach(config RELEASE DEBUG)
string(APPEND VCPKG_COMBINED_C_FLAGS_${config} " -DHAVE_EX_DATA -DNO_WOLFSSL_STUB -DWOLFSSL_ALT_CERT_CHAINS -DWOLFSSL_DES_ECB -DWOLFSSL_CUSTOM_OID -DHAVE_OID_ENCODING -DWOLFSSL_CERT_GEN -DWOLFSSL_ASN_TEMPLATE -DWOLFSSL_KEY_GEN -DHAVE_PKCS7 -DHAVE_AES_KEYWRAP -DWOLFSSL_AES_DIRECT -DHAVE_X963_KDF")
if ("secret-callback" IN_LIST FEATURES)
string(APPEND VCPKG_COMBINED_C_FLAGS_${config} " -DHAVE_SECRET_CALLBACK")
endif()
endforeach()
vcpkg_cmake_configure(
SOURCE_PATH ${SOURCE_PATH}
OPTIONS
-DWOLFSSL_BUILD_OUT_OF_TREE=yes
-DWOLFSSL_EXAMPLES=no
-DWOLFSSL_CRYPT_TESTS=no
-DWOLFSSL_OPENSSLEXTRA=yes
-DWOLFSSL_TPM=yes
-DWOLFSSL_TLSX=yes
-DWOLFSSL_OCSP=yes
-DWOLFSSL_OCSPSTAPLING=yes
-DWOLFSSL_OCSPSTAPLING_V2=yes
-DWOLFSSL_CRL=yes
-DWOLFSSL_DES3=yes
-DWOLFSSL_DTLS=${ENABLE_DTLS}
-DWOLFSSL_DTLS13=${ENABLE_DTLS}
-DWOLFSSL_DTLS_CID=${ENABLE_DTLS}
OPTIONS_RELEASE
-DCMAKE_C_FLAGS=${VCPKG_COMBINED_C_FLAGS_RELEASE}
OPTIONS_DEBUG
-DCMAKE_C_FLAGS=${VCPKG_COMBINED_C_FLAGS_DEBUG}
-DWOLFSSL_DEBUG=yes)
vcpkg_cmake_install()
vcpkg_copy_pdbs()
file(INSTALL "${SOURCE_PATH}/COPYING" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)
vcpkg_cmake_config_fixup(CONFIG_PATH lib/cmake/wolfssl)
vcpkg_fixup_pkgconfig()
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share")