From a48706b407f5434c59bebcab3334b1085c802609 Mon Sep 17 00:00:00 2001 From: Marshall Greenblatt Date: Mon, 8 Apr 2013 01:32:10 +0000 Subject: [PATCH] Linux: Add make build files to binary distribution (issue #939). git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@1186 5089003a-bbd8-11dd-ad1f-f1f9622dbc98 --- tools/distrib/cefclient.gyp | 64 +++++++++++++++++++++++++++++++++++- tools/distrib/linux/build.sh | 8 +++++ tools/file_util.py | 11 +++++++ tools/make_distrib.py | 61 +++++++++++++++++++++++++++++----- 4 files changed, 134 insertions(+), 10 deletions(-) create mode 100755 tools/distrib/linux/build.sh diff --git a/tools/distrib/cefclient.gyp b/tools/distrib/cefclient.gyp index 2d9f6ee3d..e9c0bfc86 100644 --- a/tools/distrib/cefclient.gyp +++ b/tools/distrib/cefclient.gyp @@ -5,11 +5,18 @@ { 'variables': { 'chromium_code': 1, + 'linux_use_gold_binary': 0, + 'linux_use_gold_flags': 0, 'conditions': [ [ 'OS=="mac"', { # Don't use clang with CEF binary releases due to Chromium tree structure dependency. 'clang': 0, - }] + }], + ['sysroot!=""', { + 'pkg-config': './pkg-config-wrapper "<(sysroot)" "<(target_arch)"', + }, { + 'pkg-config': 'pkg-config' + }], ] }, 'includes': [ @@ -151,7 +158,29 @@ '<@(cefclient_bundle_resources_linux)', ], }, + { + 'destination': '<(PRODUCT_DIR)/', + 'files': [ + 'Resources/cef.pak', + 'Resources/devtools_resources.pak', + 'Resources/locales/', + '$(BUILDTYPE)/libcef.so', + ], + }, ], + 'dependencies': [ + 'gtk', + ], + '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", + ], + }, 'sources': [ '<@(includes_linux)', '<@(cefclient_sources_linux)', @@ -179,6 +208,13 @@ # Target build path. 'SYMROOT': 'xcodebuild', }, + 'conditions': [ + [ 'OS=="linux" or OS=="freebsd" or OS=="openbsd"', { + 'dependencies': [ + 'gtk', + ], + }], + ], }, ], 'conditions': [ @@ -242,5 +278,31 @@ }, # target cefclient_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', + }, + 'direct_dependent_settings': { + 'cflags': [ + '= 0: + epos = str.find(data, '#', pos) + if epos >= 0: + data = data[0:pos] + data[epos:] + write_file(file, data) + def run(command_line, working_dir): """ Run a command. """ sys.stdout.write('-------- Running "'+command_line+'" in "'+\ @@ -243,6 +261,8 @@ transfer_gypi_files(cef_dir, cef_paths['autogen_capi_includes'], \ # transfer common cefclient files transfer_gypi_files(cef_dir, cef_paths2['cefclient_sources_common'], \ 'tests/cefclient/', cefclient_dir, options.quiet) +transfer_gypi_files(cef_dir, cef_paths2['cefclient_bundle_resources_common'], \ + 'tests/cefclient/', cefclient_dir, options.quiet) # transfer common libcef_dll_wrapper files transfer_gypi_files(cef_dir, cef_paths2['libcef_dll_wrapper_sources_common'], \ @@ -421,11 +441,7 @@ elif platform == 'linux': if not options.allowpartial or path_exists(build_dir): dst_dir = os.path.join(output_dir, 'Debug') make_dir(dst_dir, options.quiet) - copy_dir(os.path.join(build_dir, 'lib.target'), os.path.join(dst_dir, 'lib.target'), options.quiet) - copy_file(os.path.join(build_dir, 'cefclient'), dst_dir, options.quiet) - copy_file(os.path.join(build_dir, 'cef.pak'), dst_dir, options.quiet) - copy_file(os.path.join(build_dir, 'devtools_resources.pak'), dst_dir, options.quiet) - copy_dir(os.path.join(build_dir, 'locales'), os.path.join(dst_dir, 'locales'), options.quiet) + copy_file(os.path.join(build_dir, 'lib.target/libcef.so'), dst_dir, options.quiet) else: sys.stderr.write("No Debug build files.\n") @@ -434,13 +450,17 @@ elif platform == 'linux': if not options.allowpartial or path_exists(build_dir): dst_dir = os.path.join(output_dir, 'Release') make_dir(dst_dir, options.quiet) - copy_dir(os.path.join(build_dir, 'lib.target'), os.path.join(dst_dir, 'lib.target'), options.quiet) - copy_file(os.path.join(build_dir, 'cefclient'), dst_dir, options.quiet) + copy_file(os.path.join(build_dir, 'lib.target/libcef.so'), dst_dir, options.quiet) + else: + sys.stderr.write("No Release build files.\n") + + if not build_dir is None: + # transfer resource files + dst_dir = os.path.join(output_dir, 'Resources') + 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, 'devtools_resources.pak'), dst_dir, options.quiet) copy_dir(os.path.join(build_dir, 'locales'), os.path.join(dst_dir, 'locales'), options.quiet) - else: - sys.stderr.write("No Release build files.\n") # transfer include files transfer_gypi_files(cef_dir, cef_paths2['includes_linux'], \ @@ -449,11 +469,34 @@ elif platform == 'linux': # transfer cefclient files transfer_gypi_files(cef_dir, cef_paths2['cefclient_sources_linux'], \ 'tests/cefclient/', cefclient_dir, options.quiet) + transfer_gypi_files(cef_dir, cef_paths2['cefclient_bundle_resources_linux'], \ + 'tests/cefclient/', cefclient_dir, options.quiet) # transfer additional files, if any + copy_file(os.path.join(script_dir, 'distrib/linux/build.sh'), output_dir, options.quiet) transfer_files(cef_dir, script_dir, os.path.join(script_dir, 'distrib/linux/transfer.cfg'), \ output_dir, options.quiet) + # Back up the existing Makefile + makefile = os.path.join(src_dir, 'Makefile') + makefile_tmp = makefile + '.cef_bak' + copy_file(makefile, makefile_tmp, options.quiet) + + # Generate make project files + sys.stdout.write('Generating make project files...') + gyper = [ 'python', 'tools/gyp_cef', os.path.relpath(os.path.join(output_dir, 'cefclient.gyp'), cef_dir) ] + RunAction(cef_dir, gyper); + + # Copy the resulting Makefile to the destination directory + copy_file(makefile, output_dir, options.quiet) + + # Restore the original Makefile + remove_file(makefile, options.quiet) + move_file(makefile_tmp, makefile, options.quiet) + + # Post-process the make files + fix_make_projects() + # Create an archive of the output directory zip_file = os.path.split(output_dir)[1] + '.zip' if not options.quiet: