Merge revision 1003, revision 1192, revision 1193 and revision 1194 changes:

- Fix ninja build on all platforms (issue #922).
- Update make_distrib.py to support ninja builds via a new "ninja-build" flag (issue #922).
- Improvements to automate.py:
-- Allow specification of the depot_tools directory via a "depot-tools" flag (issue #592).
-- Add ninja build support via a "ninja-build" flag (issue #922).
-- Allow relative paths for download directories (issue #942).
-- Add the ability to print commands without executing them via a "dry-run" flag.
-- Specifying the "force-clean" flag will also remove the build output directory.

git-svn-id: https://chromiumembedded.googlecode.com/svn/branches/1364@1196 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
Marshall Greenblatt 2013-04-10 18:48:04 +00:00
parent 241d2c6794
commit d6042cc8b9
4 changed files with 731 additions and 636 deletions

View File

@ -109,27 +109,23 @@
'cefclient_helper_app',
'interpose_dependency_shim',
],
'variables': {
'PRODUCT_NAME': 'cefclient',
},
'copies': [
{
# Add library dependencies to the bundle.
'destination': '<(PRODUCT_DIR)/cefclient.app/Contents/Frameworks/Chromium Embedded Framework.framework/Libraries/',
'destination': '<(PRODUCT_DIR)/<(PRODUCT_NAME).app/Contents/Frameworks/Chromium Embedded Framework.framework/Libraries/',
'files': [
'<(PRODUCT_DIR)/libcef.dylib',
'<(PRODUCT_DIR)/ffmpegsumo.so',
],
},
{
# Add localized resources to the bundle.
'destination': '<(PRODUCT_DIR)/cefclient.app/Contents/Frameworks/Chromium Embedded Framework.framework/Resources/',
'files': [
'<!@pymod_do_main(repack_locales -o -g <(grit_out_dir) -s <(SHARED_INTERMEDIATE_DIR) -x <(INTERMEDIATE_DIR) <(locales))',
],
},
{
# Add the helper app.
'destination': '<(PRODUCT_DIR)/cefclient.app/Contents/Frameworks',
'destination': '<(PRODUCT_DIR)/<(PRODUCT_NAME).app/Contents/Frameworks',
'files': [
'<(PRODUCT_DIR)/cefclient Helper.app',
'<(PRODUCT_DIR)/<(PRODUCT_NAME) Helper.app',
'<(PRODUCT_DIR)/libplugin_carbon_interpose.dylib',
],
},
@ -145,13 +141,31 @@
'${BUILT_PRODUCTS_DIR}/${EXECUTABLE_PATH}'
],
},
{
'postbuild_name': 'Copy WebCore Resources',
'action': [
'cp',
'-Rf',
'${BUILT_PRODUCTS_DIR}/../../third_party/WebKit/Source/WebCore/Resources/',
'${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}.app/Contents/Frameworks/Chromium Embedded Framework.framework/Resources/'
],
},
{
'postbuild_name': 'Copy locale Resources',
'action': [
'cp',
'-Rf',
'${BUILT_PRODUCTS_DIR}/locales/',
'${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}.app/Contents/Frameworks/Chromium Embedded Framework.framework/Resources/'
],
},
{
'postbuild_name': 'Copy cef.pak File',
'action': [
'cp',
'-f',
'${BUILT_PRODUCTS_DIR}/cef.pak',
'${BUILT_PRODUCTS_DIR}/cefclient.app/Contents/Frameworks/Chromium Embedded Framework.framework/Resources/cef.pak'
'${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}.app/Contents/Frameworks/Chromium Embedded Framework.framework/Resources/cef.pak'
],
},
{
@ -160,16 +174,7 @@
'cp',
'-f',
'${BUILT_PRODUCTS_DIR}/devtools_resources.pak',
'${BUILT_PRODUCTS_DIR}/cefclient.app/Contents/Frameworks/Chromium Embedded Framework.framework/Resources/devtools_resources.pak'
],
},
{
'postbuild_name': 'Copy WebCore Resources',
'action': [
'cp',
'-Rf',
'${BUILT_PRODUCTS_DIR}/../../third_party/WebKit/Source/WebCore/Resources/',
'${BUILT_PRODUCTS_DIR}/cefclient.app/Contents/Frameworks/Chromium Embedded Framework.framework/Resources/'
'${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}.app/Contents/Frameworks/Chromium Embedded Framework.framework/Resources/devtools_resources.pak'
],
},
{
@ -305,30 +310,26 @@
'dependencies': [
'cef_unittests_helper_app',
],
'variables': {
'PRODUCT_NAME': 'cef_unittests',
},
'run_as': {
'action': ['${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}.app/Contents/MacOS/${PRODUCT_NAME}'],
},
'copies': [
{
# Add library dependencies to the bundle.
'destination': '<(PRODUCT_DIR)/cef_unittests.app/Contents/Frameworks/Chromium Embedded Framework.framework/Libraries/',
'destination': '<(PRODUCT_DIR)/<(PRODUCT_NAME).app/Contents/Frameworks/Chromium Embedded Framework.framework/Libraries/',
'files': [
'<(PRODUCT_DIR)/libcef.dylib',
'<(PRODUCT_DIR)/ffmpegsumo.so',
],
},
{
# Add localized resources to the bundle.
'destination': '<(PRODUCT_DIR)/cef_unittests.app/Contents/Frameworks/Chromium Embedded Framework.framework/Resources/',
'files': [
'<!@pymod_do_main(repack_locales -o -g <(grit_out_dir) -s <(SHARED_INTERMEDIATE_DIR) -x <(INTERMEDIATE_DIR) <(locales))',
],
},
{
# Add the helper app.
'destination': '<(PRODUCT_DIR)/cef_unittests.app/Contents/Frameworks',
'destination': '<(PRODUCT_DIR)/<(PRODUCT_NAME).app/Contents/Frameworks',
'files': [
'<(PRODUCT_DIR)/cef_unittests Helper.app',
'<(PRODUCT_DIR)/<(PRODUCT_NAME) Helper.app',
],
},
],
@ -343,13 +344,31 @@
'${BUILT_PRODUCTS_DIR}/${EXECUTABLE_PATH}'
],
},
{
'postbuild_name': 'Copy WebCore Resources',
'action': [
'cp',
'-Rf',
'${BUILT_PRODUCTS_DIR}/../../third_party/WebKit/Source/WebCore/Resources/',
'${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}.app/Contents/Frameworks/Chromium Embedded Framework.framework/Resources/'
],
},
{
'postbuild_name': 'Copy locale Resources',
'action': [
'cp',
'-Rf',
'${BUILT_PRODUCTS_DIR}/locales/',
'${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}.app/Contents/Frameworks/Chromium Embedded Framework.framework/Resources/'
],
},
{
'postbuild_name': 'Copy cef.pak File',
'action': [
'cp',
'-f',
'${BUILT_PRODUCTS_DIR}/cef.pak',
'${BUILT_PRODUCTS_DIR}/cef_unittests.app/Contents/Frameworks/Chromium Embedded Framework.framework/Resources/cef.pak'
'${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}.app/Contents/Frameworks/Chromium Embedded Framework.framework/Resources/cef.pak'
],
},
{
@ -358,16 +377,7 @@
'cp',
'-f',
'${BUILT_PRODUCTS_DIR}/devtools_resources.pak',
'${BUILT_PRODUCTS_DIR}/cef_unittests.app/Contents/Frameworks/Chromium Embedded Framework.framework/Resources/devtools_resources.pak'
],
},
{
'postbuild_name': 'Copy WebCore Resources',
'action': [
'cp',
'-Rf',
'${BUILT_PRODUCTS_DIR}/../../third_party/WebKit/Source/WebCore/Resources/',
'${BUILT_PRODUCTS_DIR}/cef_unittests.app/Contents/Frameworks/Chromium Embedded Framework.framework/Resources/'
'${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}.app/Contents/Frameworks/Chromium Embedded Framework.framework/Resources/devtools_resources.pak'
],
},
{
@ -409,34 +419,6 @@
'type': 'shared_library',
'msvs_guid': 'C13650D5-CF1A-4259-BE45-B1EBA6280E47',
'dependencies': [
'<(DEPTH)/content/content.gyp:content_app',
'<(DEPTH)/content/content.gyp:content_browser',
'<(DEPTH)/content/content.gyp:content_common',
'<(DEPTH)/content/content.gyp:content_gpu',
'<(DEPTH)/content/content.gyp:content_plugin',
'<(DEPTH)/content/content.gyp:content_ppapi_plugin',
'<(DEPTH)/content/content.gyp:content_renderer',
'<(DEPTH)/content/content.gyp:content_utility',
'<(DEPTH)/content/content.gyp:content_worker',
'<(DEPTH)/content/content_resources.gyp:content_resources',
'<(DEPTH)/base/base.gyp:base',
'<(DEPTH)/base/base.gyp:base_prefs',
'<(DEPTH)/base/third_party/dynamic_annotations/dynamic_annotations.gyp:dynamic_annotations',
'<(DEPTH)/build/temp_gyp/googleurl.gyp:googleurl',
'<(DEPTH)/ipc/ipc.gyp:ipc',
'<(DEPTH)/media/media.gyp:media',
'<(DEPTH)/net/net.gyp:net',
'<(DEPTH)/net/net.gyp:net_with_v8',
'<(DEPTH)/skia/skia.gyp:skia',
'<(DEPTH)/third_party/libxml/libxml.gyp:libxml',
'<(DEPTH)/third_party/WebKit/Source/WebCore/WebCore.gyp/WebCore.gyp:webcore',
'<(DEPTH)/third_party/WebKit/Source/WebKit/chromium/WebKit.gyp:webkit',
'<(DEPTH)/third_party/zlib/zlib.gyp:minizip',
'<(DEPTH)/ui/gl/gl.gyp:gl',
'<(DEPTH)/ui/ui.gyp:ui',
'<(DEPTH)/v8/tools/gyp/v8.gyp:v8',
'<(DEPTH)/webkit/support/webkit_support.gyp:glue',
'<(DEPTH)/webkit/support/webkit_support.gyp:webkit_storage',
'libcef_static',
],
'defines': [
@ -445,19 +427,15 @@
'include_dirs': [
'.',
],
# Avoid "RC1102: internal error : too many arguments to RCPP" error by
# explicitly specifying a short list of resource include directories.
'resource_include_dirs' : [
'.',
'..',
],
'sources': [
'<@(includes_common)',
'<@(includes_capi)',
'<@(libcef_sources_common)',
],
'xcode_settings': {
# Default path that will be changed by install_name_tool in dependent targets.
'INSTALL_PATH': '@executable_path',
'DYLIB_INSTALL_NAME_BASE': '@executable_path',
# The libcef_static target contains ObjC categories. Passing the -ObjC flag
# is necessary to properly load them and avoid a "selector not recognized"
# runtime error. See http://developer.apple.com/library/mac/#qa/qa1490/_index.html
@ -472,6 +450,11 @@
'<(DEPTH)/base/allocator/allocator.gyp:allocator',
],
}],
['toolkit_uses_gtk == 1', {
'dependencies': [
'<(DEPTH)/build/linux/system.gyp:gtk',
],
}],
['OS=="win"', {
'configurations': {
'Debug_Base': {
@ -486,8 +469,8 @@
'<@(includes_win)',
# TODO(cef): Remove webkit_unscaled_resources.rc once custom cursor
# resources can be loaded via ResourceBundle. See crbug.com/147663.
'$(OutDir)/obj/global_intermediate/webkit/webkit_resources.rc',
'$(OutDir)/obj/global_intermediate/webkit/webkit_unscaled_resources.rc',
'<(SHARED_INTERMEDIATE_DIR)/webkit/webkit_resources.rc',
'<(SHARED_INTERMEDIATE_DIR)/webkit/webkit_unscaled_resources.rc',
'libcef_dll/libcef_dll.rc',
],
'link_settings': {
@ -569,6 +552,14 @@
'variables': {
'repack_locales_cmd': ['python', 'tools/repack_locales.py'],
},
'copies': [
{
'destination': '<(PRODUCT_DIR)/locales',
'files': [
'<!@pymod_do_main(repack_locales -o -g <(grit_out_dir) -s <(SHARED_INTERMEDIATE_DIR) -x <(INTERMEDIATE_DIR) <(locales))'
],
},
],
'conditions': [
['OS=="win"', {
'actions': [
@ -621,16 +612,6 @@
},
],
}],
['OS != "mac"', {
'copies': [
{
'destination': '<(PRODUCT_DIR)/locales',
'files': [
'<!@pymod_do_main(repack_locales -o -g <(grit_out_dir) -s <(SHARED_INTERMEDIATE_DIR) -x <(INTERMEDIATE_DIR) <(locales))'
],
},
],
}],
],
},
{

View File

@ -46,6 +46,11 @@ patches = [
'name': 'renderer_main_642',
'path': '../content/renderer/',
},
{
# http://code.google.com/p/gyp/issues/detail?id=331
'name': 'gyp_331',
'path': '../tools/gyp/pylib/',
},
{
# http://code.google.com/p/chromiumembedded/issues/detail?id=364
'name': 'spi_webcore_364',

View File

@ -23,9 +23,10 @@ def run(command_line, working_dir, depot_tools_dir=None):
sys.stdout.write('-------- Running "'+command_line+'" in "'+\
working_dir+'"...'+"\n")
args = shlex.split(command_line.replace('\\', '\\\\'))
return subprocess.check_call(args, cwd=working_dir, env=env,
shell=(sys.platform == 'win32'))
if not options.dryrun:
args = shlex.split(command_line.replace('\\', '\\\\'))
return subprocess.check_call(args, cwd=working_dir, env=env,
shell=(sys.platform == 'win32'))
def check_url(url):
""" Check the URL and raise an exception if invalid. """
@ -53,6 +54,25 @@ def get_svn_info(path):
sys.stderr.write('Failed to read svn info: '+strerror+"\n")
raise
return {'url': url, 'revision': rev}
def onerror(func, path, exc_info):
"""
Error handler for ``shutil.rmtree``.
If the error is due to an access error (read only file)
it attempts to add write permission and then retries.
If the error is for another reason it re-raises the error.
Usage : ``shutil.rmtree(path, onerror=onerror)``
"""
import stat
if not os.access(path, os.W_OK):
# Is the error an access error ?
os.chmod(path, stat.S_IWUSR)
func(path)
else:
raise
# cannot be loaded as a module
if __name__ != "__main__":
@ -72,6 +92,8 @@ parser.add_option('--revision', dest='revision', type="int",
help='CEF source revision')
parser.add_option('--url', dest='url',
help='CEF source URL')
parser.add_option('--depot-tools', dest='depottools', metavar='DIR',
help='download directory for depot_tools', default='')
parser.add_option('--force-config',
action='store_true', dest='forceconfig', default=False,
help='force Chromium configuration')
@ -99,6 +121,12 @@ parser.add_option('--no-release-build',
parser.add_option('--no-distrib',
action='store_true', dest='nodistrib', default=False,
help="don't create the CEF binary distribution")
parser.add_option('--ninja-build',
action='store_true', dest='ninjabuild', default=False,
help="build using ninja")
parser.add_option('--dry-run',
action='store_true', dest='dryrun', default=False,
help="output commands without executing them")
(options, args) = parser.parse_args()
# the downloaddir option is required
@ -157,19 +185,31 @@ except Exception, e:
compat_url+"\n")
raise
download_dir = options.downloaddir
download_dir = os.path.abspath(options.downloaddir)
if not os.path.exists(download_dir):
# create the download directory
os.makedirs(download_dir)
# set the expected script extension
# Test the operating system.
platform = '';
if sys.platform == 'win32':
platform = 'windows'
elif sys.platform == 'darwin':
platform = 'macosx'
elif sys.platform.startswith('linux'):
platform = 'linux'
# set the expected script extension
if platform == 'windows':
script_ext = '.bat'
else:
script_ext = '.sh'
# check if the "depot_tools" directory exists
depot_tools_dir = os.path.join(download_dir, 'depot_tools')
if options.depottools != '':
depot_tools_dir = os.path.abspath(options.depottools)
else:
depot_tools_dir = os.path.join(download_dir, 'depot_tools')
if not os.path.exists(depot_tools_dir):
# checkout depot_tools
run('svn checkout '+depot_tools_url+' '+depot_tools_dir, download_dir)
@ -263,42 +303,61 @@ if release_url_changed or chromium_url_changed or options.forceconfig:
# run gclient config to create the .gclient file
run('gclient config '+url, chromium_dir, depot_tools_dir)
path = os.path.join(chromium_dir, '.gclient')
if not os.path.exists(path):
sys.stderr.write(".gclient file was not created\n")
raise Exception('.gclient file was not created')
if not options.dryrun:
path = os.path.join(chromium_dir, '.gclient')
if not os.path.exists(path):
sys.stderr.write(".gclient file was not created\n")
raise Exception('.gclient file was not created')
# read the resulting .gclient file
fp = open(path, 'r')
data = fp.read()
fp.close()
# read the resulting .gclient file
fp = open(path, 'r')
data = fp.read()
fp.close()
custom_deps = \
"\n "+'"src/third_party/WebKit/LayoutTests": None,'+\
"\n "+'"src/chrome_frame/tools/test/reference_build/chrome": None,'+\
"\n "+'"src/chrome/tools/test/reference_build/chrome_mac": None,'+\
"\n "+'"src/chrome/tools/test/reference_build/chrome_win": None,'+\
"\n "+'"src/chrome/tools/test/reference_build/chrome_linux": None,'
custom_deps = \
"\n "+'"src/third_party/WebKit/LayoutTests": None,'+\
"\n "+'"src/chrome_frame/tools/test/reference_build/chrome": None,'+\
"\n "+'"src/chrome/tools/test/reference_build/chrome_mac": None,'+\
"\n "+'"src/chrome/tools/test/reference_build/chrome_win": None,'+\
"\n "+'"src/chrome/tools/test/reference_build/chrome_linux": None,'
if not release_url is None:
# TODO: Read the DEPS file and exclude all non-src directories.
custom_deps += \
"\n "+'"chromeos": None,'+\
"\n "+'"depot_tools": None,'
if not release_url is None:
# TODO: Read the DEPS file and exclude all non-src directories.
custom_deps += \
"\n "+'"chromeos": None,'+\
"\n "+'"depot_tools": None,'
# populate "custom_deps" section
data = data.replace('"custom_deps" : {', '"custom_deps" : {'+custom_deps)
# populate "custom_deps" section
data = data.replace('"custom_deps" : {', '"custom_deps" : {'+custom_deps)
# write the new .gclient file
fp = open(path, 'w')
fp.write(data)
fp.close()
# write the new .gclient file
fp = open(path, 'w')
fp.write(data)
fp.close()
if options.forceclean:
if os.path.exists(chromium_src_dir):
# revert all Chromium changes and delete all unversioned files
run('gclient revert -n', chromium_dir, depot_tools_dir)
if not options.dryrun:
# remove the build output directories
output_dirs = []
if platform == 'windows':
output_dirs.append(os.path.join(chromium_src_dir, 'build\\Debug'))
output_dirs.append(os.path.join(chromium_src_dir, 'build\\Release'))
elif platform == 'macosx':
output_dirs.append(os.path.join(chromium_src_dir, 'xcodebuild'))
elif platform == 'linux':
output_dirs.append(os.path.join(chromium_src_dir, 'out'))
if options.ninjabuild:
output_dirs.append(os.path.join(chromium_src_dir, 'out'))
for output_dir in output_dirs:
if os.path.exists(output_dir):
shutil.rmtree(output_dir, onerror=onerror)
# force update, build and distrib steps
options.forceupdate = True
options.forcebuild = True
@ -314,7 +373,7 @@ elif release_url_changed or options.forceupdate:
run('gclient sync --jobs 8 --force', chromium_dir, depot_tools_dir)
if not os.path.exists(cef_src_dir) or cef_url_changed:
if cef_url_changed and os.path.exists(cef_src_dir):
if not options.dryrun and cef_url_changed and os.path.exists(cef_src_dir):
# delete the cef directory (it will be re-downloaded)
shutil.rmtree(cef_src_dir)
@ -326,22 +385,37 @@ elif cef_rev_changed or options.forceupdate:
if any_changed or options.forceupdate:
# create CEF projects
if options.ninjabuild:
os.environ['GYP_GENERATORS'] = 'ninja'
path = os.path.join(cef_src_dir, 'cef_create_projects'+script_ext)
run(path, cef_src_dir, depot_tools_dir)
if any_changed or options.forcebuild:
path = os.path.join(cef_tools_dir, 'build_projects'+script_ext)
if options.ninjabuild:
command = 'ninja -C '
target = ' cefclient'
if not options.nodebugbuild:
# make CEF Debug build
run(command + os.path.join('out', 'Debug') + target, chromium_src_dir, depot_tools_dir)
if not options.nodebugbuild:
# make CEF Debug build
run(path+' Debug', cef_tools_dir, depot_tools_dir)
if not options.noreleasebuild:
# make CEF Release build
run(command + os.path.join('out', 'Release') + target, chromium_src_dir, depot_tools_dir)
else:
path = os.path.join(cef_tools_dir, 'build_projects'+script_ext)
if not options.noreleasebuild:
# make CEF Release build
run(path+' Release', cef_tools_dir, depot_tools_dir)
if not options.nodebugbuild:
# make CEF Debug build
run(path+' Debug', cef_tools_dir, depot_tools_dir)
if not options.noreleasebuild:
# make CEF Release build
run(path+' Release', cef_tools_dir, depot_tools_dir)
if any_changed or options.forcedistrib:
if not options.nodistrib:
# make CEF binary distribution
path = os.path.join(cef_tools_dir, 'make_distrib'+script_ext)
if options.ninjabuild:
path = path + ' --ninja-build'
run(path, cef_tools_dir, depot_tools_dir)

File diff suppressed because it is too large Load Diff