summary refs log tree commit diff
path: root/pkgs/development/libraries/libfaketime
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2021-08-04 10:43:07 +0000
committerAlyssa Ross <hi@alyssa.is>2021-08-04 10:43:07 +0000
commit62614cbef7da005c1eda8c9400160f6bcd6546b8 (patch)
treec2630f69080637987b68acb1ee8676d2681fe304 /pkgs/development/libraries/libfaketime
parentd9c82ed3044c72cecf01c6ea042489d30914577c (diff)
parente24069138dfec3ef94f211f1da005bb5395adc11 (diff)
downloadnixpkgs-62614cbef7da005c1eda8c9400160f6bcd6546b8.tar
nixpkgs-62614cbef7da005c1eda8c9400160f6bcd6546b8.tar.gz
nixpkgs-62614cbef7da005c1eda8c9400160f6bcd6546b8.tar.bz2
nixpkgs-62614cbef7da005c1eda8c9400160f6bcd6546b8.tar.lz
nixpkgs-62614cbef7da005c1eda8c9400160f6bcd6546b8.tar.xz
nixpkgs-62614cbef7da005c1eda8c9400160f6bcd6546b8.tar.zst
nixpkgs-62614cbef7da005c1eda8c9400160f6bcd6546b8.zip
Merge branch 'nixpkgs-update' into master
Diffstat (limited to 'pkgs/development/libraries/libfaketime')
-rw-r--r--pkgs/development/libraries/libfaketime/0001-Remove-unsupported-clang-flags.patch13
-rw-r--r--pkgs/development/libraries/libfaketime/default.nix18
-rw-r--r--pkgs/development/libraries/libfaketime/nix-store-date.patch29
3 files changed, 54 insertions, 6 deletions
diff --git a/pkgs/development/libraries/libfaketime/0001-Remove-unsupported-clang-flags.patch b/pkgs/development/libraries/libfaketime/0001-Remove-unsupported-clang-flags.patch
new file mode 100644
index 00000000000..7dfad497800
--- /dev/null
+++ b/pkgs/development/libraries/libfaketime/0001-Remove-unsupported-clang-flags.patch
@@ -0,0 +1,13 @@
+diff --git a/src/Makefile b/src/Makefile
+index 2af4804..bcff809 100644
+--- a/src/Makefile
++++ b/src/Makefile
+@@ -80,7 +80,7 @@ PREFIX ?= /usr/local
+ LIBDIRNAME ?= /lib/faketime
+ PLATFORM ?=$(shell uname)
+ 
+-CFLAGS += -std=gnu99 -Wall -Wextra -Werror -Wno-nonnull-compare -DFAKE_PTHREAD -DFAKE_STAT -DFAKE_UTIME -DFAKE_SLEEP -DFAKE_TIMERS -DFAKE_INTERNAL_CALLS -fPIC -DPREFIX='"'$(PREFIX)'"' -DLIBDIRNAME='"'$(LIBDIRNAME)'"' $(FAKETIME_COMPILE_CFLAGS)
++CFLAGS += -std=gnu99 -Wall -Wextra -DFAKE_PTHREAD -DFAKE_STAT -DFAKE_UTIME -DFAKE_SLEEP -DFAKE_TIMERS -DFAKE_INTERNAL_CALLS -fPIC -DPREFIX='"'$(PREFIX)'"' -DLIBDIRNAME='"'$(LIBDIRNAME)'"' $(FAKETIME_COMPILE_CFLAGS)
+ ifeq ($(PLATFORM),SunOS)
+ CFLAGS += -D__EXTENSIONS__ -D_XOPEN_SOURCE=600
+ endif
diff --git a/pkgs/development/libraries/libfaketime/default.nix b/pkgs/development/libraries/libfaketime/default.nix
index 10cc5cace7b..34c957715dd 100644
--- a/pkgs/development/libraries/libfaketime/default.nix
+++ b/pkgs/development/libraries/libfaketime/default.nix
@@ -1,17 +1,21 @@
-{ stdenv, fetchurl, perl }:
+{ lib, stdenv, fetchurl, perl, coreutils }:
 
 stdenv.mkDerivation rec {
   pname = "libfaketime";
-  version = "0.9.8";
+  version = "0.9.9";
 
   src = fetchurl {
     url = "https://github.com/wolfcw/libfaketime/archive/v${version}.tar.gz";
-    sha256 = "18s2hjm4sbrlg6sby944z87yslnq9s85p7j892hyr42qrlvq4a06";
+    sha256 = "sha256-V9AYEVA2HAqbXI7vBbETkvYTStosLZmOkuY9rtY5ZHw=";
   };
 
   patches = [
     ./no-date-in-gzip-man-page.patch
-  ];
+    ./nix-store-date.patch
+  ] ++ (lib.optionals stdenv.cc.isClang [
+    # https://github.com/wolfcw/libfaketime/issues/277
+    ./0001-Remove-unsupported-clang-flags.patch
+  ]);
 
   postPatch = ''
     patchShebangs test src
@@ -19,20 +23,22 @@ stdenv.mkDerivation rec {
       substituteInPlace $a \
         --replace /bin/bash ${stdenv.shell}
     done
+    substituteInPlace src/faketime.c --replace @DATE_CMD@ ${coreutils}/bin/date
   '';
 
   PREFIX = placeholder "out";
   LIBDIRNAME = "/lib";
 
-  NIX_CFLAGS_COMPILE = "-Wno-error=cast-function-type -Wno-error=format-truncation";
+  NIX_CFLAGS_COMPILE = lib.optionalString stdenv.cc.isClang "-Wno-error=cast-function-type -Wno-error=format-truncation";
 
   checkInputs = [ perl ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     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 ];
+    mainProgram = "faketime";
   };
 }
diff --git a/pkgs/development/libraries/libfaketime/nix-store-date.patch b/pkgs/development/libraries/libfaketime/nix-store-date.patch
new file mode 100644
index 00000000000..b88245dfe8f
--- /dev/null
+++ b/pkgs/development/libraries/libfaketime/nix-store-date.patch
@@ -0,0 +1,29 @@
+From abd7dd05b440e3dc9621a1579e4afb0267897d9c Mon Sep 17 00:00:00 2001
+From: Finn Behrens <me@kloenk.de>
+Date: Fri, 5 Mar 2021 21:58:57 +0100
+Subject: [PATCH] use nix date path
+
+---
+ src/faketime.c | 6 +-----
+ 1 file changed, 1 insertion(+), 5 deletions(-)
+
+diff --git a/src/faketime.c b/src/faketime.c
+index af618f2..48e47da 100644
+--- a/src/faketime.c
++++ b/src/faketime.c
+@@ -50,11 +50,7 @@
+ 
+ const char version[] = "0.9.9";
+ 
+-#ifdef __APPLE__
+-static const char *date_cmd = "gdate";
+-#else
+-static const char *date_cmd = "date";
+-#endif
++static const char *date_cmd = "@DATE_CMD@";
+ 
+ #define PATH_BUFSIZE 4096
+ 
+-- 
+2.24.3 (Apple Git-128)
+