From c81f064ea85563403b71d3facf11170daa3efb0c Mon Sep 17 00:00:00 2001 From: Alyssa Ross Date: Mon, 11 Nov 2024 17:58:14 +0100 Subject: [PATCH] librist: fix build for musl (cherry picked from commit 01fe6fb38d5d50180e322fab5d7bab6f4e764c1e) (cherry picked from commit 055e7024008f7e39444dcd8af2880c04668b6d8d) --- pkgs/by-name/li/librist/musl.patch | 16 ++++++++++++++++ pkgs/by-name/li/librist/package.nix | 2 ++ 2 files changed, 18 insertions(+) create mode 100644 pkgs/by-name/li/librist/musl.patch diff --git a/pkgs/by-name/li/librist/musl.patch b/pkgs/by-name/li/librist/musl.patch new file mode 100644 index 000000000000..95f432549777 --- /dev/null +++ b/pkgs/by-name/li/librist/musl.patch @@ -0,0 +1,16 @@ +diff --git a/test/rist/unit/srp_examples.c b/test/rist/unit/srp_examples.c +index 1c5193d..6f835b5 100644 +--- a/test/rist/unit/srp_examples.c ++++ b/test/rist/unit/srp_examples.c +@@ -16,6 +16,11 @@ + #define DEBUG_USE_EXAMPLE_CONSTANTS 1 + + #if HAVE_MBEDTLS ++// musl's sched.h includes a prototype for calloc, so we need to make ++// sure it's already been included before we redefine it to something ++// that won't expand to a valid prototype. ++#include ++ + #define malloc(size) _test_malloc(size, __FILE__, __LINE__) + #define calloc(num, size) _test_calloc(num, size, __FILE__, __LINE__) + #define free(obj) _test_free(obj, __FILE__, __LINE__) diff --git a/pkgs/by-name/li/librist/package.nix b/pkgs/by-name/li/librist/package.nix index 788e75eafdda..97fbece7aa27 100644 --- a/pkgs/by-name/li/librist/package.nix +++ b/pkgs/by-name/li/librist/package.nix @@ -24,6 +24,8 @@ stdenv.mkDerivation rec { patches = [ # https://github.com/NixOS/nixpkgs/pull/257020 ./darwin.patch + # https://code.videolan.org/rist/librist/-/merge_requests/257 + ./musl.patch ]; nativeBuildInputs = [