Otok public index

apotocki/gn

apotocki/gn 2175 (r1, windows)

Library
gn
Variant
windows, target windows
Channel
stable
Published
2026-11-07
Recipe source
https://github.com/otok-dev/recipes.git
32756a87cf5bd189ca4c9825159bf0713ea8cf5e in recipes/gn/2175/windows/
Recipe SHA-256
90c7ab78d25db7e2757db4e45b439c866744ec2f4393ab17dc6509864402bf56

Recipe files changed

Inputs

source.commitb2afae122eeb6ce09c52d63f67dc53fc517dbdc8
source.githttps://gn.googlesource.com/gn

Platforms

windows

Toolchains

Recipe files

build.lua 1184 bytes · raw
-- build/gen.py writes out/build.ninja for the slice's compiler (cl and link from Visual Studio's environment),
-- ninja builds gn. The source has no .git, so gen.py cannot ask git for the commit position: the recipe writes it.
local position, commit = "2175", "b2afae122eeb"

function build(slice, options, deps)
    local out = slice.build .. "/out"
    otok.run({ slice.toolchains.python, "build/gen.py", "--no-last-commit-position", "--out-path", out, "--allow-warnings" },
        { cwd = slice.source })
    otok.write(out .. "/last_commit_position.h", "// Written by the otok recipe of GN, as build/gen.py would from git.\n\n"
        .. "#ifndef OUT_LAST_COMMIT_POSITION_H_\n#define OUT_LAST_COMMIT_POSITION_H_\n\n"
        .. "#define LAST_COMMIT_POSITION_NUM " .. position .. "\n"
        .. "#define LAST_COMMIT_POSITION \"" .. position .. " (" .. commit .. ")\"\n\n"
        .. "#endif  // OUT_LAST_COMMIT_POSITION_H_\n")
    local name = "gn.exe"
    otok.run({ slice.toolchains.ninja, "-C", out, name }, { cwd = slice.source })
    local program = slice.prefix .. "/bin/" .. name
    otok.copy(out .. "/" .. name, program)
    return { programs = { gn = program } }
end
patches/0001-escape-include-string.patch 425 bytes · raw
escape.h declares functions returning std::string without including <string>, which the standard library of
Visual Studio 2026 no longer brings in through <string_view>.

diff --git a/src/gn/escape.h b/src/gn/escape.h
index 57a723fe..f536517c 100644
--- a/src/gn/escape.h
+++ b/src/gn/escape.h
@@ -6,6 +6,7 @@
 #define TOOLS_GN_ESCAPE_H_
 
 #include <iosfwd>
+#include <string>
 #include <string_view>
 
 enum EscapingMode {
recipe.toml 1160 bytes · raw
# The otok recipe of GN (https://github.com/apotocki/otok): the gn program for the builds of other recipes, which name it
# as their toolchain (`gn = { default-recipe = "apotocki/gn" }`). GN has no releases; its version is the commit position
# (`git describe --match initial-commit`), which `gn --version` prints. 2175 is the GN Skia pins (bin/fetch-gn).
[recipe]
api = 1
library = "gn"
name = "gn"
version = "2175"
revision = 1
license = "BSD-3-Clause"
license-files = ["LICENSE"]
homepage = "https://gn.googlesource.com/gn"
description = "GN, the meta-build system that generates Ninja build files (Chromium, Skia)."
keywords = ["build", "tool"]

[tool]
programs = ["gn"]

[source]
git = "https://gn.googlesource.com/gn"
commit = "b2afae122eeb6ce09c52d63f67dc53fc517dbdc8"
# escape.h without <string>, which Visual Studio 2026 no longer includes through <string_view>
patches = ["patches/0001-escape-include-string.patch"]

[platforms]
supported = ["windows"]
build-on = ["windows/msvc", "windows/clang-cl"]

[toolchains]
python = { version = ">= 3.6", default-recipe = "apotocki/python" }
ninja = { version = ">= 1.10", default-recipe = "apotocki/ninja" }