Merge #180478: curl: fix build on certain platforms

...into staging

+58
+30
pkgs/tools/networking/curl/atomic.patch
··· 1 + From 50efb0822aa0e0ab165158dd0a26e65a2290e6d2 Mon Sep 17 00:00:00 2001 2 + From: Daniel Stenberg <daniel@haxx.se> 3 + Date: Tue, 28 Jun 2022 09:00:25 +0200 4 + Subject: [PATCH] easy_lock: switch to using atomic_int instead of bool 5 + 6 + To work with more compilers without requiring separate libs to 7 + link. Like with gcc-12 for RISC-V on Linux. 8 + 9 + Reported-by: Adam Sampson 10 + Fixes #9055 11 + Closes #9061 12 + --- 13 + lib/easy_lock.h | 4 ++-- 14 + 1 file changed, 2 insertions(+), 2 deletions(-) 15 + 16 + diff --git a/lib/easy_lock.h b/lib/easy_lock.h 17 + index 07c85c5ffdd19..9c11bc50c5f20 100644 18 + --- a/lib/easy_lock.h 19 + +++ b/lib/easy_lock.h 20 + @@ -40,8 +40,8 @@ 21 + #include <sched.h> 22 + #endif 23 + 24 + -#define curl_simple_lock atomic_bool 25 + -#define CURL_SIMPLE_LOCK_INIT false 26 + +#define curl_simple_lock atomic_int 27 + +#define CURL_SIMPLE_LOCK_INIT 0 28 + 29 + static inline void curl_simple_lock_lock(curl_simple_lock *lock) 30 + {
+2
pkgs/tools/networking/curl/default.nix
··· 60 60 61 61 patches = [ 62 62 ./7.79.1-darwin-no-systemconfiguration.patch 63 + ./sched.patch 64 + ./atomic.patch 63 65 ] ++ lib.optional patchNetrcRegression ./netrc-regression.patch; 64 66 65 67 outputs = [ "bin" "dev" "out" "man" "devdoc" ];
+26
pkgs/tools/networking/curl/sched.patch
··· 1 + From e2e7f54b7bea521fa8373095d0f43261a720cda0 Mon Sep 17 00:00:00 2001 2 + From: Daniel Stenberg <daniel@haxx.se> 3 + Date: Mon, 27 Jun 2022 08:46:21 +0200 4 + Subject: [PATCH] easy_lock.h: include sched.h if available to fix build 5 + 6 + Patched-by: Harry Sintonen 7 + 8 + Closes #9054 9 + --- 10 + lib/easy_lock.h | 3 +++ 11 + 1 file changed, 3 insertions(+) 12 + 13 + diff --git a/lib/easy_lock.h b/lib/easy_lock.h 14 + index 819f50ce815b8..1f54289ceb2d3 100644 15 + --- a/lib/easy_lock.h 16 + +++ b/lib/easy_lock.h 17 + @@ -36,6 +36,9 @@ 18 + 19 + #elif defined (HAVE_ATOMIC) 20 + #include <stdatomic.h> 21 + +#if defined(HAVE_SCHED_YIELD) 22 + +#include <sched.h> 23 + +#endif 24 + 25 + #define curl_simple_lock atomic_bool 26 + #define CURL_SIMPLE_LOCK_INIT false