summaryrefslogtreecommitdiffstats
path: root/build/gyp_chromium
blob: 0d0d75ddd4ff3eeb78d7a6419c5a03cd080896c6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/usr/bin/python

# Copyright (c) 2009 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.

# This script is wrapper for Chromium that adds some support for how GYP
# is invoked by Chromium beyond what can be done in the gclient hooks.

import glob
import os
import shlex
import sys

script_dir = os.path.dirname(__file__)
chrome_src = os.path.normpath(os.path.join(script_dir, os.pardir))

sys.path.append(os.path.join(chrome_src, 'tools', 'gyp', 'pylib'))
import gyp

if __name__ == '__main__':
  args = sys.argv[1:]

  # If we didn't get a file, check an env var, and then fall back to
  # assuming 'all.gyp' from the same directory as the script.
  gyp_file = os.environ.get('CHROMIUM_GYP_FILE')
  if gyp_file:
    # Note that CHROMIUM_GYP_FILE values can't have backslashes as
    # path separators even on Windows due to the use of shlex.split().
    args.extend(shlex.split(gyp_file))
  else:
    args.append(os.path.join(script_dir, 'all.gyp'))

  # Always include common.gypi
  args += ['-I', os.path.join(script_dir, 'common.gypi')]

  # Optionally add supplemental .gypi files if present.
  supplements = glob.glob(os.path.join(chrome_src, '*', 'supplement.gypi'))
  for supplement in supplements:
    args += ['-I', supplement]

  print 'Updating projects from gyp files...'
  sys.stdout.flush()

  # Off we go...
  sys.exit(gyp.main(args))