libevent: update to version at head and enable uwp support. (#29341)

Tagged release is +2 years old, fix-android-threads patch got upstreamed so it
is no longer necessary here. Also, includes a small patch which makes it
build on uwp.
This commit is contained in:
Paweł Wegner 2023-02-15 19:21:34 +01:00 committed by GitHub
parent 376362d3fa
commit 959f8e3175
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 83 additions and 47 deletions

View File

@ -1,5 +1,5 @@
diff --git a/cmake/LibeventConfig.cmake.in b/cmake/LibeventConfig.cmake.in
index 7b808c3..9376a5a 100644
index a12fc23c..fe108b8d 100644
--- a/cmake/LibeventConfig.cmake.in
+++ b/cmake/LibeventConfig.cmake.in
@@ -58,7 +58,7 @@ endif()
@ -11,12 +11,18 @@ index 7b808c3..9376a5a 100644
macro(message_if_needed _flag _msg)
if (NOT ${CMAKE_FIND_PACKAGE_NAME}_FIND_QUIETLY)
@@ -131,7 +131,7 @@ if(CONFIG_FOR_INSTALL_TREE)
find_library(_event_lib
NAMES "event_${_comp}"
PATHS "${_INSTALL_PREFIX}/lib"
@@ -131,12 +131,10 @@ if(CONFIG_FOR_INSTALL_TREE)
unset(_event_lib_rel CACHE)
find_library(_event_lib_dbg
NAMES "event_${_comp}d"
- PATHS "${_INSTALL_PREFIX}/lib"
- NO_DEFAULT_PATH)
+ )
if(_event_lib)
+ PATHS "${_INSTALL_PREFIX}/lib")
find_library(_event_lib_rel
NAMES "event_${_comp}"
- PATHS "${_INSTALL_PREFIX}/lib"
- NO_DEFAULT_PATH)
+ PATHS "${_INSTALL_PREFIX}/lib")
if(_event_lib_rel OR _event_lib_dbg)
list(APPEND LIBEVENT_LIBRARIES "libevent::${_comp}")
set_case_insensitive_found(${_comp})

View File

@ -1,30 +0,0 @@
From 5698ab6de0720f4da078423aa1676ad6a1c6d7ff Mon Sep 17 00:00:00 2001
From: Ryan Pavlik <ryan.pavlik@collabora.com>
Date: Mon, 3 Oct 2022 09:31:10 -0500
Subject: [PATCH] cmake: Fix Android build.
Android/Bionic C library needs no special flags to have threading support.
Found when trying to build with vcpkg.
---
CMakeLists.txt | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 20bdc92e..4efe834e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -556,6 +556,11 @@ endif()
if (NOT EVENT__DISABLE_THREAD_SUPPORT)
if (WIN32)
list(APPEND SRC_CORE evthread_win32.c)
+ elseif(ANDROID)
+ # pthreads is built in to bionic
+ set(EVENT__HAVE_PTHREADS 1)
+ CHECK_TYPE_SIZE(pthread_t EVENT__SIZEOF_PTHREAD_T)
+ list(APPEND SYMBOLS_TO_CHECK pthread_mutexattr_setprotocol)
else()
find_package(Threads REQUIRED)
if (NOT CMAKE_USE_PTHREADS_INIT)
--
2.34.1

View File

