{ stdenv, fetchurl, unzip, python, asciidoc, re2c }:

stdenv.mkDerivation rec {
  name = "ninja-${version}";
  version = "1.2.0";

  src = fetchurl {
    name = "${name}.zip";
    url = "https://github.com/martine/ninja/archive/v${version}.zip";
    sha256 = "15ynh806ah37bqb57hcs3mj2g82900sncp6n3bssfggb4azgjlh3";
  };

  buildInputs = [ python asciidoc unzip re2c ];

  buildPhase = ''
    python bootstrap.py
    asciidoc doc/manual.asciidoc
  '';

  installPhase = ''
    mkdir -p $out/bin
    cp ninja $out/bin/

    mkdir -p $out/share/doc/ninja
    cp doc/manual.asciidoc $out/share/doc/ninja/
    cp doc/manual.html $out/share/doc/ninja/
  '';

  meta = with stdenv.lib; {
    description = "Small build system with a focus on speed";
    longDescription = ''
      Ninja is a small build system with a focus on speed. It differs from
      other build systems in two major respects: it is designed to have its
      input files generated by a higher-level build system, and it is designed
      to run builds as fast as possible.
    '';
    homepage = http://martine.github.io/ninja/;
    license = licenses.asl20;
    platforms = platforms.linux;
    maintainers = [maintainers.bjornfor];
  };
}

{ stdenv, fetchurl, python, asciidoc, re2c }:

stdenv.mkDerivation rec {
  name = "ninja-${version}";
  version = "1.3.4";

  src = fetchurl {
    name = "${name}.tar.gz";
    url = "https://github.com/martine/ninja/archive/v${version}.tar.gz";
    sha256 = "16b0dxq3v19qjchcmfqq3m4l8s4qx2d674vfvamg0s3vvfqnc477";
  };

  buildInputs = [ python asciidoc re2c ];

  buildPhase = ''
    python bootstrap.py
    asciidoc doc/manual.asciidoc
  '';

  installPhase = ''
    mkdir -p $out/bin
    cp ninja $out/bin/

    mkdir -p $out/share/doc/ninja
    cp doc/manual.asciidoc $out/share/doc/ninja/
    cp doc/manual.html $out/share/doc/ninja/
  '';

  meta = with stdenv.lib; {
    description = "Small build system with a focus on speed";
    longDescription = ''
      Ninja is a small build system with a focus on speed. It differs from
      other build systems in two major respects: it is designed to have its
      input files generated by a higher-level build system, and it is designed
      to run builds as fast as possible.
    '';
    homepage = http://martine.github.io/ninja/;
    license = licenses.asl20;
    platforms = platforms.linux;
    maintainers = [maintainers.bjornfor];
  };
}

Update to v1.3.4 and drop unzip dependency.
ninja: Update to v1.3.4 and drop unzip dependency.

Version 1.2.0 is way too old in order to build the latest chromium (29) version,
so let's get it up to date (especially because no other package is referencing
ninja, so it should be non-critical).

The dependency on unzip is not needed here, because GitHub also provides
archives in tar.gz format.

Signed-off-by: aszlig <ee1aa092358634f9c53f01b5a783726c9e21b35a@redmoonstudios.org>
