From 416bb1c67769a32f7c090408715117bfebb0215e Mon Sep 17 00:00:00 2001 From: Mathis Logemann Date: Fri, 30 Oct 2020 20:47:16 +0100 Subject: [PATCH] [asio] update to version 1.18.0 (#14095) (#14167) --- ports/asio/CONTROL | 4 - ports/asio/portfile.cmake | 11 +- ports/asio/vcpkg.json | 27 ++++ ports/opendnp3/CONTROL | 5 - ports/opendnp3/export-cmake.patch | 140 ------------------- ports/opendnp3/portfile.cmake | 14 +- ports/opendnp3/vcpkg.json | 10 ++ ports/restbed/CONTROL | 8 -- ports/restbed/add_openssl_support.patch | 37 ----- ports/restbed/asio-1-18-0-deprecations.patch | 112 +++++++++++++++ ports/restbed/cmake.patch | 59 -------- ports/restbed/fix-ninja-duplicates.patch | 67 +++++++++ ports/restbed/portfile.cmake | 25 ++-- ports/restbed/use-FindOpenSSL-cmake.patch | 13 ++ ports/restbed/vcpkg.json | 16 +++ 15 files changed, 268 insertions(+), 280 deletions(-) delete mode 100644 ports/asio/CONTROL create mode 100644 ports/asio/vcpkg.json delete mode 100644 ports/opendnp3/CONTROL delete mode 100644 ports/opendnp3/export-cmake.patch create mode 100644 ports/opendnp3/vcpkg.json delete mode 100644 ports/restbed/CONTROL delete mode 100644 ports/restbed/add_openssl_support.patch create mode 100644 ports/restbed/asio-1-18-0-deprecations.patch delete mode 100644 ports/restbed/cmake.patch create mode 100644 ports/restbed/fix-ninja-duplicates.patch create mode 100644 ports/restbed/use-FindOpenSSL-cmake.patch create mode 100644 ports/restbed/vcpkg.json diff --git a/ports/asio/CONTROL b/ports/asio/CONTROL deleted file mode 100644 index c0da68a9bc..0000000000 --- a/ports/asio/CONTROL +++ /dev/null @@ -1,4 +0,0 @@ -Source: asio -Version: 1.12.2-2 -Homepage: https://github.com/chriskohlhoff/asio -Description: Asio is a cross-platform C++ library for network and low-level I/O programming that provides developers with a consistent asynchronous model using a modern C++ approach. diff --git a/ports/asio/portfile.cmake b/ports/asio/portfile.cmake index 685aa5be67..00edbed09a 100644 --- a/ports/asio/portfile.cmake +++ b/ports/asio/portfile.cmake @@ -1,16 +1,15 @@ #header-only library + vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO chriskohlhoff/asio - REF asio-1-12-2 - SHA512 7c2e213ff154bb2e5776b37906d437a62206f973316c94706e6d42e3c2f0866e7d97f3e40225ab5f28bf2c4a33fa0b38a4b75421aef86ddf9f2da0811caa2d00 + REF asio-1-18-0 + SHA512 c79529d16a51f40c9faff8549ef7dd7074aaf2574c8c338a8885aa04b3bb261a493f57498d1bd271cfcb4083e561344e286f784c77ea20e355bf86f7a39cfb39 HEAD_REF master ) # Always use "ASIO_STANDALONE" to avoid boost dependency -file(READ "${SOURCE_PATH}/asio/include/asio/detail/config.hpp" _contents) -string(REPLACE "defined(ASIO_STANDALONE)" "!defined(VCPKG_DISABLE_ASIO_STANDALONE)" _contents "${_contents}") -file(WRITE "${SOURCE_PATH}/asio/include/asio/detail/config.hpp" "${_contents}") +vcpkg_replace_string("${SOURCE_PATH}/asio/include/asio/detail/config.hpp" "defined(ASIO_STANDALONE)" "!defined(VCPKG_DISABLE_ASIO_STANDALONE)") # CMake install file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH}) @@ -23,7 +22,7 @@ vcpkg_install_cmake() vcpkg_fixup_cmake_targets(CONFIG_PATH "share/asio") file(INSTALL ${CMAKE_CURRENT_LIST_DIR}/asio-config.cmake - DESTINATION ${CURRENT_PACKAGES_DIR}/share/asio/ + DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} ) file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug) diff --git a/ports/asio/vcpkg.json b/ports/asio/vcpkg.json new file mode 100644 index 0000000000..1a838e0e7d --- /dev/null +++ b/ports/asio/vcpkg.json @@ -0,0 +1,27 @@ +{ + "name": "asio", + "version-string": "1.18.0", + "description": "Asio is a cross-platform C++ library for network and low-level I/O programming that provides developers with a consistent asynchronous model using a modern C++ approach.", + "homepage": "https://github.com/chriskohlhoff/asio", + "documentation": "https://think-async.com/Asio/asio-1.18.0/doc/", + "features": { + "coroutine": { + "description": "Boost.Coroutine (optional) if you use spawn() to launch coroutines", + "dependencies": [ + "boost-coroutine" + ] + }, + "openssl": { + "description": "OpenSSL (optional) if you use Asio's SSL support.", + "dependencies": [ + "openssl" + ] + }, + "regex": { + "description": "Boost.Regex (optional) if you use any of the read_until() or async_read_until() overloads that take a boost::regex parameter.", + "dependencies": [ + "boost-regex" + ] + } + } +} diff --git a/ports/opendnp3/CONTROL b/ports/opendnp3/CONTROL deleted file mode 100644 index a30de2622d..0000000000 --- a/ports/opendnp3/CONTROL +++ /dev/null @@ -1,5 +0,0 @@ -Source: opendnp3 -Version: 2.3.2 -Description: DNP3 (IEEE-1815) protocol stack. Modern C++ with bindings for .NET and Java. -Homepage: https://github.com/dnp3/opendnp3/ -Build-Depends: asio, openssl diff --git a/ports/opendnp3/export-cmake.patch b/ports/opendnp3/export-cmake.patch deleted file mode 100644 index ee0ab50c33..0000000000 --- a/ports/opendnp3/export-cmake.patch +++ /dev/null @@ -1,140 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 1381bab..e184423 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -104,20 +104,54 @@ include_directories(./cpp/tests/libs/src) - # ---- openpal library ---- - file(GLOB_RECURSE openpal_SRC ./cpp/libs/src/openpal/*.cpp ./cpp/libs/src/openpal/*.h ./cpp/libs/include/openpal/*.h) - add_library(openpal ${LIB_TYPE} ${openpal_SRC}) --install(TARGETS openpal DESTINATION lib) - set_target_properties(openpal PROPERTIES FOLDER cpp/libs VERSION ${OPENDNP3_VERSION} SOVERSION ${OPENDNP3_MAJOR_VERSION}) - clang_format(openpal) - clang_tidy(openpal) - -+include(CMakePackageConfigHelpers) -+write_basic_package_version_file(openpal-version.cmake VERSION ${OPENDNP3_VERSION} COMPATIBILITY ExactVersion) -+ -+install( -+ TARGETS openpal -+ EXPORT openpal-config -+ DESTINATION lib -+) -+ -+install( -+ EXPORT openpal-config -+ DESTINATION share/openpal -+) -+ - # ---- opendnp3 library ---- - file(GLOB_RECURSE opendnp3_SRC ./cpp/libs/src/opendnp3/*.cpp ./cpp/libs/src/opendnp3/*.h ./cpp/libs/include/opendnp3/*.h) - add_library(opendnp3 ${LIB_TYPE} ${opendnp3_SRC}) - target_link_libraries(opendnp3 openpal) --install(TARGETS opendnp3 DESTINATION lib) -+ - set_target_properties(opendnp3 PROPERTIES FOLDER cpp/libs VERSION ${OPENDNP3_VERSION} SOVERSION ${OPENDNP3_MAJOR_VERSION}) - clang_format(opendnp3 EXCLUDES ".*/gen/.*" ".*/objects/.*") - clang_tidy(opendnp3) - -+write_basic_package_version_file(opendnp3-version.cmake VERSION ${OPENDNP3_VERSION} COMPATIBILITY ExactVersion) -+ -+set(PROJECT_NAME opendnp3) -+set(FIND_DEPENDS "find_dependency(openpal)") -+configure_package_config_file(opendnp3-config.cmake.in opendnp3-config.cmake -+ INSTALL_DESTINATION share/opendnp3 -+ PATH_VARS PROJECT_NAME FIND_DEPENDS -+) -+ -+install(FILES ${CMAKE_CURRENT_BINARY_DIR}/opendnp3-config.cmake DESTINATION share/opendnp3) -+ -+install( -+ TARGETS opendnp3 -+ EXPORT opendnp3-targets -+ DESTINATION lib -+) -+install( -+ EXPORT opendnp3-targets -+ DESTINATION share/opendnp3 -+) -+ - if(DNP3_DECODER) - file(GLOB_RECURSE dnp3decode_SRC ./cpp/libs/src/dnp3decode/*.cpp ./cpp/libs/src/dnp3decode/*.h ./cpp/libs/include/dnp3decode/*.h) - add_library(dnp3decode ${LIB_TYPE} ${dnp3decode_SRC}) -@@ -144,8 +178,7 @@ if(DNP3_TLS) - set(asiopal_link_libraries "${asiopal_link_libraries};${OPENSSL_LIBRARIES}") - endif() - --target_link_libraries(asiopal ${asiopal_link_libraries}) --install(TARGETS asiopal DESTINATION lib) -+target_link_libraries(asiopal PUBLIC ${asiopal_link_libraries}) - set_target_properties(asiopal PROPERTIES FOLDER cpp/libs VERSION ${OPENDNP3_VERSION} SOVERSION ${OPENDNP3_MAJOR_VERSION}) - if(FLOCK) - add_definitions(-DUSE_FLOCK) -@@ -153,6 +186,32 @@ endif() - clang_format(asiopal) - clang_tidy(asiopal) - -+install( -+ TARGETS asiopal -+ EXPORT asiopal-targets -+ DESTINATION lib -+) -+ -+write_basic_package_version_file(asiopal-version.cmake VERSION ${OPENDNP3_VERSION} COMPATIBILITY ExactVersion) -+ -+set(PROJECT_NAME asiopal) -+if (DNP3_TLS) -+ set(FIND_DEPENDS "find_dependency(openpal)\nfind_dependency(OpenSSL)") -+else() -+ set(FIND_DEPENDS "find_dependency(openpal)") -+endif() -+configure_package_config_file(opendnp3-config.cmake.in asiopal-config.cmake -+ INSTALL_DESTINATION share/asiopal -+ PATH_VARS PROJECT_NAME FIND_DEPENDS -+) -+ -+install(FILES ${CMAKE_CURRENT_BINARY_DIR}/asiopal-config.cmake DESTINATION share/asiopal) -+ -+install( -+ EXPORT asiopal-targets -+ DESTINATION share/asiopal -+) -+ - # ---- asiodnp3 library ---- - file(GLOB_RECURSE asiodnp3_HPP ./cpp/libs/src/asiodnp3/*.h ./cpp/libs/include/asiodnp3/*.h) - if(DNP3_TLS) -@@ -161,12 +220,33 @@ else() - file(GLOB asiodnp3_CPP ./cpp/libs/src/asiodnp3/*.cpp) - endif() - add_library(asiodnp3 ${LIB_TYPE} ${asiodnp3_HPP} ${asiodnp3_CPP}) --target_link_libraries(asiodnp3 asiopal opendnp3) --install(TARGETS asiodnp3 DESTINATION lib) -+target_link_libraries(asiodnp3 PUBLIC asiopal opendnp3) - set_target_properties(asiodnp3 PROPERTIES FOLDER cpp/libs VERSION ${OPENDNP3_VERSION} SOVERSION ${OPENDNP3_MAJOR_VERSION}) - clang_format(asiodnp3) - clang_tidy(asiodnp3) - -+install( -+ TARGETS asiodnp3 -+ EXPORT asiodnp3-targets -+ DESTINATION lib -+) -+ -+write_basic_package_version_file(asiopal-version.cmake VERSION ${OPENDNP3_VERSION} COMPATIBILITY ExactVersion) -+ -+set(PROJECT_NAME asiodnp3) -+set(FIND_DEPENDS "find_dependency(asiopal)\nfind_dependency(opendnp3)") -+configure_package_config_file(opendnp3-config.cmake.in asiodnp3-config.cmake -+ INSTALL_DESTINATION share/asiopal -+ PATH_VARS PROJECT_NAME FIND_DEPENDS -+) -+ -+install(FILES ${CMAKE_CURRENT_BINARY_DIR}/asiodnp3-config.cmake DESTINATION share/asiodnp3) -+ -+install( -+ EXPORT asiodnp3-targets -+ DESTINATION share/asiodnp3 -+) -+ - if(DNP3_JAVA) - file(GLOB_RECURSE opendnp3java_SRC ./java/cpp/*.h ./java/cpp/*.cpp) - add_library(opendnp3java SHARED ${opendnp3java_SRC}) diff --git a/ports/opendnp3/portfile.cmake b/ports/opendnp3/portfile.cmake index 538f726392..c62261e2e5 100644 --- a/ports/opendnp3/portfile.cmake +++ b/ports/opendnp3/portfile.cmake @@ -9,10 +9,9 @@ string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "static" STATICLIBS) vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO dnp3/opendnp3 - REF 2.3.2 - SHA512 41686b5c32234088a5af3c71769b0193deb10a95d623579508cc740f126f35c18796f761093cec12ead469f0088839a680cc7d137b2f762a80c1736d71c3d90a + REF 3.1.0 + SHA512 838a816a8d65d3c99dc489e0e3e4d25f0acdbe0f6f3cc21a6fdbaea11f84f7b1f54958097763d0eae8e1860ba209da4e5377cd3ea6ab08a48a25429860063179 HEAD_REF master - PATCHES export-cmake.patch ) file(COPY ${CURRENT_PORT_DIR}/opendnp3-config.cmake.in DESTINATION ${SOURCE_PATH}) @@ -27,11 +26,8 @@ vcpkg_install_cmake() vcpkg_copy_pdbs() -vcpkg_fixup_cmake_targets(CONFIG_PATH share/asiodnp3 TARGET_PATH share/asiodnp3) -vcpkg_fixup_cmake_targets(CONFIG_PATH share/asiopal TARGET_PATH share/asiopal) -vcpkg_fixup_cmake_targets(CONFIG_PATH share/opendnp3 TARGET_PATH share/opendnp3) -vcpkg_fixup_cmake_targets(CONFIG_PATH share/openpal TARGET_PATH share/openpal) - +vcpkg_fixup_cmake_targets(CONFIG_PATH lib/cmake TARGET_PATH share/opendnp3) +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share) file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) -file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright) +file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright) \ No newline at end of file diff --git a/ports/opendnp3/vcpkg.json b/ports/opendnp3/vcpkg.json new file mode 100644 index 0000000000..d853f8c866 --- /dev/null +++ b/ports/opendnp3/vcpkg.json @@ -0,0 +1,10 @@ +{ + "name": "opendnp3", + "version-string": "3.1.0", + "description": "DNP3 (IEEE-1815) protocol stack. Modern C++ with bindings for .NET and Java.", + "homepage": "https://github.com/dnp3/opendnp3/", + "dependencies": [ + "asio", + "openssl" + ] +} diff --git a/ports/restbed/CONTROL b/ports/restbed/CONTROL deleted file mode 100644 index 7259f92c61..0000000000 --- a/ports/restbed/CONTROL +++ /dev/null @@ -1,8 +0,0 @@ -Source: restbed -Version: 4.16-07-28-2018-2 -Description: Corvusoft's Restbed framework brings asynchronous RESTful functionality to C++11 applications. -Build-Depends: asio - -Feature: openssl -Build-Depends: openssl -Description: Secure over the wire communication allowing you to transmit private data online. diff --git a/ports/restbed/add_openssl_support.patch b/ports/restbed/add_openssl_support.patch deleted file mode 100644 index 72d4dc4067..0000000000 --- a/ports/restbed/add_openssl_support.patch +++ /dev/null @@ -1,37 +0,0 @@ -diff --git a/cmake/Findopenssl.cmake b/cmake/Findopenssl.cmake -index 8db9799..626ff55 100644 ---- a/cmake/Findopenssl.cmake -+++ b/cmake/Findopenssl.cmake -@@ -1,24 +1,7 @@ --find_library( ssl_LIBRARY_STATIC libssl.a ssleay32.lib HINTS "${PROJECT_SOURCE_DIR}/dependency/openssl/out32dll" "${PROJECT_SOURCE_DIR}/dependency/openssl" "/usr/local/opt/openssl/lib" "/usr/lib" "/usr/local/lib" "/opt/local/lib" ) --find_library( crypto_LIBRARY_STATIC libcrypto.a libeay32.lib HINTS "${PROJECT_SOURCE_DIR}/dependency/openssl/out32dll" "${PROJECT_SOURCE_DIR}/dependency/openssl" "/usr/local/opt/openssl/lib" "/usr/lib" "/usr/local/lib" "/opt/local/lib" ) -- --find_library( ssl_LIBRARY_SHARED libssl.so libssl.dylib ssleay32.dll HINTS "${PROJECT_SOURCE_DIR}/dependency/openssl/out32dll" "${PROJECT_SOURCE_DIR}/dependency/openssl" "/usr/local/opt/openssl/lib" "/usr/lib" "/usr/local/lib" "/opt/local/lib" ) --find_library( crypto_LIBRARY_SHARED libcrypto.so libcrypto.dylib libeay32.dll HINTS "${PROJECT_SOURCE_DIR}/dependency/openssl/out32dll" "${PROJECT_SOURCE_DIR}/dependency/openssl" "/usr/local/opt/openssl/lib" "/usr/lib" "/usr/local/lib" "/opt/local/lib" ) -- --find_path( ssl_INCLUDE openssl/ssl.h HINTS "${PROJECT_SOURCE_DIR}/dependency/openssl/inc32" "${PROJECT_SOURCE_DIR}/dependency/openssl/include" "/usr/local/opt/openssl/include" "/usr/include" "/usr/local/include" "/opt/local/include" ) -- --if ( ssl_LIBRARY_STATIC AND ssl_LIBRARY_SHARED AND crypto_LIBRARY_STATIC AND crypto_LIBRARY_SHARED ) -- set( OPENSSL_FOUND TRUE ) -- add_definitions( -DBUILD_SSL=TRUE ) -- -- if ( APPLE AND BUILD_SSL ) -- set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated-declarations" ) -- endif( ) -- -- message( STATUS "Found OpenSSL include at: ${ssl_INCLUDE}" ) -- message( STATUS "Found OpenSSL library at: ${ssl_LIBRARY_STATIC}" ) -- message( STATUS "Found OpenSSL library at: ${ssl_LIBRARY_SHARED}" ) -- message( STATUS "Found Crypto library at: ${crypto_LIBRARY_STATIC}" ) -- message( STATUS "Found Crypto library at: ${crypto_LIBRARY_SHARED}" ) --else ( ) -- message( FATAL_ERROR "Failed to locate OpenSSL dependency. see restbed/dependency/openssl; ./config shared; make all" ) --endif ( ) -+if (BUILD_SSL) -+ set( OPENSSL_FOUND TRUE ) -+ add_definitions( -DBUILD_SSL=TRUE ) -+ if ( APPLE AND BUILD_SSL ) -+ set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated-declarations" ) -+ endif( ) -+endif() -\ No newline at end of file diff --git a/ports/restbed/asio-1-18-0-deprecations.patch b/ports/restbed/asio-1-18-0-deprecations.patch new file mode 100644 index 0000000000..7007775a2c --- /dev/null +++ b/ports/restbed/asio-1-18-0-deprecations.patch @@ -0,0 +1,112 @@ +diff --git a/source/corvusoft/restbed/detail/http_impl.cpp b/source/corvusoft/restbed/detail/http_impl.cpp +index 77f918a..08d2c9c 100644 +--- a/source/corvusoft/restbed/detail/http_impl.cpp ++++ b/source/corvusoft/restbed/detail/http_impl.cpp +@@ -153,7 +153,7 @@ namespace restbed + { + #endif + auto socket = make_shared< tcp::socket >( *request->m_pimpl->m_io_service ); +- request->m_pimpl->m_socket = make_shared< SocketImpl >( socket ); ++ request->m_pimpl->m_socket = make_shared< SocketImpl >( *request->m_pimpl->m_io_service, socket ); + #ifdef BUILD_SSL + } + +@@ -196,7 +196,7 @@ namespace restbed + } + + socket->set_verify_callback( asio::ssl::rfc2818_verification( request->get_host( ) ) ); +- request->m_pimpl->m_socket = make_shared< SocketImpl >( socket ); ++ request->m_pimpl->m_socket = make_shared< SocketImpl >( *request->m_pimpl->m_io_service, socket ); + } + #endif + void HttpImpl::request_handler( const error_code& error, const shared_ptr< Request >& request, const function< void ( const shared_ptr< Request >, const shared_ptr< Response > ) >& callback ) +diff --git a/source/corvusoft/restbed/detail/service_impl.cpp b/source/corvusoft/restbed/detail/service_impl.cpp +index 6772af1..87be1ce 100644 +--- a/source/corvusoft/restbed/detail/service_impl.cpp ++++ b/source/corvusoft/restbed/detail/service_impl.cpp +@@ -147,7 +147,7 @@ namespace restbed + + void ServiceImpl::http_listen( void ) const + { +- auto socket = make_shared< tcp::socket >( m_acceptor->get_io_service( ) ); ++ auto socket = make_shared< tcp::socket >( *m_io_service ); + m_acceptor->async_accept( *socket, bind( &ServiceImpl::create_session, this, socket, _1 ) ); + } + +@@ -273,7 +273,7 @@ namespace restbed + + void ServiceImpl::https_listen( void ) const + { +- auto socket = make_shared< asio::ssl::stream< tcp::socket > >( m_ssl_acceptor->get_io_service( ), *m_ssl_context ); ++ auto socket = make_shared< asio::ssl::stream< tcp::socket > >( *m_io_service, *m_ssl_context ); + m_ssl_acceptor->async_accept( socket->lowest_layer( ), bind( &ServiceImpl::create_ssl_session, this, socket, _1 ) ); + } + +@@ -289,7 +289,7 @@ namespace restbed + return; + } + +- auto connection = make_shared< SocketImpl >( socket, m_logger ); ++ auto connection = make_shared< SocketImpl >( *m_io_service, socket, m_logger ); + connection->set_timeout( m_settings->get_connection_timeout( ) ); + if (m_settings->get_keep_alive()) { + connection->set_keep_alive( m_settings->get_keep_alive_start(), +@@ -530,7 +530,7 @@ namespace restbed + { + if ( not error ) + { +- auto connection = make_shared< SocketImpl >( socket, m_logger ); ++ auto connection = make_shared< SocketImpl >( *m_io_service, socket, m_logger ); + connection->set_timeout( m_settings->get_connection_timeout( ) ); + if (m_settings->get_keep_alive()) { + connection->set_keep_alive( m_settings->get_keep_alive_start(), +diff --git a/source/corvusoft/restbed/detail/socket_impl.cpp b/source/corvusoft/restbed/detail/socket_impl.cpp +index fac0082..942eefa 100644 +--- a/source/corvusoft/restbed/detail/socket_impl.cpp ++++ b/source/corvusoft/restbed/detail/socket_impl.cpp +@@ -49,12 +49,12 @@ namespace restbed + { + namespace detail + { +- SocketImpl::SocketImpl( const shared_ptr< tcp::socket >& socket, const shared_ptr< Logger >& logger ) : m_error_handler( nullptr ), ++ SocketImpl::SocketImpl( asio::io_context& context, const shared_ptr< tcp::socket >& socket, const shared_ptr< Logger >& logger ) : m_error_handler( nullptr ), + m_is_open( socket->is_open( ) ), + m_pending_writes( ), + m_logger( logger ), + m_timeout( 0 ), +- m_io_service( socket->get_io_service( ) ), ++ m_io_service( context ), + m_timer( make_shared< asio::steady_timer >( m_io_service ) ), + m_strand( make_shared< io_service::strand > ( m_io_service ) ), + m_resolver( nullptr ), +@@ -66,12 +66,12 @@ namespace restbed + return; + } + #ifdef BUILD_SSL +- SocketImpl::SocketImpl( const shared_ptr< asio::ssl::stream< tcp::socket > >& socket, const shared_ptr< Logger >& logger ) : m_error_handler( nullptr ), ++ SocketImpl::SocketImpl( asio::io_context& context, const shared_ptr< asio::ssl::stream< tcp::socket > >& socket, const shared_ptr< Logger >& logger ) : m_error_handler( nullptr ), + m_is_open( socket->lowest_layer( ).is_open( ) ), + m_pending_writes( ), + m_logger( logger ), + m_timeout( 0 ), +- m_io_service( socket->get_io_service( ) ), ++ m_io_service( context ), + m_timer( make_shared< asio::steady_timer >( m_io_service ) ), + m_strand( make_shared< io_service::strand > ( m_io_service ) ), + m_resolver( nullptr ), +diff --git a/source/corvusoft/restbed/detail/socket_impl.hpp b/source/corvusoft/restbed/detail/socket_impl.hpp +index 41aec42..0977eba 100644 +--- a/source/corvusoft/restbed/detail/socket_impl.hpp ++++ b/source/corvusoft/restbed/detail/socket_impl.hpp +@@ -53,9 +53,9 @@ namespace restbed + //Definitions + + //Constructors +- SocketImpl( const std::shared_ptr< asio::ip::tcp::socket >& socket, const std::shared_ptr< Logger >& logger = nullptr ); ++ SocketImpl( asio::io_context& context, const std::shared_ptr< asio::ip::tcp::socket >& socket, const std::shared_ptr< Logger >& logger = nullptr ); + #ifdef BUILD_SSL +- SocketImpl( const std::shared_ptr< asio::ssl::stream< asio::ip::tcp::socket > >& socket, const std::shared_ptr< Logger >& logger = nullptr ); ++ SocketImpl( asio::io_context& context, const std::shared_ptr< asio::ssl::stream< asio::ip::tcp::socket > >& socket, const std::shared_ptr< Logger >& logger = nullptr ); + #endif + ~SocketImpl( void ) = default; + diff --git a/ports/restbed/cmake.patch b/ports/restbed/cmake.patch deleted file mode 100644 index 5d73409f9b..0000000000 --- a/ports/restbed/cmake.patch +++ /dev/null @@ -1,59 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index b66143e..85c5315 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -42,7 +42,9 @@ endif ( ) - set( CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${PROJECT_SOURCE_DIR}/cmake" ) - - find_package( asio REQUIRED ) -+if(NOT DISABLE_TESTS) - find_package( catch REQUIRED ) -+endif() - if ( BUILD_SSL ) - find_package( openssl REQUIRED ) - endif ( ) -@@ -54,6 +56,7 @@ include_directories( ${INCLUDE_DIR} SYSTEM ${asio_INCLUDE} ${kashmir_INCLUDE} ${ - # - file( GLOB_RECURSE MANIFEST "${SOURCE_DIR}/*.cpp" ) - -+if(NOT BUILD_SHARED_LIBS) - set( STATIC_LIBRARY_NAME "${PROJECT_NAME}-static" ) - add_library( ${STATIC_LIBRARY_NAME} STATIC ${MANIFEST} ) - set_property( TARGET ${STATIC_LIBRARY_NAME} PROPERTY CXX_STANDARD 11 ) -@@ -64,7 +67,9 @@ if ( BUILD_SSL ) - else ( ) - target_link_libraries( ${STATIC_LIBRARY_NAME} ) - endif ( ) -+endif() - -+if(BUILD_SHARED_LIBS) - set( SHARED_LIBRARY_NAME "${PROJECT_NAME}-shared" ) - add_library( ${SHARED_LIBRARY_NAME} SHARED ${MANIFEST} ) - set_property( TARGET ${SHARED_LIBRARY_NAME} PROPERTY CXX_STANDARD 11 ) -@@ -76,12 +81,15 @@ if ( BUILD_SSL ) - else ( ) - target_link_libraries( ${SHARED_LIBRARY_NAME} ) - endif ( ) -+endif() - -+if(NOT DISABLE_TESTS) - enable_testing( ) - add_subdirectory( "${PROJECT_SOURCE_DIR}/test/unit" ) - add_subdirectory( "${PROJECT_SOURCE_DIR}/test/feature" ) - add_subdirectory( "${PROJECT_SOURCE_DIR}/test/regression" ) - add_subdirectory( "${PROJECT_SOURCE_DIR}/test/integration" ) -+endif() - - # - # Install -@@ -90,5 +98,8 @@ file( GLOB ARTIFACTS "${SOURCE_DIR}/*.hpp" ) - - install( FILES "${INCLUDE_DIR}/${PROJECT_NAME}" DESTINATION "${CMAKE_INSTALL_PREFIX}/include" ) - install( FILES ${ARTIFACTS} DESTINATION "${CMAKE_INSTALL_PREFIX}/include/corvusoft/${PROJECT_NAME}" ) --install( TARGETS ${STATIC_LIBRARY_NAME} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT library ) --install( TARGETS ${SHARED_LIBRARY_NAME} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT library ) -+if(NOT BUILD_SHARED_LIBS) -+install( TARGETS ${STATIC_LIBRARY_NAME} RUNTIME DESTINATION bin LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT library ) -+else() -+install( TARGETS ${SHARED_LIBRARY_NAME} RUNTIME DESTINATION bin LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT library ) -+endif() diff --git a/ports/restbed/fix-ninja-duplicates.patch b/ports/restbed/fix-ninja-duplicates.patch new file mode 100644 index 0000000000..9b10148cd1 --- /dev/null +++ b/ports/restbed/fix-ninja-duplicates.patch @@ -0,0 +1,67 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 2fb74b3..602e05d 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -64,26 +64,33 @@ include_directories( ${INCLUDE_DIR} SYSTEM ${asio_INCLUDE} ${ssl_INCLUDE} ) + # Build + # + file( GLOB_RECURSE MANIFEST "${SOURCE_DIR}/*.cpp" ) +- +-set( STATIC_LIBRARY_NAME "${PROJECT_NAME}-static" ) +-add_library( ${STATIC_LIBRARY_NAME} STATIC ${MANIFEST} ) +-set_property( TARGET ${STATIC_LIBRARY_NAME} PROPERTY CXX_STANDARD 14 ) +-set_property( TARGET ${STATIC_LIBRARY_NAME} PROPERTY CXX_STANDARD_REQUIRED ON ) +-set_target_properties( ${STATIC_LIBRARY_NAME} PROPERTIES OUTPUT_NAME ${PROJECT_NAME} ) +- +-set( SHARED_LIBRARY_NAME "${PROJECT_NAME}-shared" ) +-add_library( ${SHARED_LIBRARY_NAME} SHARED ${MANIFEST} ) +-set_property( TARGET ${SHARED_LIBRARY_NAME} PROPERTY CXX_STANDARD 14 ) +-set_property( TARGET ${SHARED_LIBRARY_NAME} PROPERTY CXX_STANDARD_REQUIRED ON ) +-set_target_properties( ${SHARED_LIBRARY_NAME} PROPERTIES OUTPUT_NAME ${PROJECT_NAME} ) +-set_target_properties( ${SHARED_LIBRARY_NAME} PROPERTIES SOVERSION ${PROJECT_VERSION_MAJOR} VERSION ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR} ) ++if(NOT BUILD_SHARED_LIBS) ++ set( STATIC_LIBRARY_NAME "${PROJECT_NAME}-static" ) ++ add_library( ${STATIC_LIBRARY_NAME} STATIC ${MANIFEST} ) ++ set_property( TARGET ${STATIC_LIBRARY_NAME} PROPERTY CXX_STANDARD 14 ) ++ set_property( TARGET ${STATIC_LIBRARY_NAME} PROPERTY CXX_STANDARD_REQUIRED ON ) ++ set_target_properties( ${STATIC_LIBRARY_NAME} PROPERTIES OUTPUT_NAME ${PROJECT_NAME} ) ++else() ++ set( SHARED_LIBRARY_NAME "${PROJECT_NAME}-shared" ) ++ add_library( ${SHARED_LIBRARY_NAME} SHARED ${MANIFEST} ) ++ set_property( TARGET ${SHARED_LIBRARY_NAME} PROPERTY CXX_STANDARD 14 ) ++ set_property( TARGET ${SHARED_LIBRARY_NAME} PROPERTY CXX_STANDARD_REQUIRED ON ) ++ set_target_properties( ${SHARED_LIBRARY_NAME} PROPERTIES OUTPUT_NAME ${PROJECT_NAME} ) ++ set_target_properties( ${SHARED_LIBRARY_NAME} PROPERTIES SOVERSION ${PROJECT_VERSION_MAJOR} VERSION ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR} ) ++endif() + + if ( BUILD_SSL ) +- target_link_libraries( ${SHARED_LIBRARY_NAME} LINK_PRIVATE ${ssl_LIBRARY_SHARED} ${crypto_LIBRARY_SHARED} ) +- target_link_libraries( ${STATIC_LIBRARY_NAME} LINK_PRIVATE ${ssl_LIBRARY_STATIC} ${crypto_LIBRARY_STATIC} ${CMAKE_DL_LIBS} ) ++ if(BUILD_SHARED_LIBS) ++ target_link_libraries( ${SHARED_LIBRARY_NAME} LINK_PRIVATE ${ssl_LIBRARY_SHARED} ${crypto_LIBRARY_SHARED} ) ++ else() ++ target_link_libraries( ${STATIC_LIBRARY_NAME} LINK_PRIVATE ${ssl_LIBRARY_STATIC} ${crypto_LIBRARY_STATIC} ${CMAKE_DL_LIBS} ) ++ endif() + else ( ) +- target_link_libraries( ${SHARED_LIBRARY_NAME} ) +- target_link_libraries( ${STATIC_LIBRARY_NAME} ${CMAKE_DL_LIBS} ) ++ if(BUILD_SHARED_LIBS) ++ target_link_libraries( ${SHARED_LIBRARY_NAME} ) ++ else() ++ target_link_libraries( ${STATIC_LIBRARY_NAME} ${CMAKE_DL_LIBS} ) ++ endif() + endif ( ) + + if ( BUILD_TESTS ) +@@ -103,5 +110,8 @@ file( GLOB ARTIFACTS "${SOURCE_DIR}/*.hpp" ) + + install( FILES "${INCLUDE_DIR}/${PROJECT_NAME}" DESTINATION "${CMAKE_INSTALL_PREFIX}/include" ) + install( FILES ${ARTIFACTS} DESTINATION "${CMAKE_INSTALL_PREFIX}/include/corvusoft/${PROJECT_NAME}" ) +-install( TARGETS ${STATIC_LIBRARY_NAME} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT library ) +-install( TARGETS ${SHARED_LIBRARY_NAME} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT library ) ++if(NOT BUILD_SHARED_LIBS) ++ install( TARGETS ${STATIC_LIBRARY_NAME} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT library ) ++else() ++ install( TARGETS ${SHARED_LIBRARY_NAME} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT library ) ++endif() +\ No newline at end of file diff --git a/ports/restbed/portfile.cmake b/ports/restbed/portfile.cmake index 5cfa601f3d..dd9b4df45b 100644 --- a/ports/restbed/portfile.cmake +++ b/ports/restbed/portfile.cmake @@ -1,28 +1,29 @@ vcpkg_check_linkage(ONLY_STATIC_LIBRARY) -set(USE_OPENSSL OFF) -if("openssl" IN_LIST FEATURES) - set(ADDITIONAL_PATCH "add_openssl_support.patch") - set(USE_OPENSSL ON) -endif() +vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS + openssl BUILD_SSL +) vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO Corvusoft/restbed - REF 0f8af8d8ed183a88e208adeb22da0080d5d74d1e - SHA512 f0175a10c88f1ad4f16c8e4cff7ceea7b80c56b0724b59791c23e91f1ecf146dfdbda9e9238d31a35f21d8cdcc413b586cc633725dd0ba87de6b599a7087916f + REF 4.7 + SHA512 f8aaa89ae5c862253f9a480fefa8827927e3a6c13c51938bbcd6c28ac4e6d54496ecf51610343e9a3efe3e969314f643a487506c606a65f56125b51ab8478652 HEAD_REF master PATCHES - cmake.patch - ${ADDITIONAL_PATCH} + use-FindOpenSSL-cmake.patch + asio-1-18-0-deprecations.patch #https://github.com/Corvusoft/restbed/pull/444/files + fix-ninja-duplicates.patch ) +file(REMOVE ${SOURCE_PATH}/cmake/Findopenssl.cmake) + vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH} PREFER_NINJA OPTIONS - -DBUILD_SSL=${USE_OPENSSL} - -DDISABLE_TESTS=ON + ${FEATURE_OPTIONS} + -DBUILD_TESTS=OFF ) vcpkg_install_cmake() @@ -31,4 +32,4 @@ vcpkg_install_cmake() file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) # Handle copyright -configure_file(${SOURCE_PATH}/LICENSE ${CURRENT_PACKAGES_DIR}/share/restbed/copyright COPYONLY) +configure_file(${SOURCE_PATH}/LICENSE ${CURRENT_PACKAGES_DIR}/share/${PORT}/copyright COPYONLY) diff --git a/ports/restbed/use-FindOpenSSL-cmake.patch b/ports/restbed/use-FindOpenSSL-cmake.patch new file mode 100644 index 0000000000..efba4cbcf3 --- /dev/null +++ b/ports/restbed/use-FindOpenSSL-cmake.patch @@ -0,0 +1,13 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 1ec4f07..2fb74b3 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -55,7 +55,7 @@ set( CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${PROJECT_SOURCE_DIR}/cmake" ) + find_package( asio REQUIRED ) + + if ( BUILD_SSL ) +- find_package( openssl REQUIRED ) ++ find_package( OpenSSL REQUIRED ) + endif ( ) + + include_directories( ${INCLUDE_DIR} SYSTEM ${asio_INCLUDE} ${ssl_INCLUDE} ) diff --git a/ports/restbed/vcpkg.json b/ports/restbed/vcpkg.json new file mode 100644 index 0000000000..d06ab063c1 --- /dev/null +++ b/ports/restbed/vcpkg.json @@ -0,0 +1,16 @@ +{ + "name": "restbed", + "version-string": "4.7", + "description": "Corvusoft's Restbed framework brings asynchronous RESTful functionality to C++14 applications.", + "dependencies": [ + "asio" + ], + "features": { + "openssl": { + "description": "Secure over the wire communication allowing you to transmit private data online.", + "dependencies": [ + "openssl" + ] + } + } +}