Mac: Add make_distrib support (issue #260)

git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@298 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
Marshall Greenblatt 2011-10-03 10:25:14 +00:00
parent 05a9c93d98
commit 29386a3abc
11 changed files with 218 additions and 36 deletions

11
cef.gyp
View File

@ -35,16 +35,7 @@
'<@(cefclient_sources_common)',
],
'mac_bundle_resources': [
'tests/cefclient/mac/cefclient.icns',
'tests/cefclient/mac/data/',
'tests/cefclient/mac/English.lproj/InfoPlist.strings',
'tests/cefclient/mac/English.lproj/MainMenu.xib',
'tests/cefclient/mac/Info.plist',
'tests/cefclient/res/domaccess.html',
'tests/cefclient/res/extensionperf.html',
'tests/cefclient/res/localstorage.html',
'tests/cefclient/res/logo.png',
'tests/cefclient/res/xmlhttprequest.html',
'<@(cefclient_bundle_resources_mac)',
],
'mac_bundle_resources!': [
# TODO(mark): Come up with a fancier way to do this (mac_info_plist?)

View File

@ -92,7 +92,20 @@
'cefclient_sources_mac': [
'tests/cefclient/cefclient_mac.mm',
'tests/cefclient/client_handler_mac.mm',
'tests/cefclient/resource_util_mac.mm',
'tests/cefclient/resource_util_mac.mm',
'tests/cefclient/res/logo.png',
],
'cefclient_bundle_resources_mac': [
'tests/cefclient/mac/cefclient.icns',
'tests/cefclient/mac/data/',
'tests/cefclient/mac/English.lproj/InfoPlist.strings',
'tests/cefclient/mac/English.lproj/MainMenu.xib',
'tests/cefclient/mac/Info.plist',
'tests/cefclient/res/domaccess.html',
'tests/cefclient/res/extensionperf.html',
'tests/cefclient/res/localstorage.html',
'tests/cefclient/res/logo.png',
'tests/cefclient/res/xmlhttprequest.html',
],
'cefclient_sources_linux': [
'tests/cefclient/cefclient_gtk.cpp',

View File

@ -297,7 +297,7 @@ bool CefV8ValueCToCpp::DeleteValue(int index)
CefRefPtr<CefV8Value> CefV8ValueCToCpp::GetValue(const CefString& key)
{
if(CEF_MEMBER_MISSING(struct_, get_value_bykey))
return false;
return NULL;
cef_v8value_t* valueStruct = struct_->get_value_bykey(struct_,
key.GetStruct());
@ -309,7 +309,7 @@ CefRefPtr<CefV8Value> CefV8ValueCToCpp::GetValue(const CefString& key)
CefRefPtr<CefV8Value> CefV8ValueCToCpp::GetValue(int index)
{
if(CEF_MEMBER_MISSING(struct_, get_value_byindex))
return false;
return NULL;
cef_v8value_t* valueStruct = struct_->get_value_byindex(struct_, index);
if(valueStruct)
@ -363,7 +363,7 @@ bool CefV8ValueCToCpp::GetKeys(std::vector<CefString>& keys)
CefRefPtr<CefBase> CefV8ValueCToCpp::GetUserData()
{
if(CEF_MEMBER_MISSING(struct_, get_user_data))
return false;
return NULL;
cef_base_t* baseStruct = struct_->get_user_data(struct_);
if(baseStruct)
@ -393,7 +393,7 @@ CefString CefV8ValueCToCpp::GetFunctionName()
CefRefPtr<CefV8Handler> CefV8ValueCToCpp::GetFunctionHandler()
{
if(CEF_MEMBER_MISSING(struct_, get_function_handler))
return false;
return NULL;
cef_v8handler_t* handlerStruct = struct_->get_function_handler(struct_);
if(handlerStruct)

View File

@ -5,6 +5,12 @@
{
'variables': {
'chromium_code': 1,
'conditions': [
[ 'OS=="mac"', {
# Don't use clang with CEF binary releases due to Chromium tree structure dependency.
'clang': 0,
}],
]
},
'includes': [
# Bring in the source file lists for cefclient.
@ -14,6 +20,7 @@
{
'target_name': 'cefclient',
'type': 'executable',
'mac_bundle': 1,
'msvs_guid': '6617FED9-C5D4-4907-BF55-A90062A6683F',
'dependencies': [
'libcef_dll_wrapper',
@ -29,6 +36,20 @@
'<@(includes_common)',
'<@(cefclient_sources_common)',
],
'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/mac/Info.plist',
],
'xcode_settings': {
'INFOPLIST_FILE': 'cefclient/mac/Info.plist',
# Target build path.
'SYMROOT': 'xcodebuild',
},
'conditions': [
['OS=="win"', {
'msvs_settings': {
@ -54,6 +75,30 @@
],
}],
[ 'OS=="mac"', {
'product_name': 'cefclient',
'copies': [
{
# Add library dependencies to the bundle.
'destination': '<(PRODUCT_DIR)/cefclient.app/Contents/MacOS/',
'files': [
'$(CONFIGURATION)/libcef.dylib',
'$(CONFIGURATION)/ffmpegsumo.so',
],
},
{
# Add other resources to the bundle.
'destination': '<(PRODUCT_DIR)/cefclient.app/Contents/',
'files': [
'Resources/',
],
},
],
'link_settings': {
'libraries': [
'$(SDKROOT)/System/Library/Frameworks/AppKit.framework',
'$(CONFIGURATION)/libcef.dylib'
],
},
'sources': [
'<@(includes_mac)',
'<@(cefclient_sources_mac)',
@ -82,6 +127,10 @@
'<@(includes_common)',
'<@(libcef_dll_wrapper_sources_common)',
],
'xcode_settings': {
# Target build path.
'SYMROOT': 'xcodebuild',
},
},
]
}

View File

@ -0,0 +1,48 @@
Chromium Embedded Framework (CEF) Binary Distribution
-------------------------------------------------------------------------------
CEF Revision: $CEF_REV$
Chromium Revision: $CHROMIUM_REV$
Date: $DATE$
This distribution contains all files necessary to build an application using
CEF. Please read the included LICENSE.txt file for licensing terms and
restrictions.
CONTENTS
--------
cefclient Contains the cefclient sample application configured to build
using the files in this distribution.
Debug Contains libcef.dylib and other libraries required to run the debug
version of CEF-based applications.
docs Contains C++ API documentation generated from the CEF header files.
include Contains all required CEF and NPAPI-related header files. Read
the include/internal/npapi/README-TRANSFER.txt file for more
information about the NPAPI-related header files.
libcef_dll Contains the source code for the libcef_dll_wrapper static library
that all applications using the CEF C++ API must link against.
Release Contains libcef.dylib and other libraries required to run the
release version of CEF-based applications.
Resources Contains images and resources required by applications using CEF.
The contents of this folder should be transferred to the
Contents/Resources folder in the app bundle.
tools Scripts that perform post-processing on Mac release targets.
USAGE
-----
Xcode 3 and 4: Open the cefclient.xcodeproj project and build.
Please visit the CEF Website for additional usage information.
http://code.google.com/p/chromiumembedded

View File

@ -0,0 +1,29 @@
# Additional handling of transfer files.
# target: Target location relative to the target release directory. This
# value is required.
# source: Source location relative to the CEF root directory. This value
# is optional. If specified the target will be copied to this location
# and a TRANSFER-README.txt file will be created.
# post-process: Post-processing operation to perform. This value is
# optional and may be any one of the following:
# 'normalize_headers': Replace fully-qualified project header paths with
# the optionally specified 'new_header_path' value.
[
{
'source' : '../build/mac/change_mach_o_flags_from_xcode.sh',
'target' : 'tools/change_mach_o_flags_from_xcode.sh',
},
{
'source' : '../build/mac/change_mach_o_flags.py',
'target' : 'tools/change_mach_o_flags.py',
},
{
'source' : '../build/mac/strip_from_xcode',
'target' : 'tools/strip_from_xcode',
},
{
'source' : '../build/mac/strip_save_dsym',
'target' : 'tools/strip_save_dsym',
},
]

View File

@ -17,7 +17,7 @@ cefclient Contains the cefclient sample application configured to build
using the files in this distribution.
Debug Contains libcef.dll and other DLLs required to run the debug version
of CEF-based applications. Also acts as the build target for the
of CEF-based applications. Also acts as the build target for the
Debug build of cefclient.
docs Contains C++ API documentation generated from the CEF header files.
@ -33,7 +33,7 @@ libcef_dll Contains the source code for the libcef_dll_wrapper static library
that all applications using the CEF C++ API must link against.
Release Contains libcef.dll and other DLLs required to run the release
version of CEF-based applications. Also acts as the build target for
version of CEF-based applications. Also acts as the build target for
the Release build of cefclient.

View File

@ -67,7 +67,11 @@ def move_file(src, dst, quiet = True):
def copy_files(src_glob, dst_folder, quiet = True):
""" Copy multiple files. """
for fname in iglob(src_glob):
copy_file(fname, os.path.join(dst_folder, os.path.basename(fname)), quiet)
dst = os.path.join(dst_folder, os.path.basename(fname))
if os.path.isdir(fname):
copy_dir(fname, dst, quiet)
else:
copy_file(fname, dst, quiet)
def copy_dir(src, dst, quiet = True):
""" Copy a directory tree. """

View File

@ -1,2 +1,2 @@
@echo off
..\..\third_party\python_26\python.exe make_distrib.py --output-dir ..\binary_distrib
..\..\third_party\python_26\python.exe make_distrib.py --output-dir ..\binary_distrib\

View File

@ -11,6 +11,16 @@ import re
from svn_util import *
import sys
def create_readme(src, output_dir, cef_rev, chromium_rev, date):
""" Creates the README.TXT file. """
data = read_file(src)
data = data.replace('$CEF_REV$', cef_rev)
data = data.replace('$CHROMIUM_REV$', chromium_rev)
data = data.replace('$DATE$', date)
write_file(os.path.join(output_dir, 'README.TXT'), data)
if not options.quiet:
sys.stdout.write('Creating README.TXT file.\n')
def eval_file(src):
""" Loads and evaluates the contents of the specified file. """
return eval(read_file(src), {'__builtins__': None}, None)
@ -55,12 +65,13 @@ def transfer_files(cef_dir, script_dir, transfer_cfg, output_dir, quiet):
open(readme, 'a').write(cfg['source']+"\n")
# perform any required post-processing
post = cfg['post-process']
if post == 'normalize_headers':
new_path = ''
if cfg.has_key('new_header_path'):
new_path = cfg['new_header_path']
normalize_headers(dst, new_path)
if 'post-process' in cfg:
post = cfg['post-process']
if post == 'normalize_headers':
new_path = ''
if cfg.has_key('new_header_path'):
new_path = cfg['new_header_path']
normalize_headers(dst, new_path)
def generate_msvs_projects(version):
""" Generate MSVS projects for the specified version. """
@ -110,15 +121,6 @@ output_dir = os.path.abspath(os.path.join(options.outputdir, 'cef_binary_r'+cef_
remove_dir(output_dir, options.quiet)
make_dir(output_dir, options.quiet)
# write the README.TXT file
data = read_file(os.path.join(script_dir, 'distrib/README.TXT'))
data = data.replace('$CEF_REV$', cef_rev)
data = data.replace('$CHROMIUM_REV$', chromium_rev)
data = data.replace('$DATE$', date)
write_file(os.path.join(output_dir, 'README.TXT'), data)
if not options.quiet:
sys.stdout.write('Creating README.TXT file.\n')
# transfer the LICENSE.TXT file
copy_file(os.path.join(cef_dir, 'LICENSE.TXT'), output_dir, options.quiet)
@ -162,7 +164,11 @@ transfer_files(cef_dir, script_dir, os.path.join(script_dir, 'distrib/transfer.c
output_dir, options.quiet)
if sys.platform == 'win32':
# transfer include files
# create the README.TXT file
create_readme(os.path.join(script_dir, 'distrib/win/README.TXT'), output_dir, cef_rev, \
chromium_rev, date)
# transfer include files
transfer_gypi_files(cef_dir, cef_paths['includes_win'], \
'include/', include_dir, options.quiet)
@ -219,7 +225,11 @@ if sys.platform == 'win32':
generate_msvs_projects('2010');
elif sys.platform == 'darwin':
# transfer include files
# create the README.TXT file
create_readme(os.path.join(script_dir, 'distrib/mac/README.TXT'), output_dir, cef_rev, \
chromium_rev, date)
# transfer include files
transfer_gypi_files(cef_dir, cef_paths['includes_mac'], \
'include/', include_dir, options.quiet)
@ -227,10 +237,46 @@ elif sys.platform == 'darwin':
transfer_gypi_files(cef_dir, cef_paths['cefclient_sources_mac'], \
'tests/cefclient/', cefclient_dir, options.quiet)
# transfer cefclient/mac files
copy_dir(os.path.join(cef_dir, 'tests/cefclient/mac/'), os.path.join(output_dir, 'cefclient/mac/'), \
options.quiet)
# transfer xcodebuild/Debug files
dst_dir = os.path.join(output_dir, 'Debug')
make_dir(dst_dir, options.quiet)
copy_file(os.path.join(cef_dir, '../xcodebuild/Debug/ffmpegsumo.so'), dst_dir, options.quiet)
copy_file(os.path.join(cef_dir, '../xcodebuild/Debug/libcef.dylib'), dst_dir, options.quiet)
# transfer xcodebuild/Release files
dst_dir = os.path.join(output_dir, 'Release')
make_dir(dst_dir, options.quiet)
copy_file(os.path.join(cef_dir, '../xcodebuild/Release/ffmpegsumo.so'), dst_dir, options.quiet)
copy_file(os.path.join(cef_dir, '../xcodebuild/Release/libcef.dylib'), dst_dir, options.quiet)
# transfer resource files
dst_dir = os.path.join(output_dir, 'Resources')
make_dir(dst_dir, options.quiet)
copy_files(os.path.join(cef_dir, '../third_party/WebKit/Source/WebCore/Resources/*.*'), dst_dir, options.quiet)
copy_file(os.path.join(cef_dir, '../xcodebuild/Release/cefclient.app/Contents/Resources/chrome.pak'), dst_dir, options.quiet)
copy_files(os.path.join(cef_dir, '../xcodebuild/Release/cefclient.app/Contents/Resources/*.lproj'), dst_dir, options.quiet)
remove_dir(os.path.join(dst_dir, 'English.lproj'))
# transfer additional files, if any
transfer_files(cef_dir, script_dir, os.path.join(script_dir, 'distrib/mac/transfer.cfg'), \
output_dir, options.quiet)
# Generate Xcode project files
sys.stdout.write('Generating Xcode project files...')
gyper = [ 'python', 'tools/gyp_cef', os.path.relpath(os.path.join(output_dir, 'cefclient.gyp'), cef_dir) ]
RunAction(cef_dir, gyper);
# Post-process the Xcode project to fix file paths
src_file = os.path.join(output_dir, 'cefclient.xcodeproj/project.pbxproj')
data = read_file(src_file)
data = data.replace('../../../build/mac/', 'tools/')
data = data.replace('../../../', '')
write_file(src_file, data)
elif sys.platform == 'linux2':
# transfer include files
transfer_gypi_files(cef_dir, cef_paths['includes_linux'], \

2
tools/make_distrib.sh Normal file
View File

@ -0,0 +1,2 @@
#!/bin/sh
python make_distrib.py --output-dir ../binary_distrib/