blob: 1e9667b83fba5eeac1ae668a6d27d46e112711fb (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
|
{
lib,
stdenv,
fetchFromGitHub,
fetchpatch,
perl,
coreutils,
}:
let
hashes = {
"0.9.10" = "sha256-DYRuQmIhQu0CNEboBAtHOr/NnWxoXecuPMSR/UQ/VIQ=";
"0.9.11" = "sha256-a0TjHYzwbkRQyvr9Sj/DqjgLBnE1Z8kjsTQxTfGqLjE=";
};
in
stdenv.mkDerivation (finalAttrs: {
pname = "libfaketime";
# 0.9.10 break dict-db-wiktionary and quartus-prime-lite on linux,
# and 0.9.11 break everything on darwin
version = if stdenv.hostPlatform.isDarwin then "0.9.10" else "0.9.11";
src = fetchFromGitHub {
owner = "wolfcw";
repo = "libfaketime";
tag = "v${finalAttrs.version}";
hash = hashes.${finalAttrs.version};
};
outputs = [
"out"
"doc"
"man"
];
patches = [
./nix-store-date.patch
]
++ lib.optionals (!stdenv.hostPlatform.isDarwin) [
# GCC 16's unused variable analysis is more advanced than previous
# versions, and detects that these variables are unused.
# https://github.com/wolfcw/libfaketime/pull/528
(fetchpatch {
name = "libfaketime-silence-unused-variable-warning.patch";
url = "https://github.com/wolfcw/libfaketime/commit/712733e5f01e45372f3160cfdbcfd91520cb093d.patch";
hash = "sha256-Gu13gFhgvkncj8aowAnSRbHbUCctF5sakbX4uRwdy+A=";
})
]
++ lib.optionals stdenv.hostPlatform.isDarwin [
(fetchpatch {
name = "0001-libfaketime.c-wrap-timespec_get-in-TIME_UTC-macro.patch";
url = "https://github.com/wolfcw/libfaketime/commit/e0e6b79568d36a8fd2b3c41f7214769221182128.patch";
sha256 = "sha256-KwwP76v0DXNW73p/YBvwUOPdKMAcVdbQSKexD/uFOYo=";
})
(fetchpatch {
name = "LFS64.patch";
url = "https://github.com/wolfcw/libfaketime/commit/f32986867addc9d22b0fab29c1c927f079d44ac1.patch";
hash = "sha256-fIXuxxcV9J2IcgwcwSrMo4maObkH9WYv1DC/wdtbq/g=";
})
# https://github.com/wolfcw/libfaketime/issues/277
./0001-Remove-unsupported-clang-flags.patch
];
postPatch = ''
patchShebangs test src
substituteInPlace test/functests/test_exclude_mono.sh src/faketime.c \
--replace-fail /bin/bash ${stdenv.shell}
substituteInPlace src/faketime.c \
--replace-fail @DATE_CMD@ ${lib.getExe' coreutils "date"}
'';
env = {
PREFIX = placeholder "out";
LIBDIRNAME = "/lib";
CFLAGS = toString (
lib.optionals stdenv.cc.isClang [
"-Wno-error=cast-function-type"
"-Wno-error=format-truncation"
]
# https://github.com/wolfcw/libfaketime/blob/6714b98794a9e8a413bf90d2927abf5d888ada99/README#L101-L104
++ lib.optionals (stdenv.hostPlatform.isLoongArch64 || stdenv.hostPlatform.isRiscV64) [
"-DFORCE_PTHREAD_NONVER"
]
);
};
nativeCheckInputs = [ perl ];
doCheck = true;
__structuredAttrs = true;
strictDeps = true;
enableParallelBuilding = true;
meta = {
description = "Report faked system time to programs without having to change the system-wide time";
homepage = "https://github.com/wolfcw/libfaketime/";
license = lib.licenses.gpl2;
platforms = lib.platforms.all;
maintainers = [ lib.maintainers.bjornfor ];
mainProgram = "faketime";
};
})
|