diff options
Diffstat (limited to 'repo/gn')
| -rw-r--r-- | repo/gn/gn.xibuild | 26 | ||||
| -rw-r--r-- | repo/gn/python3.patch | 236 | 
2 files changed, 262 insertions, 0 deletions
| diff --git a/repo/gn/gn.xibuild b/repo/gn/gn.xibuild new file mode 100644 index 0000000..634b9d1 --- /dev/null +++ b/repo/gn/gn.xibuild @@ -0,0 +1,26 @@ +#!/bin/sh + +NAME="gn" +DESC="Meta-build system that generates build files for Ninja" + +MAKEDEPS="python" + +SOURCE="https://gn.googlesource.com/gn.git" + +ADDITIONAL=" +python3.patch +" + +build() { +	./build/gen.py +	ninja -C out +} + +check() { +	./out/gn_unittests +} + +package() { +	install -Dm755 out/gn "$PKG_DEST"/usr/bin/gn +} + diff --git a/repo/gn/python3.patch b/repo/gn/python3.patch new file mode 100644 index 0000000..891534d --- /dev/null +++ b/repo/gn/python3.patch @@ -0,0 +1,236 @@ +--- a/build/full_test.py ++++ b/build/full_test.py +@@ -1,4 +1,4 @@ +-#!/usr/bin/env python ++#!/usr/bin/env python3 + # Copyright 2018 The Chromium Authors. All rights reserved. + # Use of this source code is governed by a BSD-style license that can be + # found in the LICENSE file. +--- a/build/gen.py ++++ b/build/gen.py +@@ -1,4 +1,4 @@ +-#!/usr/bin/env python ++#!/usr/bin/env python3 + # Copyright 2014 The Chromium Authors. All rights reserved. + # Use of this source code is governed by a BSD-style license that can be + # found in the LICENSE file. +--- a/infra/recipes.py ++++ b/infra/recipes.py +@@ -1,4 +1,4 @@ +-#!/usr/bin/env python ++#!/usr/bin/env python3 +  + # Copyright 2017 The LUCI Authors. All rights reserved. + # Use of this source code is governed under the Apache License, Version 2.0 +--- a/misc/help_as_html.py ++++ b/misc/help_as_html.py +@@ -1,4 +1,4 @@ +-#!/usr/bin/env python ++#!/usr/bin/env python3 + # Copyright 2014 The Chromium Authors. All rights reserved. + # Use of this source code is governed by a BSD-style license that can be + # found in the LICENSE file. +--- a/src/gn/exec_process_unittest.cc ++++ b/src/gn/exec_process_unittest.cc +@@ -33,7 +33,7 @@ +   args.push_back(L"-c"); +   args.push_back(base::UTF8ToUTF16(command)); + #else +-  args.push_back("python"); ++  args.push_back("python3"); +   args.push_back("-c"); +   args.push_back(command); + #endif +--- a/src/gn/json_project_writer_unittest.cc ++++ b/src/gn/json_project_writer_unittest.cc +@@ -37,7 +37,7 @@ +       SubstitutionList::MakeForTest("//out/Debug/output1.out"); +  +   setup.build_settings()->set_python_path( +-      base::FilePath(FILE_PATH_LITERAL("/usr/bin/python"))); ++      base::FilePath(FILE_PATH_LITERAL("/usr/bin/python3"))); +   std::vector<const Target*> targets; +   targets.push_back(&target); + #if defined(OS_WIN) +@@ -172,7 +172,7 @@ +       SubstitutionList::MakeForTest("//out/Debug/{{source_name_part}}.out"); +  +   setup.build_settings()->set_python_path( +-      base::FilePath(FILE_PATH_LITERAL("/usr/bin/python"))); ++      base::FilePath(FILE_PATH_LITERAL("/usr/bin/python3"))); +   std::vector<const Target*> targets; +   targets.push_back(&target); + #if defined(OS_WIN) +--- a/src/gn/ninja_action_target_writer_unittest.cc ++++ b/src/gn/ninja_action_target_writer_unittest.cc +@@ -54,14 +54,14 @@ +   ASSERT_TRUE(target.OnResolved(&err)); +  +   setup.build_settings()->set_python_path( +-      base::FilePath(FILE_PATH_LITERAL("/usr/bin/python"))); ++      base::FilePath(FILE_PATH_LITERAL("/usr/bin/python3"))); +  +   std::ostringstream out; +   NinjaActionTargetWriter writer(&target, out); +   writer.Run(); +  +   const char* expected = R"(rule __foo_bar___rule +-  command = /usr/bin/python ../../foo/script.py ++  command = /usr/bin/python3 ../../foo/script.py +   description = ACTION //foo:bar() +   restat = 1 +  +@@ -96,7 +96,7 @@ +   ASSERT_TRUE(target.OnResolved(&err)); +  +   setup.build_settings()->set_python_path( +-      base::FilePath(FILE_PATH_LITERAL("/usr/bin/python"))); ++      base::FilePath(FILE_PATH_LITERAL("/usr/bin/python3"))); +  +   std::ostringstream out; +   NinjaActionTargetWriter writer(&target, out); +@@ -105,7 +105,7 @@ +   // The console pool's name must be mapped exactly to the string "console" +   // which is a special pre-defined pool name in ninja. +   const char* expected = R"(rule __foo_bar___rule +-  command = /usr/bin/python ../../foo/script.py ++  command = /usr/bin/python3 ../../foo/script.py +   description = ACTION //foo:bar() +   restat = 1 +  +@@ -138,7 +138,7 @@ +   ASSERT_TRUE(target.OnResolved(&err)); +  +   setup.build_settings()->set_python_path( +-      base::FilePath(FILE_PATH_LITERAL("/usr/bin/python"))); ++      base::FilePath(FILE_PATH_LITERAL("/usr/bin/python3"))); +  +   std::ostringstream out; +   NinjaActionTargetWriter writer(&target, out); +@@ -146,7 +146,7 @@ +  +   const char expected_linux[] = +       "rule __foo_bar___rule\n" +-      "  command = /usr/bin/python ../../foo/script.py\n" ++      "  command = /usr/bin/python3 ../../foo/script.py\n" +       "  description = ACTION //foo:bar()\n" +       "  restat = 1\n" +       "\n" +@@ -207,7 +207,7 @@ +   ASSERT_TRUE(target.OnResolved(&err)); +  +   setup.build_settings()->set_python_path( +-      base::FilePath(FILE_PATH_LITERAL("/usr/bin/python"))); ++      base::FilePath(FILE_PATH_LITERAL("/usr/bin/python3"))); +  +   std::ostringstream out; +   NinjaActionTargetWriter writer(&target, out); +@@ -215,7 +215,7 @@ +  +   const char expected_linux[] = +       "rule __foo_bar___rule\n" +-      "  command = /usr/bin/python ../../foo/script.py -i ${in} " ++      "  command = /usr/bin/python3 ../../foo/script.py -i ${in} " + // Escaping is different between Windows and Posix. + #if defined(OS_WIN) +       "\"--out=foo$ bar${source_name_part}.o\"\n" +@@ -273,7 +273,7 @@ +   target.config_values().inputs().push_back(SourceFile("//foo/included.txt")); +  +   setup.build_settings()->set_python_path( +-      base::FilePath(FILE_PATH_LITERAL("/usr/bin/python"))); ++      base::FilePath(FILE_PATH_LITERAL("/usr/bin/python3"))); +   setup.build_settings()->set_ninja_required_version(Version{1, 9, 0}); +  +   std::ostringstream out; +@@ -282,7 +282,7 @@ +  +   const char expected_linux[] = +       "rule __foo_bar___rule\n" +-      "  command = /usr/bin/python ../../foo/script.py -i ${in} " ++      "  command = /usr/bin/python3 ../../foo/script.py -i ${in} " + #if defined(OS_WIN) +       "\"--out=foo$ bar${source_name_part}.o\"\n" + #else +@@ -331,7 +331,7 @@ +       SubstitutionList::MakeForTest("//out/Debug/{{source_name_part}}.out"); +  +   setup.build_settings()->set_python_path( +-      base::FilePath(FILE_PATH_LITERAL("/usr/bin/python"))); ++      base::FilePath(FILE_PATH_LITERAL("/usr/bin/python3"))); +  +   std::ostringstream out; +   NinjaActionTargetWriter writer(&target, out); +@@ -344,7 +344,7 @@ +       // These come from rsp_file_contents above. +       "  rspfile_content = -j ${source_name_part}\n" +       // These come from the args. +-      "  command = /usr/bin/python ../../foo/script.py ${in} " ++      "  command = /usr/bin/python3 ../../foo/script.py ${in} " +       "${source_file_part} ${rspfile}\n" +       "  description = ACTION //foo:bar()\n" +       "  restat = 1\n" +@@ -389,7 +389,7 @@ +       SubstitutionList::MakeForTest("//out/Debug/{{source_name_part}}.out"); +  +   setup.build_settings()->set_python_path( +-      base::FilePath(FILE_PATH_LITERAL("/usr/bin/python"))); ++      base::FilePath(FILE_PATH_LITERAL("/usr/bin/python3"))); +  +   std::ostringstream out; +   NinjaActionTargetWriter writer(&target, out); +@@ -398,7 +398,7 @@ +   const char expected_linux[] = +       "rule __foo_bar___rule\n" +       // These come from the args. +-      "  command = /usr/bin/python ../../foo/script.py ${in} " ++      "  command = /usr/bin/python3 ../../foo/script.py ${in} " +       "${source_file_part}\n" +       "  description = ACTION //foo:bar()\n" +       "  restat = 1\n" +@@ -418,7 +418,7 @@ +   TestWithScope setup; +  +   setup.build_settings()->set_python_path( +-      base::FilePath(FILE_PATH_LITERAL("/usr/bin/python"))); ++      base::FilePath(FILE_PATH_LITERAL("/usr/bin/python3"))); +  +   Target dep(setup.settings(), Label(SourceDir("//foo/"), "dep")); +   dep.set_output_type(Target::ACTION); +@@ -445,7 +445,7 @@ +     const char expected_linux[] = +         "rule __foo_foo___rule\n" +         // These come from the args. +-        "  command = /usr/bin/python ../../foo/script.py\n" ++        "  command = /usr/bin/python3 ../../foo/script.py\n" +         "  description = ACTION //foo:foo()\n" +         "  restat = 1\n" +         "\n" +@@ -474,7 +474,7 @@ +     const char expected_linux[] = +         "rule __bar_bar___rule\n" +         // These come from the args. +-        "  command = /usr/bin/python ../../bar/script.py\n" ++        "  command = /usr/bin/python3 ../../bar/script.py\n" +         "  description = ACTION //bar:bar()\n" +         "  restat = 1\n" +         "\n" +--- a/src/gn/setup.cc ++++ b/src/gn/setup.cc +@@ -762,7 +762,7 @@ +     } +     build_settings_.set_python_path(python_path.NormalizePathSeparatorsTo('/')); + #else +-    build_settings_.set_python_path(base::FilePath("python")); ++    build_settings_.set_python_path(base::FilePath("python3")); + #endif +   } +   return true; +--- a/tools/find_unreachable.py ++++ b/tools/find_unreachable.py +@@ -1,4 +1,4 @@ +-#!/usr/bin/env python ++#!/usr/bin/env python3 + # Copyright 2020 The Chromium Authors. All rights reserved. + # Use of this source code is governed by a BSD-style license that can be + # found in the LICENSE file. | 
