[libevent] Fix android build. (#27083)

I'm not sure why find_package(Threads) isn't working, I was pretty sure
it used to, but this fixes the Android build.
This commit is contained in:
Ryan A. Pavlik 2022-10-05 17:36:14 -05:00 committed by GitHub
parent 73351a37f9
commit 955a842e86
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 38 additions and 2 deletions

View File

@ -0,0 +1,30 @@
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

@ -7,6 +7,7 @@ vcpkg_from_github(
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

View File

@ -1,7 +1,7 @@
{
"name": "libevent",
"version": "2.1.12",
"port-version": 6,
"port-version": 7,
"description": "An event notification library",
"homepage": "https://github.com/libevent/libevent",
"supports": "!uwp",

View File

@ -3666,7 +3666,7 @@
},
"libevent": {
"baseline": "2.1.12",
"port-version": 6
"port-version": 7
},
"libevhtp": {
"baseline": "1.2.18",

View File

@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "49a66da074def8806e42235e6c64af567987498f",
"version": "2.1.12",
"port-version": 7
},
{
"git-tree": "c1fbaddea4a9b98b61cba0d785441115c161d24f",
"version": "2.1.12",