Merge 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.


git-svn-id: https://chromiumembedded.googlecode.com/svn/branches/1453@1195 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
Marshall Greenblatt 2013-04-10 18:01:52 +00:00
parent 0229bac644
commit 8bb16bc943
5 changed files with 242 additions and 168 deletions

View File

@ -110,27 +110,23 @@
'cefclient_helper_app', 'cefclient_helper_app',
'interpose_dependency_shim', 'interpose_dependency_shim',
], ],
'variables': {
'PRODUCT_NAME': 'cefclient',
},
'copies': [ 'copies': [
{ {
# Add library dependencies to the bundle. # 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': [ 'files': [
'<(PRODUCT_DIR)/libcef.dylib', '<(PRODUCT_DIR)/libcef.dylib',
'<(PRODUCT_DIR)/ffmpegsumo.so', '<(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. # Add the helper app.
'destination': '<(PRODUCT_DIR)/cefclient.app/Contents/Frameworks', 'destination': '<(PRODUCT_DIR)/<(PRODUCT_NAME).app/Contents/Frameworks',
'files': [ 'files': [
'<(PRODUCT_DIR)/cefclient Helper.app', '<(PRODUCT_DIR)/<(PRODUCT_NAME) Helper.app',
'<(PRODUCT_DIR)/libplugin_carbon_interpose.dylib', '<(PRODUCT_DIR)/libplugin_carbon_interpose.dylib',
], ],
}, },
@ -146,13 +142,31 @@
'${BUILT_PRODUCTS_DIR}/${EXECUTABLE_PATH}' '${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', 'postbuild_name': 'Copy cef.pak File',
'action': [ 'action': [
'cp', 'cp',
'-f', '-f',
'${BUILT_PRODUCTS_DIR}/cef.pak', '${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'
], ],
}, },
{ {
@ -161,16 +175,7 @@
'cp', 'cp',
'-f', '-f',
'${BUILT_PRODUCTS_DIR}/devtools_resources.pak', '${BUILT_PRODUCTS_DIR}/devtools_resources.pak',
'${BUILT_PRODUCTS_DIR}/cefclient.app/Contents/Frameworks/Chromium Embedded Framework.framework/Resources/devtools_resources.pak' '${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}.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/'
], ],
}, },
{ {
@ -308,30 +313,26 @@
'dependencies': [ 'dependencies': [
'cef_unittests_helper_app', 'cef_unittests_helper_app',
], ],
'variables': {
'PRODUCT_NAME': 'cef_unittests',
},
'run_as': { 'run_as': {
'action': ['${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}.app/Contents/MacOS/${PRODUCT_NAME}'], 'action': ['${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}.app/Contents/MacOS/${PRODUCT_NAME}'],
}, },
'copies': [ 'copies': [
{ {
# Add library dependencies to the bundle. # 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': [ 'files': [
'<(PRODUCT_DIR)/libcef.dylib', '<(PRODUCT_DIR)/libcef.dylib',
'<(PRODUCT_DIR)/ffmpegsumo.so', '<(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. # Add the helper app.
'destination': '<(PRODUCT_DIR)/cef_unittests.app/Contents/Frameworks', 'destination': '<(PRODUCT_DIR)/<(PRODUCT_NAME).app/Contents/Frameworks',
'files': [ 'files': [
'<(PRODUCT_DIR)/cef_unittests Helper.app', '<(PRODUCT_DIR)/<(PRODUCT_NAME) Helper.app',
], ],
}, },
], ],
@ -346,13 +347,31 @@
'${BUILT_PRODUCTS_DIR}/${EXECUTABLE_PATH}' '${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', 'postbuild_name': 'Copy cef.pak File',
'action': [ 'action': [
'cp', 'cp',
'-f', '-f',
'${BUILT_PRODUCTS_DIR}/cef.pak', '${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'
], ],
}, },
{ {
@ -361,16 +380,7 @@
'cp', 'cp',
'-f', '-f',
'${BUILT_PRODUCTS_DIR}/devtools_resources.pak', '${BUILT_PRODUCTS_DIR}/devtools_resources.pak',
'${BUILT_PRODUCTS_DIR}/cef_unittests.app/Contents/Frameworks/Chromium Embedded Framework.framework/Resources/devtools_resources.pak' '${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}.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/'
], ],
}, },
{ {
@ -412,34 +422,6 @@
'type': 'shared_library', 'type': 'shared_library',
'msvs_guid': 'C13650D5-CF1A-4259-BE45-B1EBA6280E47', 'msvs_guid': 'C13650D5-CF1A-4259-BE45-B1EBA6280E47',
'dependencies': [ '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', 'libcef_static',
], ],
'defines': [ 'defines': [
@ -448,19 +430,15 @@
'include_dirs': [ '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': [ 'sources': [
'<@(includes_common)', '<@(includes_common)',
'<@(includes_capi)', '<@(includes_capi)',
'<@(libcef_sources_common)', '<@(libcef_sources_common)',
], ],
'xcode_settings': { 'xcode_settings': {
# Default path that will be changed by install_name_tool in dependent targets.
'INSTALL_PATH': '@executable_path', 'INSTALL_PATH': '@executable_path',
'DYLIB_INSTALL_NAME_BASE': '@executable_path',
# The libcef_static target contains ObjC categories. Passing the -ObjC flag # The libcef_static target contains ObjC categories. Passing the -ObjC flag
# is necessary to properly load them and avoid a "selector not recognized" # 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 # runtime error. See http://developer.apple.com/library/mac/#qa/qa1490/_index.html
@ -475,6 +453,11 @@
'<(DEPTH)/base/allocator/allocator.gyp:allocator', '<(DEPTH)/base/allocator/allocator.gyp:allocator',
], ],
}], }],
['toolkit_uses_gtk == 1', {
'dependencies': [
'<(DEPTH)/build/linux/system.gyp:gtk',
],
}],
['OS=="win"', { ['OS=="win"', {
'configurations': { 'configurations': {
'Debug_Base': { 'Debug_Base': {
@ -489,8 +472,8 @@
'<@(includes_win)', '<@(includes_win)',
# TODO(cef): Remove ui_unscaled_resources.rc once custom cursor # TODO(cef): Remove ui_unscaled_resources.rc once custom cursor
# resources can be loaded via ResourceBundle. See crbug.com/147663. # resources can be loaded via ResourceBundle. See crbug.com/147663.
'$(OutDir)/obj/global_intermediate/webkit/webkit_resources.rc', '<(SHARED_INTERMEDIATE_DIR)/webkit/webkit_resources.rc',
'$(OutDir)/obj/global_intermediate/ui/ui_resources/ui_unscaled_resources.rc', '<(SHARED_INTERMEDIATE_DIR)/ui/ui_resources/ui_unscaled_resources.rc',
'libcef_dll/libcef_dll.rc', 'libcef_dll/libcef_dll.rc',
], ],
'link_settings': { 'link_settings': {
@ -572,6 +555,14 @@
'variables': { 'variables': {
'repack_locales_cmd': ['python', 'tools/repack_locales.py'], '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': [ 'conditions': [
['OS=="win"', { ['OS=="win"', {
'actions': [ 'actions': [
@ -624,16 +615,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

@ -22,7 +22,7 @@ patches = [
'path': '../third_party/zlib/', 'path': '../third_party/zlib/',
}, },
{ {
# http://code.google.com/p/gyp/issues/detail?id=443 # http://code.google.com/p/chromiumembedded/issues/detail?id=443
'name': 'message_loop_443', 'name': 'message_loop_443',
'path': '../base/', 'path': '../base/',
}, },
@ -32,8 +32,7 @@ patches = [
'path': '../third_party/WebKit/Source/', 'path': '../third_party/WebKit/Source/',
}, },
{ {
# https://code.google.com/p/chromiumembedded/issues/detail?id=505 # http://code.google.com/p/chromiumembedded/issues/detail?id=899
# https://code.google.com/p/chromiumembedded/issues/detail?id=899
'name': 'webkit_features', 'name': 'webkit_features',
'path': '../third_party/WebKit/Source/WebKit/chromium/', 'path': '../third_party/WebKit/Source/WebKit/chromium/',
}, },
@ -42,6 +41,11 @@ patches = [
'name': 'webkit_933', 'name': 'webkit_933',
'path': '../third_party/WebKit/Source/WebKit/chromium/src/', 'path': '../third_party/WebKit/Source/WebKit/chromium/src/',
}, },
{
# 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 # http://code.google.com/p/chromiumembedded/issues/detail?id=364
'name': 'spi_webcore_364', 'name': 'spi_webcore_364',

View File

@ -0,0 +1,22 @@
Index: gyp/generator/ninja.py
===================================================================
--- gyp/generator/ninja.py (revision 1602)
+++ gyp/generator/ninja.py (working copy)
@@ -662,7 +662,16 @@
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

@ -23,9 +23,10 @@ def run(command_line, working_dir, depot_tools_dir=None):
sys.stdout.write('-------- Running "'+command_line+'" in "'+\ sys.stdout.write('-------- Running "'+command_line+'" in "'+\
working_dir+'"...'+"\n") working_dir+'"...'+"\n")
args = shlex.split(command_line.replace('\\', '\\\\')) if not options.dryrun:
return subprocess.check_call(args, cwd=working_dir, env=env, args = shlex.split(command_line.replace('\\', '\\\\'))
shell=(sys.platform == 'win32')) return subprocess.check_call(args, cwd=working_dir, env=env,
shell=(sys.platform == 'win32'))
def check_url(url): def check_url(url):
""" Check the URL and raise an exception if invalid. """ """ Check the URL and raise an exception if invalid. """
@ -91,6 +92,8 @@ parser.add_option('--revision', dest='revision', type="int",
help='CEF source revision') help='CEF source revision')
parser.add_option('--url', dest='url', parser.add_option('--url', dest='url',
help='CEF source 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', parser.add_option('--force-config',
action='store_true', dest='forceconfig', default=False, action='store_true', dest='forceconfig', default=False,
help='force Chromium configuration') help='force Chromium configuration')
@ -118,6 +121,12 @@ parser.add_option('--no-release-build',
parser.add_option('--no-distrib', parser.add_option('--no-distrib',
action='store_true', dest='nodistrib', default=False, action='store_true', dest='nodistrib', default=False,
help="don't create the CEF binary distribution") 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() (options, args) = parser.parse_args()
# the downloaddir option is required # the downloaddir option is required
@ -176,7 +185,7 @@ except Exception, e:
compat_url+"\n") compat_url+"\n")
raise raise
download_dir = options.downloaddir download_dir = os.path.abspath(options.downloaddir)
if not os.path.exists(download_dir): if not os.path.exists(download_dir):
# create the download directory # create the download directory
os.makedirs(download_dir) os.makedirs(download_dir)
@ -197,7 +206,10 @@ else:
script_ext = '.sh' script_ext = '.sh'
# check if the "depot_tools" directory exists # 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): if not os.path.exists(depot_tools_dir):
# checkout depot_tools # checkout depot_tools
run('svn checkout '+depot_tools_url+' '+depot_tools_dir, download_dir) run('svn checkout '+depot_tools_url+' '+depot_tools_dir, download_dir)
@ -291,55 +303,60 @@ if release_url_changed or chromium_url_changed or options.forceconfig:
# run gclient config to create the .gclient file # run gclient config to create the .gclient file
run('gclient config '+url, chromium_dir, depot_tools_dir) run('gclient config '+url, chromium_dir, depot_tools_dir)
path = os.path.join(chromium_dir, '.gclient') if not options.dryrun:
if not os.path.exists(path): path = os.path.join(chromium_dir, '.gclient')
sys.stderr.write(".gclient file was not created\n") if not os.path.exists(path):
raise Exception('.gclient file was not created') sys.stderr.write(".gclient file was not created\n")
raise Exception('.gclient file was not created')
# read the resulting .gclient file # read the resulting .gclient file
fp = open(path, 'r') fp = open(path, 'r')
data = fp.read() data = fp.read()
fp.close() fp.close()
custom_deps = \ custom_deps = \
"\n "+'"src/third_party/WebKit/LayoutTests": None,'+\ "\n "+'"src/third_party/WebKit/LayoutTests": None,'+\
"\n "+'"src/chrome_frame/tools/test/reference_build/chrome": 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_mac": None,'+\
"\n "+'"src/chrome/tools/test/reference_build/chrome_win": None,'+\ "\n "+'"src/chrome/tools/test/reference_build/chrome_win": None,'+\
"\n "+'"src/chrome/tools/test/reference_build/chrome_linux": None,' "\n "+'"src/chrome/tools/test/reference_build/chrome_linux": None,'
if not release_url is None: if not release_url is None:
# TODO: Read the DEPS file and exclude all non-src directories. # TODO: Read the DEPS file and exclude all non-src directories.
custom_deps += \ custom_deps += \
"\n "+'"chromeos": None,'+\ "\n "+'"chromeos": None,'+\
"\n "+'"depot_tools": None,' "\n "+'"depot_tools": None,'
# populate "custom_deps" section # populate "custom_deps" section
data = data.replace('"custom_deps" : {', '"custom_deps" : {'+custom_deps) data = data.replace('"custom_deps" : {', '"custom_deps" : {'+custom_deps)
# write the new .gclient file # write the new .gclient file
fp = open(path, 'w') fp = open(path, 'w')
fp.write(data) fp.write(data)
fp.close() fp.close()
if options.forceclean: if options.forceclean:
if os.path.exists(chromium_src_dir): if os.path.exists(chromium_src_dir):
# revert all Chromium changes and delete all unversioned files # revert all Chromium changes and delete all unversioned files
run('gclient revert -n', chromium_dir, depot_tools_dir) run('gclient revert -n', chromium_dir, depot_tools_dir)
# remove the build output directories if not options.dryrun:
output_dirs = [] # remove the build output directories
if platform == 'windows': output_dirs = []
output_dirs.append(os.path.join(chromium_src_dir, 'build\\Debug')) if platform == 'windows':
output_dirs.append(os.path.join(chromium_src_dir, 'build\\Release')) output_dirs.append(os.path.join(chromium_src_dir, 'build\\Debug'))
elif platform == 'macosx': output_dirs.append(os.path.join(chromium_src_dir, 'build\\Release'))
output_dirs.append(os.path.join(chromium_src_dir, 'xcodebuild')) elif platform == 'macosx':
elif platform == 'linux': output_dirs.append(os.path.join(chromium_src_dir, 'xcodebuild'))
output_dirs.append(os.path.join(chromium_src_dir, 'out')) elif platform == 'linux':
output_dirs.append(os.path.join(chromium_src_dir, 'out'))
for output_dir in output_dirs: if options.ninjabuild:
if os.path.exists(output_dir): output_dirs.append(os.path.join(chromium_src_dir, 'out'))
shutil.rmtree(output_dir, onerror=onerror)
for output_dir in output_dirs:
if os.path.exists(output_dir):
shutil.rmtree(output_dir, onerror=onerror)
# force update, build and distrib steps # force update, build and distrib steps
options.forceupdate = True options.forceupdate = True
@ -356,7 +373,7 @@ elif release_url_changed or options.forceupdate:
run('gclient sync --jobs 8 --force', chromium_dir, depot_tools_dir) run('gclient sync --jobs 8 --force', chromium_dir, depot_tools_dir)
if not os.path.exists(cef_src_dir) or cef_url_changed: 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) # delete the cef directory (it will be re-downloaded)
shutil.rmtree(cef_src_dir) shutil.rmtree(cef_src_dir)
@ -368,22 +385,37 @@ elif cef_rev_changed or options.forceupdate:
if any_changed or options.forceupdate: if any_changed or options.forceupdate:
# create CEF projects # create CEF projects
if options.ninjabuild:
os.environ['GYP_GENERATORS'] = 'ninja'
path = os.path.join(cef_src_dir, 'cef_create_projects'+script_ext) path = os.path.join(cef_src_dir, 'cef_create_projects'+script_ext)
run(path, cef_src_dir, depot_tools_dir) run(path, cef_src_dir, depot_tools_dir)
if any_changed or options.forcebuild: 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: if not options.noreleasebuild:
# make CEF Debug build # make CEF Release build
run(path+' Debug', cef_tools_dir, depot_tools_dir) 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: if not options.nodebugbuild:
# make CEF Release build # make CEF Debug build
run(path+' Release', cef_tools_dir, depot_tools_dir) 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 any_changed or options.forcedistrib:
if not options.nodistrib: if not options.nodistrib:
# make CEF binary distribution # make CEF binary distribution
path = os.path.join(cef_tools_dir, 'make_distrib'+script_ext) 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) run(path, cef_tools_dir, depot_tools_dir)

View File

@ -101,6 +101,7 @@ def transfer_files(cef_dir, script_dir, transfer_cfg, output_dir, quiet):
def generate_msvs_projects(version): def generate_msvs_projects(version):
""" Generate MSVS projects for the specified version. """ """ Generate MSVS projects for the specified version. """
sys.stdout.write('Generating '+version+' project files...') sys.stdout.write('Generating '+version+' project files...')
os.environ['GYP_GENERATORS'] = 'msvs'
os.environ['GYP_MSVS_VERSION'] = version os.environ['GYP_MSVS_VERSION'] = version
gyper = [ 'python', 'tools/gyp_cef', os.path.relpath(os.path.join(output_dir, 'cefclient.gyp'), cef_dir) ] gyper = [ 'python', 'tools/gyp_cef', os.path.relpath(os.path.join(output_dir, 'cefclient.gyp'), cef_dir) ]
RunAction(cef_dir, gyper); RunAction(cef_dir, gyper);
@ -165,6 +166,9 @@ parser.add_option('--allow-partial',
parser.add_option('--no-symbols', parser.add_option('--no-symbols',
action='store_true', dest='nosymbols', default=False, action='store_true', dest='nosymbols', default=False,
help='do not create symbol files') help='do not create symbol files')
parser.add_option('--ninja-build',
action='store_true', dest='ninjabuild', default=False,
help='build was created using ninja')
parser.add_option('-q', '--quiet', parser.add_option('-q', '--quiet',
action='store_true', dest='quiet', default=False, action='store_true', dest='quiet', default=False,
help='do not output detailed status information') help='do not output detailed status information')
@ -296,9 +300,16 @@ if platform == 'windows':
transfer_gypi_files(cef_dir, cef_paths2['cefclient_sources_win'], \ transfer_gypi_files(cef_dir, cef_paths2['cefclient_sources_win'], \
'tests/cefclient/', cefclient_dir, options.quiet) 'tests/cefclient/', cefclient_dir, options.quiet)
if options.ninjabuild:
out_dir = os.path.join(src_dir, 'out')
libcef_dll_file = 'libcef.dll.lib'
else:
out_dir = os.path.join(src_dir, 'build')
libcef_dll_file = 'lib/libcef.lib'
# transfer build/Debug files # transfer build/Debug files
build_dir = os.path.join(src_dir, 'build/Debug'); build_dir = os.path.join(out_dir, 'Debug');
if not options.allowpartial or path_exists(build_dir): if not options.allowpartial or path_exists(os.path.join(build_dir, 'cefclient.exe')):
dst_dir = os.path.join(output_dir, 'Debug') dst_dir = os.path.join(output_dir, 'Debug')
make_dir(dst_dir, options.quiet) make_dir(dst_dir, options.quiet)
copy_files(os.path.join(script_dir, 'distrib/win/*.dll'), dst_dir, options.quiet) copy_files(os.path.join(script_dir, 'distrib/win/*.dll'), dst_dir, options.quiet)
@ -312,13 +323,14 @@ if platform == 'windows':
# transfer lib/Debug files # transfer lib/Debug files
dst_dir = os.path.join(output_dir, 'lib/Debug') dst_dir = os.path.join(output_dir, 'lib/Debug')
make_dir(dst_dir, options.quiet) make_dir(dst_dir, options.quiet)
copy_file(os.path.join(build_dir, 'lib/libcef.lib'), dst_dir, options.quiet) copy_file(os.path.join(build_dir, libcef_dll_file), os.path.join(dst_dir, 'libcef.lib'), \
options.quiet)
else: else:
sys.stderr.write("No Debug build files.\n") sys.stderr.write("No Debug build files.\n")
# transfer build/Release files # transfer build/Release files
build_dir = os.path.join(src_dir, 'build/Release'); build_dir = os.path.join(out_dir, 'Release');
if not options.allowpartial or path_exists(build_dir): if not options.allowpartial or path_exists(os.path.join(build_dir, 'cefclient.exe')):
dst_dir = os.path.join(output_dir, 'Release') dst_dir = os.path.join(output_dir, 'Release')
make_dir(dst_dir, options.quiet) make_dir(dst_dir, options.quiet)
copy_files(os.path.join(script_dir, 'distrib/win/*.dll'), dst_dir, options.quiet) copy_files(os.path.join(script_dir, 'distrib/win/*.dll'), dst_dir, options.quiet)
@ -332,7 +344,8 @@ if platform == 'windows':
# transfer lib/Release files # transfer lib/Release files
dst_dir = os.path.join(output_dir, 'lib/Release') dst_dir = os.path.join(output_dir, 'lib/Release')
make_dir(dst_dir, options.quiet) make_dir(dst_dir, options.quiet)
copy_file(os.path.join(build_dir, 'lib/libcef.lib'), dst_dir, options.quiet) copy_file(os.path.join(build_dir, libcef_dll_file), os.path.join(dst_dir, 'libcef.lib'), \
options.quiet)
if not options.nosymbols: if not options.nosymbols:
# transfer symbols # transfer symbols
@ -378,20 +391,27 @@ elif platform == 'macosx':
copy_dir(os.path.join(cef_dir, 'tests/cefclient/mac/'), os.path.join(output_dir, 'cefclient/mac/'), \ copy_dir(os.path.join(cef_dir, 'tests/cefclient/mac/'), os.path.join(output_dir, 'cefclient/mac/'), \
options.quiet) options.quiet)
if options.ninjabuild:
out_dir = os.path.join(src_dir, 'out')
else:
out_dir = os.path.join(src_dir, 'xcodebuild')
valid_build_dir = None
# transfer xcodebuild/Debug files # transfer xcodebuild/Debug files
build_dir = os.path.join(src_dir, 'xcodebuild/Debug') build_dir = os.path.join(out_dir, 'Debug')
if not options.allowpartial or path_exists(build_dir): if not options.allowpartial or path_exists(os.path.join(build_dir, 'cefclient.app')):
valid_build_dir = build_dir
dst_dir = os.path.join(output_dir, 'Debug') dst_dir = os.path.join(output_dir, 'Debug')
make_dir(dst_dir, options.quiet) make_dir(dst_dir, options.quiet)
copy_file(os.path.join(build_dir, 'ffmpegsumo.so'), dst_dir, options.quiet) copy_file(os.path.join(build_dir, 'ffmpegsumo.so'), dst_dir, options.quiet)
copy_file(os.path.join(build_dir, 'libcef.dylib'), dst_dir, options.quiet) copy_file(os.path.join(build_dir, 'libcef.dylib'), dst_dir, options.quiet)
copy_file(os.path.join(build_dir, 'libplugin_carbon_interpose.dylib'), dst_dir, options.quiet) copy_file(os.path.join(build_dir, 'libplugin_carbon_interpose.dylib'), dst_dir, options.quiet)
else:
build_dir = None
# transfer xcodebuild/Release files # transfer xcodebuild/Release files
build_dir = os.path.join(src_dir, 'xcodebuild/Release') build_dir = os.path.join(out_dir, 'Release')
if not options.allowpartial or path_exists(build_dir): if not options.allowpartial or path_exists(os.path.join(build_dir, 'cefclient.app')):
valid_build_dir = build_dir
dst_dir = os.path.join(output_dir, 'Release') dst_dir = os.path.join(output_dir, 'Release')
make_dir(dst_dir, options.quiet) make_dir(dst_dir, options.quiet)
copy_file(os.path.join(build_dir, 'ffmpegsumo.so'), dst_dir, options.quiet) copy_file(os.path.join(build_dir, 'ffmpegsumo.so'), dst_dir, options.quiet)
@ -404,11 +424,10 @@ elif platform == 'macosx':
src_path = os.path.join(build_dir, 'libcef.dylib.dSYM/Contents/Resources/DWARF/libcef.dylib') src_path = os.path.join(build_dir, 'libcef.dylib.dSYM/Contents/Resources/DWARF/libcef.dylib')
dst_path = os.path.join(symbol_dir, 'libcef.dylib.dSYM') dst_path = os.path.join(symbol_dir, 'libcef.dylib.dSYM')
run('dsymutil '+src_path+' -o '+dst_path, cef_dir) run('dsymutil '+src_path+' -o '+dst_path, cef_dir)
else:
build_dir = None
if not build_dir is None: if not valid_build_dir is None:
# transfer resource files # transfer resource files
build_dir = valid_build_dir
dst_dir = os.path.join(output_dir, 'Resources') dst_dir = os.path.join(output_dir, 'Resources')
make_dir(dst_dir, options.quiet) make_dir(dst_dir, options.quiet)
copy_files(os.path.join(build_dir, 'cefclient.app/Contents/Frameworks/Chromium Embedded Framework.framework/Resources/*.*'), \ copy_files(os.path.join(build_dir, 'cefclient.app/Contents/Frameworks/Chromium Embedded Framework.framework/Resources/*.*'), \
@ -420,6 +439,7 @@ elif platform == 'macosx':
# Generate Xcode project files # Generate Xcode project files
sys.stdout.write('Generating Xcode project files...') sys.stdout.write('Generating Xcode project files...')
os.environ['GYP_GENERATORS'] = 'xcode'
gyper = [ 'python', 'tools/gyp_cef', os.path.relpath(os.path.join(output_dir, 'cefclient.gyp'), cef_dir) ] gyper = [ 'python', 'tools/gyp_cef', os.path.relpath(os.path.join(output_dir, 'cefclient.gyp'), cef_dir) ]
RunAction(cef_dir, gyper); RunAction(cef_dir, gyper);
@ -436,26 +456,37 @@ elif platform == 'linux':
create_readme(os.path.join(script_dir, 'distrib/linux/README.txt'), output_dir, cef_url, \ create_readme(os.path.join(script_dir, 'distrib/linux/README.txt'), output_dir, cef_url, \
cef_rev, cef_ver, chromium_url, chromium_rev, chromium_ver, date) cef_rev, cef_ver, chromium_url, chromium_rev, chromium_ver, date)
out_dir = os.path.join(src_dir, 'out')
if options.ninjabuild:
lib_dir_name = 'lib'
else:
lib_dir_name = 'lib.target'
valid_build_dir = None
# transfer out/Debug files # transfer out/Debug files
build_dir = os.path.join(src_dir, 'out/Debug'); build_dir = os.path.join(out_dir, 'Debug');
if not options.allowpartial or path_exists(build_dir): if not options.allowpartial or path_exists(os.path.join(build_dir, 'cefclient')):
valid_build_dir = build_dir
dst_dir = os.path.join(output_dir, 'Debug') dst_dir = os.path.join(output_dir, 'Debug')
make_dir(dst_dir, options.quiet) make_dir(dst_dir, options.quiet)
copy_file(os.path.join(build_dir, 'lib.target/libcef.so'), dst_dir, options.quiet) copy_file(os.path.join(build_dir, lib_dir_name, 'libcef.so'), dst_dir, options.quiet)
else: else:
sys.stderr.write("No Debug build files.\n") sys.stderr.write("No Debug build files.\n")
# transfer out/Release files # transfer out/Release files
build_dir = os.path.join(src_dir, 'out/Release'); build_dir = os.path.join(out_dir, 'Release');
if not options.allowpartial or path_exists(build_dir): if not options.allowpartial or path_exists(os.path.join(build_dir, 'cefclient')):
valid_build_dir = build_dir
dst_dir = os.path.join(output_dir, 'Release') dst_dir = os.path.join(output_dir, 'Release')
make_dir(dst_dir, options.quiet) make_dir(dst_dir, options.quiet)
copy_file(os.path.join(build_dir, 'lib.target/libcef.so'), dst_dir, options.quiet) copy_file(os.path.join(build_dir, lib_dir_name, 'libcef.so'), dst_dir, options.quiet)
else: else:
sys.stderr.write("No Release build files.\n") sys.stderr.write("No Release build files.\n")
if not build_dir is None: if not valid_build_dir is None:
# transfer resource files # transfer resource files
build_dir = valid_build_dir
dst_dir = os.path.join(output_dir, 'Resources') dst_dir = os.path.join(output_dir, 'Resources')
make_dir(dst_dir, options.quiet) make_dir(dst_dir, options.quiet)
copy_file(os.path.join(build_dir, 'cef.pak'), dst_dir, options.quiet) copy_file(os.path.join(build_dir, 'cef.pak'), dst_dir, options.quiet)
@ -477,22 +508,26 @@ elif platform == 'linux':
transfer_files(cef_dir, script_dir, os.path.join(script_dir, 'distrib/linux/transfer.cfg'), \ transfer_files(cef_dir, script_dir, os.path.join(script_dir, 'distrib/linux/transfer.cfg'), \
output_dir, options.quiet) output_dir, options.quiet)
# Back up the existing Makefile
makefile = os.path.join(src_dir, 'Makefile') makefile = os.path.join(src_dir, 'Makefile')
makefile_tmp = makefile + '.cef_bak' makefile_tmp = ''
copy_file(makefile, makefile_tmp, options.quiet) if path_exists(makefile):
# Back up the existing Makefile
makefile_tmp = makefile + '.cef_bak'
copy_file(makefile, makefile_tmp, options.quiet)
# Generate make project files # Generate make project files
sys.stdout.write('Generating make project files...') sys.stdout.write('Generating make project files...')
os.environ['GYP_GENERATORS'] = 'make'
gyper = [ 'python', 'tools/gyp_cef', os.path.relpath(os.path.join(output_dir, 'cefclient.gyp'), cef_dir) ] gyper = [ 'python', 'tools/gyp_cef', os.path.relpath(os.path.join(output_dir, 'cefclient.gyp'), cef_dir) ]
RunAction(cef_dir, gyper); RunAction(cef_dir, gyper);
# Copy the resulting Makefile to the destination directory # Copy the resulting Makefile to the destination directory
copy_file(makefile, output_dir, options.quiet) copy_file(makefile, output_dir, options.quiet)
# Restore the original Makefile
remove_file(makefile, options.quiet) remove_file(makefile, options.quiet)
move_file(makefile_tmp, makefile, options.quiet) if makefile_tmp != '':
# Restore the original Makefile
move_file(makefile_tmp, makefile, options.quiet)
# Post-process the make files # Post-process the make files
fix_make_projects() fix_make_projects()