summary refs log tree commit diff
path: root/pkgs/tools/text/replace/default.nix
blob: a0873d1c8d2b791dc29bd2cc8a13d62029db9ba9 (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
{ lib, stdenv, fetchurl }:

stdenv.mkDerivation rec {
  pname = "replace";
  version = "2.24";

  src = fetchurl {
    url = "http://hpux.connect.org.uk/ftp/hpux/Users/replace-${version}/replace-${version}-src-11.31.tar.gz";
    sha256 = "18hkwhaz25s6209n5mpx9hmkyznlzygqj488p2l7nvp9zrlxb9sf";
  };

  outputs = [ "out" "man" ];

  makeFlags = [ "TREE=\$(out)" "MANTREE=\$(TREE)/share/man" ];

  preBuild = ''
    sed -e "s@/bin/mv@$(type -P mv)@" -i replace.h
  '';

  preInstall = "mkdir -p \$out/share/man";
  postInstall = "mv \$out/bin/replace \$out/bin/replace-literal";

  patches = [./malloc.patch];

  meta = {
    homepage = "https://replace.richardlloyd.org.uk/";
    description = "A tool to replace verbatim strings";
    platforms = lib.platforms.unix;
  };
}