b8dd3bd2e951c528714102760a4e993e35a27e97
[AGL/meta-agl-demo.git] / recipes-wam / cef / files / cef / 0003-Add-an-option-to-use-an-alternative-base-output-dire.patch
1 From 33aa8b58d5c5d189dcd51d465f1d9d39c740146e Mon Sep 17 00:00:00 2001
2 From: Roger Zanoni <rzanoni@igalia.com>
3 Date: Thu, 30 Mar 2023 15:22:32 +0200
4 Subject: [PATCH 03/10] Add an option to use an alternative base output
5  directory
6
7 ---
8  tools/gclient_hook.py | 19 +++++++++++++++++--
9  1 file changed, 17 insertions(+), 2 deletions(-)
10
11 diff --git a/tools/gclient_hook.py b/tools/gclient_hook.py
12 index 290487433..4e5f9f687 100644
13 --- a/tools/gclient_hook.py
14 +++ b/tools/gclient_hook.py
15 @@ -6,12 +6,23 @@
16  from __future__ import absolute_import
17  from __future__ import print_function
18  from file_util import make_dir, write_file
19 +from optparse import OptionParser
20  from gclient_util import *
21  from gn_args import GetAllPlatformConfigs, GetConfigFileContents
22  import issue_1999
23  import os
24  import sys
25  
26 +parser = OptionParser()
27 +
28 +parser.add_option(
29 +    '--base-out-path',
30 +    dest='baseoutpath',
31 +    default='',
32 +    help="Use an anternative base path for the generated gn outputs instead of using chromium source dir")
33 +
34 +(options, args) = parser.parse_args()
35 +
36  # The CEF directory is the parent directory of _this_ script.
37  cef_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir))
38  # The src directory is the parent directory of the CEF directory.
39 @@ -133,14 +144,18 @@ if platform == 'windows':
40  configs = GetAllPlatformConfigs(gn_args)
41  for dir, config in configs.items():
42    # Create out directories and write the args.gn file.
43 -  out_path = os.path.join(src_dir, 'out', dir)
44 +  base_out_dir = src_dir
45 +  if options.baseoutpath != '':
46 +    base_out_dir = options.baseoutpath
47 +  out_path = os.path.join(base_out_dir, 'out', dir)
48    make_dir(out_path, False)
49    args_gn_path = os.path.join(out_path, 'args.gn')
50    args_gn_contents = GetConfigFileContents(config)
51    write_file(args_gn_path, args_gn_contents)
52  
53    # Generate the Ninja config.
54 -  cmd = ['gn', 'gen', os.path.join('out', dir)]
55 +  cmd = ['gn', 'gen', os.path.join('out', out_path)]
56 +
57    if 'GN_ARGUMENTS' in os.environ.keys():
58      cmd.extend(os.environ['GN_ARGUMENTS'].split(' '))
59    RunAction(src_dir, cmd)
60 -- 
61 2.39.2
62