mirror of
				https://bitbucket.org/chromiumembedded/cef
				synced 2025-06-05 21:39:12 +02:00 
			
		
		
		
	- Mac: Add plugin_carbon_interpose target to fix plugin crash (issue #680).
- Mac: Add version number to dylib files (issue #730). git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@795 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
		
							
								
								
									
										84
									
								
								cef.gyp
									
									
									
									
									
								
							
							
						
						
									
										84
									
								
								cef.gyp
									
									
									
									
									
								
							@@ -7,6 +7,10 @@
 | 
			
		||||
    'pkg-config': 'pkg-config',
 | 
			
		||||
    'chromium_code': 1,
 | 
			
		||||
    'grit_out_dir': '<(SHARED_INTERMEDIATE_DIR)/cef',
 | 
			
		||||
    'revision': '<!(python tools/revision.py)',
 | 
			
		||||
    # Need to be creative to match dylib version formatting requirements.
 | 
			
		||||
    'version_mac_dylib':
 | 
			
		||||
        '<!(python ../chrome/tools/build/version.py -f ../chrome/VERSION -t "3<(revision).@BUILD_HI@.@BUILD_LO@" -e "BUILD_HI=int(BUILD)/256" -e "BUILD_LO=int(BUILD)%256")',
 | 
			
		||||
  },
 | 
			
		||||
  'includes': [
 | 
			
		||||
    # Bring in the source file lists.
 | 
			
		||||
@@ -101,6 +105,7 @@
 | 
			
		||||
          'product_name': 'cefclient',
 | 
			
		||||
          'dependencies': [
 | 
			
		||||
            'cefclient_helper_app',
 | 
			
		||||
            'interpose_dependency_shim',
 | 
			
		||||
          ],
 | 
			
		||||
          'copies': [
 | 
			
		||||
            {
 | 
			
		||||
@@ -123,6 +128,7 @@
 | 
			
		||||
              'destination': '<(PRODUCT_DIR)/cefclient.app/Contents/Frameworks',
 | 
			
		||||
              'files': [
 | 
			
		||||
                '<(PRODUCT_DIR)/cefclient Helper.app',
 | 
			
		||||
                '<(PRODUCT_DIR)/libplugin_carbon_interpose.dylib',
 | 
			
		||||
              ],
 | 
			
		||||
            },
 | 
			
		||||
          ],
 | 
			
		||||
@@ -441,6 +447,8 @@
 | 
			
		||||
        # runtime error. See http://developer.apple.com/library/mac/#qa/qa1490/_index.html
 | 
			
		||||
        # for more information.
 | 
			
		||||
        'OTHER_LDFLAGS': ['-Wl,-ObjC'],
 | 
			
		||||
        'DYLIB_COMPATIBILITY_VERSION': '<(version_mac_dylib)',
 | 
			
		||||
        'DYLIB_CURRENT_VERSION': '<(version_mac_dylib)',
 | 
			
		||||
      },
 | 
			
		||||
      'conditions': [
 | 
			
		||||
        ['OS=="win" and win_use_allocator_shim==1', {
 | 
			
		||||
@@ -984,6 +992,82 @@
 | 
			
		||||
    }],
 | 
			
		||||
    ['OS=="mac"', {
 | 
			
		||||
      'targets': [
 | 
			
		||||
        {
 | 
			
		||||
          # Dummy target to allow cefclient to require plugin_carbon_interpose
 | 
			
		||||
          # to build without actually linking to the resulting library.
 | 
			
		||||
          'target_name': 'interpose_dependency_shim',
 | 
			
		||||
          'type': 'executable',
 | 
			
		||||
          'variables': { 'enable_wexit_time_destructors': 1, },
 | 
			
		||||
          'dependencies': [
 | 
			
		||||
            'plugin_carbon_interpose',
 | 
			
		||||
          ],
 | 
			
		||||
          # In release, we end up with a strip step that is unhappy if there is
 | 
			
		||||
          # no binary. Rather than check in a new file for this temporary hack,
 | 
			
		||||
          # just generate a source file on the fly.
 | 
			
		||||
          'actions': [
 | 
			
		||||
            {
 | 
			
		||||
              'action_name': 'generate_stub_main',
 | 
			
		||||
              'process_outputs_as_sources': 1,
 | 
			
		||||
              'inputs': [],
 | 
			
		||||
              'outputs': [ '<(INTERMEDIATE_DIR)/dummy_main.c' ],
 | 
			
		||||
              'action': [
 | 
			
		||||
                'bash', '-c',
 | 
			
		||||
                'echo "int main() { return 0; }" > <(INTERMEDIATE_DIR)/dummy_main.c'
 | 
			
		||||
              ],
 | 
			
		||||
            },
 | 
			
		||||
          ],
 | 
			
		||||
        },
 | 
			
		||||
        {
 | 
			
		||||
          # dylib for interposing Carbon calls in the plugin process.
 | 
			
		||||
          'target_name': 'plugin_carbon_interpose',
 | 
			
		||||
          'type': 'shared_library',
 | 
			
		||||
          'variables': { 'enable_wexit_time_destructors': 1, },
 | 
			
		||||
          # This target must not depend on static libraries, else the code in
 | 
			
		||||
          # those libraries would appear twice in plugin processes: Once from
 | 
			
		||||
          # Chromium Framework, and once from this dylib.
 | 
			
		||||
          'dependencies': [
 | 
			
		||||
            'libcef',
 | 
			
		||||
          ],
 | 
			
		||||
          'conditions': [
 | 
			
		||||
            ['component=="shared_library"', {
 | 
			
		||||
              'dependencies': [
 | 
			
		||||
                '<(DEPTH)/webkit/support/webkit_support.gyp:glue',
 | 
			
		||||
                '<(DEPTH)/content/content.gyp:content_plugin',
 | 
			
		||||
              ],
 | 
			
		||||
            }],
 | 
			
		||||
          ],
 | 
			
		||||
          'sources': [
 | 
			
		||||
            '<(DEPTH)/content/plugin/plugin_carbon_interpose_mac.cc',
 | 
			
		||||
          ],
 | 
			
		||||
          'include_dirs': [
 | 
			
		||||
            '..',
 | 
			
		||||
          ],
 | 
			
		||||
          'link_settings': {
 | 
			
		||||
            'libraries': [
 | 
			
		||||
              '$(SDKROOT)/System/Library/Frameworks/Carbon.framework',
 | 
			
		||||
            ],
 | 
			
		||||
          },
 | 
			
		||||
          'xcode_settings': {
 | 
			
		||||
            'DYLIB_COMPATIBILITY_VERSION': '<(version_mac_dylib)',
 | 
			
		||||
            'DYLIB_CURRENT_VERSION': '<(version_mac_dylib)',
 | 
			
		||||
          },
 | 
			
		||||
          '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
 | 
			
		||||
              # libplugin_carbon_interpose.dylib.
 | 
			
		||||
              'postbuild_name': 'Fix Framework Link',
 | 
			
		||||
              'action': [
 | 
			
		||||
                'install_name_tool',
 | 
			
		||||
                '-change',
 | 
			
		||||
                '@executable_path/libcef.dylib',
 | 
			
		||||
                '@executable_path/../../../../Frameworks/Chromium Embedded Framework.framework/Libraries/libcef.dylib',
 | 
			
		||||
                '${BUILT_PRODUCTS_DIR}/${EXECUTABLE_PATH}'
 | 
			
		||||
              ],
 | 
			
		||||
            },
 | 
			
		||||
          ],
 | 
			
		||||
        },
 | 
			
		||||
        {
 | 
			
		||||
          'target_name': 'cefclient_helper_app',
 | 
			
		||||
          'type': 'executable',
 | 
			
		||||
 
 | 
			
		||||
@@ -18,6 +18,14 @@
 | 
			
		||||
#include "ui/base/resource/resource_bundle.h"
 | 
			
		||||
#include "webkit/glue/user_agent.h"
 | 
			
		||||
 | 
			
		||||
namespace {
 | 
			
		||||
 | 
			
		||||
const char kInterposeLibraryPath[] =
 | 
			
		||||
    "@executable_path/../../../libplugin_carbon_interpose.dylib";
 | 
			
		||||
 | 
			
		||||
}  // namespace
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
CefContentClient::CefContentClient(CefRefPtr<CefApp> application)
 | 
			
		||||
    : application_(application),
 | 
			
		||||
      pack_loading_disabled_(false),
 | 
			
		||||
@@ -100,6 +108,12 @@ gfx::Image& CefContentClient::GetNativeImageNamed(int resource_id) const {
 | 
			
		||||
  return value;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#if defined(OS_MACOSX) && !defined(OS_IOS)
 | 
			
		||||
std::string CefContentClient::GetCarbonInterposePath() const {
 | 
			
		||||
  return std::string(kInterposeLibraryPath);
 | 
			
		||||
}
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
FilePath CefContentClient::GetPathForResourcePack(
 | 
			
		||||
    const FilePath& pack_path,
 | 
			
		||||
    ui::ScaleFactor scale_factor) {
 | 
			
		||||
 
 | 
			
		||||
@@ -35,6 +35,10 @@ class CefContentClient : public content::ContentClient,
 | 
			
		||||
      ui::ScaleFactor scale_factor) const OVERRIDE;
 | 
			
		||||
  virtual gfx::Image& GetNativeImageNamed(int resource_id) const OVERRIDE;
 | 
			
		||||
 | 
			
		||||
#if defined(OS_MACOSX) && !defined(OS_IOS)
 | 
			
		||||
  virtual std::string GetCarbonInterposePath() const OVERRIDE;
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
  CefRefPtr<CefApp> application() const { return application_; }
 | 
			
		||||
 | 
			
		||||
  void set_pack_loading_disabled(bool val) { pack_loading_disabled_ = val; }
 | 
			
		||||
 
 | 
			
		||||
@@ -100,6 +100,7 @@
 | 
			
		||||
              'destination': '<(PRODUCT_DIR)/cefclient.app/Contents/Frameworks',
 | 
			
		||||
              'files': [
 | 
			
		||||
                '<(PRODUCT_DIR)/cefclient Helper.app',
 | 
			
		||||
                '$(CONFIGURATION)/libplugin_carbon_interpose.dylib',
 | 
			
		||||
              ],
 | 
			
		||||
            },
 | 
			
		||||
          ],
 | 
			
		||||
 
 | 
			
		||||
@@ -367,9 +367,10 @@ elif platform == 'macosx':
 | 
			
		||||
    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, 'libcef.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
 | 
			
		||||
  build_dir = os.path.join(src_dir, 'xcodebuild/Release')
 | 
			
		||||
  if not options.allowpartial or path_exists(build_dir):
 | 
			
		||||
@@ -377,6 +378,7 @@ elif platform == 'macosx':
 | 
			
		||||
    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, 'libcef.dylib'), dst_dir, options.quiet)
 | 
			
		||||
    copy_file(os.path.join(build_dir, 'libplugin_carbon_interpose.dylib'), dst_dir, options.quiet)
 | 
			
		||||
 | 
			
		||||
    if not options.nosymbols:
 | 
			
		||||
      # create the real dSYM file from the "fake" dSYM file
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										19
									
								
								tools/revision.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										19
									
								
								tools/revision.py
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,19 @@
 | 
			
		||||
# Copyright (c) 2012 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.
 | 
			
		||||
 | 
			
		||||
import svn_util as svn
 | 
			
		||||
import git_util as git
 | 
			
		||||
import sys
 | 
			
		||||
 | 
			
		||||
# cannot be loaded as a module
 | 
			
		||||
if __name__ != "__main__":
 | 
			
		||||
    sys.stderr.write('This file cannot be loaded as a module!')
 | 
			
		||||
    sys.exit()
 | 
			
		||||
 | 
			
		||||
try:
 | 
			
		||||
  sys.stdout.write(svn.get_revision())
 | 
			
		||||
except:
 | 
			
		||||
  sys.stdout.write(git.get_svn_revision())
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user