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
This commit is contained in:
Marshall Greenblatt 2013-04-08 01:32:10 +00:00
parent 607a8a9338
commit a48706b407
4 changed files with 134 additions and 10 deletions

View File

@ -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': [
'<!@(<(pkg-config) --cflags <(gtk_packages))',
],
},
'link_settings': {
'ldflags': [
'<!@(<(pkg-config) --libs-only-L --libs-only-other <(gtk_packages))',
],
'libraries': [
'<!@(<(pkg-config) --libs-only-l <(gtk_packages))',
],
},
},
],
}], # OS=="linux" or OS=="freebsd" or OS=="openbsd"
],
}

8
tools/distrib/linux/build.sh Executable file
View File

@ -0,0 +1,8 @@
#!/bin/bash
if [ -z "$1" ]; then
echo "ERROR: Please specify a build target: Debug or Release"
else
make -j8 cefclient BUILDTYPE=$1
fi

View File

@ -73,6 +73,17 @@ def copy_files(src_glob, dst_folder, quiet = True):
else:
copy_file(fname, dst, quiet)
def remove_file(name, quiet = True):
""" Remove the specified file. """
try:
if path_exists(name):
os.remove(name)
if not quiet:
sys.stdout.write('Removing '+name+' file.\n')
except IOError, (errno, strerror):
sys.stderr.write('Failed to remove file '+name+': '+strerror)
raise
def copy_dir(src, dst, quiet = True):
""" Copy a directory tree. """
try:

View File

@ -120,6 +120,24 @@ def fix_msvs_projects():
data = data.replace('..\\..\\..\\build\\', '')
write_file(file, data)
def fix_make_projects():
""" Fix the output directory path in Makefile all .mk files. """
find = os.path.relpath(output_dir, src_dir)
files = [os.path.join(output_dir, 'Makefile')]
for file in get_files(os.path.join(output_dir, '*.mk')):
files.append(file)
for file in files:
data = read_file(file)
data = data.replace(find, '.')
if os.path.basename(file) == 'Makefile':
# remove the quiet_cmd_regen_makefile section
pos = str.find(data, 'quiet_cmd_regen_makefile')
if pos >= 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: