summary refs log tree commit diff
path: root/pkgs/tools/misc/mmv/default.nix
blob: 6129f15c734f1bf45b0fcdb027db7478a385601a (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
{ stdenv, fetchurl }:

stdenv.mkDerivation rec {
  pname = "mmv";
  version = "1.01b";

  src = fetchurl {
    url = "mirror://debian/pool/main/m/mmv/mmv_${version}.orig.tar.gz";
    sha256 = "0399c027ea1e51fd607266c1e33573866d4db89f64a74be8b4a1d2d1ff1fdeef";
  };

  hardeningDisable = [ "format" ];

  patches = [
    # Use Debian patched version, as upstream is no longer maintained and it
    # contains a _lot_ of fixes.
    (fetchurl {
      url = "mirror://debian/pool/main/m/mmv/mmv_${version}-15.diff.gz";
      sha256 = "9ad3e3d47510f816b4a18bae04ea75913588eec92248182f85dd09bc5ad2df13";
    })
  ];

  postPatch = ''
    sed -i \
      -e 's/^\s*LDFLAGS\s*=\s*-s\s*-N/LDFLAGS = -s/' \
      -e "s|/usr/bin|$out/bin|" \
      -e "s|/usr/man|$out/share/man|" \
      Makefile
  '';

  preInstall = ''
    mkdir -p "$out/bin" "$out/share/man/man1"
  '';

  postInstall = ''
    for variant in mcp mad mln
    do
      ln -s mmv "$out/bin/$variant"
      ln -s mmv.1 "$out/share/man/man1/$variant.1"
    done
  '';

  meta = {
    homepage = http://linux.maruhn.com/sec/mmv.html;
    description = "Utility for wildcard renaming, copying, etc";
    license = stdenv.lib.licenses.gpl2;
    platforms = stdenv.lib.platforms.linux;
  };
}