diff mbox series

[1/1] package/capnproto: update ucontext handling

Message ID 20240306145531.1413586-1-fontaine.fabrice@gmail.com
State New
Headers show
Series [1/1] package/capnproto: update ucontext handling | expand

Commit Message

Fabrice Fontaine March 6, 2024, 2:55 p.m. UTC
musl workaround for getcontext/setcontext is not needed since commit
eaeba56aa2d21f1d264c7e361731808e3f072d9d

Moreover, select libucontext if possible to get full ucontext support

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
---
 package/c-capnproto/Config.in  | 6 ++++--
 package/capnproto/Config.in    | 8 ++++++--
 package/capnproto/capnproto.mk | 5 ++---
 3 files changed, 12 insertions(+), 7 deletions(-)

Comments

Arnout Vandecappelle April 7, 2024, 4:25 p.m. UTC | #1
On 06/03/2024 15:55, Fabrice Fontaine wrote:
> musl workaround for getcontext/setcontext is not needed since commit
> eaeba56aa2d21f1d264c7e361731808e3f072d9d
> 
> Moreover, select libucontext if possible to get full ucontext support
> 
> Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
> ---
>   package/c-capnproto/Config.in  | 6 ++++--
>   package/capnproto/Config.in    | 8 ++++++--
>   package/capnproto/capnproto.mk | 5 ++---
>   3 files changed, 12 insertions(+), 7 deletions(-)
> 
> diff --git a/package/c-capnproto/Config.in b/package/c-capnproto/Config.in
> index c472128c3f..abe2a602ba 100644
> --- a/package/c-capnproto/Config.in
> +++ b/package/c-capnproto/Config.in
> @@ -7,7 +7,8 @@ config BR2_PACKAGE_C_CAPNPROTO
>   	depends on BR2_TOOLCHAIN_HAS_THREADS # capnproto
>   	depends on BR2_TOOLCHAIN_HAS_ATOMIC # capnproto
>   	depends on !BR2_TOOLCHAIN_HAS_GCC_BUG_64735 # capnproto
> -	depends on BR2_TOOLCHAIN_HAS_UCONTEXT # capnproto
> +	depends on BR2_TOOLCHAIN_HAS_UCONTEXT || \
> +		BR2_PACKAGE_LIBUCONTEXT_ARCH_SUPPORTS # capnproto
>   	select BR2_PACKAGE_CAPNPROTO
>   	help
>   	  A C plugin for Cap'n Proto. Generates the code generator
> @@ -24,4 +25,5 @@ comment "c-capnproto needs host and target gcc >= 5 w/ C++14, threads, atomic, u
>   		!BR2_TOOLCHAIN_HAS_THREADS || \
>   		!BR2_TOOLCHAIN_HAS_ATOMIC || \
>   		BR2_TOOLCHAIN_HAS_GCC_BUG_64735 || \
> -		!BR2_TOOLCHAIN_HAS_UCONTEXT
> +		!(BR2_TOOLCHAIN_HAS_UCONTEXT || \
> +			BR2_PACKAGE_LIBUCONTEXT_ARCH_SUPPORTS)
> diff --git a/package/capnproto/Config.in b/package/capnproto/Config.in
> index 943ba9de29..93e3a64fb8 100644
> --- a/package/capnproto/Config.in
> +++ b/package/capnproto/Config.in
> @@ -7,7 +7,10 @@ config BR2_PACKAGE_CAPNPROTO
>   	depends on BR2_TOOLCHAIN_HAS_THREADS
>   	depends on BR2_TOOLCHAIN_HAS_ATOMIC
>   	depends on !BR2_TOOLCHAIN_HAS_GCC_BUG_64735
> -	depends on BR2_TOOLCHAIN_HAS_UCONTEXT
> +	depends on BR2_TOOLCHAIN_HAS_UCONTEXT || \
> +		BR2_PACKAGE_LIBUCONTEXT_ARCH_SUPPORTS
> +	select BR2_PACKAGE_LIBUCONTEXT if \
> +		BR2_PACKAGE_LIBUCONTEXT_ARCH_SUPPORTS

  This will select libucontext even if the toolchain already has ucontext, so we 
have it twice? Is that really OK, and even if it is, is it really what we want? 
My feeling is that libucontext should depend on !BR2_TOOLCHAIN_HAS_UCONTEXT...
And here, I feel it should be "if !BR2_TOOLCHAIN_HAS_UCONTEXT && 
BR2_PACKAGE_LIBUCONTEXT_ARCH_SUPPORTS". Which is a bit too cumbersome to repeat 
in many places, so maybe we should also introduce an auxiliary symbol for that, 
something like BR2_PACKAGE_LIBUCONTEXT_IF_NEEDED.


  Regards,
  Arnout

