about summary refs log tree commit diff
path: root/pkgs/applications/version-management
diff options
context:
space:
mode:
authorAndrew Childs <lorne@cons.org.nz>2019-04-16 19:42:20 +0900
committerAndrew Childs <lorne@cons.org.nz>2019-04-20 18:34:07 +0900
commitc5c4d59ed6e1ec54b75595f2fee322a7be2d4feb (patch)
tree504d304fbbfdf175df5db745e19da515313fbb61 /pkgs/applications/version-management
parentf8564ae9749f789dec79f53d842d8c2b5d0b746e (diff)
downloadnixlib-c5c4d59ed6e1ec54b75595f2fee322a7be2d4feb.tar
nixlib-c5c4d59ed6e1ec54b75595f2fee322a7be2d4feb.tar.gz
nixlib-c5c4d59ed6e1ec54b75595f2fee322a7be2d4feb.tar.bz2
nixlib-c5c4d59ed6e1ec54b75595f2fee322a7be2d4feb.tar.lz
nixlib-c5c4d59ed6e1ec54b75595f2fee322a7be2d4feb.tar.xz
nixlib-c5c4d59ed6e1ec54b75595f2fee322a7be2d4feb.tar.zst
nixlib-c5c4d59ed6e1ec54b75595f2fee322a7be2d4feb.zip
rcs: fix darwin build
Diffstat (limited to 'pkgs/applications/version-management')
-rw-r--r--pkgs/applications/version-management/rcs/default.nix45
-rw-r--r--pkgs/applications/version-management/rcs/disable-t810.patch10
2 files changed, 53 insertions, 2 deletions
diff --git a/pkgs/applications/version-management/rcs/default.nix b/pkgs/applications/version-management/rcs/default.nix
index df1739aea572..862b9eacd628 100644
--- a/pkgs/applications/version-management/rcs/default.nix
+++ b/pkgs/applications/version-management/rcs/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, ed }:
+{ stdenv, fetchurl, fetchpatch, ed }:
 
 stdenv.mkDerivation rec {
   name = "rcs-5.9.4";
@@ -10,10 +10,51 @@ stdenv.mkDerivation rec {
 
   buildInputs = [ ed ];
 
+  patches = stdenv.lib.optionals stdenv.isDarwin [
+    # This failure appears unrelated to the subject of the test. This
+    # test seems to rely on a bash bug where `test $x -nt $y` ignores
+    # subsecond values in timetamps. This bug has been fixed in Bash
+    # 5, and seemingly doesn't affect Darwin.
+    ./disable-t810.patch
+
+    (fetchpatch {
+      url = "https://raw.githubusercontent.com/macports/macports-ports/b76d1e48dac/editors/nano/files/secure_snprintf.patch";
+      extraPrefix = "";
+      sha256 = "1wy9pjw3vvp8fv8a7pmkqmiapgacfx54qj9fvsc5gwry0vv7vnc3";
+    })
+
+    # Expected to appear in the next release
+    (fetchpatch {
+      url = "https://raw.githubusercontent.com/Homebrew/formula-patches/3fff7c990b8df4174045834b9c1210e7736ff5a4/rcs/noreturn.patch";
+      sha256 = "10zniqrd6xagf3q03i1vksl0vd9nla3qcj0840n3m8z6jd4aypcx";
+    })
+  ];
+
   doCheck = true;
 
+  checkFlags = [ "VERBOSE=1" ];
+
+  checkPhase = ''
+    # If neither LOGNAME or USER are set, rcs will default to
+    # getlogin(), which is unreliable on macOS. It will often return
+    # things like `_spotlight`, or `_mbsetupuser`. macOS sets both
+    # environment variables in user sessions, so this is unlikely to
+    # affect regular usage.
+
+    export LOGNAME=$(id -un)
+
+    print_logs_and_fail() {
+      grep -nH -e . -r tests/*.d/{out,err}
+      return 1
+    }
+
+    make $checkFlags check || print_logs_and_fail
+  '';
+
   NIX_CFLAGS_COMPILE = [ "-std=c99" ];
 
+  hardeningDisable = stdenv.lib.optional stdenv.cc.isClang "format";
+
   meta = {
     homepage = https://www.gnu.org/software/rcs/;
     description = "Revision control system";
@@ -27,6 +68,6 @@ stdenv.mkDerivation rec {
 
     license = stdenv.lib.licenses.gpl3Plus;
     maintainers = with stdenv.lib.maintainers; [ eelco ];
-    platforms = stdenv.lib.platforms.linux;
+    platforms = stdenv.lib.platforms.unix;
   };
 }
diff --git a/pkgs/applications/version-management/rcs/disable-t810.patch b/pkgs/applications/version-management/rcs/disable-t810.patch
new file mode 100644
index 000000000000..745f1868a369
--- /dev/null
+++ b/pkgs/applications/version-management/rcs/disable-t810.patch
@@ -0,0 +1,10 @@
+--- rcs-5.9.4-orig/tests/Makefile.in	2015-01-22 19:40:36.000000000 +0900
++++ rcs-5.9.4/tests/Makefile.in	2019-04-16 20:04:30.557626000 +0900
+@@ -1372,7 +1372,6 @@
+  t803 \
+  t804 \
+  t805 \
+- t810 \
+  t900 \
+  t999
+