about summary refs log tree commit diff
path: root/nixpkgs/pkgs/by-name/gp/gprename/package.nix
blob: 18591b735385a37886697565ad8a8d13748f2578 (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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
{
  lib,
  stdenv,
  fetchzip,
  makeWrapper,
  moreutils,
  perlPackages,
  gettext,
  glib,
  gtk3,
  gobject-introspection,
  pango,
  harfbuzz,
  gdk-pixbuf,
  at-spi2-atk,
}:
stdenv.mkDerivation (finalAttrs: {
  pname = "gprename";
  version = "20230429";

  src = fetchzip {
    url = "mirror://sourceforge/gprename/gprename-${finalAttrs.version}.zip";
    hash = "sha256-Du9OO2qeB1jUEJFcVYmLbJAGi2p/IVe3sqladq09AyY=";
  };

  nativeBuildInputs = [
    makeWrapper
    moreutils
  ];

  postPatch = ''
    grep -Ev 'desktop-file-install|update-desktop-database' Makefile | sponge Makefile

    substituteInPlace Makefile \
      --replace '/usr/share' '$(DESTDIR)/share'

    substituteInPlace bin/gprename \
      --replace '/usr/share' $out/share \
      --replace '/usr/local/share' $out/share
  '';

  makeFlags = [ "DESTDIR=$(out)" ];
  buildInputs = [
    perlPackages.perl
    pango
  ];
  postInstall = ''
    wrapProgram $out/bin/gprename \
      --set PERL5LIB ${
        perlPackages.makeFullPerlPath (
          with perlPackages; [
            Pango
            Glib
            Gtk3
            LocaleGettext
            libintl-perl
          ]
        )
      } \
      --prefix GI_TYPELIB_PATH : ${
        lib.makeSearchPath "/lib/girepository-1.0" [
          gtk3
          pango.out
          harfbuzz
          gdk-pixbuf
          at-spi2-atk
        ]
      }
  '';

  meta = {
    description = "Complete batch renamer for files and directories";
    homepage = "https://gprename.sourceforge.net/index.php";
    license = lib.licenses.gpl3Plus;
    mainProgram = "gprename";
    maintainers = with lib.maintainers; [ quantenzitrone ];
  };
})