def main(args): if 'GYP_GENERATORS' not in os.environ: os.environ['GYP_GENERATORS'] = 'ninja' crashpad_dir_or_dot = crashpad_dir if crashpad_dir is not '' else '.' args.extend(['-D', 'crashpad_standalone=1']) args.extend(['--include', os.path.join(crashpad_dir, 'third_party', 'mini_chromium', 'mini_chromium', 'build', 'common.gypi')]) args.extend(['--depth', crashpad_dir_or_dot]) args.append(os.path.join(crashpad_dir, 'crashpad.gyp')) result = gyp.main(args) if result != 0: return result if sys.platform == 'win32': # Also generate the x86 build. result = gyp.main(args + ['-D', 'target_arch=ia32', '-G', 'config=Debug']) if result != 0: return result result = gyp.main(args + ['-D', 'target_arch=ia32', '-G', 'config=Release']) return result
def main(args): if 'GYP_GENERATORS' not in os.environ: os.environ['GYP_GENERATORS'] = 'ninja' crashpad_dir_or_dot = crashpad_dir if crashpad_dir is not '' else os.curdir (dependencies, mini_chromium_dir) = (ChooseDependencyPath( os.path.join(crashpad_dir, 'third_party', 'mini_chromium', 'mini_chromium', 'build', 'common.gypi'), os.path.join(crashpad_dir, os.pardir, os.pardir, 'mini_chromium', 'mini_chromium', 'build', 'common.gypi'))) if dependencies is not None: args.extend(['-D', 'crashpad_dependencies=%s' % dependencies]) args.extend(['--include', mini_chromium_dir]) args.extend(['--depth', crashpad_dir_or_dot]) args.append(os.path.join(crashpad_dir, 'crashpad.gyp')) result = gyp.main(args) if result != 0: return result if sys.platform == 'win32': # Also generate the x86 build. result = gyp.main(args + ['-D', 'target_arch=ia32', '-G', 'config=Debug']) if result != 0: return result result = gyp.main(args + ['-D', 'target_arch=ia32', '-G', 'config=Release']) return result
def run_gyp(args): # GYP bug. # On msvs it will crash if it gets an absolute path. # On Mac/make it will crash if it doesn't get an absolute path. a_path = node_root if sys.platform == 'win32' else os.path.abspath( node_root) args.append(os.path.join(a_path, 'node.gyp')) common_fn = os.path.join(a_path, 'common.gypi') options_fn = os.path.join(a_path, 'config.gypi') if os.path.exists(common_fn): args.extend(['-I', common_fn]) if os.path.exists(options_fn): args.extend(['-I', options_fn]) args.append('--depth=' + node_root) # There's a bug with windows which doesn't allow this feature. if sys.platform != 'win32' and 'ninja' not in args: # Tell gyp to write the Makefiles into output_dir args.extend(['--generator-output', output_dir]) # Tell make to write its output into the same dir args.extend(['-Goutput_dir=' + output_dir]) args.append('-Dcomponent=static_library') args.append('-Dlibrary=static_library') rc = gyp.main(args) if rc != 0: print('Error running GYP') sys.exit(rc)
def process(args): gyp_args = ['--depth=.', '--generator-output=%s' % PATH_FLIP_PROJECTS] if args.ninja: gyp_args += ['--format', 'ninja'] os.environ.update({'CC': 'clang', 'CXX': 'clang++'}) return gyp.main(gyp_args + ['flip.gyp'])
def run_gyp(args): """ Executes gyp """ rc = gyp.main(args) if rc != 0: print 'Error running GYP' sys.exit(rc)
def run_gyp( args ): """ Executes gyp """ rc = gyp.main( args ) if rc != 0: print 'Error running GYP' sys.exit( rc )
def main(): gyp_environment.SetEnvironment() print 'Updating projects from gyp files...' sys.stdout.flush() sys.exit( gyp.main( sys.argv[1:] + ['--check', '--no-circular-check', '-D', 'gyp_output_dir=out']))
def main(args): if 'GYP_GENERATORS' not in os.environ: os.environ['GYP_GENERATORS'] = 'ninja' crashpad_dir_or_dot = crashpad_dir if crashpad_dir is not '' else os.curdir (dependencies, mini_chromium_common_gypi) = (ChooseDependencyPath( os.path.join(crashpad_dir, 'third_party', 'mini_chromium', 'mini_chromium', 'build', 'common.gypi'), os.path.join(crashpad_dir, os.pardir, os.pardir, 'mini_chromium', 'mini_chromium', 'build', 'common.gypi'))) if dependencies is not None: args.extend(['-D', 'crashpad_dependencies=%s' % dependencies]) args.extend(['--include', mini_chromium_common_gypi]) args.extend(['--depth', crashpad_dir_or_dot]) args.append(os.path.join(crashpad_dir, 'crashpad.gyp')) result = gyp.main(args) if result != 0: return result if sys.platform == 'win32': # Check to make sure that no target_arch was specified. target_arch may # be set during a cross build, such as a cross build for Android. has_target_arch = False for arg_index in range(0, len(args)): arg = args[arg_index] if (arg.startswith('-Dtarget_arch=') or (arg == '-D' and arg_index + 1 < len(args) and args[arg_index + 1].startswith('target_arch='))): has_target_arch = True break if not has_target_arch: # Also generate the x86 build. result = gyp.main(args + ['-D', 'target_arch=ia32', '-G', 'config=Debug']) if result != 0: return result result = gyp.main( args + ['-D', 'target_arch=ia32', '-G', 'config=Release']) return result
def main(): gyp_environment.SetEnvironment() print 'Updating projects from gyp files...' sys.stdout.flush() sys.exit(gyp.main(sys.argv[1:] + [ '--check', '--no-circular-check', '-I', os.path.join(script_dir, 'common.gypi'), '-D', 'gyp_output_dir=out']))
def main(args): if 'GYP_GENERATORS' not in os.environ: os.environ['GYP_GENERATORS'] = 'ninja' crashpad_dir_or_dot = crashpad_dir if crashpad_dir is not '' else os.curdir (dependencies, mini_chromium_common_gypi) = (ChooseDependencyPath( os.path.join(crashpad_dir, 'third_party', 'mini_chromium', 'mini_chromium', 'build', 'common.gypi'), os.path.join(crashpad_dir, os.pardir, os.pardir, 'mini_chromium', 'mini_chromium', 'build', 'common.gypi'))) if dependencies is not None: args.extend(['-D', 'crashpad_dependencies=%s' % dependencies]) args.extend(['--include', mini_chromium_common_gypi]) args.extend(['--depth', crashpad_dir_or_dot]) args.append(os.path.join(crashpad_dir, 'crashpad.gyp')) result = gyp.main(args) if result != 0: return result if sys.platform == 'win32': # Check to make sure that no target_arch was specified. target_arch may be # set during a cross build, such as a cross build for Android. has_target_arch = False for arg_index in xrange(0, len(args)): arg = args[arg_index] if (arg.startswith('-Dtarget_arch=') or (arg == '-D' and arg_index + 1 < len(args) and args[arg_index + 1].startswith('target_arch='))): has_target_arch = True break if not has_target_arch: # Also generate the x86 build. result = gyp.main(args + ['-D', 'target_arch=ia32', '-G', 'config=Debug']) if result != 0: return result result = gyp.main( args + ['-D', 'target_arch=ia32', '-G', 'config=Release']) return result
def process (args): gyp_args = [ '--depth=.', '--generator-output=%s' % PATH_FLIP_PROJECTS ] if args.ninja: gyp_args += ['--format', 'ninja'] os.environ.update({'CC': 'clang', 'CXX': 'clang++'}) return gyp.main (gyp_args + ['flip.gyp'])
def build_dcfpe(): os.environ['GYP_GENERATORS'] = 'ninja' os.environ['GYP_MSVS_VERSION'] = '2013' prepare_path() # base.gyp depends on this directory sys.path.insert( 1, os.path.join(ENV_SOLUTION_DIRECTORY, 'third_party/chromium/build')) import gyp print 'build dcfpe' print 'Generators=' + os.environ['GYP_GENERATORS'] print 'MSVSVersion=' + os.environ['GYP_MSVS_VERSION'] print 'Component=' + os.environ['ENV_COMPONENT'] args = [] args.append('build/dcfpe.gyp') args.append('--depth=.') args.append('--no-circular-check') args.extend(['-G', 'output_dir=' + os.environ['ENV_BUILD_DIR']]) args.extend(['-D', 'component=' + os.environ.get('ENV_COMPONENT')]) args.extend(['-D', 'build_dir=' + os.environ.get('ENV_BUILD_DIR')]) # do not use common.gypi, because it conflicts with third_party\chromium\build\common.gypi # the above comment does not take effect since 6a9af727adc6 on Sat Oct 25 20:35:48 2014 # When revert the changes to common.gypi in chromium # I keep this comment here to emphasize that we can add a default gypi file here args.append('-I' + os.path.join(ENV_SOLUTION_DIRECTORY, 'build/common.gypi')) ret = gyp.main(args) dest_dir = os.path.join(ENV_SOLUTION_DIRECTORY, os.environ.get('ENV_BUILD_DIR')) for sfx in ["", "_x64"]: debug_dir = os.path.join(dest_dir, 'Debug' + sfx) release_dir = os.path.join(dest_dir, 'Release' + sfx) if not os.path.exists(debug_dir): os.makedirs(debug_dir) if not os.path.exists(release_dir): os.makedirs(release_dir) # copy crt src_dir = os.path.join(ENV_SOLUTION_DIRECTORY, 'third_party/vc/crt' + sfx) copy_file_if_necessary(os.path.join(src_dir, 'msvcr120d.dll'), os.path.join(debug_dir, 'msvcr120d.dll')) copy_file_if_necessary(os.path.join(src_dir, 'msvcp120d.dll'), os.path.join(debug_dir, 'msvcp120d.dll')) copy_file_if_necessary(os.path.join(src_dir, 'msvcr120.dll'), os.path.join(release_dir, 'msvcr120.dll')) copy_file_if_necessary(os.path.join(src_dir, 'msvcp120.dll'), os.path.join(release_dir, 'msvcp120.dll')) return ret
def execGyp(args): print "Running gyp with this environment:" print " GYP_GENERATORS = '" + os.environ['GYP_GENERATORS'] + "'" if 'GYP_MSVS_VERSION' in os.environ: print " GYP_MSVS_VERSION = '" + os.environ['GYP_MSVS_VERSION'] + "'" if 'GYP_GENERATOR_FLAGS' in os.environ: print " GYP_GENERATOR_FLAGS = '" + os.environ['GYP_GENERATOR_FLAGS'] + "'" if 'GYP_DEFINES' in os.environ: print " GYP_DEFINES = '" + os.environ['GYP_DEFINES'] + "'" if len(args) > 0: print " CmdlineArgs: " + " ".join(args) sys.stdout.flush() return gyp.main(args)
def main(target_dir, target_file, skia_arch_type, have_neon): """Create gypd files based on target_file. Args: target_dir: Directory containing all gyp files, including common.gypi target_file: Gyp file to start on. Other files within target_dir will be read if target_file depends on them. skia_arch_type: Target architecture to pass to gyp. have_neon: Whether to generate files including neon optimizations. Only meaningful if skia_arch_type is 'arm'. Returns: path: Path to root gypd file created by running gyp. """ # Set GYP_DEFINES for building for the android framework. gyp_defines = ('skia_android_framework=1 OS=android skia_arch_type=%s ' % skia_arch_type) if skia_arch_type == 'arm': # Always use thumb and version 7 for arm gyp_defines += 'arm_thumb=1 arm_version=7 ' if have_neon: gyp_defines += 'arm_neon=1 ' else: gyp_defines += 'arm_neon=0 ' os.environ['GYP_DEFINES'] = gyp_defines args = [] args.extend(['--depth', '.']) full_path = os.path.join(target_dir, target_file) args.extend([full_path]) # Common conditions args.extend(['-I', os.path.join(target_dir, 'common.gypi')]) # Use the debugging format. We'll use these to create one master make file. args.extend(['-f', 'gypd']) # Off we go... ret = gyp.main(args) if ret != 0: raise Exception("gyp failed!") # Running gyp should have created a gypd file, with the same name as # full_path but with a 'd' on the end. gypd_file = full_path + 'd' if not os.path.exists(gypd_file): raise Exception("gyp failed to produce gypd file!") return gypd_file
def main(args): if 'GYP_GENERATORS' not in os.environ: os.environ['GYP_GENERATORS'] = 'ninja' crashpad_dir_or_dot = crashpad_dir if crashpad_dir is not '' else '.' args.extend([ '--include', os.path.join(crashpad_dir, 'third_party', 'mini_chromium', 'mini_chromium', 'build', 'common.gypi') ]) args.extend(['--depth', crashpad_dir_or_dot]) args.append(os.path.join(crashpad_dir, 'crashpad.gyp')) return gyp.main(args)
def build_dcfpe(): os.environ['GYP_GENERATORS'] = 'ninja' os.environ['GYP_MSVS_VERSION'] = '2013' prepare_path() # base.gyp depends on this directory sys.path.insert(1, os.path.join(ENV_SOLUTION_DIRECTORY, 'third_party/chromium/build')) import gyp print 'build dcfpe' print 'Generators='+os.environ['GYP_GENERATORS'] print 'MSVSVersion='+os.environ['GYP_MSVS_VERSION'] print 'Component='+os.environ['ENV_COMPONENT'] args = [] args.append('build/dcfpe.gyp') args.append('--depth=.') args.append('--no-circular-check') args.extend(['-G', 'output_dir='+os.environ['ENV_BUILD_DIR']]) args.extend(['-D', 'component='+os.environ.get('ENV_COMPONENT')]) args.extend(['-D', 'build_dir='+os.environ.get('ENV_BUILD_DIR')]) # do not use common.gypi, because it conflicts with third_party\chromium\build\common.gypi # the above comment does not take effect since 6a9af727adc6 on Sat Oct 25 20:35:48 2014 # When revert the changes to common.gypi in chromium # I keep this comment here to emphasize that we can add a default gypi file here args.append('-I'+os.path.join(ENV_SOLUTION_DIRECTORY, 'build/common.gypi')) ret = gyp.main(args) dest_dir = os.path.join(ENV_SOLUTION_DIRECTORY, os.environ.get('ENV_BUILD_DIR')) for sfx in ["", "_x64"]: debug_dir = os.path.join(dest_dir, 'Debug' + sfx) release_dir = os.path.join(dest_dir, 'Release' + sfx) if not os.path.exists(debug_dir): os.makedirs(debug_dir) if not os.path.exists(release_dir): os.makedirs(release_dir) # copy crt src_dir = os.path.join(ENV_SOLUTION_DIRECTORY, 'third_party/vc/crt' + sfx) copy_file_if_necessary(os.path.join(src_dir, 'msvcr120d.dll'), os.path.join(debug_dir, 'msvcr120d.dll')) copy_file_if_necessary(os.path.join(src_dir, 'msvcp120d.dll'), os.path.join(debug_dir, 'msvcp120d.dll')) copy_file_if_necessary(os.path.join(src_dir, 'msvcr120.dll'), os.path.join(release_dir, 'msvcr120.dll')) copy_file_if_necessary(os.path.join(src_dir, 'msvcp120.dll'), os.path.join(release_dir, 'msvcp120.dll')) return ret
def run_gyp(args): # GYP bug. # On msvs it will crash if it gets an absolute path. # On Mac/make it will crash if it doesn't get an absolute path. a_path = node_root if sys.platform == 'win32' else os.path.abspath(node_root) args.append(os.path.join(a_path, 'node.gyp')) common_fn = os.path.join(a_path, 'common.gypi') options_fn = os.path.join(a_path, 'config.gypi') options_fips_fn = os.path.join(a_path, 'config_fips.gypi') if os.path.exists(common_fn): args.extend(['-I', common_fn]) if os.path.exists(options_fn): args.extend(['-I', options_fn]) if os.path.exists(options_fips_fn): args.extend(['-I', options_fips_fn]) args.append('--depth=' + node_root) # There's a bug with windows which doesn't allow this feature. if sys.platform != 'win32' and 'ninja' not in args: # Tell gyp to write the Makefiles into output_dir args.extend(['--generator-output', output_dir]) # Tell make to write its output into the same dir args.extend(['-Goutput_dir=' + output_dir]) args.append('-Dcomponent=static_library') args.append('-Dlibrary=static_library') # Don't compile with -B and -fuse-ld=, we don't bundle ld.gold. Can't be # set in common.gypi due to how deps/v8/build/toolchain.gypi uses them. args.append('-Dlinux_use_bundled_binutils=0') args.append('-Dlinux_use_bundled_gold=0') args.append('-Dlinux_use_gold_flags=0') # Set the current program to this module. This is done because gyp # will use the program path in targets it generates. If this script was called # by another script the program name will not be gyp_node.py but whatever # the name of the script that called it is, leading to incorrect commands # in generated targets (for example cmd_regen_makefile). sys.argv[0] = os.path.abspath(__file__) rc = gyp.main(args) if rc != 0: print('Error running GYP') sys.exit(rc)
def main(args): if 'GYP_GENERATORS' not in os.environ: os.environ['GYP_GENERATORS'] = 'ninja' crashpad_dir_or_dot = crashpad_dir if crashpad_dir is not '' else '.' args.extend(['--include', os.path.join(crashpad_dir, 'third_party', 'mini_chromium', 'mini_chromium', 'build', 'common.gypi')]) args.extend(['--depth', crashpad_dir_or_dot]) args.append(os.path.join(crashpad_dir, 'crashpad.gyp')) return gyp.main(args)
def run_gyp(args): # GYP bug. # On msvs it will crash if it gets an absolute path. # On Mac/make it will crash if it doesn't get an absolute path. a_path = node_root if sys.platform == 'win32' else os.path.abspath( node_root) args.append(os.path.join(a_path, 'node.gyp')) common_fn = os.path.join(a_path, 'common.gypi') options_fn = os.path.join(a_path, 'config.gypi') options_fips_fn = os.path.join(a_path, 'config_fips.gypi') if os.path.exists(common_fn): args.extend(['-I', common_fn]) if os.path.exists(options_fn): args.extend(['-I', options_fn]) if os.path.exists(options_fips_fn): args.extend(['-I', options_fips_fn]) args.append('--depth=' + node_root) # There's a bug with windows which doesn't allow this feature. if sys.platform != 'win32' and 'ninja' not in args: # Tell gyp to write the Makefiles into output_dir args.extend(['--generator-output', output_dir]) # Tell make to write its output into the same dir args.extend(['-Goutput_dir=' + output_dir]) args.append('-Dcomponent=static_library') args.append('-Dlibrary=static_library') # Don't compile with -B and -fuse-ld=, we don't bundle ld.gold. Can't be # set in common.gypi due to how deps/v8/build/toolchain.gypi uses them. args.append('-Dlinux_use_bundled_binutils=0') args.append('-Dlinux_use_bundled_gold=0') args.append('-Dlinux_use_gold_flags=0') rc = gyp.main(args) if rc != 0: print 'Error running GYP' sys.exit(rc)
def run_gyp(args): # GYP bug. # On msvs it will crash if it gets an absolute path. # On Mac/make it will crash if it doesn't get an absolute path. a_path = node_root if sys.platform == 'win32' else os.path.abspath(node_root) args.append(os.path.join(a_path, 'node.gyp')) common_fn = os.path.join(a_path, 'common.gypi') options_fn = os.path.join(a_path, 'config.gypi') options_fips_fn = os.path.join(a_path, 'config_fips.gypi') if os.path.exists(common_fn): args.extend(['-I', common_fn]) if os.path.exists(options_fn): args.extend(['-I', options_fn]) if os.path.exists(options_fips_fn): args.extend(['-I', options_fips_fn]) args.append('--depth=' + node_root) # There's a bug with windows which doesn't allow this feature. if sys.platform != 'win32' and 'ninja' not in args: # Tell gyp to write the Makefiles into output_dir args.extend(['--generator-output', output_dir]) # Tell make to write its output into the same dir args.extend(['-Goutput_dir=' + output_dir]) args.append('-Dcomponent=static_library') args.append('-Dlibrary=static_library') # Don't compile with -B and -fuse-ld=, we don't bundle ld.gold. Can't be # set in common.gypi due to how deps/v8/build/toolchain.gypi uses them. args.append('-Dlinux_use_bundled_binutils=0') args.append('-Dlinux_use_bundled_gold=0') args.append('-Dlinux_use_gold_flags=0') rc = gyp.main(args) if rc != 0: print 'Error running GYP' sys.exit(rc)
def main(): args = [ '--depth=' + project_root, '--include=' + os.path.join(project_root, 'common.gypi'), # '--no-parallel', # '--debug=variables', # '--debug=general', # '--debug=includes', ] # TODO: define in common.gypi v8_variables = { # build/standalone.gypi 'host_arch': detect_v8_host_arch.DoMain(None), # build/toolchain.gypi 'component': 'static_library', 'want_separate_host_toolset': 0, 'v8_optimized_debug': 2, 'v8_use_external_startup_data': 0, # build/features.gypi 'v8_enable_disassembler': 1, 'v8_enable_i18n_support': 0, 'v8_deprecation_warnings': 1, } if sys.platform.startswith('darwin'): v8_variables.update({ 'target_arch': 'x64', 'clang': 1, }) elif sys.platform.startswith('win32'): v8_variables.update({ 'target_arch': 'ia32', }) args.extend(['-D%s=%s' % v for v in v8_variables.items()]) sys.exit(gyp.main(args + sys.argv[1:]))
sys.path.insert(0, os.path.join(CURRENT_DIRECTORY, 'build')) import gyp # input environment ENV_SOLUTION_DIRECTORY = os.environ.get('ENV_SOLUTION_DIRECTORY', '') # generate # prepare gyp environment if os.environ.get('ENV_GENERATE_PROJECT', '0') == '1': if use_ninja: vs2013_runtime_dll_dirs = vs_toolchain.SetEnvironmentAndGetRuntimeDllDirs( ) args = [] args.append(os.path.join(CURRENT_DIRECTORY, r'.\base\base.gyp')) args.append('--depth=.') args.extend(['-D', 'component=' + os.environ['ENV_COMPONENT']]) args.extend(['-D', 'build_dir=./../../' + os.environ['ENV_BUILD_DIR']]) args.extend( ['-G', 'output_dir=./../../' + os.environ['ENV_BUILD_DIR']]) #args.append('-I'+os.path.join(CURRENT_DIRECTORY, 'build\\common.gypi')) gyp.main(args) # build if os.environ.get('ENV_BUILD_PROJECT', '0') == '1': pass # copy if os.environ.get('ENV_COPY_PROJECT_OUTPUT', '0') == '1': pass sys.exit(0)
def main(): # Disabling garbage collection saves about 5% processing time. Since this is a # short-lived process it's not a problem. gc.disable() args = sys.argv[1:] if int(os.environ.get('GYP_CHROMIUM_NO_ACTION', 0)): print 'Skipping gyp_webrtc.py due to GYP_CHROMIUM_NO_ACTION env var.' sys.exit(0) if 'SKIP_WEBRTC_GYP_ENV' not in os.environ: # Update the environment based on webrtc.gyp_env. gyp_env_path = os.path.join(os.path.dirname(checkout_root), 'webrtc.gyp_env') gyp_helper.apply_gyp_environment_from_file(gyp_env_path) # This could give false positives since it doesn't actually do real option # parsing. Oh well. gyp_file_specified = False for arg in args: if arg.endswith('.gyp'): gyp_file_specified = True break # If we didn't get a file, assume 'all.gyp' in the root of the checkout. if not gyp_file_specified: # Because of a bug in gyp, simply adding the abspath to all.gyp doesn't # work, but chdir'ing and adding the relative path does. Spooky :/ os.chdir(checkout_root) args.append('all.gyp') # There shouldn't be a circular dependency relationship between .gyp files, args.append('--no-circular-check') # Default to ninja unless GYP_GENERATORS is set. if not os.environ.get('GYP_GENERATORS'): os.environ['GYP_GENERATORS'] = 'ninja' # Enable check for missing sources in GYP files on Windows. if sys.platform.startswith('win'): gyp_generator_flags = os.getenv('GYP_GENERATOR_FLAGS', '') if not 'msvs_error_on_missing_sources' in gyp_generator_flags: os.environ['GYP_GENERATOR_FLAGS'] = ( gyp_generator_flags + ' msvs_error_on_missing_sources=1') vs2013_runtime_dll_dirs = None if int(os.environ.get('DEPOT_TOOLS_WIN_TOOLCHAIN', '1')): vs2013_runtime_dll_dirs = vs_toolchain.SetEnvironmentAndGetRuntimeDllDirs() # Enforce gyp syntax checking. This adds about 20% execution time. args.append('--check') supplemental_includes = GetSupplementalFiles() gyp_vars = gyp_chromium.GetGypVars(supplemental_includes) # Automatically turn on crosscompile support for platforms that need it. if all(('ninja' in os.environ.get('GYP_GENERATORS', ''), gyp_vars.get('OS') in ['android', 'ios'], 'GYP_CROSSCOMPILE' not in os.environ)): os.environ['GYP_CROSSCOMPILE'] = '1' args.extend(['-I' + i for i in additional_include_files(supplemental_includes, args)]) # Set the gyp depth variable to the root of the checkout. args.append('--depth=' + os.path.relpath(checkout_root)) print 'Updating projects from gyp files...' sys.stdout.flush() # Off we go... gyp_rc = gyp.main(args) if vs2013_runtime_dll_dirs: # pylint: disable=unpacking-non-sequence x64_runtime, x86_runtime = vs2013_runtime_dll_dirs vs_toolchain.CopyVsRuntimeDlls( os.path.join(checkout_root, GetOutputDirectory()), (x86_runtime, x64_runtime)) sys.exit(gyp_rc)
def run_gyp(args): rc = gyp.main(args) if rc != 0: print('bde_gyp.py: error: gyp exited with rc %d' % rc) sys.exit(rc)
def run_gyp(args): retval = gyp.main(args) if retval != 0: print 'Error running gyp' sys.exit(retval)
def main(): # Disabling garbage collection saves about 1 second out of 16 on a Linux # z620 workstation. Since this is a short-lived process it's not a problem to # leak a few cyclyc references in order to spare the CPU cycles for # scanning the heap. gc.disable() args = sys.argv[1:] use_analyzer = len(args) and args[0] == '--analyzer' if use_analyzer: args.pop(0) os.environ['GYP_GENERATORS'] = 'analyzer' args.append('-Gconfig_path=' + args.pop(0)) args.append('-Ganalyzer_output_path=' + args.pop(0)) if int(os.environ.get('GYP_CHROMIUM_NO_ACTION', 0)): print 'Skipping gyp_chromium due to GYP_CHROMIUM_NO_ACTION env var.' sys.exit(0) # Use the Psyco JIT if available. if psyco: psyco.profile() print "Enabled Psyco JIT." # Fall back on hermetic python if we happen to get run under cygwin. # TODO(bradnelson): take this out once this issue is fixed: # http://code.google.com/p/gyp/issues/detail?id=177 if sys.platform == 'cygwin': import find_depot_tools depot_tools_path = find_depot_tools.add_depot_tools_to_path() python_dir = sorted(glob.glob(os.path.join(depot_tools_path, 'python2*_bin')))[-1] env = os.environ.copy() env['PATH'] = python_dir + os.pathsep + env.get('PATH', '') cmd = [os.path.join(python_dir, 'python.exe')] + sys.argv sys.exit(subprocess.call(cmd, env=env)) # This could give false positives since it doesn't actually do real option # parsing. Oh well. gyp_file_specified = any(arg.endswith('.gyp') for arg in args) gyp_environment.SetEnvironment() # 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. if not gyp_file_specified: 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')) supplemental_includes = GetSupplementalFiles() gyp_vars_dict = GetGypVars(supplemental_includes) # There shouldn't be a circular dependency relationship between .gyp files, # but in Chromium's .gyp files, on non-Mac platforms, circular relationships # currently exist. The check for circular dependencies is currently # bypassed on other platforms, but is left enabled on iOS, where a violation # of the rule causes Xcode to misbehave badly. # TODO(mark): Find and kill remaining circular dependencies, and remove this # option. http://crbug.com/35878. # TODO(tc): Fix circular dependencies in ChromiumOS then add linux2 to the # list. if gyp_vars_dict.get('OS') != 'ios': args.append('--no-circular-check') # libtool on Mac warns about duplicate basenames in static libraries, so # they're disallowed in general by gyp. We are lax on this point, so disable # this check other than on Mac. GN does not use static libraries as heavily, # so over time this restriction will mostly go away anyway, even on Mac. # https://code.google.com/p/gyp/issues/detail?id=384 if sys.platform != 'darwin': args.append('--no-duplicate-basename-check') # We explicitly don't support the make gyp generator (crbug.com/348686). Be # nice and fail here, rather than choking in gyp. if re.search(r'(^|,|\s)make($|,|\s)', os.environ.get('GYP_GENERATORS', '')): print 'Error: make gyp generator not supported (check GYP_GENERATORS).' sys.exit(1) # We explicitly don't support the native msvs gyp generator. Be nice and # fail here, rather than generating broken projects. if re.search(r'(^|,|\s)msvs($|,|\s)', os.environ.get('GYP_GENERATORS', '')): print 'Error: msvs gyp generator not supported (check GYP_GENERATORS).' print 'Did you mean to use the `msvs-ninja` generator?' sys.exit(1) # If CHROMIUM_GYP_SYNTAX_CHECK is set to 1, it will invoke gyp with --check # to enfore syntax checking. syntax_check = os.environ.get('CHROMIUM_GYP_SYNTAX_CHECK') if syntax_check and int(syntax_check): args.append('--check') # TODO(dmikurube): Remove these checks and messages after a while. if ('linux_use_tcmalloc' in gyp_vars_dict or 'android_use_tcmalloc' in gyp_vars_dict): print '*****************************************************************' print '"linux_use_tcmalloc" and "android_use_tcmalloc" are deprecated!' print '-----------------------------------------------------------------' print 'You specify "linux_use_tcmalloc" or "android_use_tcmalloc" in' print 'your GYP_DEFINES. Please switch them into "use_allocator" now.' print 'See http://crbug.com/345554 for the details.' print '*****************************************************************' # Automatically turn on crosscompile support for platforms that need it. # (The Chrome OS build sets CC_host / CC_target which implicitly enables # this mode.) if all(('ninja' in os.environ.get('GYP_GENERATORS', ''), gyp_vars_dict.get('OS') in ['android', 'ios'], 'GYP_CROSSCOMPILE' not in os.environ)): os.environ['GYP_CROSSCOMPILE'] = '1' if gyp_vars_dict.get('OS') == 'android': args.append('--check') args.extend( ['-I' + i for i in additional_include_files(supplemental_includes, args)]) args.extend(['-D', 'gyp_output_dir=' + GetOutputDirectory()]) if not use_analyzer: print 'Updating projects from gyp files...' sys.stdout.flush() # Off we go... gyp_rc = gyp.main(args) if not use_analyzer: vs2013_runtime_dll_dirs = vs_toolchain.SetEnvironmentAndGetRuntimeDllDirs() if vs2013_runtime_dll_dirs: x64_runtime, x86_runtime = vs2013_runtime_dll_dirs vs_toolchain.CopyVsRuntimeDlls( os.path.join(chrome_src, GetOutputDirectory()), (x86_runtime, x64_runtime)) sys.exit(gyp_rc)
if (not applied_env_from_file or not os.environ.get('GYP_MSVS_VERSION')): os.environ['GYP_MSVS_VERSION'] = '2015' if __name__ == '__main__': # Get the path of the root 'src' directory. self_dir = os.path.abspath(os.path.dirname(__file__)) src_dir = os.path.abspath(os.path.join(self_dir, '..', '..')) apply_syzygy_gyp_env(src_dir) assert os.environ.get('GYP_GENERATORS') if os.environ.get('GYP_GENERATORS') == 'msvs': print 'ERROR: The \'msvs\' configuration isn\'t supported anymore.' sys.exit(1) # Setup the VS toolchain. vs_runtime_dll_dirs = \ vs_toolchain_wrapper.SetEnvironmentAndGetRuntimeDllDirs() gyp_rc = gyp.main(sys.argv[1:]) # Copy the VS runtime DLLs to the build directories. if vs_runtime_dll_dirs: x64_runtime, x86_runtime = vs_runtime_dll_dirs vs_toolchain_wrapper.CopyVsRuntimeDlls( os.path.join(src_dir, get_output_directory()), (x86_runtime, x64_runtime)) sys.exit(gyp_rc)
if not os.environ.get('GYP_GENERATORS'): os.environ['GYP_GENERATORS'] = 'ninja' # There shouldn't be a circular dependency relationship between .gyp files, # but in Chromium's .gyp files, on non-Mac platforms, circular relationships # currently exist. The check for circular dependencies is currently # bypassed on other platforms, but is left enabled on the Mac, where a # violation of the rule causes Xcode to misbehave badly. if 'xcode' not in os.environ['GYP_GENERATORS']: args.append('--no-circular-check') # TODO(kqyang): Find a better way to handle the depth. This workaround works # only if this script is executed in 'src' directory. if ['--depth' in arg for arg in args].count(True) == 0: args.append('--depth=packager') if (not os.environ.get('GYP_GENERATOR_FLAGS') or ('output_dir=' not in os.environ.get('GYP_GENERATOR_FLAGS'))): output_dir = os.path.join(checkout_dir, 'out') gyp_generator_flags = 'output_dir="' + output_dir + '"' if os.environ.get('GYP_GENERATOR_FLAGS'): os.environ['GYP_GENERATOR_FLAGS'] += ' ' + gyp_generator_flags else: os.environ['GYP_GENERATOR_FLAGS'] = gyp_generator_flags print 'Updating projects from gyp files...' sys.stdout.flush() # Off we go... sys.exit(gyp.main(args))
or not os.environ.get('GYP_MSVS_VERSION')): os.environ['GYP_MSVS_VERSION'] = '2015' if __name__ == '__main__': # Get the path of the root 'src' directory. self_dir = os.path.abspath(os.path.dirname(__file__)) src_dir = os.path.abspath(os.path.join(self_dir, '..', '..')) apply_syzygy_gyp_env(src_dir) assert os.environ.get('GYP_GENERATORS') if os.environ.get('GYP_GENERATORS') == 'msvs': print 'ERROR: The \'msvs\' configuration isn\'t supported anymore.' sys.exit(1) # Setup the VS toolchain. vs_runtime_dll_dirs = \ vs_toolchain_wrapper.SetEnvironmentAndGetRuntimeDllDirs() gyp_rc = gyp.main(sys.argv[1:]) # Copy the VS runtime DLLs to the build directories. if vs_runtime_dll_dirs: x64_runtime, x86_runtime = vs_runtime_dll_dirs vs_toolchain_wrapper.CopyVsRuntimeDlls( os.path.join(src_dir, get_output_directory()), (x86_runtime, x64_runtime)) sys.exit(gyp_rc)
def run_gyp(args): rc = gyp.main(args) if rc != 0: print('bsl_gyp.py: error: gyp exited with rc %d' % rc) sys.exit(rc)
sys.path.append(os.path.abspath(gyp_pylib)) import gyp if __name__ == '__main__': # Make our own location absolute as it is stored in Makefiles. sys.argv[0] = os.path.abspath(sys.argv[0]) # Add any extra arguments. Needed by compiler/dart.gyp to build v8. args = sys.argv[2:] args += ['--depth', project_src] args += ['-I', './tools/gyp/common.gypi'] if platform.system() == 'Linux': # We need to fiddle with toplevel-dir to work around a GYP bug # that breaks building v8 from compiler/dart.gyp. args += ['--toplevel-dir', os.curdir] args += ['--generator-output', project_src] else: # On at least the Mac, the toplevel-dir should be where the # sources are. Otherwise, Xcode won't show sources correctly. args += ['--toplevel-dir', project_src] # Change into the dart directory as we want the project to be rooted here. # Also, GYP is very sensitive to exacly from where it is being run. os.chdir(dart_src) args += [GetProjectGypFile(project_src)] # Generate the projects. sys.exit(gyp.main(args))
#!/usr/bin/env python # Copyright (c) 2009 Google Inc. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import sys # TODO(mark): sys.path manipulation is some temporary testing stuff. try: import gyp except ImportError, e: import os.path sys.path.append(os.path.join(os.path.dirname(sys.argv[0]), 'pylib')) import gyp if __name__ == '__main__': sys.exit(gyp.main(sys.argv[1:]))
# coding: utf-8 import os import sys base_dir = os.path.abspath(os.path.dirname(__file__)) sys.path.append(os.path.join(base_dir, 'third_party', 'gyp', 'pylib')) import gyp import gyp.generator.msvs orig_fix_path = gyp.generator.msvs._FixPath # gyp is trying to expand parameters as paths and the fix prevents gyp from # doing it for particular parameters for particular tools. # Don't touch following js2c and build-v8 parameters dont_expand = [ # js2c 'CORE', 'EXTRAS', 'EXPERIMENTAL_EXTRAS', # build-v8 'ia32', 'x64' ] def _FixPath(path): if path in dont_expand: return path return orig_fix_path(path) gyp.generator.msvs._FixPath = _FixPath if __name__ == '__main__': gyp.main(sys.argv[1:])
def main(target_dir, target_file, skia_arch_type, have_neon, have_mips_dspr2, have_mips_dspr1, gyp_source_dir=None): """Create gypd files based on target_file. Args: target_dir: Directory containing all gyp files, including common.gypi target_file: Gyp file to start on. Other files within target_dir will be read if target_file depends on them. skia_arch_type: Target architecture to pass to gyp. have_neon: Whether to generate files including neon optimizations. Only meaningful if skia_arch_type is 'arm'. gyp_source_dir: Directory of the gyp source code. The default is in third_party/externals/gyp. Returns: path: Path to root gypd file created by running gyp. """ # Ensure we import our current gyp source's module, not any version # pre-installed in your PYTHONPATH. if not gyp_source_dir: if DEBUG_FAILURE: print 'gyp_source_dir not provided. using the default!' gyp_source_dir = os.path.join(SKIA_DIR, 'third_party', 'externals', 'gyp') if DEBUG_FAILURE: print 'gyp_source_dir is "%s"' % gyp_source_dir if not os.path.exists(gyp_source_dir): print 'and it does not exist!' assert os.path.exists(gyp_source_dir) sys.path.insert(0, os.path.join(gyp_source_dir, 'pylib')) import gyp # Set GYP_DEFINES for building for the android framework. gyp_defines = ('skia_android_framework=1 OS=android skia_arch_type=%s ' % skia_arch_type) if skia_arch_type == 'arm': # Always version 7 (which implies thumb) for arm gyp_defines += 'arm_version=7 ' if have_neon: gyp_defines += 'arm_neon=1 ' else: gyp_defines += 'arm_neon=0 ' if skia_arch_type == 'mips': if have_mips_dspr2: gyp_defines += 'mips_arch_variant=mips32r2 ' gyp_defines += 'mips_dsp=2 ' elif have_mips_dspr1: gyp_defines += 'mips_arch_variant=mips32r2 ' gyp_defines += 'mips_dsp=1 ' os.environ['GYP_DEFINES'] = gyp_defines args = [] args.extend(['--depth', '.']) full_path = os.path.join(target_dir, target_file) args.extend([full_path]) # Common conditions args.extend(['-I', os.path.join(target_dir, 'common.gypi')]) # Use the debugging format. We'll use these to create one master make file. args.extend(['-f', 'gypd']) # Off we go... ret = gyp.main(args) if ret != 0: raise Exception("gyp failed!") # Running gyp should have created a gypd file, with the same name as # full_path but with a 'd' on the end. gypd_file = full_path + 'd' if not os.path.exists(gypd_file): raise Exception("gyp failed to produce gypd file!") return gypd_file
def exec_gyp(args): gyp_lib = os.path.join(os.path.dirname(sys.argv[0]), 'gyp', 'pylib') sys.path.insert(0, gyp_lib) import gyp print('gyp ' + ' '.join(args)) sys.exit(gyp.main(args))
# Points to the parent of the src folder, in this case, project root. args.append('--depth=' + v8_i18n_root) # Include some gypi files. args.append('-I' + os.path.join(v8_i18n_root, 'build', 'common.gypi')) # Necessary for building standalone v8 project. args.append('-I' + os.path.join(v8_i18n_root, chrome_dir, 'src', 'v8', 'build', 'standalone.gypi')) # Point to v8 and icu checkouts within Chrome (overrides all.gyp). args.append( '-Dicu_path=' + os.path.join(v8_i18n_root, '..', chrome_dir, 'src', 'third_party', 'icu')) args.append('-Dv8_path=' + os.path.join(v8_i18n_root, '..', chrome_dir, 'src')) args.append('-Dclang=1') # ICU build fails if werror is on. args.append('-Dwerror=') # Process unittest.gyp file. args.append(os.path.join(v8_i18n_root, 'build', 'unittest.gyp')) print 'Generating project files from gyp rules...' status = gyp.main(args) if status != 0: print 'Error running gyp.' sys.exit(status)
#!/usr/bin/env python # Copyright (c) 2009 Google Inc. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import sys import gyp if __name__ == '__main__': arguments = sys.argv[1:] # Temporary hack until i've figured out the reason # this is in place, avoids the whole: # 'Could not automatically locate src directory. # This isa temporary Chromium feature that will be removed.' arguments.insert(0, '.') arguments.insert(0, '--depth') sys.exit( gyp.main(arguments) )
def run_gyp(args): rc = gyp.main(args) if rc != 0: print 'Error running GYP' sys.exit(rc)
def main(argv): gypfile = "all.gyp" gypdir = os.path.dirname(os.path.abspath(gypfile)) includefile = "defaults.gypi" gyp.main(argv[1:] + ["--include=" + includefile, "--depth=" + gypdir, gypfile]) return 0
def main(target_dir, target_file, skia_arch_type, have_neon, gyp_source_dir=None): """Create gypd files based on target_file. Args: target_dir: Directory containing all gyp files, including common.gypi target_file: Gyp file to start on. Other files within target_dir will be read if target_file depends on them. skia_arch_type: Target architecture to pass to gyp. have_neon: Whether to generate files including neon optimizations. Only meaningful if skia_arch_type is 'arm'. gyp_source_dir: Directory of the gyp source code. The default is in third_party/externals/gyp. Returns: path: Path to root gypd file created by running gyp. """ # Ensure we import our current gyp source's module, not any version # pre-installed in your PYTHONPATH. if not gyp_source_dir: if DEBUG_FAILURE: print 'gyp_source_dir not provided. using the default!' gyp_source_dir = os.path.join(SKIA_DIR, 'third_party', 'externals', 'gyp') if DEBUG_FAILURE: print 'gyp_source_dir is "%s"' % gyp_source_dir if not os.path.exists(gyp_source_dir): print 'and it does not exist!' assert os.path.exists(gyp_source_dir) sys.path.insert(0, os.path.join(gyp_source_dir, 'pylib')) import gyp # Set GYP_DEFINES for building for the android framework. gyp_defines = ('skia_android_framework=1 OS=android skia_arch_type=%s ' % skia_arch_type) if skia_arch_type == 'arm': # Always use thumb and version 7 for arm gyp_defines += 'arm_thumb=1 arm_version=7 ' if have_neon: gyp_defines += 'arm_neon=1 ' else: gyp_defines += 'arm_neon=0 ' os.environ['GYP_DEFINES'] = gyp_defines args = [] args.extend(['--depth', '.']) full_path = os.path.join(target_dir, target_file) args.extend([full_path]) # Common conditions args.extend(['-I', os.path.join(target_dir, 'common.gypi')]) # Use the debugging format. We'll use these to create one master make file. args.extend(['-f', 'gypd']) # Off we go... ret = gyp.main(args) if ret != 0: raise Exception("gyp failed!") # Running gyp should have created a gypd file, with the same name as # full_path but with a 'd' on the end. gypd_file = full_path + 'd' if not os.path.exists(gypd_file): raise Exception("gyp failed to produce gypd file!") return gypd_file
def run_gyp(args): rc = gyp.main(args) if rc != 0: print 'Error running gyp' sys.exit(rc)
#!/usr/bin/env python # Copyright (c) 2009 Google Inc. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import sys, os, inspect cmd_folder = os.path.realpath(os.path.abspath(os.path.split(inspect.getfile( inspect.currentframe() ))[0])) pylib = os.path.join(cmd_folder, 'pylib') sys.path.insert(0, pylib) import gyp # TODO(mark): sys.path manipulation is some temporary testing stuff. #try: # import gyp #except ImportError, e: # import os.path # sys.path.append(os.path.join(os.path.dirname(sys.argv[0]), 'pylib')) # import gyp if __name__ == '__main__': sys.exit(gyp.main(sys.argv[1:]))
def run_gyp(args): rc = gyp.main(args) if rc != 0: print('Error running GYP') sys.exit(rc)
args = [] # Points to the parent of the src folder, in this case, project root. args.append('--depth=' + v8_i18n_root) # Include some gypi files. args.append('-I' + os.path.join(v8_i18n_root, 'build', 'common.gypi')) # Necessary for building standalone v8 project. args.append('-I' + os.path.join(v8_i18n_root, chrome_dir, 'src', 'v8', 'build', 'standalone.gypi')) # Point to v8 and icu checkouts within Chrome (overrides all.gyp). args.append('-Dicu_path=' + os.path.join(v8_i18n_root, '..', chrome_dir, 'src', 'third_party', 'icu')) args.append('-Dv8_path=' + os.path.join(v8_i18n_root, '..', chrome_dir, 'src')) args.append('-Dclang=1') # ICU build fails if werror is on. args.append('-Dwerror=') # Process unittest.gyp file. args.append(os.path.join(v8_i18n_root, 'build','unittest.gyp')) print 'Generating project files from gyp rules...' status = gyp.main(args) if status != 0: print 'Error running gyp.' sys.exit(status)
delattr(self, "_abp_configs") def overridden_WriteAndroidNdkModuleRule(self, module_name, all_sources, link_deps): for config in self._abp_configs: libs = self._abp_configs[config].get("user_libraries") if not libs: continue self.WriteLn("ifeq (${{BUILDTYPE}}, {})".format(config)) for lib in libs: self.WriteLn("include $(CLEAR_VARS)") self.WriteLn("LOCAL_MODULE := {}".format(lib)) self.WriteLn("LOCAL_SRC_FILES := {}".format(lib)) self.WriteLn("include $(PREBUILT_STATIC_LIBRARY)") self.WriteLn("ABP_STATIC_LIBRARIES_${{BUILDTYPE}} += {}".format(lib)) self.WriteLn("endif") orig_WriteList = self.WriteList def overridden_WriteList(self, orig_value_list, variable=None, prefix='', quoter=QuoteIfNecessary): value_list = orig_value_list[:] if variable == "LOCAL_STATIC_LIBRARIES": value_list.append("${ABP_STATIC_LIBRARIES_${BUILDTYPE}}") orig_WriteList(value_list, variable, prefix, quoter) self.WriteList = types.MethodType(overridden_WriteList, self) orig_MakefileWriter_WriteAndroidNdkModuleRule(self, module_name, all_sources, link_deps) self.WriteList = orig_WriteList MakefileWriter.Write = overridden_Write MakefileWriter.WriteAndroidNdkModuleRule = overridden_WriteAndroidNdkModuleRule if __name__ == '__main__': gyp.main(sys.argv[1:])
def main(): # Disabling garbage collection saves about 1 second out of 16 on a Linux # z620 workstation. Since this is a short-lived process it's not a problem to # leak a few cyclyc references in order to spare the CPU cycles for # scanning the heap. gc.disable() args = sys.argv[1:] use_analyzer = len(args) and args[0] == '--analyzer' if use_analyzer: args.pop(0) os.environ['GYP_GENERATORS'] = 'analyzer' args.append('-Gconfig_path=' + args.pop(0)) args.append('-Ganalyzer_output_path=' + args.pop(0)) if int(os.environ.get('GYP_CHROMIUM_NO_ACTION', 0)): print 'Skipping gyp_chromium due to GYP_CHROMIUM_NO_ACTION env var.' sys.exit(0) # Use the Psyco JIT if available. if psyco: psyco.profile() print "Enabled Psyco JIT." # Fall back on hermetic python if we happen to get run under cygwin. # TODO(bradnelson): take this out once this issue is fixed: # http://code.google.com/p/gyp/issues/detail?id=177 if sys.platform == 'cygwin': import find_depot_tools depot_tools_path = find_depot_tools.add_depot_tools_to_path() python_dir = sorted( glob.glob(os.path.join(depot_tools_path, 'python2*_bin')))[-1] env = os.environ.copy() env['PATH'] = python_dir + os.pathsep + env.get('PATH', '') cmd = [os.path.join(python_dir, 'python.exe')] + sys.argv sys.exit(subprocess.call(cmd, env=env)) # This could give false positives since it doesn't actually do real option # parsing. Oh well. gyp_file_specified = any(arg.endswith('.gyp') for arg in args) gyp_environment.SetEnvironment() # 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. if not gyp_file_specified: 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')) supplemental_includes = GetSupplementalFiles() gyp_vars_dict = GetGypVars(supplemental_includes) # There shouldn't be a circular dependency relationship between .gyp files, # but in Chromium's .gyp files, on non-Mac platforms, circular relationships # currently exist. The check for circular dependencies is currently # bypassed on other platforms, but is left enabled on iOS, where a violation # of the rule causes Xcode to misbehave badly. # TODO(mark): Find and kill remaining circular dependencies, and remove this # option. http://crbug.com/35878. # TODO(tc): Fix circular dependencies in ChromiumOS then add linux2 to the # list. if gyp_vars_dict.get('OS') != 'ios': args.append('--no-circular-check') # libtool on Mac warns about duplicate basenames in static libraries, so # they're disallowed in general by gyp. We are lax on this point, so disable # this check other than on Mac. GN does not use static libraries as heavily, # so over time this restriction will mostly go away anyway, even on Mac. # https://code.google.com/p/gyp/issues/detail?id=384 if sys.platform != 'darwin': args.append('--no-duplicate-basename-check') # We explicitly don't support the make gyp generator (crbug.com/348686). Be # nice and fail here, rather than choking in gyp. if re.search(r'(^|,|\s)make($|,|\s)', os.environ.get('GYP_GENERATORS', '')): print 'Error: make gyp generator not supported (check GYP_GENERATORS).' sys.exit(1) # We explicitly don't support the native msvs gyp generator. Be nice and # fail here, rather than generating broken projects. if re.search(r'(^|,|\s)msvs($|,|\s)', os.environ.get('GYP_GENERATORS', '')): print 'Error: msvs gyp generator not supported (check GYP_GENERATORS).' print 'Did you mean to use the `msvs-ninja` generator?' sys.exit(1) # If CHROMIUM_GYP_SYNTAX_CHECK is set to 1, it will invoke gyp with --check # to enfore syntax checking. syntax_check = os.environ.get('CHROMIUM_GYP_SYNTAX_CHECK') if syntax_check and int(syntax_check): args.append('--check') # TODO(dmikurube): Remove these checks and messages after a while. if ('linux_use_tcmalloc' in gyp_vars_dict or 'android_use_tcmalloc' in gyp_vars_dict): print '*****************************************************************' print '"linux_use_tcmalloc" and "android_use_tcmalloc" are deprecated!' print '-----------------------------------------------------------------' print 'You specify "linux_use_tcmalloc" or "android_use_tcmalloc" in' print 'your GYP_DEFINES. Please switch them into "use_allocator" now.' print 'See http://crbug.com/345554 for the details.' print '*****************************************************************' # Automatically turn on crosscompile support for platforms that need it. # (The Chrome OS build sets CC_host / CC_target which implicitly enables # this mode.) if all(('ninja' in os.environ.get('GYP_GENERATORS', ''), gyp_vars_dict.get('OS') in ['android', 'ios'], 'GYP_CROSSCOMPILE' not in os.environ)): os.environ['GYP_CROSSCOMPILE'] = '1' if gyp_vars_dict.get('OS') == 'android': args.append('--check') args.extend([ '-I' + i for i in additional_include_files(supplemental_includes, args) ]) args.extend(['-D', 'gyp_output_dir=' + GetOutputDirectory()]) if not use_analyzer: print 'Updating projects from gyp files...' sys.stdout.flush() # Off we go... gyp_rc = gyp.main(args) if not use_analyzer: vs2013_runtime_dll_dirs = vs_toolchain.SetEnvironmentAndGetRuntimeDllDirs( ) if vs2013_runtime_dll_dirs: x64_runtime, x86_runtime = vs2013_runtime_dll_dirs vs_toolchain.CopyVsRuntimeDlls( os.path.join(chrome_src, GetOutputDirectory()), (x86_runtime, x64_runtime)) sys.exit(gyp_rc)
def main(): # Disabling garbage collection saves about 5% processing time. Since this is a # short-lived process it's not a problem. gc.disable() args = sys.argv[1:] if int(os.environ.get('GYP_CHROMIUM_NO_ACTION', 0)): print 'Skipping gyp_webrtc.py due to GYP_CHROMIUM_NO_ACTION env var.' sys.exit(0) if 'SKIP_WEBRTC_GYP_ENV' not in os.environ: # Update the environment based on webrtc.gyp_env. gyp_env_path = os.path.join(os.path.dirname(checkout_root), 'webrtc.gyp_env') gyp_helper.apply_gyp_environment_from_file(gyp_env_path) # This could give false positives since it doesn't actually do real option # parsing. Oh well. gyp_file_specified = False for arg in args: if arg.endswith('.gyp'): gyp_file_specified = True break # If we didn't get a file, assume 'all.gyp' in the root of the checkout. if not gyp_file_specified: # Because of a bug in gyp, simply adding the abspath to all.gyp doesn't # work, but chdir'ing and adding the relative path does. Spooky :/ os.chdir(checkout_root) args.append('all.gyp') # There shouldn't be a circular dependency relationship between .gyp files, args.append('--no-circular-check') # Default to ninja unless GYP_GENERATORS is set. if not os.environ.get('GYP_GENERATORS'): os.environ['GYP_GENERATORS'] = 'ninja' fixVS2015Ninja() # Enable check for missing sources in GYP files on Windows. if sys.platform.startswith('win'): gyp_generator_flags = os.getenv('GYP_GENERATOR_FLAGS', '') if not 'msvs_error_on_missing_sources' in gyp_generator_flags: os.environ['GYP_GENERATOR_FLAGS'] = ( gyp_generator_flags + ' msvs_error_on_missing_sources=1') vs2013_runtime_dll_dirs = None if int(os.environ.get('DEPOT_TOOLS_WIN_TOOLCHAIN', '1')): vs2013_runtime_dll_dirs = vs_toolchain.SetEnvironmentAndGetRuntimeDllDirs() else: gyp_defines_dict = gyp.NameValueListToDict(gyp.ShlexEnv('GYP_DEFINES')) winSdkDir = os.environ.get('UniversalCRTSdkDir') if winSdkDir != None: gyp_defines_dict['windows_sdk_path'] = winSdkDir os.environ['GYP_DEFINES'] = ' '.join('%s=%s' % (k, pipes.quote(str(v))) for k, v in gyp_defines_dict.iteritems()) # Enforce gyp syntax checking. This adds about 20% execution time. args.append('--check') supplemental_includes = GetSupplementalFiles() gyp_vars = gyp_chromium.GetGypVars(supplemental_includes) # Automatically turn on crosscompile support for platforms that need it. if all(('ninja' in os.environ.get('GYP_GENERATORS', ''), gyp_vars.get('OS') in ['android', 'ios'], 'GYP_CROSSCOMPILE' not in os.environ)): os.environ['GYP_CROSSCOMPILE'] = '1' args.extend(['-I' + i for i in gyp_chromium.additional_include_files(supplemental_includes, args)]) # Set the gyp depth variable to the root of the checkout. args.append('--depth=' + os.path.relpath(checkout_root)) print 'Updating projects from gyp files...' sys.stdout.flush() # Off we go... gyp_rc = gyp.main(args) if vs2013_runtime_dll_dirs: # pylint: disable=unpacking-non-sequence x64_runtime, x86_runtime = vs2013_runtime_dll_dirs vs_toolchain.CopyVsRuntimeDlls( os.path.join(checkout_root, gyp_chromium.GetOutputDirectory()), (x86_runtime, x64_runtime)) sys.exit(gyp_rc)
gyp_file = "sumatra.gyp" sln_file = gyp_file.split(".")[0] + ".sln" print("Processing %s to generate %s" % (gyp_file, sln_file)) os.chdir("gyp") # TODO: other possible args: # --depth=build\ia32 -f msvs -I common.gypi --generator-output=build\ia32 -G msvs_version=2012 -Dtarget_arch=ia32 -Dhost_arch=ia32 # -f: # msvs - generates .sln VS solution # ninja - generates ninja makefile # msvs-ninja - generates .sln VS solution that call ninja for the build # -d : variables, includes, general, all args = [ "-G", "msvs_version=2013", "-f", "msvs", "-Icommon.gypi", "--depth", ".", # "--depth", "build/32", # TODO: this fails with: # Warning: Missing input files: # build/32/..\..\..\..\..\..\..\bin\nasm.exe # "--generator-output=build/32", gyp_file, ] # when something goes wrong, add -d all arg to get reasonable error message # args.append("-d"); args.append("all") gyp.main(args)
#!/usr/bin/env python import os import sys import fnmatch import shutil script_dir = os.path.abspath(os.path.dirname(__file__)) if __name__ == '__main__': sys.path.append(os.path.join(script_dir, 'vendor', 'gyp', 'pylib')) import gyp os.putenv("PYTHONDONTWRITEBYTECODE", "1") gyp_file = os.path.join(script_dir, "SinchService.gyp") gyp_args = [] gyp_args += ['--depth', script_dir] gyp_args += ['-D', "OS=ios"] gyp_args += ['-f', "xcode"] gyp_args += [gyp_file] status = gyp.main(gyp_args) sys.stdout.flush() sys.exit(status)
def main(target_dir, target_file, skia_arch_type, have_neon, gyp_source_dir=None): """Create gypd files based on target_file. Args: target_dir: Directory containing all gyp files, including common.gypi target_file: Gyp file to start on. Other files within target_dir will be read if target_file depends on them. skia_arch_type: Target architecture to pass to gyp. have_neon: Whether to generate files including neon optimizations. Only meaningful if skia_arch_type is 'arm'. gyp_source_dir: Directory of the gyp source code. The default is in third_party/externals/gyp. Returns: path: Path to root gypd file created by running gyp. """ # Ensure we import our current gyp source's module, not any version # pre-installed in your PYTHONPATH. if not gyp_source_dir: if DEBUG_FAILURE: print "gyp_source_dir not provided. using the default!" gyp_source_dir = os.path.join(SKIA_DIR, "third_party", "externals", "gyp") if DEBUG_FAILURE: print 'gyp_source_dir is "%s"' % gyp_source_dir if not os.path.exists(gyp_source_dir): print "and it does not exist!" assert os.path.exists(gyp_source_dir) sys.path.insert(0, os.path.join(gyp_source_dir, "pylib")) import gyp # Set GYP_DEFINES for building for the android framework. gyp_defines = "skia_android_framework=1 OS=android skia_arch_type=%s " % skia_arch_type if skia_arch_type == "arm": # Always use thumb and version 7 for arm gyp_defines += "arm_thumb=1 arm_version=7 " if have_neon: gyp_defines += "arm_neon=1 " else: gyp_defines += "arm_neon=0 " os.environ["GYP_DEFINES"] = gyp_defines args = [] args.extend(["--depth", "."]) full_path = os.path.join(target_dir, target_file) args.extend([full_path]) # Common conditions args.extend(["-I", os.path.join(target_dir, "common.gypi")]) # Use the debugging format. We'll use these to create one master make file. args.extend(["-f", "gypd"]) # Off we go... ret = gyp.main(args) if ret != 0: raise Exception("gyp failed!") # Running gyp should have created a gypd file, with the same name as # full_path but with a 'd' on the end. gypd_file = full_path + "d" if not os.path.exists(gypd_file): raise Exception("gyp failed to produce gypd file!") return gypd_file
def main(argv): gyp.main(argv[1:] + ['--depth=' + thisdir, 'all.gyp']) return 0
import sys, os.path # This script reads .gyp files and generates apropriate .sln etc. # projects and solutions. Gyp can generate solution for every version # of Visual Studio try: import gyp except: print("You need to install gyp from") print("http://code.google.com/p/gyp/\n\n") raise if __name__ == '__main__': fp = os.path.join("gyp", "sizer.gyp") # TODO: I don't get why the generated files are put in # ${--generator-output}/gyp directory #args = [fp, "--generator-output=vs/2010", "-G", "msvs-version=2010", # "-Goutput_dir=.", "--depth=.", "--suffix=vs2010"] args = [fp, "--generator-output=vs", "-G", "msvs-version=2010", "--suffix=-vs2010"] ret = gyp.main(args) args = [fp, "--generator-output=vs", "-G", "msvs-version=2012", "--suffix=-vs2012"] ret = gyp.main(args) #args = [fp, "--generator-output=vs", "-G", "msvs-version=2008", "--suffix=-vs2008"] #ret = gyp.main(args) sys.exit(ret)