diff --git a/pkgs/by-name/fl/flashrom/0002-tests-erase-parenthesize-braced-initializer.patch b/pkgs/by-name/fl/flashrom/0002-tests-erase-parenthesize-braced-initializer.patch new file mode 100644 index 000000000000..fdad7832431b --- /dev/null +++ b/pkgs/by-name/fl/flashrom/0002-tests-erase-parenthesize-braced-initializer.patch @@ -0,0 +1,50 @@ +From ba84c4aba56420315973026288e7b336006336a9 Mon Sep 17 00:00:00 2001 +From: edef +Date: Tue, 30 Jul 2024 03:14:37 +0000 +Subject: [PATCH] tests/erase: parenthesize braced initializer + +memcpy is a macro on Darwin, and thus requires braced initializer lists +to be parenthesized. +--- + tests/erase_func_algo.c | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/tests/erase_func_algo.c b/tests/erase_func_algo.c +index 576923f8..b13ee70c 100644 +--- a/tests/erase_func_algo.c ++++ b/tests/erase_func_algo.c +@@ -1233,13 +1233,13 @@ static void erase_unwritable_regions_skipflag_on_test_success(void **state) + + // This test needs special block erase to emulate protected regions. + memcpy(g_test_erase_injector, +- (erasefunc_t *const[]){ ++ ((erasefunc_t *const[]){ + block_erase_chip_with_protected_region_1, + block_erase_chip_with_protected_region_2, + block_erase_chip_with_protected_region_3, + block_erase_chip_with_protected_region_4, + block_erase_chip_with_protected_region_5, +- }, ++ }), + sizeof(g_test_erase_injector) + ); + +@@ -1322,13 +1322,13 @@ static void write_unwritable_regions_skipflag_on_test_success(void **state) { + + // This test needs special block erase to emulate protected regions. + memcpy(g_test_erase_injector, +- (erasefunc_t *const[]){ ++ ((erasefunc_t *const[]){ + block_erase_chip_with_protected_region_1, + block_erase_chip_with_protected_region_2, + block_erase_chip_with_protected_region_3, + block_erase_chip_with_protected_region_4, + block_erase_chip_with_protected_region_5, +- }, ++ }), + sizeof(g_test_erase_injector) + ); + +-- +2.45.2 + diff --git a/pkgs/by-name/fl/flashrom/package.nix b/pkgs/by-name/fl/flashrom/package.nix index f8cbd4f1354a..75404ada546d 100644 --- a/pkgs/by-name/fl/flashrom/package.nix +++ b/pkgs/by-name/fl/flashrom/package.nix @@ -24,14 +24,17 @@ stdenv.mkDerivation rec { hash = "sha256-rX7htJI5xvtPj1XjZwb81zFDXbGkvS+rPYDx9yUIzO4="; }; - patches = [ - # Release notes for 1.4.0 state that Promontory chipsets are unsupported, and that attempting to read flash on those systems may crash the system. - # The patch that removes this (broken) support only made it into the 1.3.0 release, seemingly by mistake, and the relevant code has been essentially untouched since. - # We cherry-pick the upstream patch from 1.3.0, though amended to reference the relevant bug in the error message, rather than requesting the user email upstream. - # https://ticket.coreboot.org/issues/370 - # https://review.coreboot.org/c/flashrom/+/68824 - ./0001-sb600spi.c-Drop-Promontory-support.patch - ]; + patches = + [ + # Release notes for 1.4.0 state that Promontory chipsets are unsupported, and that attempting to read flash on those systems may crash the system. + # The patch that removes this (broken) support only made it into the 1.3.0 release, seemingly by mistake, and the relevant code has been essentially untouched since. + # We cherry-pick the upstream patch from 1.3.0, though amended to reference the relevant bug in the error message, rather than requesting the user email upstream. + # https://ticket.coreboot.org/issues/370 + # https://review.coreboot.org/c/flashrom/+/68824 + ./0001-sb600spi.c-Drop-Promontory-support.patch + ] + # Darwin's memcpy is a macro, and requires braced initializer lists to be parenthesized + ++ lib.optional stdenv.isDarwin ./0002-tests-erase-parenthesize-braced-initializer.patch; nativeBuildInputs = [ meson