aboutsummaryrefslogtreecommitdiff
path: root/vcpkg/ports/oatpp-mbedtls
diff options
context:
space:
mode:
Diffstat (limited to 'vcpkg/ports/oatpp-mbedtls')
-rw-r--r--vcpkg/ports/oatpp-mbedtls/find-mbedtls.patch17
-rw-r--r--vcpkg/ports/oatpp-mbedtls/mbedtls-3.patch44
-rw-r--r--vcpkg/ports/oatpp-mbedtls/portfile.cmake35
-rw-r--r--vcpkg/ports/oatpp-mbedtls/vcpkg.json20
4 files changed, 116 insertions, 0 deletions
diff --git a/vcpkg/ports/oatpp-mbedtls/find-mbedtls.patch b/vcpkg/ports/oatpp-mbedtls/find-mbedtls.patch
new file mode 100644
index 0000000..6d673e1
--- /dev/null
+++ b/vcpkg/ports/oatpp-mbedtls/find-mbedtls.patch
@@ -0,0 +1,17 @@
+diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
+index 7e81ed9..39b95a9 100644
+--- a/src/CMakeLists.txt
++++ b/src/CMakeLists.txt
+@@ -31,9 +31,9 @@ target_include_directories(${OATPP_THIS_MODULE_NAME}
+ )
+
+ target_link_libraries(${OATPP_THIS_MODULE_NAME}
+- PRIVATE mbedtls::TLS
+- PRIVATE mbedtls::X509
+- PRIVATE mbedtls::Crypto
++ PRIVATE ${MBEDTLS_TLS_LIBRARY}
++ PRIVATE ${MBEDTLS_X509_LIBRARY}
++ PRIVATE ${MBEDTLS_CRYPTO_LIBRARY}
+ )
+
+ if(${OATPP_MBEDTLS_DEBUG} GREATER 0)
diff --git a/vcpkg/ports/oatpp-mbedtls/mbedtls-3.patch b/vcpkg/ports/oatpp-mbedtls/mbedtls-3.patch
new file mode 100644
index 0000000..089cf1e
--- /dev/null
+++ b/vcpkg/ports/oatpp-mbedtls/mbedtls-3.patch
@@ -0,0 +1,44 @@
+diff --git a/cmake/module/Findmbedtls.cmake b/cmake/module/Findmbedtls.cmake
+index 8c76d0a..f0ed1e2 100644
+--- a/cmake/module/Findmbedtls.cmake
++++ b/cmake/module/Findmbedtls.cmake
+@@ -160,6 +160,9 @@ if(MBEDTLS_INCLUDE_DIR AND EXISTS "${MBEDTLS_INCLUDE_DIR}/mbedtls/version.h")
+
+ # Get Version From File
+ file(STRINGS "${MBEDTLS_INCLUDE_DIR}/mbedtls/version.h" VERSIONH REGEX "#define MBEDTLS_VERSION_STRING[ ]+\".*\"")
++ if(VERSIONH STREQUAL "")
++ file(STRINGS "${MBEDTLS_INCLUDE_DIR}/mbedtls/build_info.h" VERSIONH REGEX "#define MBEDTLS_VERSION_STRING[ ]+\".*\"")
++ endif()
+
+ # Match Version String
+ string(REGEX REPLACE ".*\".*([0-9]+)\\.([0-9]+)\\.([0-9]+)\"" "\\1;\\2;\\3" MBEDTLS_VERSION_LIST "${VERSIONH}")
+diff --git a/src/oatpp-mbedtls/Config.cpp b/src/oatpp-mbedtls/Config.cpp
+index 63fe9d4..8d3c9ce 100644
+--- a/src/oatpp-mbedtls/Config.cpp
++++ b/src/oatpp-mbedtls/Config.cpp
+@@ -90,7 +90,11 @@ std::shared_ptr<Config> Config::createDefaultServerConfigShared(const char* serv
+ throw std::runtime_error("[oatpp::mbedtls::Config::createDefaultServerConfigShared()]: Error. Can't parse serverCertFile");
+ }
+
++#if MBEDTLS_VERSION_MAJOR < 3
+ res = mbedtls_pk_parse_keyfile(&result->m_privateKey, privateKeyFile, pkPassword);
++#else
++ res = mbedtls_pk_parse_keyfile(&result->m_privateKey, privateKeyFile, pkPassword, mbedtls_ctr_drbg_random, &result->m_ctr_drbg);
++#endif
+ if(res != 0) {
+ OATPP_LOGD("[oatpp::mbedtls::Config::createDefaultServerConfigShared()]", "Error. Can't parse privateKeyFile path='%s', return value=%d", privateKeyFile, res);
+ throw std::runtime_error("[oatpp::mbedtls::Config::createDefaultServerConfigShared()]: Error. Can't parse privateKeyFile");
+diff --git a/src/oatpp-mbedtls/Config.hpp b/src/oatpp-mbedtls/Config.hpp
+index d4d6072..47c1c2d 100644
+--- a/src/oatpp-mbedtls/Config.hpp
++++ b/src/oatpp-mbedtls/Config.hpp
+@@ -28,7 +28,9 @@
+
+ #include "mbedtls/entropy.h"
+ #include "mbedtls/ctr_drbg.h"
++#if MBEDTLS_VERSION_MAJOR < 3
+ #include "mbedtls/certs.h"
++#endif
+ #include "mbedtls/x509.h"
+ #include "mbedtls/ssl.h"
+ #include "mbedtls/net_sockets.h"
diff --git a/vcpkg/ports/oatpp-mbedtls/portfile.cmake b/vcpkg/ports/oatpp-mbedtls/portfile.cmake
new file mode 100644
index 0000000..914f4cb
--- /dev/null
+++ b/vcpkg/ports/oatpp-mbedtls/portfile.cmake
@@ -0,0 +1,35 @@
+if(VCPKG_TARGET_IS_WINDOWS)
+ vcpkg_check_linkage(ONLY_STATIC_LIBRARY)
+endif()
+
+vcpkg_from_github(
+ OUT_SOURCE_PATH SOURCE_PATH
+ REPO oatpp/oatpp-mbedtls
+ REF ${VERSION}
+ SHA512 3eea805f2a02110daec25b7455543c59d8e72acd37d412fa98cb1c90f58e4edcd9cc62c16331efcca36a524834fa0f314f2f69a7a4d0d1108a758f811a68e021
+ HEAD_REF master
+ PATCHES
+ find-mbedtls.patch
+ mbedtls-3.patch
+)
+
+vcpkg_cmake_configure(
+ SOURCE_PATH "${SOURCE_PATH}"
+ OPTIONS
+ "-DOATPP_BUILD_TESTS:BOOL=OFF"
+)
+
+vcpkg_cmake_install()
+vcpkg_cmake_config_fixup(CONFIG_PATH "lib/cmake/oatpp-mbedtls-${VERSION}")
+vcpkg_copy_pdbs()
+
+if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
+ file(READ "${CURRENT_PACKAGES_DIR}/share/oatpp-mbedtls/oatpp-mbedtlsConfig.cmake" cmake_config)
+ file(WRITE "${CURRENT_PACKAGES_DIR}/share/oatpp-mbedtls/oatpp-mbedtlsConfig.cmake" "
+include(CMakeFindDependencyMacro)
+find_dependency(oatpp CONFIG)
+${cmake_config}")
+endif()
+
+file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
+vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE")
diff --git a/vcpkg/ports/oatpp-mbedtls/vcpkg.json b/vcpkg/ports/oatpp-mbedtls/vcpkg.json
new file mode 100644
index 0000000..058a99b
--- /dev/null
+++ b/vcpkg/ports/oatpp-mbedtls/vcpkg.json
@@ -0,0 +1,20 @@
+{
+ "name": "oatpp-mbedtls",
+ "version": "1.3.0",
+ "port-version": 1,
+ "description": "Oat++ Mbed TLS submodule providing secure server and client connection providers.",
+ "homepage": "https://oatpp.io/docs/modules/oatpp-mbedtls/",
+ "license": "Apache-2.0",
+ "dependencies": [
+ "mbedtls",
+ "oatpp",
+ {
+ "name": "vcpkg-cmake",
+ "host": true
+ },
+ {
+ "name": "vcpkg-cmake-config",
+ "host": true
+ }
+ ]
+}