zig: build offline documentation

This commit is contained in:
Dmitry Bogatov 2023-03-04 22:24:16 -05:00
parent 2da8d6d95a
commit 1360d4cc51

View File

@ -11,6 +11,7 @@
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
pname = "zig"; pname = "zig";
version = "0.10.1"; version = "0.10.1";
outputs = [ "out" "doc" ];
src = fetchFromGitHub { src = fetchFromGitHub {
owner = "ziglang"; owner = "ziglang";
@ -52,7 +53,17 @@ stdenv.mkDerivation rec {
"-DZIG_TARGET_MCPU=baseline" "-DZIG_TARGET_MCPU=baseline"
]; ];
postBuild = ''
./zig2 build-exe ../doc/docgen.zig
./docgen ./zig2 ../doc/langref.html.in ./langref.html
'';
doCheck = true; doCheck = true;
postInstall = ''
install -Dm644 -t $doc/share/doc/$pname-$version/html ./langref.html
'';
installCheckPhase = '' installCheckPhase = ''
$out/bin/zig test --cache-dir "$TMPDIR" -I $src/test $src/test/behavior.zig $out/bin/zig test --cache-dir "$TMPDIR" -I $src/test $src/test/behavior.zig
''; '';