@ -0,0 +1,53 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 07520043..7eec4059 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1022,6 +1022,9 @@ if(WIN32)
add_definitions(
-D_CRT_SECURE_NO_WARNINGS
-D_CRT_NONSTDC_NO_DEPRECATE)
+ if(CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
+ add_definitions(-DWINRT)
+ endif()
include_directories(./WIN32-Code)
endif()
diff --git a/evdns.c b/evdns.c
index 05e515c0..912f1115 100644
--- a/evdns.c
+++ b/evdns.c
@@ -4501,8 +4501,12 @@ evdns_get_default_hosts_filename(void)
char *path_out;
size_t len_out;
+#ifndef WINRT
if (! SHGetSpecialFolderPathA(NULL, path, CSIDL_SYSTEM, 0))
return NULL;
+#else
+ return NULL;
+#endif
len_out = strlen(path)+strlen(hostfile)+1;
path_out = mm_malloc(len_out);
evutil_snprintf(path_out, len_out, "%s%s", path, hostfile);
diff --git a/evutil.c b/evutil.c
index d46c997b..bad21ede 100644
--- a/evutil.c
+++ b/evutil.c
@@ -2240,6 +2240,9 @@ evutil_inet_pton_scope(int af, const char *src, void *dst, unsigned *indexp)
if (cp == NULL)
return evutil_inet_pton(af, src, dst);
+#ifdef WINRT
+ return -1;
+#else
if_index = if_nametoindex(cp + 1);
if (if_index == 0) {
/* Could be numeric */
@@ -2256,6 +2259,7 @@ evutil_inet_pton_scope(int af, const char *src, void *dst, unsigned *indexp)
r = evutil_inet_pton(af, tmp_src, dst);
free(tmp_src);
return r;
+#endif
}
int

View File

@ -1,13 +1,13 @@
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO libevent/libevent
REF release-2.1.12-stable
SHA512 5d6c6f0072f69a68b190772d4c973ce8f33961912032cdc104ad0854c0950f9d7e28bc274ca9df23897937f0cd8e45d1f214543d80ec271c5a6678814a7f195e
REF 4d85d28acdbb83bb60e500e9345bab757b64d6d1
SHA512 d03daf8e2277e8b9d67e0028d05566c8972a706e53dcb6593f8f92942ff9ce814970418a10d4c37e68228ec153f8fbc7d764a7ff92e2872277a92039380cbbe9
PATCHES
fix-uwp.patch
fix-file_path.patch
fix-LibeventConfig_cmake_in_path.patch
fix-usage.patch
fix-android-threads.patch
)
vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
@ -28,6 +28,10 @@ else()
set(LIBEVENT_STATIC_RUNTIME OFF)
endif()
if(VCPKG_TARGET_IS_UWP)
list(APPEND FEATURE_OPTIONS -DEVENT__HAVE_AFUNIX_H=0)
endif()
vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
OPTIONS ${FEATURE_OPTIONS}
@ -37,6 +41,7 @@ vcpkg_cmake_configure(
-DEVENT__DISABLE_TESTS=ON
-DEVENT__DISABLE_REGRESS=ON
-DEVENT__DISABLE_SAMPLES=ON
-DEVENT__DISABLE_MBEDTLS=ON
)
vcpkg_cmake_install()

View File

@ -1,10 +1,9 @@
{
"name": "libevent",
"version": "2.1.12",
"port-version": 7,
"version": "2.1.12+20230128",
"description": "An event notification library",
"homepage": "https://github.com/libevent/libevent",
"supports": "!uwp",
"license": "BSD-3-Clause",
"dependencies": [
{
"name": "vcpkg-cmake",

View File

@ -381,8 +381,6 @@ libgpod:x64-osx=fail
libepoxy:arm-uwp=fail
libepoxy:x64-uwp=fail
libepoxy:x64-windows-static=fail
libevent:arm-uwp=fail
libevent:x64-uwp=fail
libevhtp:x86-windows=fail
libevhtp:x64-windows=fail
libevhtp:x64-windows-static=fail

View File

@ -3857,8 +3857,8 @@
"port-version": 1
},
"libevent": {
"baseline": "2.1.12",
"port-version": 7
"baseline": "2.1.12+20230128",
"port-version": 0
},
"libevhtp": {
"baseline": "1.2.18",

View File

@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "2ac9c2c5c7aedb962fd3c546c601132a5dc32788",
"version": "2.1.12+20230128",
"port-version": 0
},
{
"git-tree": "49a66da074def8806e42235e6c64af567987498f",
"version": "2.1.12",