1{ stdenv, fetchurl }:
2
3stdenv.mkDerivation rec {
4 name = "mmv-${version}";
5 version = "1.01b";
6
7 src = fetchurl {
8 url = "mirror://debian/pool/main/m/mmv/mmv_${version}.orig.tar.gz";
9 sha256 = "0399c027ea1e51fd607266c1e33573866d4db89f64a74be8b4a1d2d1ff1fdeef";
10 };
11
12 patches = [
13 # Use Debian patched version, as upstream is no longer maintained and it
14 # contains a _lot_ of fixes.
15 (fetchurl {
16 url = "mirror://debian/pool/main/m/mmv/mmv_${version}-15.diff.gz";
17 sha256 = "9ad3e3d47510f816b4a18bae04ea75913588eec92248182f85dd09bc5ad2df13";
18 })
19 ];
20
21 postPatch = ''
22 sed -i \
23 -e 's/^\s*LDFLAGS\s*=\s*-s\s*-N/LDFLAGS = -s/' \
24 -e "s|/usr/bin|$out/bin|" \
25 -e "s|/usr/man|$out/share/man|" \
26 Makefile
27 '';
28
29 preInstall = ''
30 mkdir -p "$out/bin" "$out/share/man/man1"
31 '';
32
33 postInstall = ''
34 for variant in mcp mad mln
35 do
36 ln -s mmv "$out/bin/$variant"
37 ln -s mmv.1 "$out/share/man/man1/$variant.1"
38 done
39 '';
40
41 meta = {
42 homepage = "http://linux.maruhn.com/sec/mmv.html";
43 description = "Utility for wildcard renaming, copying, etc";
44 license = stdenv.lib.licenses.gpl2;
45 };
46}