nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at python-updates 74 lines 2.8 kB view raw
1From f26dd335c8650a2f8ab7d6e4fb5dfc40ee6af618 Mon Sep 17 00:00:00 2001 2From: Jade Lovelace <software@lfcode.ca> 3Date: Sun, 10 Aug 2025 10:54:14 +0000 4Subject: [PATCH] fix: include libucontext in Requires.private in cmake builds 5 6This is required so that static musl actually links to libucontext 7correctly to get setcontext/etc for fibers. 8--- 9 c++/CMakeLists.txt | 4 ++++ 10 c++/configure.ac | 4 ++++ 11 c++/pkgconfig/kj-async.pc.in | 1 + 12 3 files changed, 9 insertions(+) 13 14diff --git a/c++/CMakeLists.txt b/c++/CMakeLists.txt 15index f335f12f7c..b2a24e40e0 100644 16--- a/c++/CMakeLists.txt 17+++ b/c++/CMakeLists.txt 18@@ -96,6 +96,9 @@ set_property(CACHE WITH_FIBERS PROPERTY STRINGS AUTO ON OFF) 19 # CapnProtoConfig.cmake.in needs this variable. 20 set(_WITH_LIBUCONTEXT OFF) 21 22+# Used by pkg-config files 23+set(ASYNC_REQUIRES_PRIVATE "") 24+ 25 if (WITH_FIBERS OR WITH_FIBERS STREQUAL "AUTO") 26 set(_capnp_fibers_found OFF) 27 if (WIN32 OR CYGWIN) 28@@ -116,6 +119,7 @@ if (WITH_FIBERS OR WITH_FIBERS STREQUAL "AUTO") 29 if (libucontext_FOUND) 30 set(_WITH_LIBUCONTEXT ON) 31 set(_capnp_fibers_found ON) 32+ set(ASYNC_REQUIRES_PRIVATE "${ASYNC_REQUIRES_PRIVATE} libucontext") 33 endif() 34 else() 35 set(_capnp_fibers_found OFF) 36diff --git a/c++/configure.ac b/c++/configure.ac 37index a2de7aac80..ce3c632e8c 100644 38--- a/c++/configure.ac 39+++ b/c++/configure.ac 40@@ -216,6 +216,8 @@ AS_IF([test "$with_fibers" != no], [ 41 ]) 42 ]) 43 44+ASYNC_REQUIRES_PRIVATE="" 45+ 46 # Check for library support necessary for fibers. 47 AS_IF([test "$with_fibers" != no], [ 48 case "${host_os}" in 49@@ -241,6 +243,7 @@ AS_IF([test "$with_fibers" != no], [ 50 ]) 51 AS_IF([test "$ucontext_supports_fibers" = yes], [ 52 ASYNC_LIBS="$ASYNC_LIBS -lucontext" 53+ ASYNC_REQUIRES_PRIVATE="$ASYNC_REQUIRES_PRIVATE libucontext" 54 with_fibers=yes 55 ], [ 56 AS_IF([test "$with_fibers" = yes], [ 57@@ -259,6 +262,7 @@ AS_IF([test "$with_fibers" = yes], [ 58 ], [ 59 CXXFLAGS="$CXXFLAGS -DKJ_USE_FIBERS=0" 60 ]) 61+AC_SUBST(ASYNC_REQUIRES_PRIVATE, $ASYNC_REQUIRES_PRIVATE) 62 63 # CapnProtoConfig.cmake.in needs these variables, 64 # we force them to NO because we don't need the CMake dependency for them, 65diff --git a/c++/pkgconfig/kj-async.pc.in b/c++/pkgconfig/kj-async.pc.in 66index 49d5ff6996..41aae28555 100644 67--- a/c++/pkgconfig/kj-async.pc.in 68+++ b/c++/pkgconfig/kj-async.pc.in 69@@ -8,4 +8,5 @@ Description: Basic utility library called KJ (async part) 70 Version: @VERSION@ 71 Libs: -L${libdir} -lkj-async @ASYNC_LIBS@ @PTHREAD_CFLAGS@ @PTHREAD_LIBS@ @STDLIB_FLAG@ 72 Requires: kj = @VERSION@ 73+Requires.private: @ASYNC_REQUIRES_PRIVATE@ 74 Cflags: -I${includedir} @ASYNC_LIBS@ @PTHREAD_CFLAGS@ @STDLIB_FLAG@ @CAPNP_LITE_FLAG@