about summary refs log tree commit diff
path: root/pkgs/tools/typesetting/pdfchain/default.nix
blob: 6d772a6fea20adf339a7080df2cb3d1704af771a (plain) (blame)
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
{ lib, stdenv, fetchurl, fetchDebianPatch
, autoconf, gtkmm3, glib, pdftk, pkg-config, wrapGAppsHook
}:

stdenv.mkDerivation rec {
  pname = "pdfchain";
  version = "0.4.4.2";

  src = fetchurl {
    url = "mirror://sourceforge/${pname}/${pname}-${version}/${pname}-${version}.tar.gz";
    hash = "sha256-Hu4Pk9voyc75+f5OwKEOCkXKjN5nzWzv+izmyEN1Lz0=";
  };

  nativeBuildInputs = [
    pkg-config wrapGAppsHook autoconf
  ];

  buildInputs = [
    gtkmm3 pdftk glib
  ];

  patches = let
    fetchDebianPatch' = args: fetchDebianPatch ({
      inherit pname;
      version = "1:0.4.4.2";
      debianRevision = "2";
    } // args);
  in
  [
    (fetchDebianPatch' {
      patch = "fix_crash_on_startup";
      hash = "sha256-1UyMHHGrmUIFhY53ILdMMsyocSIbcV6CKQ7sLVNhNQw=";
    })
    (fetchDebianPatch' {
      patch = "fix_desktop_file";
      hash = "sha256-L6lhUs7GqVN1XOQO6bbz6BT29n4upsJtlHCAIGzk1Bw=";
    })
    (fetchDebianPatch' {
      patch = "fix_spelling";
      hash = "sha256-sOUUslPfcOo2K3zuaLcux+CNdgfWM0phsfe6g4GUFes=";
    })
  ];

  postPatch = ''
    substituteInPlace src/constant.h \
        --replace '"pdftk"' '"${pdftk}/bin/pdftk"' \
        --replace "/usr/share" "$out/share"
  '';

  meta = with lib; {
    description = "A graphical user interface for the PDF Toolkit (PDFtk)";
    homepage = "https://pdfchain.sourceforge.io";
    license = licenses.gpl3Plus;
    maintainers = with maintainers; [ hqurve ];
    platforms = platforms.unix;
    mainProgram = "pdfchain";
  };
}