mirror of
https://github.com/openwrt/packages.git
synced 2025-12-10 20:51:23 +00:00
Backport upstream patch fixing compilation with GCC 15. Remove upstreamed patch. Signed-off-by: Rosen Penev <rosenp@gmail.com>
58 lines
2.2 KiB
Diff
58 lines
2.2 KiB
Diff
libmariadb: Fix async api by linking to libucontext
|
|
The asynchronous API of libmariadb uses cooperative multi threading
|
|
by using the system calls
|
|
* makecontext
|
|
* swapcontext
|
|
* getcontext
|
|
* setcontext
|
|
of the ucontext.h C-API.
|
|
|
|
Thus additionally link libmariadb to libucontext which is a library
|
|
providing these system calls on platforms not supporting them out of
|
|
the box - like musl based platforms.
|
|
--- a/CMakeLists.txt
|
|
+++ b/CMakeLists.txt
|
|
@@ -263,11 +263,19 @@ IF(UNIX)
|
|
SEARCH_LIBRARY(LIBPTHREAD pthread_getspecific "pthread;pthreads")
|
|
SEARCH_LIBRARY(LIBNSL gethostbyname_r "nsl_r;nsl")
|
|
SEARCH_LIBRARY(LIBSOCKET setsockopt socket)
|
|
+ SEARCH_LIBRARY(LIBUCONTEXT libucontext_swapcontext libucontext.a)
|
|
+ SEARCH_LIBRARY(LIBUCONTEXT_POSIX swapcontext libucontext_posix.a)
|
|
+ IF (NOT HAVE_LIBUCONTEXT_POSIX OR NOT HAVE_LIBUCONTEXT)
|
|
+ UNSET(HAVE_LIBUCONTEXT)
|
|
+ UNSET(LIBUCONTEXT)
|
|
+ UNSET(HAVE_LIBUCONTEXT_POSIX)
|
|
+ UNSET(LIBUCONTEXT_POSIX)
|
|
+ ENDIF()
|
|
FIND_PACKAGE(Threads)
|
|
SET(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} ${LIBNSL} ${LIBBIND} ${LIBICONV} ${ZLIB_LIBRARY}
|
|
- ${LIBSOCKET} ${CMAKE_DL_LIBS} ${LIBM} ${LIBPTHREAD})
|
|
+ ${LIBSOCKET} ${LIBUCONTEXT} ${LIBUCONTEXT_POSIX} ${CMAKE_DL_LIBS} ${LIBM} ${LIBPTHREAD})
|
|
SET(SYSTEM_LIBS ${SYSTEM_LIBS} ${LIBNSL} ${LIBBIND} ${LIBICONV}
|
|
- ${LIBSOCKET} ${CMAKE_DL_LIBS} ${LIBM} ${LIBPTHREAD})
|
|
+ ${LIBSOCKET} ${LIBUCONTEXT} ${LIBUCONTEXT_POSIX} ${CMAKE_DL_LIBS} ${LIBM} ${LIBPTHREAD})
|
|
#remove possible dups from required libraries
|
|
LIST(LENGTH CMAKE_REQUIRED_LIBRARIES rllength)
|
|
IF(${rllength} GREATER 0)
|
|
--- a/include/ma_config.h.in
|
|
+++ b/include/ma_config.h.in
|
|
@@ -29,6 +29,7 @@
|
|
#cmakedefine HAVE_SYS_UN_H 1
|
|
#cmakedefine HAVE_UNISTD_H 1
|
|
#cmakedefine HAVE_UCONTEXT_H 1
|
|
+#cmakedefine HAVE_LIBUCONTEXT_POSIX 1
|
|
#cmakedefine HAVE_BOOST_CONTEXT_H 1
|
|
|
|
/*
|
|
--- a/include/ma_context.h
|
|
+++ b/include/ma_context.h
|
|
@@ -61,7 +61,7 @@
|
|
#define MY_CONTEXT_USE_AARCH64_GCC_ASM
|
|
#elif defined(HAVE_BOOST_CONTEXT_H)
|
|
#define MY_CONTEXT_USE_BOOST_CONTEXT
|
|
-#elif defined(HAVE_UCONTEXT_H)
|
|
+#elif defined(HAVE_UCONTEXT_H) || defined(HAVE_LIBUCONTEXT_POSIX)
|
|
#define MY_CONTEXT_USE_UCONTEXT
|
|
#else
|
|
#define MY_CONTEXT_DISABLE
|