jq: fix build for musl

This commit is contained in:
Alyssa Ross
2025-07-03 11:03:14 +02:00
parent e0910df589
commit 4f6cd96536
2 changed files with 40 additions and 8 deletions

View File

@@ -0,0 +1,31 @@
From 63e9449a8142ce30c83fcd7e9396e5de9843774e Mon Sep 17 00:00:00 2001
From: Alyssa Ross <hi@alyssa.is>
Date: Thu, 3 Jul 2025 11:00:13 +0200
Subject: [PATCH] jq.test: drop non-portable %F test
%F is a non-portable GNU extension, not supported by all strptime
implementations (for example musl's).
Link: https://github.com/jqlang/jq/pull/3365
---
tests/jq.test | 4 ----
1 file changed, 4 deletions(-)
diff --git a/tests/jq.test b/tests/jq.test
index 4ecf72f..6bfb6f8 100644
--- a/tests/jq.test
+++ b/tests/jq.test
@@ -1848,10 +1848,6 @@ try ["OK", strflocaltime({})] catch ["KO", .]
"2015-03-05T23:51:47Z"
[[2015,2,5,23,51,47,4,63],1425599507]
-[strptime("%FT%T")|(.,mktime)]
-"2025-06-07T08:09:10"
-[[2025,5,7,8,9,10,6,157],1749283750]
-
# Check day-of-week and day of year computations
# (should trip an assert if this fails)
last(range(365 * 67)|("1970-03-01T01:02:03Z"|strptime("%Y-%m-%dT%H:%M:%SZ")|mktime) + (86400 * .)|strftime("%Y-%m-%dT%H:%M:%SZ")|strptime("%Y-%m-%dT%H:%M:%SZ"))
--
2.49.0

View File

@@ -30,14 +30,15 @@ stdenv.mkDerivation (finalAttrs: {
"out"
];
# tortured syntax to avoid rebuilds
# needed because epoch conversion test here is right at the end of 32 bit integer space
# See also: https://github.com/jqlang/jq/blob/859a8073ee8a21f2133154eea7c2bd5e0d60837f/tests/optional.test#L15-L18
# "-D_TIME_BITS=64 -D_FILE_OFFSET_BITS=64" would be preferrable, but breaks with dynamic linking,
# unless done globally in stdenv for all of 32 bit.
${if stdenv.hostPlatform.is32bit then "patches" else null} = [
./disable-end-of-epoch-conversion-test.patch
];
patches =
[ ./musl.patch ]
++ lib.optionals stdenv.hostPlatform.is32bit [
# needed because epoch conversion test here is right at the end of 32 bit integer space
# See also: https://github.com/jqlang/jq/blob/859a8073ee8a21f2133154eea7c2bd5e0d60837f/tests/optional.test#L15-L18
# "-D_TIME_BITS=64 -D_FILE_OFFSET_BITS=64" would be preferrable, but breaks with dynamic linking,
# unless done globally in stdenv for all of 32 bit.
./disable-end-of-epoch-conversion-test.patch
];
# https://github.com/jqlang/jq/issues/2871
postPatch = lib.optionalString stdenv.hostPlatform.isFreeBSD ''