about summary refs log tree commit diff
path: root/pkgs/tools/text/dirdiff
diff options
context:
space:
mode:
authorBryan Gardiner <bog@khumba.net>2020-10-10 19:21:20 -0700
committerBryan Gardiner <bog@khumba.net>2021-02-25 18:40:50 -0800
commitfabe4e78acf687ecdb91a936711a88a9811a842c (patch)
tree40e602dcd28a2ce256a544dc63656e2a3388fcdc /pkgs/tools/text/dirdiff
parent50dd350c4cdc007db52032fbff7c5bf13a11b8a9 (diff)
dirdiff: init at 2.1
Diffstat (limited to 'pkgs/tools/text/dirdiff')
-rw-r--r--pkgs/tools/text/dirdiff/default.nix59
-rw-r--r--pkgs/tools/text/dirdiff/dirdiff-2.1-vars.patch32
2 files changed, 91 insertions, 0 deletions
diff --git a/pkgs/tools/text/dirdiff/default.nix b/pkgs/tools/text/dirdiff/default.nix
new file mode 100644
index 0000000000000..b49df59b29e1e
--- /dev/null
+++ b/pkgs/tools/text/dirdiff/default.nix
@@ -0,0 +1,59 @@
+{ copyDesktopItems, fetchurl, lib, makeDesktopItem, stdenv, tcl, tk }:
+
+stdenv.mkDerivation rec {
+  pname = "dirdiff";
+  version = "2.1";
+
+  src = fetchurl {
+    url = "https://www.samba.org/ftp/paulus/${pname}-${version}.tar.gz";
+    sha256 = "0lljd8av68j70733yshzzhxjr1lm0vgmbqsm8f02g03qsma3cdyb";
+  };
+
+  nativeBuildInputs = [ copyDesktopItems ];
+  buildInputs = [ tcl tk ];
+
+  # Some light path patching.
+  patches = [ ./dirdiff-2.1-vars.patch ];
+  postPatch = ''
+    for file in dirdiff Makefile; do
+      substituteInPlace "$file" \
+          --subst-var out \
+          --subst-var-by tcl ${tcl} \
+          --subst-var-by tk ${tk}
+    done
+  '';
+
+  # If we don't create the directories ourselves, then 'make install' creates
+  # files named 'bin' and 'lib'.
+  preInstall = ''
+    mkdir -p $out/bin $out/lib
+  '';
+
+  installFlags = [
+    "BINDIR=${placeholder "out"}/bin"
+    "LIBDIR=${placeholder "out"}/lib"
+  ];
+
+  desktopItems = [
+    (makeDesktopItem {
+      name = "dirdiff";
+      exec = "dirdiff";
+      desktopName = "Dirdiff";
+      genericName = "Directory Diff Viewer";
+      comment = "Diff and merge directory trees";
+      categories = "Development;";
+    })
+  ];
+
+  meta = with lib; {
+    description = "Graphical directory tree diff and merge tool";
+    longDescription = ''
+      Dirdiff is a graphical tool for displaying the differences between
+      directory trees and for merging changes from one tree into another.
+    '';
+    homepage = "https://www.samba.org/ftp/paulus/";
+    license = licenses.gpl2Plus;
+    maintainers = with maintainers; [ khumba ];
+    platforms = platforms.linux;
+  };
+}
diff --git a/pkgs/tools/text/dirdiff/dirdiff-2.1-vars.patch b/pkgs/tools/text/dirdiff/dirdiff-2.1-vars.patch
new file mode 100644
index 0000000000000..4e7aa025754a4
--- /dev/null
+++ b/pkgs/tools/text/dirdiff/dirdiff-2.1-vars.patch
@@ -0,0 +1,32 @@
+diff '--color=auto' -ru dirdiff-2.1/dirdiff dirdiff-2.1-patched/dirdiff
+--- dirdiff-2.1/dirdiff	2005-04-20 03:09:53.000000000 -0700
++++ dirdiff-2.1-patched/dirdiff	2021-02-14 22:54:09.837692023 -0800
+@@ -1,6 +1,6 @@
+ #!/bin/sh
+ # Tcl ignores the next line \
+-exec wish "$0" -- "${1+$@}"
++exec @tk@/bin/wish "$0" -- "${1+$@}"
+ 
+ # Copyright (C) 1999-2004 Paul Mackerras.  All rights reserved.
+ # This program is free software; it may be used, copied, modified
+@@ -17,7 +17,7 @@
+ set TclExe [info nameofexecutable]
+ set compound_ok [expr {$tcl_version >= 8.4}]
+ 
+-set nofilecmp [catch {load libfilecmp.so.0.0}]
++set nofilecmp [catch {load @out@/lib/libfilecmp.so.0.0}]
+ set rcsflag {}
+ set diffbflag {}
+ set diffBflag {}
+diff '--color=auto' -ru dirdiff-2.1/Makefile dirdiff-2.1-patched/Makefile
+--- dirdiff-2.1/Makefile	2005-04-19 03:22:01.000000000 -0700
++++ dirdiff-2.1-patched/Makefile	2021-02-14 22:54:58.575400923 -0800
+@@ -7,7 +7,7 @@
+ INSTALL=install
+ 
+ # You may need to change the -I arguments depending on your system
+-CFLAGS=-O3 -I/usr/include/tcl8.3/ -I/usr/include/tcl
++CFLAGS=-O3 -I@tcl@/include
+ 
+ all:	libfilecmp.so.0.0
+