Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 #!/usr/bin/python | 1 #!/usr/bin/python |
| 2 | 2 |
| 3 # Copyright 2011 The Android Open Source Project | 3 # Copyright 2011 The Android Open Source Project |
| 4 # | 4 # |
| 5 # Use of this source code is governed by a BSD-style license that can be | 5 # Use of this source code is governed by a BSD-style license that can be |
| 6 # found in the LICENSE file. | 6 # found in the LICENSE file. |
| 7 | 7 |
| 8 # This script is a wrapper which invokes gyp with the correct --depth argument, | 8 # This script is a wrapper which invokes gyp with the correct --depth argument, |
| 9 # and supports the automatic regeneration of build files if all.gyp is | 9 # and supports the automatic regeneration of build files if all.gyp is |
| 10 # changed (Linux-only). | 10 # changed (Linux-only). |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 28 sys.path.insert(0, os.path.join(gyp_source_dir, 'pylib')) | 28 sys.path.insert(0, os.path.join(gyp_source_dir, 'pylib')) |
| 29 import gyp | 29 import gyp |
| 30 | 30 |
| 31 ENVVAR_GYP_GENERATORS = 'GYP_GENERATORS' | 31 ENVVAR_GYP_GENERATORS = 'GYP_GENERATORS' |
| 32 | 32 |
| 33 | 33 |
| 34 def additional_include_files(args=[]): | 34 def additional_include_files(args=[]): |
| 35 # Determine the include files specified on the command line. | 35 # Determine the include files specified on the command line. |
| 36 # This doesn't cover all the different option formats you can use, | 36 # This doesn't cover all the different option formats you can use, |
| 37 # but it's mainly intended to avoid duplicating flags on the automatic | 37 # but it's mainly intended to avoid duplicating flags on the automatic |
| 38 # makefile regeneration which only uses this format. | 38 # build files regeneration which only uses this format. |
|
epoger
2014/05/07 13:47:01
I would leave this line alone, because it is refer
tfarina
2014/05/07 14:41:10
Done.
| |
| 39 specified_includes = set() | 39 specified_includes = set() |
| 40 for arg in args: | 40 for arg in args: |
| 41 if arg.startswith('-I') and len(arg) > 2: | 41 if arg.startswith('-I') and len(arg) > 2: |
| 42 specified_includes.add(os.path.realpath(arg[2:])) | 42 specified_includes.add(os.path.realpath(arg[2:])) |
| 43 | 43 |
| 44 result = [] | 44 result = [] |
| 45 def AddInclude(path): | 45 def AddInclude(path): |
| 46 if os.path.realpath(path) not in specified_includes: | 46 if os.path.realpath(path) not in specified_includes: |
| 47 result.append(path) | 47 result.append(path) |
| 48 | 48 |
| 49 # Always include common.gypi. | 49 # Always include common.gypi. |
| 50 # We do this, rather than including common.gypi explicitly in all our gyp | 50 # We do this, rather than including common.gypi explicitly in all our gyp |
| 51 # files, so that gyp files we use but do not maintain (e.g., | 51 # files, so that gyp files we use but do not maintain (e.g., |
| 52 # third_party/externals/libjpeg/libjpeg.gyp) will include common.gypi too. | 52 # third_party/externals/libjpeg/libjpeg.gyp) will include common.gypi too. |
| 53 AddInclude(os.path.join(gyp_config_dir, 'common.gypi')) | 53 AddInclude(os.path.join(gyp_config_dir, 'common.gypi')) |
| 54 | 54 |
| 55 return result | 55 return result |
| 56 | 56 |
| 57 # Return the directory where all generated files (including Makefiles) are to | 57 # Return the directory where all the build files are to be written. |
| 58 # be written. | |
| 59 def get_output_dir(): | 58 def get_output_dir(): |
| 60 | |
| 61 # SKIA_OUT can be any directory either as a child of the standard out/ | 59 # SKIA_OUT can be any directory either as a child of the standard out/ |
| 62 # directory or any given location on the file system (e.g. /tmp/skia) | 60 # directory or any given location on the file system (e.g. /tmp/skia) |
| 63 output_dir = os.getenv('SKIA_OUT') | 61 output_dir = os.getenv('SKIA_OUT') |
| 64 | 62 |
| 65 if not output_dir: | 63 if not output_dir: |
| 66 return os.path.join(os.path.abspath(script_dir), 'out') | 64 return os.path.join(os.path.abspath(script_dir), 'out') |
| 67 | 65 |
| 68 if (sys.platform.startswith('darwin') and | 66 if (sys.platform.startswith('darwin') and |
| 69 (not os.getenv(ENVVAR_GYP_GENERATORS) or | 67 (not os.getenv(ENVVAR_GYP_GENERATORS) or |
| 70 'xcode' in os.getenv(ENVVAR_GYP_GENERATORS))): | 68 'xcode' in os.getenv(ENVVAR_GYP_GENERATORS))): |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 112 # If we didn't get a file, then fall back to assuming 'skia.gyp' from the | 110 # If we didn't get a file, then fall back to assuming 'skia.gyp' from the |
| 113 # same directory as the script. | 111 # same directory as the script. |
| 114 # The gypfile must be passed as a relative path, not an absolute path, | 112 # The gypfile must be passed as a relative path, not an absolute path, |
| 115 # or else the gyp code doesn't write into the proper output dir. | 113 # or else the gyp code doesn't write into the proper output dir. |
| 116 if not gyp_file_specified: | 114 if not gyp_file_specified: |
| 117 args.append('skia.gyp') | 115 args.append('skia.gyp') |
| 118 | 116 |
| 119 args.extend(['-I' + i for i in additional_include_files(args)]) | 117 args.extend(['-I' + i for i in additional_include_files(args)]) |
| 120 args.extend(['--depth', '.']) | 118 args.extend(['--depth', '.']) |
| 121 | 119 |
| 122 # Tell gyp to write the Makefiles into output_dir | 120 # Tell gyp to write the build files into output_dir. |
| 123 args.extend(['--generator-output', os.path.abspath(get_output_dir())]) | 121 args.extend(['--generator-output', os.path.abspath(get_output_dir())]) |
| 124 | 122 |
| 125 # Tell make to write its output into the same dir | 123 # Tell ninja to write its output into the same directory. |
| 126 args.extend(['-Goutput_dir=.']) | 124 args.extend(['-Goutput_dir=.']) |
| 127 | 125 |
| 128 # By default, we build 'most' instead of 'all' or 'everything'. See skia.gyp. | 126 # By default, we build 'most' instead of 'all' or 'everything'. See skia.gyp. |
| 129 args.extend(['-Gdefault_target=most']) | 127 args.extend(['-Gdefault_target=most']) |
| 130 | 128 |
| 131 print 'Updating projects from gyp files...' | 129 print 'Updating projects from gyp files...' |
| 132 sys.stdout.flush() | 130 sys.stdout.flush() |
| 133 | 131 |
| 134 # Off we go... | 132 # Off we go... |
| 135 sys.exit(gyp.main(args)) | 133 sys.exit(gyp.main(args)) |
| OLD | NEW |