2023-02-16 17:41:37 +00:00
|
|
|
{ lib, stdenv, fetchFromGitHub, fetchpatch, perl, coreutils }:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "libfaketime";
|
2023-02-16 17:41:37 +00:00
|
|
|
version = "0.9.10";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-01-03 16:56:52 +00:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "wolfcw";
|
|
|
|
repo = "libfaketime";
|
|
|
|
rev = "v${version}";
|
2023-02-16 17:41:37 +00:00
|
|
|
sha256 = "sha256-DYRuQmIhQu0CNEboBAtHOr/NnWxoXecuPMSR/UQ/VIQ=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
patches = [
|
2021-03-09 03:18:52 +00:00
|
|
|
./nix-store-date.patch
|
2023-02-16 17:41:37 +00:00
|
|
|
(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=";
|
|
|
|
})
|
2021-02-05 17:12:51 +00:00
|
|
|
] ++ (lib.optionals stdenv.cc.isClang [
|
2020-11-30 08:33:03 +00:00
|
|
|
# https://github.com/wolfcw/libfaketime/issues/277
|
|
|
|
./0001-Remove-unsupported-clang-flags.patch
|
|
|
|
]);
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
postPatch = ''
|
|
|
|
patchShebangs test src
|
|
|
|
for a in test/functests/test_exclude_mono.sh src/faketime.c ; do
|
|
|
|
substituteInPlace $a \
|
|
|
|
--replace /bin/bash ${stdenv.shell}
|
|
|
|
done
|
2021-03-09 03:18:52 +00:00
|
|
|
substituteInPlace src/faketime.c --replace @DATE_CMD@ ${coreutils}/bin/date
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
PREFIX = placeholder "out";
|
|
|
|
LIBDIRNAME = "/lib";
|
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
NIX_CFLAGS_COMPILE = lib.optionalString stdenv.cc.isClang "-Wno-error=cast-function-type -Wno-error=format-truncation";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2023-02-02 18:25:31 +00:00
|
|
|
nativeCheckInputs = [ perl ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "Report faked system time to programs without having to change the system-wide time";
|
|
|
|
homepage = "https://github.com/wolfcw/libfaketime/";
|
|
|
|
license = licenses.gpl2;
|
|
|
|
platforms = platforms.all;
|
|
|
|
maintainers = [ maintainers.bjornfor ];
|
2021-05-03 20:48:10 +00:00
|
|
|
mainProgram = "faketime";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|