14 , ninjaRelease ? "latest"
17 stdenv.mkDerivation (finalAttrs: {
19 version = lib.removePrefix "v" finalAttrs.src.rev;
22 # TODO: Remove Ninja 1.11 as soon as possible.
23 "1.11" = fetchFromGitHub {
24 owner = "ninja-build";
27 hash = "sha256-LvV/Fi2ARXBkfyA1paCRmLUwCh/rTyz+tGMg2/qEepI=";
30 latest = fetchFromGitHub {
31 owner = "ninja-build";
34 hash = "sha256-RT5u+TDvWxG5EVQEYj931EZyrHUSAqK73OKDAascAwA=";
36 }.${ninjaRelease} or (throw "Unsupported Ninja release: ${ninjaRelease}");
38 depsBuildBuild = [ buildPackages.stdenv.cc ];
45 ++ lib.optionals buildDocs [
53 # write rebuild args to file after bootstrap
54 substituteInPlace configure.py --replace "subprocess.check_call(rebuild_args)" "open('rebuild_args','w').write(rebuild_args[0])"
60 # for list of env vars
61 # see https://github.com/ninja-build/ninja/blob/v1.11.1/configure.py#L264
62 CXX="$CXX_FOR_BUILD" \
64 CFLAGS="$CFLAGS_FOR_BUILD" \
65 CXXFLAGS="$CXXFLAGS_FOR_BUILD" \
66 LDFLAGS="$LDFLAGS_FOR_BUILD" \
67 python configure.py --bootstrap
71 '' + lib.optionalString buildDocs ''
72 # "./ninja -vn manual" output copied here to support cross compilation.
73 asciidoc -b docbook -d book -o build/manual.xml doc/manual.asciidoc
74 xsltproc --nonet doc/docbook.xsl build/manual.xml > doc/manual.html
83 install -Dm555 -t $out/bin ninja
84 installShellCompletion --name ninja \
85 --bash misc/bash-completion \
86 --zsh misc/zsh-completion
87 '' + lib.optionalString buildDocs ''
88 install -Dm444 -t $out/share/doc/ninja doc/manual.asciidoc doc/manual.html
94 setupHook = ./setup-hook.sh;
96 passthru.updateScript = nix-update-script {};
99 description = "Small build system with a focus on speed";
100 mainProgram = "ninja";
102 Ninja is a small build system with a focus on speed. It differs from
103 other build systems in two major respects: it is designed to have its
104 input files generated by a higher-level build system, and it is designed
105 to run builds as fast as possible.
107 homepage = "https://ninja-build.org/";
108 license = lib.licenses.asl20;
109 platforms = lib.platforms.unix;
110 maintainers = with lib.maintainers; [ thoughtpolice bjornfor orivej ];