Remove GYP build support (issue #1403)

This commit is contained in:
Marshall Greenblatt 2016-08-08 14:31:57 +03:00
parent 2070a1bc41
commit 968fbacac3
15 changed files with 93 additions and 3321 deletions

View File

@ -10,12 +10,7 @@
# #
# GN Setup: # GN Setup:
# #
# 1. Enable use of GN instead of GYP by setting the `CEF_USE_GN` environment # Optionally configure GN by setting the `GN_DEFINES` and/or `GN_ARGUMENTS`
# variable to a value of `1`. For example, on Windows:
#
# > set CEF_USE_GN=1
#
# 2. Optionally configure GN by setting the `GN_DEFINES` and/or `GN_ARGUMENTS`
# environment variables. # environment variables.
# #
# Example A: Use /DEBUG:FASTLINK on Windows: # Example A: Use /DEBUG:FASTLINK on Windows:

2025
cef.gyp

File diff suppressed because it is too large Load Diff

View File

@ -1,29 +0,0 @@
# Copyright (c) 2013 The Chromium Embedded Framework Authors. All rights
# reserved. Use of this source code is governed by a BSD-style license that
# can be found in the LICENSE file.
{
'variables': {
# Don't use the chrome style plugin with CEF.
'clang_use_chrome_plugins': 0,
# Set ENABLE_PRINTING=1 ENABLE_BASIC_PRINTING=1.
'enable_basic_printing': 1,
'enable_print_preview': 0,
# Enable support for Widevine CDM.
'enable_widevine': 1,
# Disable support for plugin installation.
'enable_plugin_installation': 0,
'conditions': [
# Directory for CEF source files.
[ 'OS=="win"', {
'cef_directory' : '<!(echo %CEF_DIRECTORY%)',
}, { # OS!="win"
'cef_directory' : '<!(echo $CEF_DIRECTORY)',
}],
[ 'OS=="mac"', {
# Strip symbols and create dSYM files for the Release target.
'mac_strip_release': 1,
}],
]
}
}

View File

@ -25,14 +25,6 @@ patches = [
'name': 'gn_config', 'name': 'gn_config',
'path': '../', 'path': '../',
}, },
{
# Disable use of the sysroot image for CEF because it does not include
# the GTK dependency required by cefclient. It would be nice to enable
# this functionality in the future. See http://crbug.com/504446.
# TODO(cef): Remove this patch when GYP support is removed.
'name': 'build',
'path': '../build/',
},
{ {
# Support loading of password protected zip archives. # Support loading of password protected zip archives.
# https://bitbucket.org/chromiumembedded/cef/issues/496 # https://bitbucket.org/chromiumembedded/cef/issues/496
@ -48,13 +40,6 @@ patches = [
'name': 'message_loop_443_1992243003', 'name': 'message_loop_443_1992243003',
'path': '../base/message_loop/', 'path': '../base/message_loop/',
}, },
{
# Fix ninja output for localization directories on OS X.
# https://bugs.chromium.org/p/gyp/issues/detail?id=331
# TODO(cef): Remove this patch when GYP support is removed.
'name': 'gyp_331',
'path': '../tools/gyp/pylib/',
},
{ {
# Enable popups in offscreen rendering on OS X. # Enable popups in offscreen rendering on OS X.
'name': 'webkit_popups', 'name': 'webkit_popups',
@ -245,20 +230,6 @@ patches = [
'name': 'render_view_host_impl_1392', 'name': 'render_view_host_impl_1392',
'path': '../content/browser/renderer_host/', 'path': '../content/browser/renderer_host/',
}, },
{
# Fix GYP build error on Linux.
# https://bugs.chromium.org/p/chromium/issues/detail?id=626150
# TODO(cef): Remove this patch when GYP support is removed.
'name': 'gyp_build_626150',
'path': '../',
},
{
# Fix GYP build error on Windows.
# https://bugs.chromium.org/p/chromium/issues/detail?id=627924
# TODO(cef): Remove this patch when GYP support is removed.
'name': 'gyp_build_627924',
'path': '../',
},
{ {
# Expose ui::Compositor via BrowserCompositorMac for OSR. # Expose ui::Compositor via BrowserCompositorMac for OSR.
'name': 'browser_compositor_mac', 'name': 'browser_compositor_mac',

View File

@ -1,26 +0,0 @@
diff --git common.gypi common.gypi
index 0935433..670db78 100644
--- common.gypi
+++ common.gypi
@@ -9,6 +9,9 @@
# Variables expected to be overriden on the GYP command line (-D) or by
# ~/.gyp/include.gypi.
'variables': {
+ # Directory for CEF source files. This will be set by cef.gypi.
+ 'cef_directory%' : '',
+
# Putting a variables dict inside another variables dict looks kind of
# weird. This is done so that 'host_arch', 'chromeos', etc are defined as
# variables within the outer variables dict here. This is necessary
@@ -90,7 +93,10 @@
# depending on the packages installed on the local machine. Set this
# to 0 to build against locally installed headers and libraries (e.g.
# if packaging for a linux distro)
- 'use_sysroot%': 1,
+ # Disable use of the sysroot image for CEF because it does not include
+ # the GTK dependency required by cefclient. It would be nice to enable
+ # this functionality in the future. See http://crbug.com/504446.
+ 'use_sysroot%': 0,
# Override buildtype to select the desired build flavor.
# Dev - everyday build for development/testing

View File

@ -1,22 +0,0 @@
diff --git gyp/generator/ninja.py gyp/generator/ninja.py
index 9cfc706..932dc86 100644
--- gyp/generator/ninja.py
+++ gyp/generator/ninja.py
@@ -760,7 +760,16 @@ class NinjaWriter(object):
for path in copy['files']:
# Normalize the path so trailing slashes don't confuse us.
path = os.path.normpath(path)
- basename = os.path.split(path)[1]
+ (parent_path, basename) = os.path.split(path)
+
+ # Xcode uses .lproj directories for localized resources. Add a special
+ # case to maintain the localization directory component if present.
+ if parent_path != '':
+ parent_basename = os.path.basename(parent_path)
+ (parent_root, parent_ext) = os.path.splitext(parent_basename)
+ if parent_ext == '.lproj':
+ basename = os.path.join(parent_basename, basename)
+
src = self.GypPathToNinja(path, env)
dst = self.GypPathToNinja(os.path.join(copy['destination'], basename),
env)

View File

@ -1,17 +0,0 @@
diff --git components/webmessaging.gypi components/webmessaging.gypi
index 318f0db..cbe0bac 100644
--- components/webmessaging.gypi
+++ components/webmessaging.gypi
@@ -49,12 +49,6 @@
'target_name': 'webmessaging_mojo_bindings_for_blink',
'type': 'static_library',
'sources': [ '<@(mojom_files)' ],
- 'dependencies': [
- '../url/url.gyp:url_mojom_for_blink',
- ],
- 'export_dependent_settings': [
- '../url/url.gyp:url_mojom_for_blink',
- ],
'variables': {
'for_blink': 'true',
'mojom_typemaps': [

View File

@ -1,17 +0,0 @@
diff --git chrome_elf/chrome_elf.gyp chrome_elf/chrome_elf.gyp
index c9a412b..95a7fa6 100644
--- chrome_elf/chrome_elf.gyp
+++ chrome_elf/chrome_elf.gyp
@@ -65,12 +65,6 @@
],
# Set /SUBSYSTEM:WINDOWS.
'SubSystem': '2',
- 'AdditionalDependencies!': [
- 'user32.lib',
- ],
- 'IgnoreDefaultLibraryNames': [
- 'user32.lib',
- ],
},
},
},

View File

@ -889,7 +889,17 @@ if not options.nobuild and (chromium_checkout_changed or \
# Building should also force a distribution. # Building should also force a distribution.
options.forcedistrib = True options.forcedistrib = True
if not use_gn: if use_gn:
# Make sure the GN configuration exists.
if not options.dryrun and \
not os.path.exists(os.path.join(cef_src_dir, 'BUILD.gn')):
raise Exception('GN configuration does not exist; set CEF_USE_GN=0')
else:
# Make sure the GYP configuration exists.
if not options.dryrun and \
not os.path.exists(os.path.join(cef_src_dir, 'cef.gyp')):
raise Exception('GYP configuration does not exist; set CEF_USE_GN=1')
# Set GYP environment variables. # Set GYP environment variables.
os.environ['GYP_GENERATORS'] = 'ninja' os.environ['GYP_GENERATORS'] = 'ninja'
if gyp_needs_target_arch_x64: if gyp_needs_target_arch_x64:

View File

@ -1,697 +0,0 @@
# Copyright (c) 2011 The Chromium Embedded Framework Authors. All rights
# reserved. Use of this source code is governed by a BSD-style license that
# can be found in the LICENSE file.
{
'variables': {
'chromium_code': 1,
'framework_name': 'Chromium Embedded Framework',
'linux_use_gold_binary': 0,
'linux_use_gold_flags': 0,
# Don't use clang with CEF binary releases due to Chromium tree structure dependency.
'clang': 0,
'conditions': [
['sysroot!=""', {
'pkg-config': './pkg-config-wrapper "<(sysroot)" "<(target_arch)"',
}, {
'pkg-config': 'pkg-config'
}],
[ 'OS=="win"', {
'multi_threaded_dll%': 0,
}],
]
},
'includes': [
# Bring in the source file lists for cefclient.
'cef_paths2.gypi',
],
'targets': [
{
'target_name': 'cefclient',
'type': 'executable',
'mac_bundle': 1,
'msvs_guid': '6617FED9-C5D4-4907-BF55-A90062A6683F',
'dependencies': [
'libcef_dll_wrapper',
],
'defines': [
'USING_CEF_SHARED',
],
'include_dirs': [
'.',
],
'sources': [
'<@(includes_common)',
'<@(includes_wrapper)',
],
'mac_bundle_resources': [
'<@(cefclient_bundle_resources_mac)',
],
'mac_bundle_resources!': [
# TODO(mark): Come up with a fancier way to do this (mac_info_plist?)
# that automatically sets the correct INFOPLIST_FILE setting and adds
# the file to a source group.
'cefclient/resources/mac/Info.plist',
],
'xcode_settings': {
'INFOPLIST_FILE': 'cefclient/resources/mac/Info.plist',
# Target build path.
'SYMROOT': 'xcodebuild',
},
'conditions': [
['OS=="win"', {
'variables': {
'win_exe_compatibility_manifest': 'cefclient/resources/win/compatibility.manifest',
},
'actions': [
{
'action_name': 'copy_resources',
'msvs_cygwin_shell': 0,
'inputs': [],
'outputs': [
'<(PRODUCT_DIR)/copy_resources.stamp',
],
'action': [
'xcopy /efy',
'Resources\*',
'$(OutDir)',
],
},
{
'action_name': 'copy_executables',
'msvs_cygwin_shell': 0,
'inputs': [],
'outputs': [
'<(PRODUCT_DIR)/copy_executables.stamp',
],
'action': [
'xcopy /efy',
'$(ConfigurationName)\*.exe',
'$(OutDir)',
],
},
{
'action_name': 'copy_libraries',
'msvs_cygwin_shell': 0,
'inputs': [],
'outputs': [
'<(PRODUCT_DIR)/copy_libraries.stamp',
],
'action': [
'xcopy /efy',
'$(ConfigurationName)\*.dll',
'$(OutDir)',
],
},
{
'action_name': 'copy_bin_files',
'msvs_cygwin_shell': 0,
'inputs': [],
'outputs': [
'<(PRODUCT_DIR)/copy_bin_files.stamp',
],
'action': [
'xcopy /efy',
'$(ConfigurationName)\*.bin',
'$(OutDir)',
],
},
],
'msvs_settings': {
'VCLinkerTool': {
# Set /SUBSYSTEM:WINDOWS.
'SubSystem': '2',
},
'VCManifestTool': {
'AdditionalManifestFiles': [
'cefclient/resources/win/cefclient.exe.manifest',
],
},
},
'link_settings': {
'libraries': [
'-lcomctl32.lib',
'-lshlwapi.lib',
'-lrpcrt4.lib',
'-lopengl32.lib',
'-lglu32.lib',
'-l$(ConfigurationName)/libcef.lib',
],
},
'library_dirs': [
# Needed to find cef_sandbox.lib using #pragma comment(lib, ...).
'$(ConfigurationName)',
],
'sources': [
'<@(includes_win)',
'<@(cefclient_sources_win)',
],
}],
[ 'OS=="win" and multi_threaded_dll', {
'configurations': {
'Debug': {
'msvs_settings': {
'VCCLCompilerTool': {
'RuntimeLibrary': 3,
'WarnAsError': 'false',
},
},
},
'Release': {
'msvs_settings': {
'VCCLCompilerTool': {
'RuntimeLibrary': 2,
'WarnAsError': 'false',
},
},
}
}
}],
[ 'OS=="mac"', {
'product_name': 'cefclient',
'dependencies': [
'cefclient_helper_app',
],
'copies': [
{
# Add libraries and helper app.
'destination': '<(PRODUCT_DIR)/cefclient.app/Contents/Frameworks',
'files': [
'<(PRODUCT_DIR)/cefclient Helper.app',
],
},
],
'postbuilds': [
{
'postbuild_name': 'Add framework',
'action': [
'cp',
'-Rf',
'${CONFIGURATION}/<(framework_name).framework',
'${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}.app/Contents/Frameworks/'
],
},
{
'postbuild_name': 'Fix Framework Link',
'action': [
'install_name_tool',
'-change',
'@executable_path/<(framework_name)',
'@executable_path/../Frameworks/<(framework_name).framework/<(framework_name)',
'${BUILT_PRODUCTS_DIR}/${EXECUTABLE_PATH}'
],
},
],
'link_settings': {
'libraries': [
'$(SDKROOT)/System/Library/Frameworks/AppKit.framework',
'$(SDKROOT)/System/Library/Frameworks/OpenGL.framework',
'$(CONFIGURATION)/<(framework_name).framework/<(framework_name)',
],
},
'sources': [
'<@(includes_mac)',
'<@(cefclient_sources_mac)',
],
}],
[ 'OS=="linux" or OS=="freebsd" or OS=="openbsd"', {
'copies': [
{
'destination': '<(PRODUCT_DIR)/files',
'files': [
'<@(cefclient_bundle_resources_linux)',
],
},
{
'destination': '<(PRODUCT_DIR)/',
'files': [
'Resources/cef.pak',
'Resources/cef_100_percent.pak',
'Resources/cef_200_percent.pak',
'Resources/cef_extensions.pak',
'Resources/devtools_resources.pak',
'Resources/icudtl.dat',
'Resources/locales/',
'$(BUILDTYPE)/chrome-sandbox',
'$(BUILDTYPE)/libcef.so',
'$(BUILDTYPE)/natives_blob.bin',
'$(BUILDTYPE)/snapshot_blob.bin',
],
},
],
'dependencies': [
'gtk',
'gtkglext',
],
'link_settings': {
'ldflags': [
# Look for libcef.so in the current directory. Path can also be
# specified using the LD_LIBRARY_PATH environment variable.
'-Wl,-rpath,.',
],
'libraries': [
"$(BUILDTYPE)/libcef.so",
"-lX11",
],
},
'sources': [
'<@(includes_linux)',
'<@(cefclient_sources_linux)',
],
}],
],
},
{
'target_name': 'cefsimple',
'type': 'executable',
'mac_bundle': 1,
'msvs_guid': '5390D142-473F-49A0-BC5E-5F6C609EEDB6',
'dependencies': [
'libcef_dll_wrapper',
],
'defines': [
'USING_CEF_SHARED',
],
'include_dirs': [
'.',
],
'sources': [
'<@(includes_common)',
'<@(includes_wrapper)',
'<@(cefsimple_sources_common)',
],
'mac_bundle_resources': [
'<@(cefsimple_bundle_resources_mac)',
],
'mac_bundle_resources!': [
# TODO(mark): Come up with a fancier way to do this (mac_info_plist?)
# that automatically sets the correct INFOPLIST_FILE setting and adds
# the file to a source group.
'cefsimple/mac/Info.plist',
],
'xcode_settings': {
'INFOPLIST_FILE': 'cefsimple/mac/Info.plist',
# Target build path.
'SYMROOT': 'xcodebuild',
},
'conditions': [
['OS=="win"', {
'variables': {
'win_exe_compatibility_manifest': 'cefsimple/compatibility.manifest',
},
'actions': [
{
'action_name': 'copy_resources',
'msvs_cygwin_shell': 0,
'inputs': [],
'outputs': [
'<(PRODUCT_DIR)/copy_resources.stamp',
],
'action': [
'xcopy /efy',
'Resources\*',
'$(OutDir)',
],
},
{
'action_name': 'copy_executables',
'msvs_cygwin_shell': 0,
'inputs': [],
'outputs': [
'<(PRODUCT_DIR)/copy_executables.stamp',
],
'action': [
'xcopy /efy',
'$(ConfigurationName)\*.exe',
'$(OutDir)',
],
},
{
'action_name': 'copy_libraries',
'msvs_cygwin_shell': 0,
'inputs': [],
'outputs': [
'<(PRODUCT_DIR)/copy_libraries.stamp',
],
'action': [
'xcopy /efy',
'$(ConfigurationName)\*.dll',
'$(OutDir)',
],
},
{
'action_name': 'copy_bin_files',
'msvs_cygwin_shell': 0,
'inputs': [],
'outputs': [
'<(PRODUCT_DIR)/copy_bin_files.stamp',
],
'action': [
'xcopy /efy',
'$(ConfigurationName)\*.bin',
'$(OutDir)',
],
},
],
'msvs_settings': {
'VCLinkerTool': {
# Set /SUBSYSTEM:WINDOWS.
'SubSystem': '2',
},
'VCManifestTool': {
'AdditionalManifestFiles': [
'cefsimple/cefsimple.exe.manifest',
],
},
},
'link_settings': {
'libraries': [
'-lcomctl32.lib',
'-lshlwapi.lib',
'-lrpcrt4.lib',
'-l$(ConfigurationName)/libcef.lib',
],
},
'library_dirs': [
# Needed to find cef_sandbox.lib using #pragma comment(lib, ...).
'$(ConfigurationName)',
],
'sources': [
'<@(includes_win)',
'<@(cefsimple_sources_win)',
],
}],
[ 'OS=="win" and multi_threaded_dll', {
'configurations': {
'Debug': {
'msvs_settings': {
'VCCLCompilerTool': {
'RuntimeLibrary': 3,
'WarnAsError': 'false',
},
},
},
'Release': {
'msvs_settings': {
'VCCLCompilerTool': {
'RuntimeLibrary': 2,
'WarnAsError': 'false',
},
},
}
}
}],
[ 'OS=="mac"', {
'product_name': 'cefsimple',
'dependencies': [
'cefsimple_helper_app',
],
'copies': [
{
# Add libraries and helper app.
'destination': '<(PRODUCT_DIR)/cefsimple.app/Contents/Frameworks',
'files': [
'<(PRODUCT_DIR)/cefsimple Helper.app',
],
},
],
'postbuilds': [
{
'postbuild_name': 'Add framework',
'action': [
'cp',
'-Rf',
'${CONFIGURATION}/<(framework_name).framework',
'${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}.app/Contents/Frameworks/'
],
},
{
'postbuild_name': 'Fix Framework Link',
'action': [
'install_name_tool',
'-change',
'@executable_path/<(framework_name)',
'@executable_path/../Frameworks/<(framework_name).framework/<(framework_name)',
'${BUILT_PRODUCTS_DIR}/${EXECUTABLE_PATH}'
],
},
],
'link_settings': {
'libraries': [
'$(SDKROOT)/System/Library/Frameworks/AppKit.framework',
'$(CONFIGURATION)/<(framework_name).framework/<(framework_name)',
],
},
'sources': [
'<@(includes_mac)',
'<@(cefsimple_sources_mac)',
],
}],
[ 'OS=="linux" or OS=="freebsd" or OS=="openbsd"', {
'copies': [
{
'destination': '<(PRODUCT_DIR)/',
'files': [
'Resources/cef.pak',
'Resources/cef_100_percent.pak',
'Resources/cef_200_percent.pak',
'Resources/cef_extensions.pak',
'Resources/devtools_resources.pak',
'Resources/icudtl.dat',
'Resources/locales/',
'$(BUILDTYPE)/chrome-sandbox',
'$(BUILDTYPE)/libcef.so',
'$(BUILDTYPE)/natives_blob.bin',
'$(BUILDTYPE)/snapshot_blob.bin',
],
},
],
'link_settings': {
'ldflags': [
# Look for libcef.so in the current directory. Path can also be
# specified using the LD_LIBRARY_PATH environment variable.
'-Wl,-rpath,.',
],
'libraries': [
"$(BUILDTYPE)/libcef.so",
"-lX11",
],
},
'sources': [
'<@(includes_linux)',
'<@(cefsimple_sources_linux)',
],
}],
],
},
{
'target_name': 'libcef_dll_wrapper',
'type': 'static_library',
'msvs_guid': 'A9D6DC71-C0DC-4549-AEA0-3B15B44E86A9',
'defines': [
'USING_CEF_SHARED',
],
'include_dirs': [
'.',
],
'sources': [
'<@(includes_common)',
'<@(includes_capi)',
'<@(includes_wrapper)',
'<@(libcef_dll_wrapper_sources_base)',
'<@(libcef_dll_wrapper_sources_common)',
],
'xcode_settings': {
# Target build path.
'SYMROOT': 'xcodebuild',
},
'conditions': [
[ 'OS=="win" and multi_threaded_dll', {
'configurations': {
'Debug': {
'msvs_settings': {
'VCCLCompilerTool': {
'RuntimeLibrary': 3,
'WarnAsError': 'false',
},
},
},
'Release': {
'msvs_settings': {
'VCCLCompilerTool': {
'RuntimeLibrary': 2,
'WarnAsError': 'false',
},
},
}
}
}],
],
},
],
'conditions': [
['OS=="mac"', {
'targets': [
{
'target_name': 'cefclient_helper_app',
'type': 'executable',
'variables': { 'enable_wexit_time_destructors': 1, },
'product_name': 'cefclient Helper',
'mac_bundle': 1,
'dependencies': [
'libcef_dll_wrapper',
],
'defines': [
'USING_CEF_SHARED',
],
'include_dirs': [
'.',
],
'link_settings': {
'libraries': [
'$(SDKROOT)/System/Library/Frameworks/AppKit.framework',
'$(CONFIGURATION)/<(framework_name).framework/<(framework_name)',
],
},
'sources': [
'<@(cefclient_sources_mac_helper)',
],
# TODO(mark): Come up with a fancier way to do this. It should only
# be necessary to list helper-Info.plist once, not the three times it
# is listed here.
'mac_bundle_resources!': [
'cefclient/resources/mac/helper-Info.plist',
],
# TODO(mark): For now, don't put any resources into this app. Its
# resources directory will be a symbolic link to the browser app's
# resources directory.
'mac_bundle_resources/': [
['exclude', '.*'],
],
'xcode_settings': {
'INFOPLIST_FILE': 'cefclient/resources/mac/helper-Info.plist',
},
'postbuilds': [
{
# The framework defines its load-time path
# (DYLIB_INSTALL_NAME_BASE) relative to the main executable
# (chrome). A different relative path needs to be used in
# cefclient_helper_app.
'postbuild_name': 'Fix Framework Link',
'action': [
'install_name_tool',
'-change',
'@executable_path/<(framework_name)',
'@executable_path/../../../../Frameworks/<(framework_name).framework/<(framework_name)',
'${BUILT_PRODUCTS_DIR}/${EXECUTABLE_PATH}'
],
},
],
}, # target cefclient_helper_app
{
'target_name': 'cefsimple_helper_app',
'type': 'executable',
'variables': { 'enable_wexit_time_destructors': 1, },
'product_name': 'cefsimple Helper',
'mac_bundle': 1,
'dependencies': [
'libcef_dll_wrapper',
],
'defines': [
'USING_CEF_SHARED',
],
'include_dirs': [
'.',
],
'link_settings': {
'libraries': [
'$(SDKROOT)/System/Library/Frameworks/AppKit.framework',
'$(CONFIGURATION)/<(framework_name).framework/<(framework_name)',
],
},
'sources': [
'<@(cefsimple_sources_mac_helper)',
],
# TODO(mark): Come up with a fancier way to do this. It should only
# be necessary to list helper-Info.plist once, not the three times it
# is listed here.
'mac_bundle_resources!': [
'cefsimple/mac/helper-Info.plist',
],
# TODO(mark): For now, don't put any resources into this app. Its
# resources directory will be a symbolic link to the browser app's
# resources directory.
'mac_bundle_resources/': [
['exclude', '.*'],
],
'xcode_settings': {
'INFOPLIST_FILE': 'cefsimple/mac/helper-Info.plist',
},
'postbuilds': [
{
# The framework defines its load-time path
# (DYLIB_INSTALL_NAME_BASE) relative to the main executable
# (chrome). A different relative path needs to be used in
# cefsimple_helper_app.
'postbuild_name': 'Fix Framework Link',
'action': [
'install_name_tool',
'-change',
'@executable_path/<(framework_name)',
'@executable_path/../../../../Frameworks/<(framework_name).framework/<(framework_name)',
'${BUILT_PRODUCTS_DIR}/${EXECUTABLE_PATH}'
],
},
],
}, # target cefsimple_helper_app
],
}], # OS=="mac"
[ 'OS=="linux" or OS=="freebsd" or OS=="openbsd"', {
'targets': [
{
'target_name': 'gtk',
'type': 'none',
'variables': {
# gtk requires gmodule, but it does not list it as a dependency
# in some misconfigured systems.
'gtk_packages': 'gmodule-2.0 gtk+-2.0 gthread-2.0 gtk+-unix-print-2.0',
},
'direct_dependent_settings': {
'cflags': [
'$(shell <(pkg-config) --cflags <(gtk_packages))',
],
},
'link_settings': {
'ldflags': [
'$(shell <(pkg-config) --libs-only-L --libs-only-other <(gtk_packages))',
],
'libraries': [
'$(shell <(pkg-config) --libs-only-l <(gtk_packages))',
],
},
},
{
'target_name': 'gtkglext',
'type': 'none',
'variables': {
# gtkglext is required by the cefclient OSR example.
'gtk_packages': 'gtkglext-1.0',
},
'direct_dependent_settings': {
'cflags': [
'$(shell <(pkg-config) --cflags <(gtk_packages))',
],
},
'link_settings': {
'ldflags': [
'$(shell <(pkg-config) --libs-only-L --libs-only-other <(gtk_packages))',
],
'libraries': [
'$(shell <(pkg-config) --libs-only-l <(gtk_packages))',
],
},
},
],
}], # OS=="linux" or OS=="freebsd" or OS=="openbsd"
],
}

View File

@ -26,101 +26,75 @@ else:
print "\nGenerating CEF version header file..." print "\nGenerating CEF version header file..."
gyper = [ 'python', 'tools/make_version_header.py', cmd = [ 'python', 'tools/make_version_header.py',
'--header', 'include/cef_version.h', '--header', 'include/cef_version.h',
'--cef_version', 'VERSION', '--cef_version', 'VERSION',
'--chrome_version', '../chrome/VERSION', '--chrome_version', '../chrome/VERSION',
'--cpp_header_dir', 'include' ] '--cpp_header_dir', 'include' ]
RunAction(cef_dir, gyper) RunAction(cef_dir, cmd)
print "\nPatching build configuration and source files for CEF..." print "\nPatching build configuration and source files for CEF..."
patcher = [ 'python', 'tools/patcher.py', cmd = [ 'python', 'tools/patcher.py',
'--patch-config', 'patch/patch.cfg' ] '--patch-config', 'patch/patch.cfg' ]
RunAction(cef_dir, patcher) RunAction(cef_dir, cmd)
print "\nGenerating CEF project files..." print "\nGenerating CEF project files..."
# Whether to use GN or GYP. GN is currently the default.
use_gn = bool(int(os.environ.get('CEF_USE_GN', '1')))
gn_args = {} gn_args = {}
custom_toolchain = False
if platform == 'windows': if platform == 'windows':
# Force use of the locally installed version of Visual Studio. # Force use of the locally installed version of Visual Studio.
if not 'DEPOT_TOOLS_WIN_TOOLCHAIN' in os.environ: if not 'DEPOT_TOOLS_WIN_TOOLCHAIN' in os.environ:
os.environ['DEPOT_TOOLS_WIN_TOOLCHAIN'] = '0' os.environ['DEPOT_TOOLS_WIN_TOOLCHAIN'] = '0'
# By default GN/GYP+Ninja on Windows expects Visual Studio to be installed on # By default GN+Ninja on Windows expects Visual Studio to be installed on
# the local machine. To build when Visual Studio is extracted to a directory # the local machine. To build when Visual Studio is extracted to a directory
# but not installed (e.g. via a custom toolchain): # but not installed (e.g. via a custom toolchain) set the following
# environment variables:
#
# set WIN_CUSTOM_TOOLCHAIN=1 # set WIN_CUSTOM_TOOLCHAIN=1
# set CEF_VCVARS=none # set VS_VERSION=<VS version>
# set GYP_MSVS_VERSION=<VS version> # set VS_CRT_ROOT=<VS CRT root directory>
# set VS_ROOT=<VS root directory> # set VS_ROOT=<VS root directory>
# set VS_CRT_ROOT=<VS CRT root directory> (GN only)
# set SDK_ROOT=<Platform SDK root directory> # set SDK_ROOT=<Platform SDK root directory>
# set INCLUDE=<VS include paths> # set INCLUDE=<VS include paths>
# set PATH=<VS executable paths>
# set LIB=<VS library paths> # set LIB=<VS library paths>
# set PATH=<VS executable paths>
#
if bool(int(os.environ.get('WIN_CUSTOM_TOOLCHAIN', '0'))): if bool(int(os.environ.get('WIN_CUSTOM_TOOLCHAIN', '0'))):
required_vars = [ required_vars = [
'GYP_MSVS_VERSION', 'VS_VERSION',
'VS_CRT_ROOT',
'VS_ROOT', 'VS_ROOT',
'SDK_ROOT', 'SDK_ROOT',
'INCLUDE', 'INCLUDE',
'PATH',
'LIB', 'LIB',
'PATH',
] ]
if use_gn:
required_vars.append('VS_CRT_ROOT')
for var in required_vars: for var in required_vars:
if not var in os.environ.keys(): if not var in os.environ.keys():
raise Exception('%s environment variable must be set' % var) raise Exception('%s environment variable must be set' % var)
custom_toolchain = True # VC variables for CEF will be set via INCLUDE/LIB/PATH.
# TODO(cef): Make INCLUDE/PATH/LIB values optional when
# VC variables will be set via INCLUDE/PATH/LIB. # "%VS_ROOT%\VC\vcvarsall.bat" exists (use those values instead).
os.environ['CEF_VCVARS'] = 'none' os.environ['CEF_VCVARS'] = 'none'
# Necessary to return correct VS version information via GetVSVersion in # Checked in build/toolchain/win/setup_toolchain.py _LoadToolchainEnv.
# src/tools/gyp/pylib/gyp/msvs_emulation.py. # If "%VS_ROOT%\VC\vcvarsall.bat" exists then environment variables will
# be derived from there and the specified INCLUDE/LIB/PATH values, if any,
# will be ignored by Chromium. If this file does not exist then the
# INCLUDE/LIB/PATH values are also required by Chromium.
os.environ['GYP_MSVS_OVERRIDE_PATH'] = os.environ['VS_ROOT'] os.environ['GYP_MSVS_OVERRIDE_PATH'] = os.environ['VS_ROOT']
if use_gn:
# Windows custom toolchain requirements. See comments in gn_args.py. # Windows custom toolchain requirements. See comments in gn_args.py.
gn_args['visual_studio_path'] = os.environ['VS_ROOT'] gn_args['visual_studio_path'] = os.environ['VS_ROOT']
gn_args['visual_studio_version'] = os.environ['GYP_MSVS_VERSION'] gn_args['visual_studio_version'] = os.environ['VS_VERSION']
gn_args['visual_studio_runtime_dirs'] = os.environ['VS_CRT_ROOT'] gn_args['visual_studio_runtime_dirs'] = os.environ['VS_CRT_ROOT']
gn_args['windows_sdk_path'] = os.environ['SDK_ROOT'] gn_args['windows_sdk_path'] = os.environ['SDK_ROOT']
else:
# Set windows_sdk_path via GYP_DEFINES.
gyp_defines = ''
if 'GYP_DEFINES' in os.environ:
gyp_defines = os.environ['GYP_DEFINES'] + ' '
gyp_defines = \
gyp_defines + \
'windows_sdk_path=' + os.environ['SDK_ROOT'].replace('\\', '/')
os.environ['GYP_DEFINES'] = gyp_defines
# Generate environment files (environment.x64, environment.x86) in each configs = GetAllPlatformConfigs(gn_args)
# build output directory. for dir, config in configs.items():
# When using the default toolchain this is done by
# GenerateEnvironmentFiles in src/tools/gyp/pylib/gyp/msvs_emulation.py.
setup_script = os.path.join(cef_dir, 'tools/setup_toolchain.py')
win_tool_script = os.path.join(src_dir, 'tools/gyp/pylib/gyp/win_tool.py')
out_dirs = ['Debug', 'Debug_x64', 'Release', 'Release_x64']
for out_dir in out_dirs:
out_dir_abs = os.path.join(src_dir, 'out', out_dir)
if not os.path.exists(out_dir_abs):
os.makedirs(out_dir_abs)
cmd = ['python', setup_script,
os.environ['VS_ROOT'], win_tool_script, os.environ['SDK_ROOT']]
RunAction(out_dir_abs, cmd)
if use_gn:
configs = GetAllPlatformConfigs(gn_args)
for dir, config in configs.items():
# Create out directories and write the args.gn file. # Create out directories and write the args.gn file.
out_path = os.path.join(src_dir, 'out', dir) out_path = os.path.join(src_dir, 'out', dir)
make_dir(out_path, False) make_dir(out_path, False)
@ -133,12 +107,3 @@ if use_gn:
if 'GN_ARGUMENTS' in os.environ.keys(): if 'GN_ARGUMENTS' in os.environ.keys():
cmd.extend(os.environ['GN_ARGUMENTS'].split(' ')) cmd.extend(os.environ['GN_ARGUMENTS'].split(' '))
RunAction(src_dir, cmd) RunAction(src_dir, cmd)
else:
os.environ['CEF_DIRECTORY'] = os.path.basename(cef_dir)
gyper = [ 'python', '../build/gyp_chromium', 'cef.gyp', '-I', 'cef.gypi' ]
if custom_toolchain:
# Disable GYP's auto-detection of the VS install.
gyper.extend(['-G', 'ninja_use_custom_environment_files'])
if 'GYP_ARGUMENTS' in os.environ.keys():
gyper.extend(os.environ['GYP_ARGUMENTS'].split(' '))
RunAction(cef_dir, gyper)

View File

@ -207,7 +207,7 @@ def ValidateArgs(args):
# Windows custom toolchain requirements. # Windows custom toolchain requirements.
# See tools/depot_tools/win_toolchain/package_from_installed.py for an # See tools/depot_tools/win_toolchain/package_from_installed.py for an
# example packaging script along with required directory contents and # example packaging script along with required directory contents and
# PATH/LIB/INCLUDE values. # INCLUDE/LIB/PATH values.
# #
# Required GN arguments: # Required GN arguments:
# visual_studio_path="<path to VS root>" # visual_studio_path="<path to VS root>"
@ -225,24 +225,41 @@ def ValidateArgs(args):
# #
# Required environment variables: # Required environment variables:
# DEPOT_TOOLS_WIN_TOOLCHAIN=0 # DEPOT_TOOLS_WIN_TOOLCHAIN=0
# GYP_MSVS_OVERRIDE_PATH=<path to VS root, must match visual_studio_path>
# CEF_VCVARS=none # CEF_VCVARS=none
# GYP_MSVS_OVERRIDE_PATH=<path to VS root>
# PATH=<VS executable paths>
# LIB=<VS library paths>
# INCLUDE=<VS include paths> # INCLUDE=<VS include paths>
# LIB=<VS library paths>
# PATH=<VS executable paths>
#
if visual_studio_path != '': if visual_studio_path != '':
assert visual_studio_version != '', 'visual_studio_path requires visual_studio_version' assert visual_studio_version != '', 'visual_studio_path requires visual_studio_version'
assert visual_studio_runtime_dirs != '', 'visual_studio_path requires visual_studio_runtime_dirs' assert visual_studio_runtime_dirs != '', 'visual_studio_path requires visual_studio_runtime_dirs'
assert windows_sdk_path != '', 'visual_studio_path requires windows_sdk_path' assert windows_sdk_path != '', 'visual_studio_path requires windows_sdk_path'
assert bool(int(os.environ.get('DEPOT_TOOLS_WIN_TOOLCHAIN', 0))), \
"visual_studio_path requires DEPOT_TOOLS_WIN_TOOLCHAIN=0 env variable" # VC variables for CEF will be set via INCLUDE/LIB/PATH.
# TODO(cef): Make INCLUDE/LIB/PATH values optional when
# "%VS_ROOT%\VC\vcvarsall.bat" exists (use those values instead).
assert os.environ.get('CEF_VCVARS', '') == 'none', \ assert os.environ.get('CEF_VCVARS', '') == 'none', \
"visual_studio_path requires CEF_VCVARS=none env variable" "visual_studio_path requires CEF_VCVARS=none env variable"
assert 'GYP_MSVS_OVERRIDE_PATH' is os.environ \ assert 'INCLUDE' in os.environ \
and 'PATH' in os.environ \
and 'LIB' in os.environ \ and 'LIB' in os.environ \
and 'INCLUDE' in os.environ, \ and 'PATH' in os.environ, \
"visual_studio_path requires GYP_MSVS_OVERRIDE_PATH, PATH, LIB and INCLUDE env variables" "visual_studio_path requires INCLUDE, LIB and PATH env variables"
# Checked in build/toolchain/win/setup_toolchain.py _LoadToolchainEnv.
# If "%VS_ROOT%\VC\vcvarsall.bat" exists then environment variables will
# be derived from there and the specified INCLUDE/LIB/PATH values, if any,
# will be ignored by Chromium. If this file does not exist then the
# INCLUDE/LIB/PATH values are also required by Chromium.
assert bool(int(os.environ.get('DEPOT_TOOLS_WIN_TOOLCHAIN', 0))), \
"visual_studio_path requires DEPOT_TOOLS_WIN_TOOLCHAIN=0 env variable"
msvs_path = os.environ.get('GYP_MSVS_OVERRIDE_PATH', '')
assert msvs_path == visual_studio_path and os.path.exists(msvs_path), \
"visual_studio_path requires matching GYP_MSVS_OVERRIDE_PATH env variable"
vcvars_path = os.path.join(msvs_path, 'VC', 'vcvarsall.bat')
if (os.path.exists(vcvars_path)):
msg('INCLUDE/LIB/PATH values will be derived from %s' % vcvars_path)
def GetConfigArgs(args, is_debug, is_x64): def GetConfigArgs(args, is_debug, is_x64):
""" """

View File

@ -282,9 +282,6 @@ elif sys.platform == 'darwin':
elif sys.platform.startswith('linux'): elif sys.platform.startswith('linux'):
platform = 'linux' platform = 'linux'
# Whether to use GN or GYP. GN is currently the default.
use_gn = bool(int(os.environ.get('CEF_USE_GN', '1')))
# the outputdir option is required # the outputdir option is required
if options.outputdir is None: if options.outputdir is None:
parser.print_help(sys.stderr) parser.print_help(sys.stderr)
@ -340,21 +337,6 @@ platform_arch = '32'
if options.x64build: if options.x64build:
platform_arch = '64' platform_arch = '64'
if platform == 'linux' and not use_gn:
# GYP places x86 and x64 builds in the same directory. Check file attributes
# to differentiate between them.
platform_arch = ''
lib_dir_name = 'lib'
release_libcef_path = os.path.join(src_dir, 'out', 'Release', lib_dir_name, 'libcef.so');
debug_libcef_path = os.path.join(src_dir, 'out', 'Debug', lib_dir_name, 'libcef.so');
file_desc = ''
output = subprocess.check_output('file ' + release_libcef_path + ' ' + debug_libcef_path + '; exit 0',
env=os.environ, stderr=subprocess.STDOUT, shell=True)
if output.find('32-bit') != -1:
platform_arch = '32'
if output.find('64-bit') != -1:
platform_arch = '64'
# output directory # output directory
output_dir_base = 'cef_binary_' + cef_ver output_dir_base = 'cef_binary_' + cef_ver
@ -388,20 +370,12 @@ cef_paths = cef_paths['variables']
cef_paths2 = eval_file(os.path.join(cef_dir, 'cef_paths2.gypi')) cef_paths2 = eval_file(os.path.join(cef_dir, 'cef_paths2.gypi'))
cef_paths2 = cef_paths2['variables'] cef_paths2 = cef_paths2['variables']
# Determine the build directory suffix. # Determine the build directory suffix. CEF uses a consistent directory naming
build_dir_suffix = '' # scheme for GN via GetAllPlatformConfigs in gn_args.py.
if use_gn: if options.x64build:
# CEF uses a consistent directory naming scheme for GN via
# GetAllPlatformConfigs in gn_args.py.
if options.x64build:
build_dir_suffix = '_GN_x64' build_dir_suffix = '_GN_x64'
else:
build_dir_suffix = '_GN_x86'
else: else:
# GYP outputs both x86 and x64 builds to the same directory on Linux and build_dir_suffix = '_GN_x86'
# Mac OS X. On Windows it suffixes the directory name for x64 builds.
if platform == 'windows' and options.x64build:
build_dir_suffix = '_x64'
# Determine the build directory paths. # Determine the build directory paths.
out_dir = os.path.join(src_dir, 'out') out_dir = os.path.join(src_dir, 'out')
@ -509,7 +483,6 @@ if mode == 'standard':
variables, options.quiet) variables, options.quiet)
# transfer gyp files # transfer gyp files
copy_file(os.path.join(script_dir, 'distrib/cefclient.gyp'), output_dir, options.quiet)
paths_gypi = os.path.join(cef_dir, 'cef_paths2.gypi') paths_gypi = os.path.join(cef_dir, 'cef_paths2.gypi')
data = read_file(paths_gypi) data = read_file(paths_gypi)
data = data.replace('tests/cefclient/', 'cefclient/') data = data.replace('tests/cefclient/', 'cefclient/')
@ -526,7 +499,7 @@ if platform == 'windows':
'libGLESv2.dll', 'libGLESv2.dll',
'natives_blob.bin', 'natives_blob.bin',
'snapshot_blob.bin', 'snapshot_blob.bin',
# Should match the output path from src/media/cdm_paths.gypi. # Should match the output path from media/cdm/ppapi/cdm_paths.gni.
'WidevineCdm\\_platform_specific\\win_%s\\widevinecdmadapter.dll' % \ 'WidevineCdm\\_platform_specific\\win_%s\\widevinecdmadapter.dll' % \
('x64' if options.x64build else 'x86'), ('x64' if options.x64build else 'x86'),
] ]
@ -535,13 +508,10 @@ if platform == 'windows':
sandbox_libs = [ sandbox_libs = [
'obj\\base\\base.lib', 'obj\\base\\base.lib',
'obj\\base\\base_static.lib', 'obj\\base\\base_static.lib',
'obj\\cef\\cef_sandbox.lib',
'obj\\base\\third_party\\dynamic_annotations\\dynamic_annotations.lib', 'obj\\base\\third_party\\dynamic_annotations\\dynamic_annotations.lib',
'obj\\cef\\cef_sandbox.lib',
'obj\\sandbox\\win\\sandbox.lib',
] ]
if use_gn:
sandbox_libs.append('obj\\sandbox\\win\\sandbox.lib')
else:
sandbox_libs.append('obj\\sandbox\\sandbox.lib')
valid_build_dir = None valid_build_dir = None

