From 4454f21034fa1049162ea4f5665a8d95ae668123 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20=C4=8Cun=C3=A1t?= Date: Tue, 21 Feb 2023 08:44:53 +0100 Subject: [PATCH] cmocka: 1.1.5 -> 1.1.6 > Version 1.1.6 has been released to fix several issues > and a few small new features. https://gitlab.com/cmocka/cmocka/-/blob/cmocka-1.1.6/ChangeLog We might conditionalize the patch e.g. for musl only, but I don't think it could cause trouble elsewhere. --- pkgs/development/libraries/cmocka/default.nix | 19 +++++-------------- .../libraries/cmocka/uintptr_t.patch | 16 ++++++++++++++++ 2 files changed, 21 insertions(+), 14 deletions(-) create mode 100644 pkgs/development/libraries/cmocka/uintptr_t.patch diff --git a/pkgs/development/libraries/cmocka/default.nix b/pkgs/development/libraries/cmocka/default.nix index 718377a7ca5..5eefba8eb47 100644 --- a/pkgs/development/libraries/cmocka/default.nix +++ b/pkgs/development/libraries/cmocka/default.nix @@ -1,26 +1,17 @@ { fetchurl, fetchpatch, lib, stdenv, cmake }: -let - # Temporary split to save rebuilds; see PR #217469 - isUpdated = with stdenv; isDarwin && isAarch64; -in + stdenv.mkDerivation rec { pname = "cmocka"; majorVersion = "1.1"; - version = "${majorVersion}." + (if isUpdated then "6" else "5"); + version = "${majorVersion}.6"; src = fetchurl { url = "https://cmocka.org/files/${majorVersion}/cmocka-${version}.tar.xz"; - sha256 = if isUpdated - then "0xksffx1w3pzm18ynf28cx8scrhylcbz43s1rgkkdqnyil1q6cjv" - else "1dm8pdvkyfa8dsbz9bpq7wwgixjij4sii9bbn5sgvqjm5ljdik7h"; + sha256 = "0xksffx1w3pzm18ynf28cx8scrhylcbz43s1rgkkdqnyil1q6cjv"; }; - patches = lib.optionals (!isUpdated) [ - (fetchpatch { - name = "musl-uintptr.patch"; - url = "https://git.alpinelinux.org/aports/plain/main/cmocka/musl_uintptr.patch?id=6a15dd0d0ba9cc354a621fb359ca5e315ff2eabd"; - sha256 = "sha256-fhb2Tax30kRTGuaKvzSzglSd/ntxiNeGFJt5I8poa24="; - }) + patches = [ + ./uintptr_t.patch ]; nativeBuildInputs = [ cmake ]; diff --git a/pkgs/development/libraries/cmocka/uintptr_t.patch b/pkgs/development/libraries/cmocka/uintptr_t.patch new file mode 100644 index 00000000000..ac69560d1c9 --- /dev/null +++ b/pkgs/development/libraries/cmocka/uintptr_t.patch @@ -0,0 +1,16 @@ +Resolve messy situation with uintptr_t and stdint.h + +Platforms common in nixpkgs will have stdint.h - thereby we avoid problems +that seem complicated to avoid. References: +https://gitlab.com/cmocka/cmocka/-/issues/38#note_1286565655 +https://git.alpinelinux.org/aports/plain/main/cmocka/musl_uintptr.patch?id=6a15dd0d0ba9cc354a621fb359ca5e315ff2eabd + +It isn't easy, as 1.1.6 codebase is missing stdint.h includes on many places, +and HAVE_UINTPTR_T from cmake also wouldn't get on all places it needs to. +--- a/include/cmocka.h ++++ b/include/cmocka.h +@@ -18,2 +18,4 @@ + #define CMOCKA_H_ ++#include ++#define HAVE_UINTPTR_T 1 +