summaryrefslogtreecommitdiffstats
path: root/pkgs/by-name/xx/xxdiff/package.nix
blob: 0d42c1cf02e868eaeb4bcc40736f5ea3dde40108 (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
{
  lib,
  stdenv,
  fetchFromGitHub,
  docutils,
  bison,
  flex,
  libsForQt5,
}:

stdenv.mkDerivation (finalAttrs: {
  pname = "xxdiff";
  version = "5.1-unstable-2025-03-21";

  src = fetchFromGitHub {
    owner = "blais";
    repo = "xxdiff";
    rev = "a5593c1c675fb79d0ec2b6e353abba1fb0179aa7";
    hash = "sha256-nRXvqhO128XsAFy4KrsrSYKpzWnciXGJV6QkuqRa07w=";
  };

  nativeBuildInputs = [
    bison
    docutils
    flex
    libsForQt5.qmake
    libsForQt5.wrapQtAppsHook
  ];

  buildInputs = [ libsForQt5.qtbase ];

  dontUseQmakeConfigure = true;

  # c++11 and above is needed for building with Qt 5.9+
  env.NIX_CFLAGS_COMPILE = toString [ "-std=c++14" ];

  sourceRoot = "${finalAttrs.src.name}/src";

  postPatch = ''
    substituteInPlace xxdiff.pro \
      --replace-fail "../bin" "./bin"
  '';

  preConfigure = ''
    make -f Makefile.bootstrap
  '';

  installPhase = ''
    runHook preInstall

    install -Dm555 -t $out/bin ./bin/xxdiff
    install -Dm444 -t $out/share/doc/xxdiff ${finalAttrs.src}/README.rst

    runHook postInstall
  '';

  meta = {
    description = "Graphical file and directories comparator and merge tool";
    mainProgram = "xxdiff";
    homepage = "http://furius.ca/xxdiff/";
    license = lib.licenses.gpl2Plus;
    maintainers = with lib.maintainers; [
      pSub
      raskin
    ];
    platforms = lib.platforms.linux;
  };
})