>   	help
>   	  Cap'n Proto is an insanely fast data interchange format
>   	  and capability-based RPC system. Think JSON, except
> @@ -25,4 +28,5 @@ comment "capnproto needs host and target gcc >= 5 w/ C++14, threads, atomic, uco
>   		!BR2_TOOLCHAIN_HAS_THREADS || \
>   		!BR2_TOOLCHAIN_HAS_ATOMIC || \
>   		BR2_TOOLCHAIN_HAS_GCC_BUG_64735 || \
> -		!BR2_TOOLCHAIN_HAS_UCONTEXT
> +		!(BR2_TOOLCHAIN_HAS_UCONTEXT || \
> +			BR2_PACKAGE_LIBUCONTEXT_ARCH_SUPPORTS)
> diff --git a/package/capnproto/capnproto.mk b/package/capnproto/capnproto.mk
> index 7424a1420f..d322c27a54 100644
> --- a/package/capnproto/capnproto.mk
> +++ b/package/capnproto/capnproto.mk
> @@ -29,9 +29,8 @@ else
>   CAPNPROTO_CONF_OPTS += --without-openssl
>   endif
>   
> -# musl doesn't support getcontext/setcontext
> -ifeq ($(BR2_TOOLCHAIN_USES_MUSL),y)
> -CAPNPROTO_CONF_ENV += CXXFLAGS="$(TARGET_CXXFLAGS) -DKJ_USE_FIBERS=0"
> +ifeq ($(BR2_PACKAGE_LIBUCONTEXT),y)
> +CAPNPROTO_DEPENDENCIES += libucontext
>   endif
>   
>   $(eval $(autotools-package))
diff mbox series

Patch

diff --git a/package/c-capnproto/Config.in b/package/c-capnproto/Config.in
index c472128c3f..abe2a602ba 100644
--- a/package/c-capnproto/Config.in
+++ b/package/c-capnproto/Config.in
@@ -7,7 +7,8 @@  config BR2_PACKAGE_C_CAPNPROTO
 	depends on BR2_TOOLCHAIN_HAS_THREADS # capnproto
 	depends on BR2_TOOLCHAIN_HAS_ATOMIC # capnproto
 	depends on !BR2_TOOLCHAIN_HAS_GCC_BUG_64735 # capnproto
-	depends on BR2_TOOLCHAIN_HAS_UCONTEXT # capnproto
+	depends on BR2_TOOLCHAIN_HAS_UCONTEXT || \
+		BR2_PACKAGE_LIBUCONTEXT_ARCH_SUPPORTS # capnproto
 	select BR2_PACKAGE_CAPNPROTO
 	help
 	  A C plugin for Cap'n Proto. Generates the code generator
@@ -24,4 +25,5 @@  comment "c-capnproto needs host and target gcc >= 5 w/ C++14, threads, atomic, u
 		!BR2_TOOLCHAIN_HAS_THREADS || \
 		!BR2_TOOLCHAIN_HAS_ATOMIC || \
 		BR2_TOOLCHAIN_HAS_GCC_BUG_64735 || \
-		!BR2_TOOLCHAIN_HAS_UCONTEXT
+		!(BR2_TOOLCHAIN_HAS_UCONTEXT || \
+			BR2_PACKAGE_LIBUCONTEXT_ARCH_SUPPORTS)
diff --git a/package/capnproto/Config.in b/package/capnproto/Config.in
index 943ba9de29..93e3a64fb8 100644
--- a/package/capnproto/Config.in
+++ b/package/capnproto/Config.in
@@ -7,7 +7,10 @@  config BR2_PACKAGE_CAPNPROTO
 	depends on BR2_TOOLCHAIN_HAS_THREADS
 	depends on BR2_TOOLCHAIN_HAS_ATOMIC
 	depends on !BR2_TOOLCHAIN_HAS_GCC_BUG_64735
-	depends on BR2_TOOLCHAIN_HAS_UCONTEXT
+	depends on BR2_TOOLCHAIN_HAS_UCONTEXT || \
+		BR2_PACKAGE_LIBUCONTEXT_ARCH_SUPPORTS
+	select BR2_PACKAGE_LIBUCONTEXT if \
+		BR2_PACKAGE_LIBUCONTEXT_ARCH_SUPPORTS
 	help
 	  Cap'n Proto is an insanely fast data interchange format
 	  and capability-based RPC system. Think JSON, except
@@ -25,4 +28,5 @@  comment "capnproto needs host and target gcc >= 5 w/ C++14, threads, atomic, uco
 		!BR2_TOOLCHAIN_HAS_THREADS || \
 		!BR2_TOOLCHAIN_HAS_ATOMIC || \
 		BR2_TOOLCHAIN_HAS_GCC_BUG_64735 || \
-		!BR2_TOOLCHAIN_HAS_UCONTEXT
+		!(BR2_TOOLCHAIN_HAS_UCONTEXT || \
+			BR2_PACKAGE_LIBUCONTEXT_ARCH_SUPPORTS)
diff --git a/package/capnproto/capnproto.mk b/package/capnproto/capnproto.mk
index 7424a1420f..d322c27a54 100644
--- a/package/capnproto/capnproto.mk
+++ b/package/capnproto/capnproto.mk
@@ -29,9 +29,8 @@  else
 CAPNPROTO_CONF_OPTS += --without-openssl
 endif
 
-# musl doesn't support getcontext/setcontext
-ifeq ($(BR2_TOOLCHAIN_USES_MUSL),y)
-CAPNPROTO_CONF_ENV += CXXFLAGS="$(TARGET_CXXFLAGS) -DKJ_USE_FIBERS=0"
+ifeq ($(BR2_PACKAGE_LIBUCONTEXT),y)
+CAPNPROTO_DEPENDENCIES += libucontext
 endif
 
 $(eval $(autotools-package))