1 # 2 # Copyright (C) 2013 Google Inc. All rights reserved. 3 # 4 # Redistribution and use in source and binary forms, with or without 5 # modification, are permitted provided that the following conditions are 6 # met: 7 # 8 # * Redistributions of source code must retain the above copyright 9 # notice, this list of conditions and the following disclaimer. 10 # * Redistributions in binary form must reproduce the above 11 # copyright notice, this list of conditions and the following disclaimer 12 # in the documentation and/or other materials provided with the 13 # distribution. 14 # * Neither the name of Google Inc. nor the names of its 15 # contributors may be used to endorse or promote products derived from 16 # this software without specific prior written permission. 17 # 18 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 # 30 31 { 32 'includes': [ 33 '../build/win/precompile.gypi', 34 '../core/core.gypi', 35 '../modules/modules.gypi', 36 'bindings.gypi', 37 ], 38 39 'variables': { 40 'deprecated_perl_idl_files': [ 41 '<@(deprecated_perl_core_idl_files)', 42 '<@(deprecated_perl_modules_idl_files)', 43 '<@(deprecated_perl_svg_idl_files)', 44 ], 45 'python_idl_files': [ 46 '<@(python_core_idl_files)', 47 '<@(python_modules_idl_files)', 48 '<@(python_svg_idl_files)', 49 ], 50 'perl_and_python_idl_files': [ 51 '<@(deprecated_perl_idl_files)', 52 '<@(python_idl_files)', 53 ], 54 'webcore_test_support_idl_files': [ 55 '<@(deprecated_perl_webcore_test_support_idl_files)', 56 '<@(python_webcore_test_support_idl_files)', 57 ], 58 'code_generator_template_files': [ 59 'templates/callback_interface.cpp', 60 'templates/callback_interface.h', 61 'templates/interface.cpp', 62 'templates/interface.h', 63 ], 64 65 'bindings_output_dir': '<(SHARED_INTERMEDIATE_DIR)/blink/bindings', 66 'generated_global_constructors_idl_files': [ 67 '<(SHARED_INTERMEDIATE_DIR)/blink/WindowConstructors.idl', 68 '<(SHARED_INTERMEDIATE_DIR)/blink/WorkerGlobalScopeConstructors.idl', 69 '<(SHARED_INTERMEDIATE_DIR)/blink/SharedWorkerGlobalScopeConstructors.idl', 70 '<(SHARED_INTERMEDIATE_DIR)/blink/DedicatedWorkerGlobalScopeConstructors.idl', 71 ], 72 73 'conditions': [ 74 ['OS=="win" and buildtype=="Official"', { 75 # On windows official release builds, we try to preserve symbol space. 76 'derived_sources_aggregate_files': [ 77 '<(bindings_output_dir)/V8DerivedSourcesAll.cpp', 78 ], 79 },{ 80 'derived_sources_aggregate_files': [ 81 '<(bindings_output_dir)/V8DerivedSources01.cpp', 82 '<(bindings_output_dir)/V8DerivedSources02.cpp', 83 '<(bindings_output_dir)/V8DerivedSources03.cpp', 84 '<(bindings_output_dir)/V8DerivedSources04.cpp', 85 '<(bindings_output_dir)/V8DerivedSources05.cpp', 86 '<(bindings_output_dir)/V8DerivedSources06.cpp', 87 '<(bindings_output_dir)/V8DerivedSources07.cpp', 88 '<(bindings_output_dir)/V8DerivedSources08.cpp', 89 '<(bindings_output_dir)/V8DerivedSources09.cpp', 90 '<(bindings_output_dir)/V8DerivedSources10.cpp', 91 '<(bindings_output_dir)/V8DerivedSources11.cpp', 92 '<(bindings_output_dir)/V8DerivedSources12.cpp', 93 '<(bindings_output_dir)/V8DerivedSources13.cpp', 94 '<(bindings_output_dir)/V8DerivedSources14.cpp', 95 '<(bindings_output_dir)/V8DerivedSources15.cpp', 96 '<(bindings_output_dir)/V8DerivedSources16.cpp', 97 '<(bindings_output_dir)/V8DerivedSources17.cpp', 98 '<(bindings_output_dir)/V8DerivedSources18.cpp', 99 '<(bindings_output_dir)/V8DerivedSources19.cpp', 100 ], 101 }], 102 # The bindings generator can not write generated files if they are identical 103 # to the already existing file that way they don't need to be recompiled. 104 # However, a reverse dependency having a newer timestamp than a 105 # generated binding can confuse some build systems, so only use this on 106 # ninja which explicitly supports this use case (gyp turns all actions into 107 # ninja restat rules). 108 ['"<(GENERATOR)"=="ninja"', { 109 'write_file_only_if_changed': '--write-file-only-if-changed 1', 110 },{ 111 'write_file_only_if_changed': '--write-file-only-if-changed 0', 112 }], 113 ], 114 }, 115 116 'target_defaults': { 117 'variables': { 118 'optimize': 'max', 119 }, 120 }, 121 122 'targets': [{ 123 'target_name': 'interface_dependencies', 124 'type': 'none', 125 'actions': [{ 126 'action_name': 'compute_interface_dependencies', 127 'variables': { 128 # Write sources into a file, so that the action command line won't 129 # exceed OS limits. 130 'idl_files_list': '<|(idl_files_list.tmp <@(perl_and_python_idl_files))', 131 }, 132 'inputs': [ 133 'scripts/compute_dependencies.py', 134 '<(idl_files_list)', 135 '<!@(cat <(idl_files_list))', 136 ], 137 'outputs': [ 138 '<(SHARED_INTERMEDIATE_DIR)/blink/InterfaceDependencies.txt', 139 '<@(generated_global_constructors_idl_files)', 140 '<(SHARED_INTERMEDIATE_DIR)/blink/EventInterfaces.in', 141 ], 142 'msvs_cygwin_shell': 0, 143 'action': [ 144 'python', 145 'scripts/compute_dependencies.py', 146 '--idl-files-list', 147 '<(idl_files_list)', 148 '--interface-dependencies-file', 149 '<(SHARED_INTERMEDIATE_DIR)/blink/InterfaceDependencies.txt', 150 '--window-constructors-file', 151 '<(SHARED_INTERMEDIATE_DIR)/blink/WindowConstructors.idl', 152 '--workerglobalscope-constructors-file', 153 '<(SHARED_INTERMEDIATE_DIR)/blink/WorkerGlobalScopeConstructors.idl', 154 '--sharedworkerglobalscope-constructors-file', 155 '<(SHARED_INTERMEDIATE_DIR)/blink/SharedWorkerGlobalScopeConstructors.idl', 156 '--dedicatedworkerglobalscope-constructors-file', 157 '<(SHARED_INTERMEDIATE_DIR)/blink/DedicatedWorkerGlobalScopeConstructors.idl', 158 '--event-names-file', 159 '<(SHARED_INTERMEDIATE_DIR)/blink/EventInterfaces.in', 160 '<@(write_file_only_if_changed)', 161 ], 162 'message': 'Resolving partial interfaces dependencies in all IDL files', 163 }] 164 }, 165 { 166 'target_name': 'deprecated_perl_bindings_sources', 167 'type': 'none', 168 # The 'binding' rule generates .h files, so mark as hard_dependency, per: 169 # https://code.google.com/p/gyp/wiki/InputFormatReference#Linking_Dependencies 170 'hard_dependency': 1, 171 'dependencies': [ 172 'interface_dependencies', 173 '../core/core_derived_sources.gyp:generate_test_support_idls', 174 ], 175 'sources': [ 176 '<@(deprecated_perl_idl_files)', 177 '<@(deprecated_perl_webcore_test_support_idl_files)', 178 ], 179 'rules': [{ 180 'rule_name': 'deprecated_perl_binding', 181 'extension': 'idl', 182 'msvs_external_rule': 1, 183 'inputs': [ 184 'scripts/deprecated_generate_bindings.pl', 185 'scripts/deprecated_code_generator_v8.pm', 186 'scripts/deprecated_idl_parser.pm', 187 'scripts/deprecated_idl_serializer.pm', 188 '../core/scripts/preprocessor.pm', 189 'scripts/IDLAttributes.txt', 190 # FIXME: If the dependency structure changes, we rebuild all files, 191 # since we're not computing dependencies file-by-file in the build. 192 '<(SHARED_INTERMEDIATE_DIR)/blink/InterfaceDependencies.txt', 193 # FIXME: Similarly, if any partial interface changes, rebuild 194 # everything, since every IDL potentially depends on them, because 195 # we're not computing dependencies file-by-file. 196 # 197 # If a new partial interface is added, need to regyp to update these 198 # dependencies, as these are computed statically at gyp runtime. 199 '<!@pymod_do_main(list_idl_files_with_partial_interface <@(perl_and_python_idl_files))', 200 # Generated IDLs are all partial interfaces, hence everything 201 # potentially depends on them. 202 '<@(generated_global_constructors_idl_files)', 203 ], 204 'outputs': [ 205 '<(bindings_output_dir)/V8<(RULE_INPUT_ROOT).cpp', 206 '<(bindings_output_dir)/V8<(RULE_INPUT_ROOT).h', 207 ], 208 'variables': { 209 # IDL include paths. The generator will search recursively for IDL 210 # files under these locations. 211 'generator_include_dirs': [ 212 '--include', '../core', 213 '--include', '../modules', 214 '--include', '<(SHARED_INTERMEDIATE_DIR)/blink', 215 ], 216 # Hook for embedders to specify extra directories to find IDL files. 217 'extra_blink_generator_include_dirs%': [], 218 }, 219 'msvs_cygwin_shell': 0, 220 # sanitize-win-build-log.sed uses a regex which matches this command 221 # line (Perl script + .idl file being processed). 222 # Update that regex if command line changes (other than changing flags) 223 'action': [ 224 '<(perl_exe)', 225 '-w', 226 '-Iscripts', 227 '-I../core/scripts', 228 '-I<(DEPTH)/third_party/JSON/out/lib/perl5', 229 'scripts/deprecated_generate_bindings.pl', 230 '--outputDir', 231 '<(bindings_output_dir)', 232 '--idlAttributesFile', 233 'scripts/IDLAttributes.txt', 234 '<@(generator_include_dirs)', 235 '<@(extra_blink_generator_include_dirs)', 236 '--interfaceDependenciesFile', 237 '<(SHARED_INTERMEDIATE_DIR)/blink/InterfaceDependencies.txt', 238 '--additionalIdlFiles', 239 '<(deprecated_perl_webcore_test_support_idl_files)', 240 '<@(preprocessor)', 241 '<@(write_file_only_if_changed)', 242 '<(RULE_INPUT_PATH)', 243 ], 244 'message': 'Generating binding from <(RULE_INPUT_PATH)', 245 }], 246 }, 247 { 248 'target_name': 'python_bindings_sources', 249 'type': 'none', 250 # The 'binding' rule generates .h files, so mark as hard_dependency, per: 251 # https://code.google.com/p/gyp/wiki/InputFormatReference#Linking_Dependencies 252 'hard_dependency': 1, 253 'dependencies': [ 254 'interface_dependencies', 255 '../core/core_derived_sources.gyp:generate_test_support_idls', 256 ], 257 'sources': [ 258 '<@(python_idl_files)', 259 '<@(python_webcore_test_support_idl_files)', 260 ], 261 'rules': [{ 262 'rule_name': 'python_binding', 263 'extension': 'idl', 264 'msvs_external_rule': 1, 265 'inputs': [ 266 'scripts/idl_compiler.py', 267 '<(DEPTH)/third_party/ply/lex.py', 268 '<(DEPTH)/third_party/ply/yacc.py', 269 '<(DEPTH)/tools/idl_parser/idl_lexer.py', 270 '<(DEPTH)/tools/idl_parser/idl_node.py', 271 '<(DEPTH)/tools/idl_parser/idl_parser.py', 272 'scripts/blink_idl_lexer.py', 273 'scripts/blink_idl_parser.py', 274 'scripts/code_generator_v8.py', 275 'scripts/idl_definitions.py', 276 'scripts/idl_definitions_builder.py', 277 'scripts/idl_reader.py', 278 'scripts/idl_validator.py', 279 'scripts/interface_dependency_resolver.py', 280 'scripts/IDLAttributes.txt', 281 '<@(code_generator_template_files)', 282 # FIXME: If the dependency structure changes, we rebuild all files, 283 # since we're not computing dependencies file-by-file in the build. 284 '<(SHARED_INTERMEDIATE_DIR)/blink/InterfaceDependencies.txt', 285 # FIXME: Similarly, if any partial interface changes, rebuild 286 # everything, since every IDL potentially depends on them, because 287 # we're not computing dependencies file-by-file. 288 '<!@pymod_do_main(list_idl_files_with_partial_interface <@(perl_and_python_idl_files))', 289 # Generated IDLs are all partial interfaces, hence everything 290 # potentially depends on them. 291 '<@(generated_global_constructors_idl_files)', 292 ], 293 'outputs': [ 294 '<(bindings_output_dir)/V8<(RULE_INPUT_ROOT).cpp', 295 '<(bindings_output_dir)/V8<(RULE_INPUT_ROOT).h', 296 ], 297 'variables': { 298 # IDL include paths. The generator will search recursively for IDL 299 # files under these locations. 300 'generator_include_dirs': [ 301 '--include', '../core', 302 '--include', '../modules', 303 '--include', '<(SHARED_INTERMEDIATE_DIR)/blink', 304 ], 305 # Hook for embedders to specify extra directories to find IDL files. 306 'extra_blink_generator_include_dirs%': [], 307 }, 308 'msvs_cygwin_shell': 0, 309 # sanitize-win-build-log.sed uses a regex which matches this command 310 # line (Python script + .idl file being processed). 311 # Update that regex if command line changes (other than changing flags) 312 'action': [ 313 'python', 314 'scripts/idl_compiler.py', 315 '--output-dir', 316 '<(bindings_output_dir)', 317 '--idl-attributes-file', 318 'scripts/IDLAttributes.txt', 319 '<@(generator_include_dirs)', 320 '<@(extra_blink_generator_include_dirs)', 321 '--interface-dependencies-file', 322 '<(SHARED_INTERMEDIATE_DIR)/blink/InterfaceDependencies.txt', 323 '--additional-idl-files', 324 '<(webcore_test_support_idl_files)', 325 '<@(write_file_only_if_changed)', 326 '<(RULE_INPUT_PATH)', 327 ], 328 'message': 'Generating binding from <(RULE_INPUT_PATH)', 329 }], 330 }, 331 { 332 'target_name': 'bindings_derived_sources', 333 'type': 'none', 334 'dependencies': [ 335 'interface_dependencies', 336 'deprecated_perl_bindings_sources', 337 'python_bindings_sources', 338 ], 339 'actions': [{ 340 'action_name': 'derived_sources_all_in_one', 341 'inputs': [ 342 '../core/scripts/action_derivedsourcesallinone.py', 343 '<(SHARED_INTERMEDIATE_DIR)/blink/InterfaceDependencies.txt', 344 ], 345 'outputs': [ 346 '<@(derived_sources_aggregate_files)', 347 ], 348 'action': [ 349 'python', 350 '../core/scripts/action_derivedsourcesallinone.py', 351 '<(SHARED_INTERMEDIATE_DIR)/blink/InterfaceDependencies.txt', 352 '--', 353 '<@(derived_sources_aggregate_files)', 354 ], 355 'message': 'Generating bindings derived sources', 356 }], 357 }, 358 ], 359 } 360