From faf2d6ffb67fcf273cd0716598c6bfafb8a99d62 Mon Sep 17 00:00:00 2001 From: DailyShana <8469304+DailyShana@users.noreply.github.com> Date: Sat, 1 Aug 2020 02:21:44 +0800 Subject: [PATCH] [libevent] update to 2.1.12 (#12277) * [libevent] update to 2.1.12 * fix path in LibeventConfig.cmake.in * configure crt runtime * patch target file * try to fix evpp build on unix * try to fix evpp build on unix * try to fix evpp build on unix * try to fix evpp build on unix * fix file patching * code review * fix fizz:x64-windows build --- ports/evpp/CONTROL | 3 +- ports/evpp/fix-linux-build.patch | 20 ++++----- ports/fizz/CONTROL | 3 +- ports/fizz/fix-build_error.patch | 13 ------ ports/fizz/portfile.cmake | 4 +- ports/libevent/CONTROL | 2 +- .../fix-LibeventConfig_cmake_in_path.patch | 18 ++++---- ports/libevent/fix-crt_linkage.patch | 13 ------ ports/libevent/fix-file_path.patch | 42 +++++++++---------- ports/libevent/portfile.cmake | 32 +++++++++----- 10 files changed, 66 insertions(+), 84 deletions(-) delete mode 100644 ports/fizz/fix-build_error.patch delete mode 100644 ports/libevent/fix-crt_linkage.patch diff --git a/ports/evpp/CONTROL b/ports/evpp/CONTROL index 68244157bf..047c77a440 100644 --- a/ports/evpp/CONTROL +++ b/ports/evpp/CONTROL @@ -1,5 +1,6 @@ Source: evpp -Version: 0.7.0-3 +Version: 0.7.0 +Port-Version: 4 Homepage: https://github.com/Qihoo360/evpp Description: A modern C++ network library based on libevent for developing high performance network services in TCP/UDP/HTTP protocols. Build-Depends: glog, libevent (windows), libevent[openssl] (!windows), rapidjson, concurrentqueue (!windows), boost-lockfree (!windows) \ No newline at end of file diff --git a/ports/evpp/fix-linux-build.patch b/ports/evpp/fix-linux-build.patch index 2b772a145a..b5673b27c4 100644 --- a/ports/evpp/fix-linux-build.patch +++ b/ports/evpp/fix-linux-build.patch @@ -11,7 +11,7 @@ index 7872fc8..2a06614 100644 + find_path(GLOG_INCLUDE_DIRS logging.h PATH_SUFFIXES glog) + find_package(Libevent CONFIG REQUIRED) + list(APPEND DEPENDENT_INCLUDE_DIRS "${GLOG_INCLUDE_DIRS}/../") -+ SET(DEPENDENT_LIBRARIES event_static event_core_static event_extra_static event_openssl_static glog::glog pthread) ++ SET(DEPENDENT_LIBRARIES libevent::core libevent::extra libevent::openssl glog::glog pthread) else (UNIX) SET(DEPENDENT_LIBRARIES event glog) endif (UNIX) @@ -24,7 +24,7 @@ index 469ed1c..8219424 100644 if (UNIX) -set(LIBRARIES evpp_concurrentqueue event glog pthread) -+set(LIBRARIES evpp_concurrentqueue event_static event_core_static event_extra_static event_openssl_static glog::glog pthread) ++set(LIBRARIES evpp_concurrentqueue libevent::core libevent::extra libevent::openssl glog::glog pthread) link_directories("/home/s/safe/lib" ${PROJECT_BUILD_DIR}/lib) else(UNIX) set(LIBRARIES evpp_static event glog) @@ -36,7 +36,7 @@ index 1148616..0356b71 100644 add_executable(benchmark_http_libevent libevent_http_bench.c) -target_link_libraries(benchmark_http_libevent event) -+target_link_libraries(benchmark_http_libevent event_static event_core_static event_extra_static event_openssl_static) ++target_link_libraries(benchmark_http_libevent libevent::core libevent::extra libevent::openssl) diff --git a/benchmark/ioevent/libevent/CMakeLists.txt b/benchmark/ioevent/libevent/CMakeLists.txt index dfa51a3..de4849d 100644 --- a/benchmark/ioevent/libevent/CMakeLists.txt @@ -45,7 +45,7 @@ index dfa51a3..de4849d 100644 add_executable(benchmark_ioevent_libevent libevent_ioevent_bench.c) -target_link_libraries(benchmark_ioevent_libevent event) -+target_link_libraries(benchmark_ioevent_libevent event_static event_core_static event_extra_static event_openssl_static) ++target_link_libraries(benchmark_ioevent_libevent libevent::core libevent::extra libevent::openssl) diff --git a/benchmark/throughput/libevent/CMakeLists.txt b/benchmark/throughput/libevent/CMakeLists.txt index 21dab84..aefe698 100644 --- a/benchmark/throughput/libevent/CMakeLists.txt @@ -53,11 +53,11 @@ index 21dab84..aefe698 100644 @@ -1,5 +1,5 @@ add_executable(benchmark_tcp_libevent_client client.c) -target_link_libraries(benchmark_tcp_libevent_client event) -+target_link_libraries(benchmark_tcp_libevent_client event_static event_core_static event_extra_static event_openssl_static) ++target_link_libraries(benchmark_tcp_libevent_client libevent::core libevent::extra libevent::openssl) add_executable(benchmark_tcp_libevent_server server.c) -target_link_libraries(benchmark_tcp_libevent_server event) -+target_link_libraries(benchmark_tcp_libevent_server event_static event_core_static event_extra_static event_openssl_static) ++target_link_libraries(benchmark_tcp_libevent_server libevent::core libevent::extra libevent::openssl) diff --git a/examples/recipes/self_control_timer/basic_01/CMakeLists.txt b/examples/recipes/self_control_timer/basic_01/CMakeLists.txt index 7834db4..82294c5 100644 --- a/examples/recipes/self_control_timer/basic_01/CMakeLists.txt @@ -67,7 +67,7 @@ index 7834db4..82294c5 100644 add_executable(example_recipes_self_control_timer_basic_01 ${SRCS}) -target_link_libraries(example_recipes_self_control_timer_basic_01 event) -+target_link_libraries(example_recipes_self_control_timer_basic_01 event_static event_core_static event_extra_static event_openssl_static) ++target_link_libraries(example_recipes_self_control_timer_basic_01 libevent::core libevent::extra libevent::openssl) @@ -80,7 +80,7 @@ index a8be419..0329ccc 100644 add_executable(example_recipes_self_control_timer_basic_02 ${SRCS}) -target_link_libraries(example_recipes_self_control_timer_basic_02 event) -+target_link_libraries(example_recipes_self_control_timer_basic_02 event_static event_core_static event_extra_static event_openssl_static) ++target_link_libraries(example_recipes_self_control_timer_basic_02 libevent::core libevent::extra libevent::openssl) @@ -93,7 +93,7 @@ index 1cae9bb..218b771 100644 add_executable(example_recipes_self_control_timer_cancel_03 ${SRCS}) -target_link_libraries(example_recipes_self_control_timer_cancel_03 event) -+target_link_libraries(example_recipes_self_control_timer_cancel_03 event_static event_core_static event_extra_static event_openssl_static) ++target_link_libraries(example_recipes_self_control_timer_cancel_03 libevent::core libevent::extra libevent::openssl) @@ -106,7 +106,7 @@ index 749c584..e7c658e 100644 add_executable(example_recipes_self_control_timer_periodic_04 ${SRCS}) -target_link_libraries(example_recipes_self_control_timer_periodic_04 event) -+target_link_libraries(example_recipes_self_control_timer_periodic_04 event_static event_core_static event_extra_static event_openssl_static) ++target_link_libraries(example_recipes_self_control_timer_periodic_04 libevent::core libevent::extra libevent::openssl) diff --git a/ports/fizz/CONTROL b/ports/fizz/CONTROL index 9ad27acd8c..152f53ad56 100644 --- a/ports/fizz/CONTROL +++ b/ports/fizz/CONTROL @@ -1,4 +1,5 @@ Source: fizz -Version: 2020.02.03.00 +Version: 2020.02.03.00 +Port-Version: 1 Build-Depends: folly, openssl, libsodium, zlib, fmt Description: a TLS 1.3 implementation by Facebook \ No newline at end of file diff --git a/ports/fizz/fix-build_error.patch b/ports/fizz/fix-build_error.patch deleted file mode 100644 index c6bafbb15e..0000000000 --- a/ports/fizz/fix-build_error.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/fizz/CMakeLists.txt b/fizz/CMakeLists.txt -index ccbbbb6..ee10c90 100644 ---- a/fizz/CMakeLists.txt -+++ b/fizz/CMakeLists.txt -@@ -86,7 +86,7 @@ if(TARGET event) - message(STATUS "Found libevent from package config") - list(APPEND FIZZ_SHINY_DEPENDENCIES event) - else() -- find_package(Libevent MODULE REQUIRED) -+ find_package(Libevent CONFIG REQUIRED) - list(APPEND FIZZ_LINK_LIBRARIES ${LIBEVENT_LIB}) - list(APPEND FIZZ_INCLUDE_DIRECTORIES ${LIBEVENT_INCLUDE_DIR}) - endif() diff --git a/ports/fizz/portfile.cmake b/ports/fizz/portfile.cmake index 1dc4fa30c2..869dfcd2e5 100644 --- a/ports/fizz/portfile.cmake +++ b/ports/fizz/portfile.cmake @@ -3,18 +3,16 @@ vcpkg_check_linkage(ONLY_STATIC_LIBRARY) vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO facebookincubator/fizz - REF c0bafd67140e8c6f4f585c1077f2fd89102e4582 # v2020.02.03.00 + REF c0bafd67140e8c6f4f585c1077f2fd89102e4582 # v2020.02.03.00 SHA512 7db706ffdd79f6d753c5530eb67646747d1e7b8b380387f34bd1fc7a06b289a68a6bb4c13faa74e108d4dede72bb2d993d7ad8f60fabcfb3b48abbf4326291c2 HEAD_REF master PATCHES find-zlib.patch - fix-build_error.patch ) # Prefer installed config files file(REMOVE ${SOURCE_PATH}/fizz/cmake/FindGflags.cmake - ${SOURCE_PATH}/fizz/cmake/FindLibevent.cmake ${SOURCE_PATH}/fizz/cmake/FindGlog.cmake ) diff --git a/ports/libevent/CONTROL b/ports/libevent/CONTROL index 4df532990c..fd98e588a1 100644 --- a/ports/libevent/CONTROL +++ b/ports/libevent/CONTROL @@ -1,5 +1,5 @@ Source: libevent -Version: 2.1.11-5 +Version: 2.1.12 Homepage: https://github.com/libevent/libevent Description: An event notification library Supports: !uwp diff --git a/ports/libevent/fix-LibeventConfig_cmake_in_path.patch b/ports/libevent/fix-LibeventConfig_cmake_in_path.patch index b444ae3e72..9566f152cc 100644 --- a/ports/libevent/fix-LibeventConfig_cmake_in_path.patch +++ b/ports/libevent/fix-LibeventConfig_cmake_in_path.patch @@ -1,13 +1,13 @@ diff --git a/cmake/LibeventConfig.cmake.in b/cmake/LibeventConfig.cmake.in -index 5422336..d436100 100644 +index 7b808c3..fbf67be 100644 --- a/cmake/LibeventConfig.cmake.in +++ b/cmake/LibeventConfig.cmake.in -@@ -8,7 +8,7 @@ +@@ -58,7 +58,7 @@ endif() + + # Get the path of the current file. get_filename_component(LIBEVENT_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH) - - # Set the include directories. --set(LIBEVENT_INCLUDE_DIRS "@EVENT_INSTALL_INCLUDE_DIR@") -+set(LIBEVENT_INCLUDE_DIRS "${LIBEVENT_CMAKE_DIR}/../../include") - - # Include the project Targets file, this contains definitions for IMPORTED targets. - include(${LIBEVENT_CMAKE_DIR}/LibeventTargets.cmake) +-get_filename_component(_INSTALL_PREFIX "${LIBEVENT_CMAKE_DIR}/../../.." ABSOLUTE) ++get_filename_component(_INSTALL_PREFIX "${LIBEVENT_CMAKE_DIR}/../.." ABSOLUTE) + + macro(message_if_needed _flag _msg) + if (NOT ${CMAKE_FIND_PACKAGE_NAME}_FIND_QUIETLY) diff --git a/ports/libevent/fix-crt_linkage.patch b/ports/libevent/fix-crt_linkage.patch deleted file mode 100644 index b766b45565..0000000000 --- a/ports/libevent/fix-crt_linkage.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index bf333f3..5bc2a54 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -230,7 +230,7 @@ endif() - - if (${MSVC}) - set(msvc_static_runtime OFF) -- if ("${EVENT_LIBRARY_TYPE}" STREQUAL "STATIC") -+ if ("${VCPKG_CRT_LINKAGE}" STREQUAL "STATIC") - set(msvc_static_runtime ON) - endif() - diff --git a/ports/libevent/fix-file_path.patch b/ports/libevent/fix-file_path.patch index 179700b7ed..fb34080f87 100644 --- a/ports/libevent/fix-file_path.patch +++ b/ports/libevent/fix-file_path.patch @@ -1,26 +1,22 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 6e91c08..44b6e18 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -1430,7 +1430,7 @@ configure_file(${PROJECT_SOURCE_DIR}/cmake/LibeventConfigBuildTree.cmake.in - # Calculate the relative directory from the Cmake dir. - file(RELATIVE_PATH - REL_INCLUDE_DIR -- "${EVENT_INSTALL_CMAKE_DIR}" -+ "${CURRENT_PACKAGES_DIR}/${EVENT_INSTALL_CMAKE_DIR}" - "${CMAKE_INSTALL_PREFIX}/include") - - # Note the LIBEVENT_CMAKE_DIR is defined in LibeventConfig.cmake.in, diff --git a/cmake/AddEventLibrary.cmake b/cmake/AddEventLibrary.cmake -index 9de4484..411ca9d 100644 +index 04f5837..95d9808 100644 --- a/cmake/AddEventLibrary.cmake +++ b/cmake/AddEventLibrary.cmake -@@ -113,7 +113,7 @@ macro(add_event_library LIB_NAME) - EXPORT LibeventTargets - LIBRARY DESTINATION "lib" COMPONENT lib - ARCHIVE DESTINATION "lib" COMPONENT lib -- RUNTIME DESTINATION "lib" COMPONENT lib -+ RUNTIME DESTINATION "bin" COMPONENT bin - PUBLIC_HEADER DESTINATION "include/event2" - COMPONENT dev - ) +@@ -42,7 +42,7 @@ macro(export_install_target TYPE LIB_NAME OUTER_INCLUDES) + install(TARGETS "${LIB_NAME}_${TYPE}" + LIBRARY DESTINATION "lib" COMPONENT lib + ARCHIVE DESTINATION "lib" COMPONENT lib +- RUNTIME DESTINATION "lib" COMPONENT lib ++ RUNTIME DESTINATION "bin" COMPONENT bin + COMPONENT dev + ) + else() +@@ -69,7 +69,7 @@ macro(export_install_target TYPE LIB_NAME OUTER_INCLUDES) + EXPORT LibeventTargets-${TYPE} + LIBRARY DESTINATION "lib" COMPONENT lib + ARCHIVE DESTINATION "lib" COMPONENT lib +- RUNTIME DESTINATION "lib" COMPONENT lib ++ RUNTIME DESTINATION "bin" COMPONENT bin + COMPONENT dev + ) + endif() diff --git a/ports/libevent/portfile.cmake b/ports/libevent/portfile.cmake index bd44d8428a..9865cecea3 100644 --- a/ports/libevent/portfile.cmake +++ b/ports/libevent/portfile.cmake @@ -3,11 +3,10 @@ vcpkg_fail_port_install(MESSAGE "${PORT} does not currently support UWP" ON_TARG vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO libevent/libevent - REF release-2.1.11-stable - SHA512 a34ca4ad4d55a989a4f485f929d0ed2438d070d0e12a19d90c2b12783a562419c64db6a2603b093d958a75246d14ffefc8730c69c90b1b2f48339bde947f0e02 + REF release-2.1.12-stable + SHA512 5d6c6f0072f69a68b190772d4c973ce8f33961912032cdc104ad0854c0950f9d7e28bc274ca9df23897937f0cd8e45d1f214543d80ec271c5a6678814a7f195e PATCHES fix-file_path.patch - fix-crt_linkage.patch fix-LibeventConfig_cmake_in_path.patch ) @@ -23,13 +22,18 @@ else() set(LIBEVENT_LIB_TYPE STATIC) endif() +if(VCPKG_CRT_LINKAGE STREQUAL "static") + set(LIBEVENT_STATIC_RUNTIME ON) +else() + set(LIBEVENT_STATIC_RUNTIME OFF) +endif() + vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH} PREFER_NINJA OPTIONS ${FEATURE_OPTIONS} - -DEVENT_INSTALL_CMAKE_DIR:PATH=share/libevent -DEVENT__LIBRARY_TYPE=${LIBEVENT_LIB_TYPE} - -DVCPKG_CRT_LINKAGE=${VCPKG_CRT_LINKAGE} + -DEVENT__MSVC_STATIC_RUNTIME=${LIBEVENT_STATIC_RUNTIME} -DEVENT__DISABLE_BENCHMARK=ON -DEVENT__DISABLE_TESTS=ON -DEVENT__DISABLE_REGRESS=ON @@ -38,20 +42,28 @@ vcpkg_configure_cmake( vcpkg_install_cmake() -if (VCPKG_TARGET_IS_WINDOWS) - vcpkg_fixup_cmake_targets(CONFIG_PATH cmake TARGET_PATH share/libevent) -else () - vcpkg_fixup_cmake_targets(CONFIG_PATH lib/cmake TARGET_PATH share) -endif() +vcpkg_fixup_cmake_targets(CONFIG_PATH lib/cmake TARGET_PATH share) file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/tools/libevent/) file(RENAME ${CURRENT_PACKAGES_DIR}/bin/event_rpcgen.py ${CURRENT_PACKAGES_DIR}/tools/libevent/event_rpcgen.py) file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share) if(VCPKG_LIBRARY_LINKAGE STREQUAL static) file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin ${CURRENT_PACKAGES_DIR}/debug/bin) endif() +set(_target_suffix) +if(VCPKG_LIBRARY_LINKAGE STREQUAL static) + set(_target_suffix static) +else() + set(_target_suffix shared) +endif() +vcpkg_replace_string(${CURRENT_PACKAGES_DIR}/share/libevent/LibeventTargets-${_target_suffix}.cmake + "${CURRENT_PACKAGES_DIR}" + "${CURRENT_INSTALLED_DIR}" +) + vcpkg_copy_pdbs() #Handle copyright