View File

@ -1,211 +0,0 @@
#!/usr/bin/env python
# Copyright (c) 2011 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.
"""Helper script to repack paks for a list of locales.
Gyp doesn't have any built-in looping capability, so this just provides a way to
loop over a list of locales when repacking pak files, thus avoiding a
proliferation of mostly duplicate, cut-n-paste gyp actions.
"""
import getopt
import os
import sys
sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..',
'tools', 'grit'))
from grit.format import data_pack
# Some build paths defined by gyp.
GRIT_DIR = None
SHARE_INT_DIR = None
INT_DIR = None
class Usage(Exception):
def __init__(self, msg):
self.msg = msg
def calc_output(locale, create_dir):
"""Determine the file that will be generated for the given locale."""
#e.g. '<(INTERMEDIATE_DIR)/da.pak',
# For Fake Bidi, generate it at a fixed path so that tests can safely
# reference it.
if locale == 'fake-bidi':
return '%s/%s.pak' % (INT_DIR, locale)
if sys.platform in ('darwin',):
# For Cocoa to find the locale at runtime, it needs to use '_' instead
# of '-' (http://crbug.com/20441). Also, 'en-US' should be represented
# simply as 'en' (http://crbug.com/19165, http://crbug.com/25578).
if locale == 'en-US':
locale = 'en'
dir = '%s/%s.lproj' % (INT_DIR, locale.replace('-', '_'))
if create_dir and not os.path.exists(dir):
os.makedirs(dir)
return dir + '/locale.pak'
else:
return os.path.join(INT_DIR, locale + '.pak')
def calc_inputs(locale):
"""Determine the files that need processing for the given locale."""
inputs = []
#e.g.
# '<(SHARED_INTERMEDIATE_DIR)/chrome/generated_resources_da.pak'
inputs.append(os.path.join(SHARE_INT_DIR, 'chrome',
'generated_resources_%s.pak' % locale))
#e.g.
# '<(SHARED_INTERMEDIATE_DIR)/chrome/locale_settings_da.pak'
inputs.append(os.path.join(SHARE_INT_DIR, 'chrome',
'locale_settings_%s.pak' % locale))
#e.g.
# '<(SHARED_INTERMEDIATE_DIR)/chrome/platform_locale_settings_da.pak'
inputs.append(os.path.join(SHARE_INT_DIR, 'chrome',
'platform_locale_settings_%s.pak' % locale))
#e.g.
# '<(SHARED_INTERMEDIATE_DIR)/components/strings/components_locale_settings_da.pak'
inputs.append(os.path.join(SHARE_INT_DIR, 'components', 'strings',
'components_locale_settings_%s.pak' % locale))
#e.g.
# '<(SHARED_INTERMEDIATE_DIR)/components/strings/components_strings_da.pak'
inputs.append(os.path.join(SHARE_INT_DIR, 'components', 'strings',
'components_strings_%s.pak' % locale))
#e.g.
# '<(SHARED_INTERMEDIATE_DIR)/content/app/strings/content_strings_da.pak'
inputs.append(os.path.join(SHARE_INT_DIR, 'content', 'app', 'strings',
'content_strings_%s.pak' % locale))
#e.g.
# '<(SHARED_INTERMEDIATE_DIR)/extensions/strings/extensions_strings_da.pak'
inputs.append(os.path.join(SHARE_INT_DIR, 'extensions', 'strings',
'extensions_strings_%s.pak' % locale))
#e.g. '<(SHARED_INTERMEDIATE_DIR)/ui/strings/ui_strings_da.pak',
inputs.append(os.path.join(SHARE_INT_DIR, 'ui', 'strings',
'ui_strings_%s.pak' % locale))
#e.g. '<(SHARED_INTERMEDIATE_DIR)/ui/strings/app_locale_settings_da.pak',
inputs.append(os.path.join(SHARE_INT_DIR, 'ui', 'strings',
'app_locale_settings_%s.pak' % locale))
#e.g. '<(SHARED_INTERMEDIATE_DIR)/cef/cef_strings_da.pak'
inputs.append(os.path.join(SHARE_INT_DIR, 'cef',
'cef_strings_%s.pak' % locale))
return inputs
def list_outputs(locales):
"""Returns the names of files that will be generated for the given locales.
This is to provide gyp the list of output files, so build targets can
properly track what needs to be built.
"""
outputs = []
for locale in locales:
outputs.append(calc_output(locale, False))
# Quote each element so filename spaces don't mess up gyp's attempt to parse
# it into a list.
return " ".join(['"%s"' % x for x in outputs])
def list_inputs(locales):
"""Returns the names of files that will be processed for the given locales.
This is to provide gyp the list of input files, so build targets can properly
track their prerequisites.
"""
inputs = []
for locale in locales:
inputs += calc_inputs(locale)
# Quote each element so filename spaces don't mess up gyp's attempt to parse
# it into a list.
return " ".join(['"%s"' % x for x in inputs])
def repack_locales(locales):
""" Loop over and repack the given locales."""
for locale in locales:
inputs = []
inputs += calc_inputs(locale)
output = calc_output(locale, True)
data_pack.DataPack.RePack(output, inputs)
def DoMain(argv):
global GRIT_DIR
global SHARE_INT_DIR
global INT_DIR
short_options = 'iog:s:x:b:h'
long_options = 'help'
print_inputs = False
print_outputs = False
usage_msg = ''
helpstr = """\
Usage: %s [-h] [-i | -o] -g <DIR> -x <DIR> -s <DIR> <locale> [...]
-h, --help Print this help, then exit.
-i Print the expected input file list, then exit.
-o Print the expected output file list, then exit.
-g DIR GRIT build files output directory.
-x DIR Intermediate build files output directory.
-s DIR Shared intermediate build files output directory.
locale [...] One or more locales to repack.""" % (
os.path.basename(__file__))
try:
opts, locales = getopt.getopt(argv, short_options, long_options)
except getopt.GetoptError, msg:
raise Usage(str(msg))
if not locales:
usage_msg = 'Please specificy at least one locale to process.\n'
for o, a in opts:
if o in ('-i'):
print_inputs = True
elif o in ('-o'):
print_outputs = True
elif o in ('-g'):
GRIT_DIR = a
elif o in ('-s'):
SHARE_INT_DIR = a
elif o in ('-x'):
INT_DIR = a
elif o in ('-h', '--help'):
raise Usage(helpstr)
if not (GRIT_DIR and INT_DIR and SHARE_INT_DIR):
usage_msg += 'Please specify all of "-g" and "-x" and "-s".\n'
if print_inputs and print_outputs:
usage_msg += 'Please specify only one of "-i" or "-o".\n'
if usage_msg:
raise Usage(usage_msg)
if print_inputs:
return list_inputs(locales)
if print_outputs:
return list_outputs(locales)
if not os.path.exists(INT_DIR):
os.makedirs(INT_DIR)
return repack_locales(locales)
if __name__ == '__main__':
results = DoMain(sys.argv[1:])
if results:
print results

