From 0352e8df546c58b85e79714f77c616832c8c72ac Mon Sep 17 00:00:00 2001 From: Elvis Pranskevichus Date: Fri, 28 Apr 2017 17:22:38 -0400 Subject: [PATCH] Gentoo build fixes --- chromiumcontent/BUILD.gn | 9 +++------ chromiumcontent/build_libs.py | 2 +- script/create-dist | 39 ++++++++++++++++++++++++++------------- script/lib/config.py | 2 +- 4 files changed, 31 insertions(+), 21 deletions(-) diff --git a/chromiumcontent/BUILD.gn b/chromiumcontent/BUILD.gn index e4e4166..f88fab3 100644 --- a/chromiumcontent/BUILD.gn +++ b/chromiumcontent/BUILD.gn @@ -343,12 +343,9 @@ if (is_electron_build && !is_component_build) { } } - static_library("v8") { - complete_static_lib = true - sources = [] - if (defined(obj_v8)) { - sources += obj_v8 - } + shared_library("v8") { + deps = [ "//v8:v8", "//v8:v8_libplatform" ] + ldflags = [ "-Wl,-rpath=\$ORIGIN/" ] } } else { diff --git a/chromiumcontent/build_libs.py b/chromiumcontent/build_libs.py index e10f320..716c5f2 100644 --- a/chromiumcontent/build_libs.py +++ b/chromiumcontent/build_libs.py @@ -82,7 +82,7 @@ with open(args.out, 'w') as out: "third_party/usrsctp", "third_party/woff2", "third_party/zlib", - "tools", + "tools/battor_agent", "ui", "url", ]) diff --git a/script/create-dist b/script/create-dist index aec75e5..cf2f62c 100755 --- a/script/create-dist +++ b/script/create-dist @@ -45,7 +45,6 @@ COMPONENTS = ['static_library', 'shared_library'] BINARIES = { 'all': [ 'content_shell.pak', - 'icudtl.dat', 'natives_blob.bin', 'snapshot_blob.bin', os.path.join('gen', 'blink', 'public', 'resources', 'blink_image_resources_200_percent.pak'), @@ -59,7 +58,6 @@ BINARIES = { 'libffmpeg.dylib', ], 'linux': [ - 'libffmpeg.so', ], 'win32': [ 'd3dcompiler_47.dll', @@ -308,12 +306,11 @@ def main(): for component in COMPONENTS: if args.component == 'all' or args.component == component: - copy_binaries(target_arch, component, create_debug_archive) + copy_binaries(target_arch, component, create_debug_archive, + args.system_icu) copy_generated_sources(target_arch, component) copy_locales(target_arch, component) - copy_ffmpeg(target_arch) - copy_sources() generate_licenses() if not args.no_zip: create_zip(create_debug_archive) @@ -331,6 +328,8 @@ def parse_args(): help='static_library or shared_library or all') parser.add_argument('--no_zip', action='store_true', help='Do not create zip distribution') + parser.add_argument('--system-icu', action='store_true', dest='system_icu', + help='Use system icu.') return parser.parse_args() @@ -355,15 +354,17 @@ def check_create_debug_archive(target_arch): def copy_with_blacklist(target_arch, src, dest): if os.path.basename(src) in ARCH_BLACKLIST[target_arch]: return - shutil.copy2(src, dest) + link_or_copy(src, dest) -def copy_binaries(target_arch, component, create_debug_archive): +def copy_binaries(target_arch, component, create_debug_archive, system_icu): output_dir = get_output_dir(SOURCE_ROOT, target_arch, component) target_dir = os.path.join(MAIN_DIR, component) mkdir_p(target_dir) binaries = BINARIES['all'] + BINARIES[TARGET_PLATFORM] + if not system_icu: + binaries.append('icudtl.dat') if component == 'shared_library': binaries += BINARIES_SHARED_LIBRARY[TARGET_PLATFORM] for binary in binaries: @@ -371,7 +372,7 @@ def copy_binaries(target_arch, component, create_debug_archive): # Copy all static libraries from chromiumcontent for library in glob.glob(os.path.join(output_dir, 'obj', 'chromiumcontent', '*.' + STATIC_LIBRARY_SUFFIX)): - shutil.copy2(library, target_dir) + link_or_copy(library, target_dir) if component == 'shared_library': match = '*.{0}'.format(SHARED_LIBRARY_SUFFIX) @@ -396,7 +397,7 @@ def copy_binaries(target_arch, component, create_debug_archive): for root, _, filenames in os.walk(output_dir): for pdb in filenames: if pdb.endswith('.pdb'): - shutil.copy2(os.path.join(root, pdb), target_dir) + link_or_copy(os.path.join(root, pdb), target_dir) if TARGET_PLATFORM == 'linux': if component == 'shared_library': @@ -433,7 +434,7 @@ def copy_binaries(target_arch, component, create_debug_archive): ffmpeg_output_dir = get_output_dir(SOURCE_ROOT, target_arch, 'ffmpeg') for binary in binaries: - shutil.copy2(os.path.join(ffmpeg_output_dir, binary), target_dir) + link_or_copy(os.path.join(ffmpeg_output_dir, binary), target_dir) def copy_generated_sources(target_arch, component): @@ -452,7 +453,7 @@ def copy_locales(target_arch, component): for src_file in glob.glob(os.path.join(src_dir, 'content_strings_*.pak')): filename = os.path.basename(src_file) new_name = re.sub('content_strings_', '', filename) - shutil.copy2(src_file, os.path.join(target_dir, new_name)) + link_or_copy(src_file, os.path.join(target_dir, new_name)) def copy_sources(): for include_path in INCLUDE_DIRS: @@ -477,7 +478,7 @@ def copy_ffmpeg(target_arch): target_dir = os.path.join(MAIN_DIR, 'ffmpeg') mkdir_p(target_dir) - shutil.copy2(os.path.join(output_dir, binary), target_dir) + link_or_copy(os.path.join(output_dir, binary), target_dir) @@ -494,7 +495,7 @@ def copy_source_file(absolute_path, relative_to, destination): relative_path = os.path.relpath(absolute_path, start=relative_to) final_path = os.path.join(destination, relative_path) mkdir_p(os.path.dirname(final_path)) - shutil.copy2(absolute_path, final_path) + link_or_copy(absolute_path, final_path) def copy_dir(relative_path, relative_to, destination): @@ -531,6 +532,7 @@ def link_binary_to_debug_file(objcopy, binfile, symfile, dirname): def run_strip(target_arch, filename, create_debug_archive): # Static libraries are not stripped because it would remove # all the symbols in it. + return if filename.endswith('.a'): return @@ -620,6 +622,17 @@ def rm_rf(path): raise +def link_or_copy(src, dst): + if os.path.isfile(src): + if os.path.isdir(dst): + dst = os.path.join(dst, os.path.basename(src)) + try: + os.link(src, dst) + except OSError: + shutil.copy2(src, dst) + else: + shutil.copy2(src, dst) + def safe_unlink(path): try: os.unlink(path) diff --git a/script/lib/config.py b/script/lib/config.py index 3455161..195b2a1 100644 --- a/script/lib/config.py +++ b/script/lib/config.py @@ -4,4 +4,4 @@ import os def get_output_dir(source_root, target_arch, component): - return os.path.join(source_root, 'src', 'out-' + target_arch, component) + return os.environ.get('CHROMIUM_BUILD_DIR') -- 2.13.6