View File

@ -1,112 +0,0 @@
# Copyright (c) 2013 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.
import errno
import os
import re
import subprocess
import sys
"""
Copies the given "win tool" (which the toolchain uses to wrap compiler
invocations) and the environment blocks for the 32-bit and 64-bit builds on
Windows to the build directory.
The arguments are the visual studio install location and the location of the
win tool. The script assumes that the root build directory is the current dir
and the files will be written to the current directory.
"""
def ExtractImportantEnvironment():
"""Extracts environment variables required for the toolchain from the
current environment."""
# This list should be kept synchronized with _ExtractImportantEnvironment from
# tools/gyp/pylib/gyp/msvs_emulation.py.
envvars_to_save = (
'goma_.*', # TODO(scottmg): This is ugly, but needed for goma.
'include', # Needed by midl compiler.
'lib',
'libpath',
'path',
'pathext',
'systemroot',
'temp',
'tmp',
)
result = {}
for envvar in envvars_to_save:
if envvar in os.environ:
envvar = envvar.lower()
if envvar == 'path':
# Our own rules (for running gyp-win-tool) and other actions in
# Chromium rely on python being in the path. Add the path to this
# python here so that if it's not in the path when ninja is run
# later, python will still be found.
result[envvar.upper()] = os.path.dirname(sys.executable) + \
os.pathsep + os.environ[envvar]
else:
result[envvar.upper()] = os.environ[envvar]
for required in ('SYSTEMROOT', 'TEMP', 'TMP'):
if required not in result:
raise Exception('Environment variable "%s" '
'required to be set to valid path' % required)
return result
def FormatAsEnvironmentBlock(envvar_dict):
"""Format as an 'environment block' directly suitable for CreateProcess.
Briefly this is a list of key=value\0, terminated by an additional \0. See
CreateProcess documentation for more details."""
block = ''
nul = '\0'
for key, value in envvar_dict.iteritems():
block += key + '=' + value + nul
block += nul
return block
def CopyTool(source_path):
"""Copies the given tool to the current directory, including a warning not
to edit it."""
with open(source_path) as source_file:
tool_source = source_file.readlines()
# Add header and write it out to the current directory (which should be the
# root build dir).
with open("gyp-win-tool", 'w') as tool_file:
tool_file.write(''.join([tool_source[0],
'# Generated by setup_toolchain.py do not edit.\n']
+ tool_source[1:]))
if len(sys.argv) != 4:
print('Usage setup_toolchain.py '
'<visual studio path> <win tool path> <win sdk path>')
sys.exit(2)
vs_path = sys.argv[1]
tool_source = sys.argv[2]
win_sdk_path = sys.argv[3]
CopyTool(tool_source)
important_env_vars = ExtractImportantEnvironment()
path = important_env_vars["PATH"].split(";")
# Add 32-bit compiler path to the beginning and write the block.
path32 = [os.path.join(vs_path, "VC\\BIN\\amd64_x86")] + \
[os.path.join(win_sdk_path, "bin\\x86")] + \
path
important_env_vars["PATH"] = ";".join(path32)
environ = FormatAsEnvironmentBlock(important_env_vars)
with open('environment.x86', 'wb') as env_file:
env_file.write(environ)
# Add 64-bit compiler path to the beginning and write the block.
path64 = [os.path.join(vs_path, "VC\\BIN\\amd64")] + \
[os.path.join(win_sdk_path, "bin\\x64")] + \
path
important_env_vars["PATH"] = ";".join(path64)
environ = FormatAsEnvironmentBlock(important_env_vars)
with open('environment.x64', 'wb') as env_file:
env_file.write(environ)