From 4bd6d01eac5a36c13e4f8dbb47befccef6d53ace Mon Sep 17 00:00:00 2001 From: Alexander Frick Date: Mon, 22 Jan 2024 15:21:54 -0600 Subject: [PATCH] M120 stage 7 --- LICENSE.md | 2 +- arm/android/media/media_options.gni | 14 +- arm/media/base/supported_types.cc | 13 +- arm/media/ffmpeg/ffmpeg_common.cc | 6 +- .../installer/linux/common/installer.include | 2 +- depot_tools/autoninja | 2 +- .../win_toolchain/package_from_installed.py | 1006 +++++++++-------- docs/WIN_CROSS_BUILD_INSTRUCTIONS.txt | 4 +- docs/WIN_INSTRUCTIONS.txt | 4 +- infra/APPIMAGE/Thorium.yml | 2 +- infra/Arch_Linux/PKGBUILD | 2 +- infra/DEBUG/Thorium_Debug_Shell.sh | 2 +- infra/DEBUG/build_debug_linux.sh | 3 +- infra/DEBUG/build_debug_shell_linux.sh | 4 +- infra/DEBUG/build_debug_shell_win.sh | 3 +- infra/DEBUG/build_debug_win.sh | 3 +- infra/THORIUM_DEV_BOOKMARKS.html | 3 + infra/arch-prerequisites.sh | 4 +- infra/build_dmg_cr.sh | 2 +- infra/fetch_api_keys.sh | 4 +- infra/fix_libaom.sh | 4 +- infra/install_deps.sh | 4 +- infra/portable/README.debug | 2 +- infra/portable/README.linux | 5 +- infra/portable/README.win | 5 +- infra/portable/THORIUM-PORTABLE | 2 +- infra/portable/THORIUM-SHELL | 2 +- infra/portable/make_portable_linux.sh | 3 +- infra/portable/make_portable_win.sh | 3 +- logos/NEW/mac/gen/app/build_icns.sh | 2 +- logos/NEW/mac/gen/document/build_icns.sh | 2 +- other/CrOS/chrome/BUILD.gn | 21 +- other/build_polly.sh | 2 +- other/setup_polly.sh | 90 -- package.sh | 2 +- pak_src/build.sh | 29 +- src/chrome/android/BUILD.gn | 4 +- src/chrome/installer/linux/common/apt.include | 2 +- .../chromium-browser/chromium-browser.info | 2 +- .../installer/linux/common/installer.include | 2 +- src/chrome/installer/linux/common/repo.cron | 2 +- src/chrome/installer/linux/common/wrapper | 2 +- src/chrome/installer/linux/debian/build.sh | 2 +- src/chrome/installer/linux/debian/postinst | 2 +- src/chrome/installer/linux/debian/postrm | 2 +- src/chrome/installer/linux/debian/prerm | 2 +- src/chrome/installer/linux/rpm/build.sh | 2 +- src/content/shell/android/BUILD.gn | 4 +- src/third_party/widevine/cdm/BUILD.gn | 2 +- .../cdm/chromeos/arm64/widevine_cdm_version.h | 2 +- .../cdm/chromeos/x64/widevine_cdm_version.h | 2 +- src/third_party/widevine/cdm/widevine.gni | 12 +- .../widevine/cdm/widevine_cdm_version.h | 2 +- thorium-libjxl | 2 +- 54 files changed, 645 insertions(+), 668 deletions(-) mode change 100644 => 100755 depot_tools/win_toolchain/package_from_installed.py delete mode 100755 other/setup_polly.sh diff --git a/LICENSE.md b/LICENSE.md index 88b655cd..8436f213 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -1,6 +1,6 @@ BSD 3-Clause License -Copyright (c) 2021-2024, Alexander David Frick +Copyright (c) 2021-2024, Alexander Frick Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: diff --git a/arm/android/media/media_options.gni b/arm/android/media/media_options.gni index 61d5046d..669e9d4c 100644 --- a/arm/android/media/media_options.gni +++ b/arm/android/media/media_options.gni @@ -71,6 +71,10 @@ declare_args() { # on-device decoding and bitstream passthrough as supported by device. enable_platform_ac3_eac3_audio = proprietary_codecs && is_cast_media_device + # Enables AC4 audio handling in chromium. This includes demuxing, + # on-device decoding and bitstream passthrough as supported by device. + enable_platform_ac4_audio = false + enable_platform_mpeg_h_audio = proprietary_codecs && is_cast_media_device # Enables DTS/DTSX audio handling in chromium. This includes demuxing, @@ -150,6 +154,8 @@ assert(!enable_hls_demuxer || proprietary_codecs, "proprietary_codecs required for enable_hls_demuxer") assert(!enable_platform_ac3_eac3_audio || proprietary_codecs, "proprietary_codecs required for enable_platform_ac3_eac3_audio") +assert(!enable_platform_ac4_audio || proprietary_codecs, + "proprietary_codecs required for enable_platform_ac4_audio") assert(!enable_platform_mpeg_h_audio || proprietary_codecs, "proprietary_codecs required for enable_platform_mpeg_h_audio") assert(!enable_mse_mpeg2ts_stream_parser || proprietary_codecs, @@ -228,7 +234,8 @@ declare_args() { # Enables host verification for CDMs. # Windows and Mac. enable_cdm_host_verification = - enable_library_cdms && (is_mac || is_win) && is_chrome_branded + enable_library_cdms && (is_mac || is_win) && is_chrome_branded && + !is_chrome_for_testing_branded # Enable Storage ID which is used by CDMs. This is only available with chrome # branding, but may be overridden by other embedders. @@ -245,6 +252,10 @@ declare_args() { assert(!enable_cdm_host_verification || is_mac || is_win, "CDM host verification is only supported on Mac and Windows.") +# https://crbug.com/1475137#c37 +assert(!is_chrome_for_testing_branded || !enable_cdm_host_verification, + "Chrome for Testing is incompatible with CDM Host Verification.") + # Default |mojo_media_services| and |mojo_media_host| on various platforms. See # comments below for valid values. Can be overridden by gn build arguments from # the --args command line flag. @@ -258,6 +269,7 @@ if (is_cast_media_device) { _default_mojo_media_services = [ "cdm", "audio_decoder", + "audio_encoder", "video_decoder", ] _default_mojo_media_host = "gpu" diff --git a/arm/media/base/supported_types.cc b/arm/media/base/supported_types.cc index 3fc515ec..289a48f8 100644 --- a/arm/media/base/supported_types.cc +++ b/arm/media/base/supported_types.cc @@ -1,4 +1,4 @@ -// Copyright 2023 The Chromium Authors and Alex313031 +// Copyright 2024 The Chromium Authors and Alex313031 // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -197,6 +197,7 @@ bool IsAudioCodecProprietary(AudioCodec codec) { case AudioCodec::kDTS: case AudioCodec::kDTSXP2: case AudioCodec::kDTSE: + case AudioCodec::kAC4: return true; case AudioCodec::kFLAC: @@ -266,8 +267,8 @@ bool IsAV1Supported(const VideoType& type) { } bool IsMPEG4Supported() { -#if BUILDFLAG(IS_CHROMEOS_ASH) - return true; +#if BUILDFLAG(IS_CHROMEOS) && BUILDFLAG(USE_PROPRIETARY_CODECS) + return base::FeatureList::IsEnabled(kCrOSLegacyMediaFormats); #else return false; #endif @@ -324,9 +325,10 @@ bool IsDefaultSupportedVideoType(const VideoType& type) { #endif switch (type.codec) { + case VideoCodec::kTheora: + return IsBuiltInVideoCodec(type.codec); case VideoCodec::kH264: case VideoCodec::kVP8: - case VideoCodec::kTheora: return true; case VideoCodec::kAV1: return IsAV1Supported(type); @@ -372,6 +374,7 @@ bool IsDefaultSupportedAudioType(const AudioType& type) { case AudioCodec::kGSM_MS: case AudioCodec::kALAC: case AudioCodec::kMpegHAudio: + case AudioCodec::kAC4: case AudioCodec::kUnknown: return false; case AudioCodec::kDTS: @@ -395,7 +398,7 @@ bool IsDefaultSupportedAudioType(const AudioType& type) { bool IsBuiltInVideoCodec(VideoCodec codec) { #if BUILDFLAG(ENABLE_FFMPEG_VIDEO_DECODERS) if (codec == VideoCodec::kTheora) - return true; + return base::FeatureList::IsEnabled(kTheoraVideoCodec); if (codec == VideoCodec::kVP8) return true; #if BUILDFLAG(USE_PROPRIETARY_CODECS) diff --git a/arm/media/ffmpeg/ffmpeg_common.cc b/arm/media/ffmpeg/ffmpeg_common.cc index 910f9ad5..a88f613f 100644 --- a/arm/media/ffmpeg/ffmpeg_common.cc +++ b/arm/media/ffmpeg/ffmpeg_common.cc @@ -421,10 +421,10 @@ bool AVCodecContextToAudioDecoderConfig(const AVCodecContext* codec_context, } #endif - // Verify that AudioConfig.bits_per_channel was calculated correctly for + // Verify that AudioConfig.bytes_per_channel was calculated correctly for // codecs that have |sample_fmt| set by FFmpeg. - DCHECK_EQ(av_get_bytes_per_sample(codec_context->sample_fmt) * 8, - config->bits_per_channel()); + DCHECK_EQ(av_get_bytes_per_sample(codec_context->sample_fmt), + config->bytes_per_channel()); return true; } diff --git a/arm/raspi/chrome/installer/linux/common/installer.include b/arm/raspi/chrome/installer/linux/common/installer.include index fb564885..82886dc6 100644 --- a/arm/raspi/chrome/installer/linux/common/installer.include +++ b/arm/raspi/chrome/installer/linux/common/installer.include @@ -1,4 +1,4 @@ -# Copyright (c) 2023 Alex313031 and Iridium +# Copyright (c) 2024 Alex313031 and Iridium # Shows the output of a given command only on failure, or when VERBOSE is set. log_cmd() { if [ "${VERBOSE:-}" ]; then diff --git a/depot_tools/autoninja b/depot_tools/autoninja index ac2e57a4..e60d119b 100755 --- a/depot_tools/autoninja +++ b/depot_tools/autoninja @@ -1,6 +1,6 @@ #!/usr/bin/env bash -# Copyright (c) 2022 Google Inc and Alex313031. All rights reserved. +# Copyright (c) 2024 Google Inc and Alex313031. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/depot_tools/win_toolchain/package_from_installed.py b/depot_tools/win_toolchain/package_from_installed.py old mode 100644 new mode 100755 index 8366bb0f..ea80db30 --- a/depot_tools/win_toolchain/package_from_installed.py +++ b/depot_tools/win_toolchain/package_from_installed.py @@ -1,8 +1,7 @@ #!/usr/bin/env python3 -# Copyright 2023 The Chromium Authors and Alex313031. All rights reserved. +# Copyright 2024 The Chromium Authors and Alex313031. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. - """ From a system-installed copy of the toolchain, packages all the required bits into a .zip file. @@ -31,8 +30,6 @@ useful as the resulting zip can't be redistributed, and most will presumably have a Pro license anyway). """ -from __future__ import print_function - import collections import glob import json @@ -47,7 +44,6 @@ import zipfile import get_toolchain_if_necessary - _vs_version = None _win_version = None _vc_tools = None @@ -56,527 +52,579 @@ _allow_multiple_vs_installs = False def GetVSPath(): - # Use vswhere to find the VS installation. This will find prerelease - # versions because -prerelease is specified. This assumes that only one - # version is installed. - command = (r'C:\Program Files (x86)\Microsoft Visual Studio\Installer' - r'\vswhere.exe -prerelease') - vs_version_marker = 'catalog_productLineVersion: ' - vs_path_marker = 'installationPath: ' - output = subprocess.check_output(command, universal_newlines=True) - vs_path = None - vs_installs_count = 0 - matching_vs_path = "" - for line in output.splitlines(): - if line.startswith(vs_path_marker): - # The path information comes first - vs_path = line[len(vs_path_marker):] - vs_installs_count += 1 - if line.startswith(vs_version_marker): - # The version for that path comes later - if line[len(vs_version_marker):] == _vs_version: - matching_vs_path = vs_path + # Use vswhere to find the VS installation. This will find prerelease + # versions because -prerelease is specified. This assumes that only one + # version is installed. + command = (r'C:\Program Files (x86)\Microsoft Visual Studio\Installer' + r'\vswhere.exe -prerelease') + vs_version_marker = 'catalog_productLineVersion: ' + vs_path_marker = 'installationPath: ' + output = subprocess.check_output(command, universal_newlines=True) + vs_path = None + vs_installs_count = 0 + matching_vs_path = "" + for line in output.splitlines(): + if line.startswith(vs_path_marker): + # The path information comes first + vs_path = line[len(vs_path_marker):] + vs_installs_count += 1 + if line.startswith(vs_version_marker): + # The version for that path comes later + if line[len(vs_version_marker):] == _vs_version: + matching_vs_path = vs_path - if vs_installs_count == 0: - raise Exception('VS %s path not found in vswhere output' % (_vs_version)) - if vs_installs_count > 1: - if not _allow_multiple_vs_installs: - raise Exception('Multiple VS installs detected. This is unsupported. ' - 'It is recommended that packaging be done on a clean VM ' - 'with just one version installed. To proceed anyway add ' - 'the --allow_multiple_vs_installs flag to this script') - else: - print('Multiple VS installs were detected. This is unsupported. ' - 'Proceeding anyway') - return matching_vs_path + if vs_installs_count == 0: + raise Exception('VS %s path not found in vswhere output' % + (_vs_version)) + if vs_installs_count > 1: + if not _allow_multiple_vs_installs: + raise Exception( + 'Multiple VS installs detected. This is unsupported. ' + 'It is recommended that packaging be done on a clean VM ' + 'with just one version installed. To proceed anyway add ' + 'the --allow_multiple_vs_installs flag to this script') + else: + print('Multiple VS installs were detected. This is unsupported. ' + 'Proceeding anyway') + return matching_vs_path def ExpandWildcards(root, sub_dir): - # normpath is needed to change '/' to '\\' characters. - path = os.path.normpath(os.path.join(root, sub_dir)) - matches = glob.glob(path) - if len(matches) != 1: - raise Exception('%s had %d matches - should be one' % (path, len(matches))) - return matches[0] + # normpath is needed to change '/' to '\\' characters. + path = os.path.normpath(os.path.join(root, sub_dir)) + matches = glob.glob(path) + if len(matches) != 1: + raise Exception('%s had %d matches - should be one' % + (path, len(matches))) + return matches[0] def BuildRepackageFileList(src_dir): - # Strip off a trailing separator if present - if src_dir.endswith(os.path.sep): - src_dir = src_dir[:-len(os.path.sep)] + # Strip off a trailing separator if present + if src_dir.endswith(os.path.sep): + src_dir = src_dir[:-len(os.path.sep)] - # Ensure .\Windows Kits\10\Debuggers exists and fail to repackage if it - # doesn't. - debuggers_path = os.path.join(src_dir, 'Windows Kits', '10', 'Debuggers') - if not os.path.exists(debuggers_path): - raise Exception('Repacking failed. Missing %s.' % (debuggers_path)) + # Ensure .\Windows Kits\10\Debuggers exists and fail to repackage if it + # doesn't. + debuggers_path = os.path.join(src_dir, 'Windows Kits', '10', 'Debuggers') + if not os.path.exists(debuggers_path): + raise Exception('Repacking failed. Missing %s.' % (debuggers_path)) - result = [] - for root, _, files in os.walk(src_dir): - for f in files: - final_from = os.path.normpath(os.path.join(root, f)) - dest = final_from[len(src_dir) + 1:] - result.append((final_from, dest)) - return result + result = [] + for root, _, files in os.walk(src_dir): + for f in files: + final_from = os.path.normpath(os.path.join(root, f)) + dest = final_from[len(src_dir) + 1:] + result.append((final_from, dest)) + return result def BuildFileList(override_dir, include_arm, vs_path): - result = [] + result = [] - # Subset of VS corresponding roughly to VC. - paths = [ - 'DIA SDK/bin', - 'DIA SDK/idl', - 'DIA SDK/include', - 'DIA SDK/lib', - _vc_tools + '/atlmfc', - _vc_tools + '/crt', - 'VC/redist', - ] + # Subset of VS corresponding roughly to VC. + paths = [ + 'DIA SDK/bin', + 'DIA SDK/idl', + 'DIA SDK/include', + 'DIA SDK/lib', + _vc_tools + '/atlmfc', + _vc_tools + '/crt', + 'VC/redist', + ] + + if override_dir: + paths += [ + (os.path.join(override_dir, 'bin'), _vc_tools + '/bin'), + (os.path.join(override_dir, 'include'), _vc_tools + '/include'), + (os.path.join(override_dir, 'lib'), _vc_tools + '/lib'), + ] + else: + paths += [ + _vc_tools + '/bin', + _vc_tools + '/include', + _vc_tools + '/lib', + ] - if override_dir: paths += [ - (os.path.join(override_dir, 'bin'), _vc_tools + '/bin'), - (os.path.join(override_dir, 'include'), _vc_tools + '/include'), - (os.path.join(override_dir, 'lib'), _vc_tools + '/lib'), + ('VC/redist/MSVC/14.*.*/x86/Microsoft.VC*.CRT', 'sys32'), + ('VC/redist/MSVC/14.*.*/x86/Microsoft.VC*.CRT', + 'Windows Kits/10//bin/x86'), + ('VC/redist/MSVC/14.*.*/debug_nonredist/x86/Microsoft.VC*.DebugCRT', + 'sys32'), + ('VC/redist/MSVC/14.*.*/x64/Microsoft.VC*.CRT', 'sys64'), + ('VC/redist/MSVC/14.*.*/x64/Microsoft.VC*.CRT', 'VC/bin/amd64_x86'), + ('VC/redist/MSVC/14.*.*/x64/Microsoft.VC*.CRT', 'VC/bin/amd64'), + ('VC/redist/MSVC/14.*.*/x64/Microsoft.VC*.CRT', + 'Windows Kits/10/bin/x64'), + ('VC/redist/MSVC/14.*.*/debug_nonredist/x64/Microsoft.VC*.DebugCRT', + 'sys64'), ] - else: - paths += [ - _vc_tools + '/bin', - _vc_tools + '/include', - _vc_tools + '/lib', + if include_arm: + paths += [ + ('VC/redist/MSVC/14.*.*/arm64/Microsoft.VC*.CRT', 'sysarm64'), + ('VC/redist/MSVC/14.*.*/arm64/Microsoft.VC*.CRT', + 'VC/bin/amd64_arm64'), + ('VC/redist/MSVC/14.*.*/arm64/Microsoft.VC*.CRT', 'VC/bin/arm64'), + ('VC/redist/MSVC/14.*.*/arm64/Microsoft.VC*.CRT', + 'Windows Kits/10/bin/arm64'), + ('VC/redist/MSVC/14.*.*/debug_nonredist/arm64/Microsoft.VC*.DebugCRT', + 'sysarm64'), + ] + + for path in paths: + src = path[0] if isinstance(path, tuple) else path + # Note that vs_path is ignored if src is an absolute path. + combined = ExpandWildcards(vs_path, src) + if not os.path.exists(combined): + raise Exception('%s missing.' % combined) + if not os.path.isdir(combined): + raise Exception('%s not a directory.' % combined) + for root, _, files in os.walk(combined): + for f in files: + # vctip.exe doesn't shutdown, leaving locks on directories. It's + # optional so let's avoid this problem by not packaging it. + # https://crbug.com/735226 + if f.lower() == 'vctip.exe': + continue + final_from = os.path.normpath(os.path.join(root, f)) + if isinstance(path, tuple): + assert final_from.startswith(combined) + dest = final_from[len(combined) + 1:] + result.append((final_from, + os.path.normpath(os.path.join(path[1], + dest)))) + else: + assert final_from.startswith(vs_path) + dest = final_from[len(vs_path) + 1:] + result.append((final_from, dest)) + + command = ( + r'reg query "HKLM\SOFTWARE\Microsoft\Windows Kits\Installed Roots"' + r' /v KitsRoot10') + marker = " KitsRoot10 REG_SZ " + sdk_path = None + output = subprocess.check_output(command, universal_newlines=True) + for line in output.splitlines(): + if line.startswith(marker): + sdk_path = line[len(marker):] + + # Strip off a trailing slash if present + if sdk_path.endswith(os.path.sep): + sdk_path = sdk_path[:-len(os.path.sep)] + + debuggers_path = os.path.join(sdk_path, 'Debuggers') + if not os.path.exists(debuggers_path): + raise Exception('Packaging failed. Missing %s.' % (debuggers_path)) + + for root, _, files in os.walk(sdk_path): + for f in files: + combined = os.path.normpath(os.path.join(root, f)) + # Some of the files in this directory are exceedingly long (and + # exceed _MAX_PATH for any moderately long root), so exclude them. + # We don't need them anyway. Exclude/filter/skip others just to save + # space. + tail = combined[len(sdk_path) + 1:] + skip_dir = False + for dir in [ + 'References\\', 'Windows Performance Toolkit\\', + 'Testing\\', 'App Certification Kit\\', 'Extension SDKs\\', + 'Assessment and Deployment Kit\\' + ]: + if tail.startswith(dir): + skip_dir = True + if skip_dir: + continue + # There may be many Include\Lib\Source\bin directories for many + # different versions of Windows and packaging them all wastes ~450 + # MB (uncompressed) per version and wastes time. Only copy the + # specified version. Note that the SDK version number started being + # part of the bin path with 10.0.15063.0. + if (tail.startswith('Include\\') or tail.startswith('Lib\\') + or tail.startswith('Source\\') or tail.startswith('bin\\')): + if tail.count(_win_version) == 0: + continue + to = os.path.join('Windows Kits', '10', tail) + result.append((combined, to)) + + # Copy the x86 ucrt DLLs to all directories with x86 binaries that are + # added to the path by SetEnv.cmd, and to sys32. Starting with the 17763 + # SDK the ucrt files are in _win_version\ucrt instead of just ucrt. + ucrt_dir = os.path.join(sdk_path, 'redist', _win_version, r'ucrt\dlls\x86') + if not os.path.exists(ucrt_dir): + ucrt_dir = os.path.join(sdk_path, r'redist\ucrt\dlls\x86') + ucrt_paths = glob.glob(ucrt_dir + r'\*') + assert (len(ucrt_paths) > 0) + for ucrt_path in ucrt_paths: + ucrt_file = os.path.split(ucrt_path)[1] + for dest_dir in [r'Windows Kits\10\bin\x86', 'sys32']: + result.append((ucrt_path, os.path.join(dest_dir, ucrt_file))) + + # Copy the x64 ucrt DLLs to all directories with x64 binaries that are + # added to the path by SetEnv.cmd, and to sys64. + ucrt_dir = os.path.join(sdk_path, 'redist', _win_version, r'ucrt\dlls\x64') + if not os.path.exists(ucrt_dir): + ucrt_dir = os.path.join(sdk_path, r'redist\ucrt\dlls\x64') + ucrt_paths = glob.glob(ucrt_dir + r'\*') + assert (len(ucrt_paths) > 0) + for ucrt_path in ucrt_paths: + ucrt_file = os.path.split(ucrt_path)[1] + for dest_dir in [ + r'VC\bin\amd64_x86', r'VC\bin\amd64', + r'Windows Kits\10\bin\x64', 'sys64' + ]: + result.append((ucrt_path, os.path.join(dest_dir, ucrt_file))) + + system_crt_files = [ + # Needed to let debug binaries run. + 'ucrtbased.dll', ] - - paths += [ - ('VC/redist/MSVC/14.*.*/x86/Microsoft.VC*.CRT', 'sys32'), - ('VC/redist/MSVC/14.*.*/x86/Microsoft.VC*.CRT', - 'Windows Kits/10//bin/x86'), - ('VC/redist/MSVC/14.*.*/debug_nonredist/x86/Microsoft.VC*.DebugCRT', - 'sys32'), - ('VC/redist/MSVC/14.*.*/x64/Microsoft.VC*.CRT', 'sys64'), - ('VC/redist/MSVC/14.*.*/x64/Microsoft.VC*.CRT', 'VC/bin/amd64_x86'), - ('VC/redist/MSVC/14.*.*/x64/Microsoft.VC*.CRT', 'VC/bin/amd64'), - ('VC/redist/MSVC/14.*.*/x64/Microsoft.VC*.CRT', - 'Windows Kits/10/bin/x64'), - ('VC/redist/MSVC/14.*.*/debug_nonredist/x64/Microsoft.VC*.DebugCRT', - 'sys64'), - ] - if include_arm: - paths += [ - ('VC/redist/MSVC/14.*.*/arm64/Microsoft.VC*.CRT', 'sysarm64'), - ('VC/redist/MSVC/14.*.*/arm64/Microsoft.VC*.CRT', 'VC/bin/amd64_arm64'), - ('VC/redist/MSVC/14.*.*/arm64/Microsoft.VC*.CRT', 'VC/bin/arm64'), - ('VC/redist/MSVC/14.*.*/arm64/Microsoft.VC*.CRT', - 'Windows Kits/10/bin/arm64'), - ('VC/redist/MSVC/14.*.*/debug_nonredist/arm64/Microsoft.VC*.DebugCRT', - 'sysarm64'), + cpu_pairs = [ + ('x86', 'sys32'), + ('x64', 'sys64'), ] + if include_arm: + cpu_pairs += [ + ('arm64', 'sysarm64'), + ] + for system_crt_file in system_crt_files: + for cpu_pair in cpu_pairs: + target_cpu, dest_dir = cpu_pair + src_path = os.path.join(sdk_path, 'bin', _win_version, target_cpu, + 'ucrt') + result.append((os.path.join(src_path, system_crt_file), + os.path.join(dest_dir, system_crt_file))) - for path in paths: - src = path[0] if isinstance(path, tuple) else path - # Note that vs_path is ignored if src is an absolute path. - combined = ExpandWildcards(vs_path, src) - if not os.path.exists(combined): - raise Exception('%s missing.' % combined) - if not os.path.isdir(combined): - raise Exception('%s not a directory.' % combined) - for root, _, files in os.walk(combined): - for f in files: - # vctip.exe doesn't shutdown, leaving locks on directories. It's - # optional so let's avoid this problem by not packaging it. - # https://crbug.com/735226 - if f.lower() =='vctip.exe': - continue - final_from = os.path.normpath(os.path.join(root, f)) - if isinstance(path, tuple): - assert final_from.startswith(combined) - dest = final_from[len(combined) + 1:] - result.append( - (final_from, os.path.normpath(os.path.join(path[1], dest)))) - else: - assert final_from.startswith(vs_path) - dest = final_from[len(vs_path) + 1:] - result.append((final_from, dest)) + # Generically drop all arm stuff that we don't need, and + # drop .msi files because we don't need installers and drop + # samples since those are not used by any tools. + def is_skippable(f): + return ('arm\\' in f.lower() + or (not include_arm and 'arm64\\' in f.lower()) + or 'samples\\' in f.lower() or f.lower().endswith( + ('.msi', '.msm'))) - command = (r'reg query "HKLM\SOFTWARE\Microsoft\Windows Kits\Installed Roots"' - r' /v KitsRoot10') - marker = " KitsRoot10 REG_SZ " - sdk_path = None - output = subprocess.check_output(command, universal_newlines=True) - for line in output.splitlines(): - if line.startswith(marker): - sdk_path = line[len(marker):] + return [(f, t) for f, t in result if not is_skippable(f)] - # Strip off a trailing slash if present - if sdk_path.endswith(os.path.sep): - sdk_path = sdk_path[:-len(os.path.sep)] - - debuggers_path = os.path.join(sdk_path, 'Debuggers') - if not os.path.exists(debuggers_path): - raise Exception('Packaging failed. Missing %s.' % (debuggers_path)) - - for root, _, files in os.walk(sdk_path): - for f in files: - combined = os.path.normpath(os.path.join(root, f)) - # Some of the files in this directory are exceedingly long (and exceed - # _MAX_PATH for any moderately long root), so exclude them. We don't need - # them anyway. Exclude/filter/skip others just to save space. - tail = combined[len(sdk_path) + 1:] - skip_dir = False - for dir in ['References\\', 'Windows Performance Toolkit\\', 'Testing\\', - 'App Certification Kit\\', 'Extension SDKs\\', - 'Assessment and Deployment Kit\\']: - if tail.startswith(dir): - skip_dir = True - if skip_dir: - continue - # There may be many Include\Lib\Source\bin directories for many different - # versions of Windows and packaging them all wastes ~450 MB - # (uncompressed) per version and wastes time. Only copy the specified - # version. Note that the SDK version number started being part of the bin - # path with 10.0.15063.0. - if (tail.startswith('Include\\') or tail.startswith('Lib\\') or - tail.startswith('Source\\') or tail.startswith('bin\\')): - if tail.count(_win_version) == 0: - continue - to = os.path.join('Windows Kits', '10', tail) - result.append((combined, to)) - - # Copy the x86 ucrt DLLs to all directories with x86 binaries that are - # added to the path by SetEnv.cmd, and to sys32. Starting with the 17763 - # SDK the ucrt files are in _win_version\ucrt instead of just ucrt. - ucrt_dir = os.path.join(sdk_path, 'redist', _win_version, r'ucrt\dlls\x86') - if not os.path.exists(ucrt_dir): - ucrt_dir = os.path.join(sdk_path, r'redist\ucrt\dlls\x86') - ucrt_paths = glob.glob(ucrt_dir + r'\*') - assert(len(ucrt_paths) > 0) - for ucrt_path in ucrt_paths: - ucrt_file = os.path.split(ucrt_path)[1] - for dest_dir in [ r'Windows Kits\10\bin\x86', 'sys32' ]: - result.append((ucrt_path, os.path.join(dest_dir, ucrt_file))) - - # Copy the x64 ucrt DLLs to all directories with x64 binaries that are - # added to the path by SetEnv.cmd, and to sys64. - ucrt_dir = os.path.join(sdk_path, 'redist', _win_version, r'ucrt\dlls\x64') - if not os.path.exists(ucrt_dir): - ucrt_dir = os.path.join(sdk_path, r'redist\ucrt\dlls\x64') - ucrt_paths = glob.glob(ucrt_dir + r'\*') - assert(len(ucrt_paths) > 0) - for ucrt_path in ucrt_paths: - ucrt_file = os.path.split(ucrt_path)[1] - for dest_dir in [ r'VC\bin\amd64_x86', r'VC\bin\amd64', - r'Windows Kits\10\bin\x64', 'sys64']: - result.append((ucrt_path, os.path.join(dest_dir, ucrt_file))) - - system_crt_files = [ - # Needed to let debug binaries run. - 'ucrtbased.dll', - ] - cpu_pairs = [ - ('x86', 'sys32'), - ('x64', 'sys64'), - ] - if include_arm: - cpu_pairs += [ - ('arm64', 'sysarm64'), - ] - for system_crt_file in system_crt_files: - for cpu_pair in cpu_pairs: - target_cpu, dest_dir = cpu_pair - src_path = os.path.join(sdk_path, 'bin', _win_version, target_cpu, 'ucrt') - result.append((os.path.join(src_path, system_crt_file), - os.path.join(dest_dir, system_crt_file))) - - # Generically drop all arm stuff that we don't need, and - # drop .msi files because we don't need installers and drop - # samples since those are not used by any tools. - def is_skippable(f): - return ('arm\\' in f.lower() or - (not include_arm and 'arm64\\' in f.lower()) or - 'samples\\' in f.lower() or - f.lower().endswith(('.msi', - '.msm'))) - return [(f, t) for f, t in result if not is_skippable(f)] def GenerateSetEnvCmd(target_dir): - """Generate a batch file that gyp expects to exist to set up the compiler - environment. + """Generate a batch file that gyp expects to exist to set up the compiler + environment. - This is normally generated by a full install of the SDK, but we - do it here manually since we do not do a full install.""" - vc_tools_parts = _vc_tools.split('/') + This is normally generated by a full install of the SDK, but we + do it here manually since we do not do a full install.""" + vc_tools_parts = _vc_tools.split('/') - # All these paths are relative to the root of the toolchain package. - include_dirs = [ - ['Windows Kits', '10', 'Include', _win_version, 'um'], - ['Windows Kits', '10', 'Include', _win_version, 'shared'], - ['Windows Kits', '10', 'Include', _win_version, 'winrt'], - ] - include_dirs.append(['Windows Kits', '10', 'Include', _win_version, 'ucrt']) - include_dirs.extend([ - vc_tools_parts + ['include'], - vc_tools_parts + ['atlmfc', 'include'], - ]) - libpath_dirs = [ - vc_tools_parts + ['lib', 'x86', 'store', 'references'], - ['Windows Kits', '10', 'UnionMetadata', _win_version], - ] - # Common to x86, x64, and arm64 - env = collections.OrderedDict([ - # Yuck: These have a trailing \ character. No good way to represent this in - # an OS-independent way. - ('VSINSTALLDIR', [['.\\']]), - ('VCINSTALLDIR', [['VC\\']]), - ('INCLUDE', include_dirs), - ('LIBPATH', libpath_dirs), - ]) - # x86. Always use amd64_x86 cross, not x86 on x86. - env['VCToolsInstallDir'] = [vc_tools_parts[:]] - # Yuck: This one ends in a path separator as well. - env['VCToolsInstallDir'][0][-1] += os.path.sep - env_x86 = collections.OrderedDict([ - ( - 'PATH', - [ - ['Windows Kits', '10', 'bin', _win_version, 'x64'], - vc_tools_parts + ['bin', 'HostX64', 'x86'], - vc_tools_parts + ['bin', 'HostX64', 'x64' - ], # Needed for mspdb1x0.dll. - ]), - ('LIB', [ - vc_tools_parts + ['lib', 'x86'], - ['Windows Kits', '10', 'Lib', _win_version, 'um', 'x86'], - ['Windows Kits', '10', 'Lib', _win_version, 'ucrt', 'x86'], - vc_tools_parts + ['atlmfc', 'lib', 'x86'], - ]), - ]) + # All these paths are relative to the root of the toolchain package. + include_dirs = [ + ['Windows Kits', '10', 'Include', _win_version, 'um'], + ['Windows Kits', '10', 'Include', _win_version, 'shared'], + ['Windows Kits', '10', 'Include', _win_version, 'winrt'], + ] + include_dirs.append(['Windows Kits', '10', 'Include', _win_version, 'ucrt']) + include_dirs.extend([ + vc_tools_parts + ['include'], + vc_tools_parts + ['atlmfc', 'include'], + ]) + libpath_dirs = [ + vc_tools_parts + ['lib', 'x86', 'store', 'references'], + ['Windows Kits', '10', 'UnionMetadata', _win_version], + ] + # Common to x86, x64, and arm64 + env = collections.OrderedDict([ + # Yuck: These have a trailing \ character. No good way to represent this + # in an OS-independent way. + ('VSINSTALLDIR', [['.\\']]), + ('VCINSTALLDIR', [['VC\\']]), + ('INCLUDE', include_dirs), + ('LIBPATH', libpath_dirs), + ]) + # x86. Always use amd64_x86 cross, not x86 on x86. + env['VCToolsInstallDir'] = [vc_tools_parts[:]] + # Yuck: This one ends in a path separator as well. + env['VCToolsInstallDir'][0][-1] += os.path.sep + env_x86 = collections.OrderedDict([ + ( + 'PATH', + [ + ['Windows Kits', '10', 'bin', _win_version, 'x64'], + vc_tools_parts + ['bin', 'HostX64', 'x86'], + vc_tools_parts + + ['bin', 'HostX64', 'x64'], # Needed for mspdb1x0.dll. + ]), + ('LIB', [ + vc_tools_parts + ['lib', 'x86'], + ['Windows Kits', '10', 'Lib', _win_version, 'um', 'x86'], + ['Windows Kits', '10', 'Lib', _win_version, 'ucrt', 'x86'], + vc_tools_parts + ['atlmfc', 'lib', 'x86'], + ]), + ]) - # x64. - env_x64 = collections.OrderedDict([ - ('PATH', [ - ['Windows Kits', '10', 'bin', _win_version, 'x64'], - vc_tools_parts + ['bin', 'HostX64', 'x64'], - ]), - ('LIB', [ - vc_tools_parts + ['lib', 'x64'], - ['Windows Kits', '10', 'Lib', _win_version, 'um', 'x64'], - ['Windows Kits', '10', 'Lib', _win_version, 'ucrt', 'x64'], - vc_tools_parts + ['atlmfc', 'lib', 'x64'], - ]), - ]) + # x64. + env_x64 = collections.OrderedDict([ + ('PATH', [ + ['Windows Kits', '10', 'bin', _win_version, 'x64'], + vc_tools_parts + ['bin', 'HostX64', 'x64'], + ]), + ('LIB', [ + vc_tools_parts + ['lib', 'x64'], + ['Windows Kits', '10', 'Lib', _win_version, 'um', 'x64'], + ['Windows Kits', '10', 'Lib', _win_version, 'ucrt', 'x64'], + vc_tools_parts + ['atlmfc', 'lib', 'x64'], + ]), + ]) - # arm64. - env_arm64 = collections.OrderedDict([ - ('PATH', [ - ['Windows Kits', '10', 'bin', _win_version, 'x64'], - vc_tools_parts + ['bin', 'HostX64', 'arm64'], - vc_tools_parts + ['bin', 'HostX64', 'x64'], - ]), - ('LIB', [ - vc_tools_parts + ['lib', 'arm64'], - ['Windows Kits', '10', 'Lib', _win_version, 'um', 'arm64'], - ['Windows Kits', '10', 'Lib', _win_version, 'ucrt', 'arm64'], - vc_tools_parts + ['atlmfc', 'lib', 'arm64'], - ]), - ]) + # arm64. + env_arm64 = collections.OrderedDict([ + ('PATH', [ + ['Windows Kits', '10', 'bin', _win_version, 'x64'], + vc_tools_parts + ['bin', 'HostX64', 'arm64'], + vc_tools_parts + ['bin', 'HostX64', 'x64'], + ]), + ('LIB', [ + vc_tools_parts + ['lib', 'arm64'], + ['Windows Kits', '10', 'Lib', _win_version, 'um', 'arm64'], + ['Windows Kits', '10', 'Lib', _win_version, 'ucrt', 'arm64'], + vc_tools_parts + ['atlmfc', 'lib', 'arm64'], + ]), + ]) - def BatDirs(dirs): - return ';'.join(['%cd%\\' + os.path.join(*d) for d in dirs]) - set_env_prefix = os.path.join(target_dir, r'Windows Kits\10\bin\SetEnv') - with open(set_env_prefix + '.cmd', 'w') as f: - # The prologue changes the current directory to the root of the toolchain - # package, so that path entries can be set up without needing ..\..\..\ - # components. - f.write('@echo off\n' - ':: Generated by win_toolchain\\package_from_installed.py.\n' - 'pushd %~dp0..\..\..\n') - for var, dirs in env.items(): - f.write('set %s=%s\n' % (var, BatDirs(dirs))) - f.write('if "%1"=="/x64" goto x64\n') - f.write('if "%1"=="/arm64" goto arm64\n') + def BatDirs(dirs): + return ';'.join(['%cd%\\' + os.path.join(*d) for d in dirs]) - for var, dirs in env_x86.items(): - f.write('set %s=%s%s\n' % ( - var, BatDirs(dirs), ';%PATH%' if var == 'PATH' else '')) - f.write('goto :END\n') + set_env_prefix = os.path.join(target_dir, r'Windows Kits\10\bin\SetEnv') + with open(set_env_prefix + '.cmd', 'w') as f: + # The prologue changes the current directory to the root of the + # toolchain package, so that path entries can be set up without needing + # ..\..\..\ components. + f.write('@echo off\n' + ':: Generated by win_toolchain\\package_from_installed.py.\n' + 'pushd %~dp0..\..\..\n') + for var, dirs in env.items(): + f.write('set %s=%s\n' % (var, BatDirs(dirs))) + f.write('if "%1"=="/x64" goto x64\n') + f.write('if "%1"=="/arm64" goto arm64\n') - f.write(':x64\n') - for var, dirs in env_x64.items(): - f.write('set %s=%s%s\n' % ( - var, BatDirs(dirs), ';%PATH%' if var == 'PATH' else '')) - f.write('goto :END\n') + for var, dirs in env_x86.items(): + f.write('set %s=%s%s\n' % + (var, BatDirs(dirs), ';%PATH%' if var == 'PATH' else '')) + f.write('goto :END\n') - f.write(':arm64\n') - for var, dirs in env_arm64.items(): - f.write('set %s=%s%s\n' % ( - var, BatDirs(dirs), ';%PATH%' if var == 'PATH' else '')) - f.write('goto :END\n') - f.write(':END\n') - # Restore the original directory. - f.write('popd\n') - with open(set_env_prefix + '.x86.json', 'wt', newline='') as f: - assert not set(env.keys()) & set(env_x86.keys()), 'dupe keys' - json.dump({'env': collections.OrderedDict(list(env.items()) + list(env_x86.items()))}, - f) - with open(set_env_prefix + '.x64.json', 'wt', newline='') as f: - assert not set(env.keys()) & set(env_x64.keys()), 'dupe keys' - json.dump({'env': collections.OrderedDict(list(env.items()) + list(env_x64.items()))}, - f) - with open(set_env_prefix + '.arm64.json', 'wt', newline='') as f: - assert not set(env.keys()) & set(env_arm64.keys()), 'dupe keys' - json.dump({'env': collections.OrderedDict(list(env.items()) + list(env_arm64.items()))}, - f) + f.write(':x64\n') + for var, dirs in env_x64.items(): + f.write('set %s=%s%s\n' % + (var, BatDirs(dirs), ';%PATH%' if var == 'PATH' else '')) + f.write('goto :END\n') + + f.write(':arm64\n') + for var, dirs in env_arm64.items(): + f.write('set %s=%s%s\n' % + (var, BatDirs(dirs), ';%PATH%' if var == 'PATH' else '')) + f.write('goto :END\n') + f.write(':END\n') + # Restore the original directory. + f.write('popd\n') + with open(set_env_prefix + '.x86.json', 'wt', newline='') as f: + assert not set(env.keys()) & set(env_x86.keys()), 'dupe keys' + json.dump( + { + 'env': + collections.OrderedDict( + list(env.items()) + list(env_x86.items())) + }, f) + with open(set_env_prefix + '.x64.json', 'wt', newline='') as f: + assert not set(env.keys()) & set(env_x64.keys()), 'dupe keys' + json.dump( + { + 'env': + collections.OrderedDict( + list(env.items()) + list(env_x64.items())) + }, f) + with open(set_env_prefix + '.arm64.json', 'wt', newline='') as f: + assert not set(env.keys()) & set(env_arm64.keys()), 'dupe keys' + json.dump( + { + 'env': + collections.OrderedDict( + list(env.items()) + list(env_arm64.items())) + }, f) def AddEnvSetup(files, include_arm): - """We need to generate this file in the same way that the "from pieces" - script does, so pull that in here.""" - tempdir = tempfile.mkdtemp() - os.makedirs(os.path.join(tempdir, 'Windows Kits', '10', 'bin')) - GenerateSetEnvCmd(tempdir) - files.append(( - os.path.join(tempdir, 'Windows Kits', '10', 'bin', 'SetEnv.cmd'), - 'Windows Kits\\10\\bin\\SetEnv.cmd')) - files.append(( - os.path.join(tempdir, 'Windows Kits', '10', 'bin', 'SetEnv.x86.json'), - 'Windows Kits\\10\\bin\\SetEnv.x86.json')) - files.append(( - os.path.join(tempdir, 'Windows Kits', '10', 'bin', 'SetEnv.x64.json'), - 'Windows Kits\\10\\bin\\SetEnv.x64.json')) - if include_arm: - files.append(( - os.path.join(tempdir, 'Windows Kits', '10', 'bin', 'SetEnv.arm64.json'), - 'Windows Kits\\10\\bin\\SetEnv.arm64.json')) - vs_version_file = os.path.join(tempdir, 'VS_VERSION') - with open(vs_version_file, 'wt', newline='') as version: - print(_vs_version, file=version) - files.append((vs_version_file, 'VS_VERSION')) + """We need to generate this file in the same way that the "from pieces" + script does, so pull that in here.""" + tempdir = tempfile.mkdtemp() + os.makedirs(os.path.join(tempdir, 'Windows Kits', '10', 'bin')) + GenerateSetEnvCmd(tempdir) + files.append( + (os.path.join(tempdir, 'Windows Kits', '10', 'bin', + 'SetEnv.cmd'), 'Windows Kits\\10\\bin\\SetEnv.cmd')) + files.append((os.path.join(tempdir, 'Windows Kits', '10', 'bin', + 'SetEnv.x86.json'), + 'Windows Kits\\10\\bin\\SetEnv.x86.json')) + files.append((os.path.join(tempdir, 'Windows Kits', '10', 'bin', + 'SetEnv.x64.json'), + 'Windows Kits\\10\\bin\\SetEnv.x64.json')) + if include_arm: + files.append((os.path.join(tempdir, 'Windows Kits', '10', 'bin', + 'SetEnv.arm64.json'), + 'Windows Kits\\10\\bin\\SetEnv.arm64.json')) + vs_version_file = os.path.join(tempdir, 'VS_VERSION') + with open(vs_version_file, 'wt', newline='') as version: + print(_vs_version, file=version) + files.append((vs_version_file, 'VS_VERSION')) def RenameToSha1(output): - """Determine the hash in the same way that the unzipper does to rename the - # .zip file.""" - print('Extracting to determine hash...') - tempdir = tempfile.mkdtemp() - old_dir = os.getcwd() - os.chdir(tempdir) - rel_dir = 'vs_files' - with zipfile.ZipFile( - os.path.join(old_dir, output), 'r', zipfile.ZIP_DEFLATED, True) as zf: - zf.extractall(rel_dir) - print('Hashing...') - sha1 = get_toolchain_if_necessary.CalculateHash(rel_dir, None) - # Shorten from forty characters to ten. This is still enough to avoid - # collisions, while being less unwieldy and reducing the risk of MAX_PATH - # failures. - sha1 = sha1[:10] - os.chdir(old_dir) - shutil.rmtree(tempdir) - final_name = sha1 + '.zip' - os.rename(output, final_name) - print('Renamed %s to %s.' % (output, final_name)) + """Determine the hash in the same way that the unzipper does to rename the + # .zip file.""" + print('Extracting to determine hash...') + tempdir = tempfile.mkdtemp() + old_dir = os.getcwd() + os.chdir(tempdir) + rel_dir = 'vs_files' + with zipfile.ZipFile(os.path.join(old_dir, output), 'r', + zipfile.ZIP_DEFLATED, True) as zf: + zf.extractall(rel_dir) + print('Hashing...') + sha1 = get_toolchain_if_necessary.CalculateHash(rel_dir, None) + # Shorten from forty characters to ten. This is still enough to avoid + # collisions, while being less unwieldy and reducing the risk of MAX_PATH + # failures. + sha1 = sha1[:10] + os.chdir(old_dir) + shutil.rmtree(tempdir) + final_name = sha1 + '.zip' + os.rename(output, final_name) + print('Renamed %s to %s.' % (output, final_name)) def main(): - if sys.version_info[0] < 3: - print('This script requires Python 3') - sys.exit(10) - usage = 'usage: %prog [options] 2019|2022' - parser = optparse.OptionParser(usage) - parser.add_option('-w', '--winver', action='store', type='string', - dest='winver', default='10.0.22621.0', - help='Windows SDK version, such as 10.0.22621.0') - parser.add_option('-d', '--dryrun', action='store_true', dest='dryrun', - default=False, - help='scan for file existence and prints statistics') - parser.add_option('--noarm', action='store_false', dest='arm', - default=True, - help='Avoids arm parts of the SDK') - parser.add_option('--override', action='store', type='string', - dest='override_dir', default=None, - help='Specify alternate bin/include/lib directory') - parser.add_option('--repackage', action='store', type='string', - dest='repackage_dir', default=None, - help='Specify raw directory to be packaged, for hot fixes.') - parser.add_option('--allow_multiple_vs_installs', action='store_true', - default=False, dest='allow_multiple_vs_installs', - help='Specify if multiple VS installs are allowed.') - (options, args) = parser.parse_args() + if sys.version_info[0] < 3: + print('This script requires Python 3') + sys.exit(10) + usage = 'usage: %prog [options] 2019|2022' + parser = optparse.OptionParser(usage) + parser.add_option('-w', + '--winver', + action='store', + type='string', + dest='winver', + default='10.0.22621.0', + help='Windows SDK version, such as 10.0.22621.0') + parser.add_option('-d', + '--dryrun', + action='store_true', + dest='dryrun', + default=False, + help='scan for file existence and prints statistics') + parser.add_option('--noarm', + action='store_false', + dest='arm', + default=True, + help='Avoids arm parts of the SDK') + parser.add_option('--override', + action='store', + type='string', + dest='override_dir', + default=None, + help='Specify alternate bin/include/lib directory') + parser.add_option( + '--repackage', + action='store', + type='string', + dest='repackage_dir', + default=None, + help='Specify raw directory to be packaged, for hot fixes.') + parser.add_option('--allow_multiple_vs_installs', + action='store_true', + default=False, + dest='allow_multiple_vs_installs', + help='Specify if multiple VS installs are allowed.') + (options, args) = parser.parse_args() - if options.repackage_dir: - files = BuildRepackageFileList(options.repackage_dir) - else: - if len(args) != 1 or args[0] not in SUPPORTED_VS_VERSIONS: - print('Must specify 2019 or 2022') - parser.print_help(); - return 1 + if options.repackage_dir: + files = BuildRepackageFileList(options.repackage_dir) + else: + if len(args) != 1 or args[0] not in SUPPORTED_VS_VERSIONS: + print('Must specify 2019 or 2022') + parser.print_help() + return 1 - if options.override_dir: - if (not os.path.exists(os.path.join(options.override_dir, 'bin')) or - not os.path.exists(os.path.join(options.override_dir, 'include')) or - not os.path.exists(os.path.join(options.override_dir, 'lib'))): - print('Invalid override directory - must contain bin/include/lib dirs') - return 1 + if options.override_dir: + if (not os.path.exists(os.path.join(options.override_dir, 'bin')) + or not os.path.exists( + os.path.join(options.override_dir, 'include')) + or not os.path.exists( + os.path.join(options.override_dir, 'lib'))): + print( + 'Invalid override directory - must contain bin/include/lib dirs' + ) + return 1 - global _vs_version - _vs_version = args[0] - global _win_version - _win_version = options.winver - global _vc_tools - global _allow_multiple_vs_installs - _allow_multiple_vs_installs = options.allow_multiple_vs_installs - vs_path = GetVSPath() - temp_tools_path = ExpandWildcards(vs_path, 'VC/Tools/MSVC/14.*.*') - # Strip off the leading vs_path characters and switch back to / separators. - _vc_tools = temp_tools_path[len(vs_path) + 1:].replace('\\', '/') + global _vs_version + _vs_version = args[0] + global _win_version + _win_version = options.winver + global _vc_tools + global _allow_multiple_vs_installs + _allow_multiple_vs_installs = options.allow_multiple_vs_installs + vs_path = GetVSPath() + temp_tools_path = ExpandWildcards(vs_path, 'VC/Tools/MSVC/14.*.*') + # Strip off the leading vs_path characters and switch back to / + # separators. + _vc_tools = temp_tools_path[len(vs_path) + 1:].replace('\\', '/') - print('Building file list for VS %s Windows %s...' % (_vs_version, _win_version)) - files = BuildFileList(options.override_dir, options.arm, vs_path) + print('Building file list for VS %s Windows %s...' % + (_vs_version, _win_version)) + files = BuildFileList(options.override_dir, options.arm, vs_path) - AddEnvSetup(files, options.arm) + AddEnvSetup(files, options.arm) + + if False: + for f in files: + print(f[0], '->', f[1]) + return 0 + + output = 'out.zip' + if os.path.exists(output): + os.unlink(output) + count = 0 + version_match_count = 0 + total_size = 0 + missing_files = False + with zipfile.ZipFile(output, 'w', zipfile.ZIP_DEFLATED, True) as zf: + for disk_name, archive_name in files: + sys.stdout.write('\r%d/%d ...%s' % + (count, len(files), disk_name[-40:])) + sys.stdout.flush() + count += 1 + if not options.repackage_dir and disk_name.count(_win_version) > 0: + version_match_count += 1 + if os.path.exists(disk_name): + total_size += os.path.getsize(disk_name) + if not options.dryrun: + zf.write(disk_name, archive_name) + else: + missing_files = True + sys.stdout.write('\r%s does not exist.\n\n' % disk_name) + sys.stdout.flush() + sys.stdout.write( + '\r%1.3f GB of data in %d files, %d files for %s.%s\n' % + (total_size / 1e9, count, version_match_count, _win_version, ' ' * 50)) + if options.dryrun: + return 0 + if missing_files: + raise Exception('One or more files were missing - aborting') + if not options.repackage_dir and version_match_count == 0: + raise Exception('No files found that match the specified winversion') + sys.stdout.write('\rWrote to %s.%s\n' % (output, ' ' * 50)) + sys.stdout.flush() + + RenameToSha1(output) - if False: - for f in files: - print(f[0], '->', f[1]) return 0 - output = 'out.zip' - if os.path.exists(output): - os.unlink(output) - count = 0 - version_match_count = 0 - total_size = 0 - missing_files = False - with zipfile.ZipFile(output, 'w', zipfile.ZIP_DEFLATED, True) as zf: - for disk_name, archive_name in files: - sys.stdout.write('\r%d/%d ...%s' % (count, len(files), disk_name[-40:])) - sys.stdout.flush() - count += 1 - if not options.repackage_dir and disk_name.count(_win_version) > 0: - version_match_count += 1 - if os.path.exists(disk_name): - total_size += os.path.getsize(disk_name) - if not options.dryrun: - zf.write(disk_name, archive_name) - else: - missing_files = True - sys.stdout.write('\r%s does not exist.\n\n' % disk_name) - sys.stdout.flush() - sys.stdout.write('\r%1.3f GB of data in %d files, %d files for %s.%s\n' % - (total_size / 1e9, count, version_match_count, _win_version, ' '*50)) - if options.dryrun: - return 0 - if missing_files: - raise Exception('One or more files were missing - aborting') - if not options.repackage_dir and version_match_count == 0: - raise Exception('No files found that match the specified winversion') - sys.stdout.write('\rWrote to %s.%s\n' % (output, ' '*50)) - sys.stdout.flush() - - RenameToSha1(output) - - return 0 - if __name__ == '__main__': - sys.exit(main()) + sys.exit(main()) diff --git a/docs/WIN_CROSS_BUILD_INSTRUCTIONS.txt b/docs/WIN_CROSS_BUILD_INSTRUCTIONS.txt index 53711429..ee9e8e6d 100644 --- a/docs/WIN_CROSS_BUILD_INSTRUCTIONS.txt +++ b/docs/WIN_CROSS_BUILD_INSTRUCTIONS.txt @@ -1,5 +1,5 @@ -## These are instruction for cross building Thorium for Windows, on Linux. Preliminary file for @gz83, to be eventually migrated to a Wiki with building instructions for all paltforms. -## Copyright (c) 2022 Alex313031 +# These are instruction for cross building Thorium for Windows, on Linux. Preliminary file for @gz83, to be eventually migrated to a Wiki with building instructions for all paltforms. +## Copyright (c) 2024 Alex313031 ## In general, this document follows information from > https://chromium.googlesource.com/chromium/src.git/+/HEAD/docs/win_cross.md and https://chromium.googlesource.com/chromium/src/+/main/docs/linux/build_instructions.md diff --git a/docs/WIN_INSTRUCTIONS.txt b/docs/WIN_INSTRUCTIONS.txt index 671bd7f9..2bb109ef 100644 --- a/docs/WIN_INSTRUCTIONS.txt +++ b/docs/WIN_INSTRUCTIONS.txt @@ -1,5 +1,5 @@ -## These are instruction for building Thorium for Windows, natively on Windows. Preliminary file for @gz83, to be eventually migrated to a Wiki with building instructions for all paltforms. -## Copyright (c) 2022 Alex313031 +# These are instruction for building Thorium for Windows, natively on Windows. Preliminary file for @gz83, to be eventually migrated to a Wiki with building instructions for all paltforms. +## Copyright (c) 2024 Alex313031 ## Preparatory setup First, we need to install depot_tools and Visual Studio. depot_tools is a .zip that contains tools for all Google projects like Chromium, ChromiumOS, NaCl, V8, Infra, Android, Google Cloud, and Fuschia. diff --git a/infra/APPIMAGE/Thorium.yml b/infra/APPIMAGE/Thorium.yml index 3ae581f6..36e8c335 100644 --- a/infra/APPIMAGE/Thorium.yml +++ b/infra/APPIMAGE/Thorium.yml @@ -1,4 +1,4 @@ -# Copyright (c) 2023 Alex313031 +# Copyright (c) 2024 Alex313031 # Official Thorium builds can be downloaded from https://github.com/Alex313031/thorium/releases app: Thorium appId: "org.chromium.Thorium" diff --git a/infra/Arch_Linux/PKGBUILD b/infra/Arch_Linux/PKGBUILD index 16984695..20453601 100644 --- a/infra/Arch_Linux/PKGBUILD +++ b/infra/Arch_Linux/PKGBUILD @@ -1,4 +1,4 @@ -# Copyright (c) 2023 Alex313031, JPratama7, and StarterX4. +# Copyright (c) 2024 Alex313031, JPratama7, and StarterX4. # Maintainer: JPratama7 # Maintainer: Dominik Adrian Grzywak diff --git a/infra/DEBUG/Thorium_Debug_Shell.sh b/infra/DEBUG/Thorium_Debug_Shell.sh index b2bee8bb..5090bcb6 100755 --- a/infra/DEBUG/Thorium_Debug_Shell.sh +++ b/infra/DEBUG/Thorium_Debug_Shell.sh @@ -1,6 +1,6 @@ #!/bin/bash -# Copyright (c) 2022 Alex313031. +# Copyright (c) 2024 Alex313031. # Export libs LD_LIBRARY_PATH="$(pwd)/lib" diff --git a/infra/DEBUG/build_debug_linux.sh b/infra/DEBUG/build_debug_linux.sh index 413fb645..50545ee0 100755 --- a/infra/DEBUG/build_debug_linux.sh +++ b/infra/DEBUG/build_debug_linux.sh @@ -1,6 +1,6 @@ #!/bin/bash -# Copyright (c) 2022 Alex313031. +# Copyright (c) 2024 Alex313031. YEL='\033[1;33m' # Yellow CYA='\033[1;96m' # Cyan @@ -22,7 +22,6 @@ displayHelp () { printf "${underline}Usage: ${c0}build_debug_linux.sh # (where # is number of jobs)\n" && printf "\n" } - case $1 in --help) displayHelp; exit 0;; esac diff --git a/infra/DEBUG/build_debug_shell_linux.sh b/infra/DEBUG/build_debug_shell_linux.sh index 3ea522d5..34f4c294 100755 --- a/infra/DEBUG/build_debug_shell_linux.sh +++ b/infra/DEBUG/build_debug_shell_linux.sh @@ -1,6 +1,6 @@ #!/bin/bash -# Copyright (c) 2023 Alex313031. +# Copyright (c) 2024 Alex313031. YEL='\033[1;33m' # Yellow CYA='\033[1;96m' # Cyan @@ -22,7 +22,6 @@ displayHelp () { printf "${underline}Usage: ${c0}build_debug_shell.sh # (where # is number of jobs)\n" && printf "\n" } - case $1 in --help) displayHelp; exit 0;; esac @@ -76,4 +75,3 @@ cp -r -f -v ~/chromium/src/out/thorium/ClearKeyCdm/_platform_specific/linux_x64/ printf "${GRE}Thorium UI Debug Shell Build Completed.\n" && tput sgr0 -exit 0 diff --git a/infra/DEBUG/build_debug_shell_win.sh b/infra/DEBUG/build_debug_shell_win.sh index 5fbd2818..7fd8100f 100755 --- a/infra/DEBUG/build_debug_shell_win.sh +++ b/infra/DEBUG/build_debug_shell_win.sh @@ -1,6 +1,6 @@ #!/bin/bash -# Copyright (c) 2022 Alex313031. +# Copyright (c) 2024 Alex313031. YEL='\033[1;33m' # Yellow CYA='\033[1;96m' # Cyan @@ -22,7 +22,6 @@ displayHelp () { printf "${underline}Usage: ${c0}build_debug_shell.sh # (where # is number of jobs)\n" && printf "\n" } - case $1 in --help) displayHelp; exit 0;; esac diff --git a/infra/DEBUG/build_debug_win.sh b/infra/DEBUG/build_debug_win.sh index 743a0852..4b733fba 100755 --- a/infra/DEBUG/build_debug_win.sh +++ b/infra/DEBUG/build_debug_win.sh @@ -1,6 +1,6 @@ #!/bin/bash -# Copyright (c) 2022 Alex313031. +# Copyright (c) 2024 Alex313031. YEL='\033[1;33m' # Yellow CYA='\033[1;96m' # Cyan @@ -22,7 +22,6 @@ displayHelp () { printf "${underline}Usage: ${c0}build_debug_win.sh # (where # is number of jobs)\n" && printf "\n" } - case $1 in --help) displayHelp; exit 0;; esac diff --git a/infra/THORIUM_DEV_BOOKMARKS.html b/infra/THORIUM_DEV_BOOKMARKS.html index d404a057..ac8bc8d0 100644 --- a/infra/THORIUM_DEV_BOOKMARKS.html +++ b/infra/THORIUM_DEV_BOOKMARKS.html @@ -64,6 +64,8 @@
x11_util.cc - Chromium Code Search
js-display-names.cc - Chromium Code Search
widevine_cdm_version.h - Chromium Code Search +
BUILD.gn - Chromium Code Search +
widevine.gni - Chromium Code Search
cdm_registration.cc - Chromium Code Search
components.css - Chromium Code Search
incognito_marker.svg - Chromium Code Search @@ -117,6 +119,7 @@
chrome_exe.vsprops - Chromium Code Search
util_constants.cc - Chromium Code Search
BUILD.gn - Chromium Code Search +
BUILD.gn - Chromium Code Search
shell_main_delegate.cc - Chromium Code Search
channel_info_posix.cc - Chromium Code Search
shell_integration_linux.cc - Chromium Code Search diff --git a/infra/arch-prerequisites.sh b/infra/arch-prerequisites.sh index a4f766c9..4b0bdb35 100755 --- a/infra/arch-prerequisites.sh +++ b/infra/arch-prerequisites.sh @@ -1,7 +1,7 @@ #!/bin/bash -# Copyright (c) 2022 Alex313031. +# Copyright (c) 2024 Alex313031. -# Installs necessary prerequisites for building and running Chromium/ChromiumOS on Arch Linux. +echo "Installs necessary prerequisites for building and running Chromium/ChromiumOS on Arch Linux." sudo pacman -Syyuu --needed autoconf autoconf-archive automake base-devel beep bluez-libs cabextract cmake curl dkms dosfstools exfatprogs exo ffmpeg gcc git go gperf gtk2 gtk3 hwdata i2c-tools java-runtime-common java-runtime-headless kdialog libcbor libdrm libnet libpulse libsecret libudev0-shim libva libva-utils libva-vdpau-driver libwebp libxss lm_sensors lsb-release make man-db mesa-utils minizip mtools nano nasm ncurses nodejs nss ntfs-3g numlockx openjpeg2 opus org.freedesktop.secrets p7zip pciutils pipewire polkit python python-docutils python-oauth2client python-oauthlib python-pkgconfig python-pkginfo python-protobuf python-setuptools python-virtualenv qt5-base re2 read-edid tar libtar tk tree ttf-font ttf-liberation unrar unzip vulkan-extra-layers vulkan-headers vulkan-tools wget xdg-utils xsensors xz yasm zenity diff --git a/infra/build_dmg_cr.sh b/infra/build_dmg_cr.sh index ea93d2e6..1bab6fa4 100755 --- a/infra/build_dmg_cr.sh +++ b/infra/build_dmg_cr.sh @@ -1,6 +1,6 @@ #!/bin/bash -# Copyright (c) 2023 Alex313031 and Midzer. +# Copyright (c) 2024 Alex313031 and Midzer. YEL='\033[1;33m' # Yellow CYA='\033[1;96m' # Cyan diff --git a/infra/fetch_api_keys.sh b/infra/fetch_api_keys.sh index 8a239a97..f86a626f 100755 --- a/infra/fetch_api_keys.sh +++ b/infra/fetch_api_keys.sh @@ -1,6 +1,6 @@ #!/bin/bash -# Copyright (c) 2023 Alex313031. +# Copyright (c) 2024 Alex313031. # Simply uses wget to fetch Thorium API Keys. # This is to keep them out of the main repo, in the case Google @@ -32,5 +32,3 @@ printf "${GRE}Done.\n" && printf "${YEL}- Use the three lines therein at the atop of your args.gn\n" && printf "${YEL} (Replacing the ones already in there that have blank values)\n" && tput sgr0 - -exit 0 diff --git a/infra/fix_libaom.sh b/infra/fix_libaom.sh index f5337dbc..aa58dd89 100755 --- a/infra/fix_libaom.sh +++ b/infra/fix_libaom.sh @@ -1,6 +1,6 @@ #!/bin/bash -# Copyright (c) 2023 Alex313031. +# Copyright (c) 2024 Alex313031. YEL='\033[1;33m' # Yellow CYA='\033[1;96m' # Cyan @@ -44,5 +44,3 @@ printf "\n" && printf "${GRE}Done.\n" && printf "\n" && tput sgr0 - -exit 0 diff --git a/infra/install_deps.sh b/infra/install_deps.sh index 5d465203..1375b8b3 100755 --- a/infra/install_deps.sh +++ b/infra/install_deps.sh @@ -1,6 +1,6 @@ #!/bin/bash -# Copyright (c) 2022 Alex313031. +# Copyright (c) 2024 Alex313031. YEL='\033[1;33m' # Yellow RED='\033[1;31m' # Red @@ -146,5 +146,3 @@ printf "${YEL}Done!\n" && printf "${GRE}Done! ${YEL}You can now run ./setup.sh or build vanilla Chromium.\n" tput sgr0 - -exit 0 diff --git a/infra/portable/README.debug b/infra/portable/README.debug index 0ca44a9a..b99c73d6 100644 --- a/infra/portable/README.debug +++ b/infra/portable/README.debug @@ -1,4 +1,4 @@ -## Copyright (c) 2022 Alex313031 +## Copyright (c) 2024 Alex313031 ## Summary This is a special program, built on top of content_shell and incorporating a multitude of options for testing, viewing, and debugging UI resources in Thorium. diff --git a/infra/portable/README.linux b/infra/portable/README.linux index 03e1245a..6caf17a4 100644 --- a/infra/portable/README.linux +++ b/infra/portable/README.linux @@ -1,5 +1,6 @@ -## Thorium Portable for Linux README -## Copyright (c) 2022 Alex313031 +# Thorium Portable for Linux README + +## Copyright (c) 2024 Alex313031 This is a portable build of Thorium which can also be used to install/use Thorium on Linux distros that do not use .deb packages. The THORIUM-PORTABLE script and THORIUM-SHELL script will need to be made executable with `sudo chmod +x`, and when run will disable logging, default browser check, and set the user data dir to .config/thorium in this folder rather than the usual $HOME/.config/thorium folder. diff --git a/infra/portable/README.win b/infra/portable/README.win index 4e47b410..07733b6c 100644 --- a/infra/portable/README.win +++ b/infra/portable/README.win @@ -1,5 +1,6 @@ -## Thorium Portable for Windows README.txt -## Copyright (c) 2023 Alex313031 +# Thorium Portable for Windows README.txt + +## Copyright (c) 2024 Alex313031 # How to use the files in this .zip # Unpack .zip to wherever diff --git a/infra/portable/THORIUM-PORTABLE b/infra/portable/THORIUM-PORTABLE index 9ac91d04..01978ba3 100755 --- a/infra/portable/THORIUM-PORTABLE +++ b/infra/portable/THORIUM-PORTABLE @@ -1,6 +1,6 @@ #!/bin/bash # -# Copyright (c) 2023 The Chromium Authors and Alex313031. All rights reserved. +# Copyright (c) 2024 The Chromium Authors and Alex313031. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/infra/portable/THORIUM-SHELL b/infra/portable/THORIUM-SHELL index fa25a8dd..e5277d33 100755 --- a/infra/portable/THORIUM-SHELL +++ b/infra/portable/THORIUM-SHELL @@ -1,5 +1,5 @@ #!/bin/bash -# Copyright (c) 2022 Alex313031 +# Copyright (c) 2024 Alex313031 ./thorium_shell --data-path=$(pwd)/.config/thorium-shell --enable-experimental-web-platform-features --debug --enable-clear-hevc-for-testing $@ diff --git a/infra/portable/make_portable_linux.sh b/infra/portable/make_portable_linux.sh index bd1515a3..668b1664 100755 --- a/infra/portable/make_portable_linux.sh +++ b/infra/portable/make_portable_linux.sh @@ -1,6 +1,6 @@ #!/bin/bash -# Copyright (c) 2023 Alex313031. +# Copyright (c) 2024 Alex313031. YEL='\033[1;33m' # Yellow RED='\033[1;31m' # Red @@ -21,7 +21,6 @@ displayHelp () { printf "${bold}${YEL}Please place the Thorium .deb file in this directory before running.${c0}\n" && printf "\n" } - case $1 in --help) displayHelp; exit 0;; esac diff --git a/infra/portable/make_portable_win.sh b/infra/portable/make_portable_win.sh index f03bde59..71de280a 100755 --- a/infra/portable/make_portable_win.sh +++ b/infra/portable/make_portable_win.sh @@ -1,6 +1,6 @@ #!/bin/bash -# Copyright (c) 2023 Alex313031. +# Copyright (c) 2024 Alex313031. YEL='\033[1;33m' # Yellow RED='\033[1;31m' # Red @@ -21,7 +21,6 @@ displayHelp () { printf "${bold}${YEL}Please place the thorium_mini_installer.exe file in this directory before running.${c0}\n" && printf "\n" } - case $1 in --help) displayHelp; exit 0;; esac diff --git a/logos/NEW/mac/gen/app/build_icns.sh b/logos/NEW/mac/gen/app/build_icns.sh index 3aac09e7..3dfe47de 100755 --- a/logos/NEW/mac/gen/app/build_icns.sh +++ b/logos/NEW/mac/gen/app/build_icns.sh @@ -1,6 +1,6 @@ #!/bin/bash -# Copyright (c) 2022 Alex313031. +# Copyright (c) 2024 Alex313031. YEL='\033[1;33m' # Yellow RED='\033[1;31m' # Red diff --git a/logos/NEW/mac/gen/document/build_icns.sh b/logos/NEW/mac/gen/document/build_icns.sh index 664c49a4..3870f0a5 100755 --- a/logos/NEW/mac/gen/document/build_icns.sh +++ b/logos/NEW/mac/gen/document/build_icns.sh @@ -1,6 +1,6 @@ #!/bin/bash -# Copyright (c) 2022 Alex313031. +# Copyright (c) 2024 Alex313031. YEL='\033[1;33m' # Yellow RED='\033[1;31m' # Red diff --git a/other/CrOS/chrome/BUILD.gn b/other/CrOS/chrome/BUILD.gn index 4490ef93..baaa32d7 100644 --- a/other/CrOS/chrome/BUILD.gn +++ b/other/CrOS/chrome/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright 2023 The Chromium Authors and Alex313031 +# Copyright 2024 The Chromium Authors and Alex313031 # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. @@ -50,6 +50,7 @@ if (is_android) { import("//chrome/version.gni") import("//content/public/app/mac_helpers.gni") import("//media/cdm/library_cdm/cdm_paths.gni") + import("//services/on_device_model/on_device_model.gni") import("//third_party/icu/config.gni") } @@ -325,6 +326,7 @@ if (!is_android && !is_mac) { # On Chrome OS builds (for both ash-chrome and lacros-chrome), put # a metadata.json file in root directory containing Chrome version. if (is_chromeos) { + deps += [ "//ui/gfx/linux:gbm" ] data_deps += [ "//build:version_metadata" ] } @@ -1033,6 +1035,14 @@ if (is_win) { } } + if (enable_ml_internal) { + bundle_data("chrome_ml_library") { + sources = [ "$root_out_dir/libchrome_ml.dylib" ] + outputs = [ "{{bundle_contents_dir}}/Libraries/{{source_file_part}}" ] + public_deps = [ "//third_party/ml:chrome_ml_library_copy" ] + } + } + group("angle_library") { if (bundle_egl_libraries) { deps = [ ":angle_binaries" ] @@ -1253,6 +1263,10 @@ if (is_win) { "//chrome/browser/resources/media/mei_preload:component_bundle", ] + if (enable_ml_internal) { + bundle_deps += [ ":chrome_ml_library" ] + } + if (is_chrome_branded) { bundle_deps += [ ":preinstalled_apps" ] } @@ -1531,11 +1545,6 @@ if (is_win) { ] } - process_version_rc_template("nacl64_exe_version") { - sources = [ "app/nacl64_exe.ver" ] - output = "$target_gen_dir/nacl64_exe_version.rc" - } - process_version_rc_template("other_version") { sources = [ "app/other.ver" ] output = "$target_gen_dir/other_version.rc" diff --git a/other/build_polly.sh b/other/build_polly.sh index 8a676cbf..e90fada1 100644 --- a/other/build_polly.sh +++ b/other/build_polly.sh @@ -1,6 +1,6 @@ #!/bin/bash -## Copyright (c) 2022 Alex313031/ +## Copyright (c) 2024 Alex313031 ## Clones latest LLVM being used by the Chromium Project, and builds a local LLVM toolchain with Polly to use the Polly optimizations in the main Thorium BUILD.gn diff --git a/other/setup_polly.sh b/other/setup_polly.sh deleted file mode 100755 index a68c3a69..00000000 --- a/other/setup_polly.sh +++ /dev/null @@ -1,90 +0,0 @@ -#!/bin/bash - -# Copyright (c) 2022 Alex313031. - -YEL='\033[1;33m' # Yellow -CYA='\033[1;96m' # Cyan -RED='\033[1;31m' # Red -GRE='\033[1;32m' # Green -c0='\033[0m' # Reset Text -bold='\033[1m' # Bold Text -underline='\033[4m' # Underline Text - -# Error handling -yell() { echo "$0: $*" >&2; } -die() { yell "$*"; exit 111; } -try() { "$@" || die "${RED}Failed $*"; } - -# help - printf "\n" && - printf "${bold}${GRE}Script to copy Thorium source files over the Chromium source tree.${c0}\n" && - printf "${bold}${YEL}Use the --avx flag for Regular (AVX) builds.${c0}\n" && - printf "${bold}${YEL}Use the --avx2 flag for AVX2 Builds.${c0}\n" && - printf "${bold}${YEL}Use the --sse3 flag for SSE3 Builds.${c0}\n" && - printf "${bold}${YEL}IMPORTANT: For Polly builds, first run build_polly.sh in Thorium/infra, then use this script.${c0}\n" && - printf "${bold}${YEL}Both of these actions should be taken AFTER running the regular setup.sh script!${c0}\n" && - printf "\n" && - -tput sgr0 && - -# Copy Polly AVX files -copyAVX () { - printf "\n" && - printf "${YEL}Copying Polly AVX build files...${c0}\n" && - cp -r -v Regular/BUILD.gn $HOME/chromium/src/build/config/compiler/ && - printf "\n" -} - -case $1 in - --avx) copyAVX; -esac - -# Copy Polly AVX2 files -copyAVX2 () { - printf "\n" && - printf "${YEL}Copying Polly AVX2 build files...${c0}\n" && - cp -r -v AVX2/BUILD.gn $HOME/chromium/src/build/config/compiler/ && - printf "\n" -} - -case $1 in - --avx2) copyAVX2; -esac - -# Copy Polly SSE3 files -copySSE3 () { - printf "\n" && - printf "${YEL}Copying Polly SSE3 build files...${c0}\n" && - cp -r -v SSE3/BUILD.gn $HOME/chromium/src/build/config/compiler/ && - printf "\n" -} - -case $1 in - --sse3) copySSE3; -esac - -printf "${GRE}Done!\n" && -printf "\n" && - -printf "${YEL}Exporting variables...\n" && - -export NINJA_SUMMARIZE_BUILD=1 && - -export EDITOR=nano && - -export VISUAL=nano && -printf "\n" && -tput sgr0 && - -printf "export ${CYA}NINJA_SUMMARIZE_BUILD=1${c0}\n" && - -printf "export ${CYA}EDITOR=nano${c0}\n" && - -printf "export ${CYA}VISUAL=nano${c0}\n" && -printf "\n" && - -printf "${GRE}Enjoy Thorium!\n" && -printf "\n" && -tput sgr0 - -exit 0 diff --git a/package.sh b/package.sh index 9461d592..357ce1fe 100755 --- a/package.sh +++ b/package.sh @@ -1,6 +1,6 @@ #!/bin/bash -# Copyright (c) 2023 Alex313031. +# Copyright (c) 2024 Alex313031. YEL='\033[1;33m' # Yellow CYA='\033[1;96m' # Cyan diff --git a/pak_src/build.sh b/pak_src/build.sh index 519b15e2..0e456f6a 100755 --- a/pak_src/build.sh +++ b/pak_src/build.sh @@ -1,6 +1,6 @@ #!/bin/bash -# Copyright (c) 2022 Alex313031. +# Copyright (c) 2024 Alex313031. YEL='\033[1;33m' # Yellow RED='\033[1;31m' # Red @@ -13,14 +13,6 @@ underline=$'\033[4m' # Underline Text yell() { echo "$0: $*" >&2; } die() { yell "$*"; exit 111; } try() { "$@" || die "${RED}Failed $*"; } -# Clean build dir. -cleanBuild () { - printf "\n" && - printf "${bold}${RED}Cleaning build directory.${c0}\n" && - printf "\n" && - sleep 1 && - rm -r -f -v ./build -} # --help displayHelp () { @@ -29,22 +21,31 @@ displayHelp () { printf "${bold}${YEL}Use the --clean flag to delete the build directory.${c0}\n" && printf "\n" } - - case $1 in --help) displayHelp; exit 0;; esac +# Clean build dir. +cleanBuild () { + printf "\n" && + printf "${bold}${YEL}Cleaning build directory.${c0}\n" && + printf "\n" && + sleep 1 && + rm -r -f -v ./build_ + printf "\n" && + printf "${bold}${GRE}Done.${c0}\n" && + printf "\n" && +} case $1 in --clean) cleanBuild; exit 0;; esac -mkdir -v -p build && +mkdir -v -p build_ && -cd build && +cd build_ && cmake -GNinja -DLGPL=OFF .. && ninja -v -d stats && -cd ../build +cd ../ diff --git a/src/chrome/android/BUILD.gn b/src/chrome/android/BUILD.gn index abcc7d88..adc7f718 100644 --- a/src/chrome/android/BUILD.gn +++ b/src/chrome/android/BUILD.gn @@ -2499,12 +2499,12 @@ if (current_toolchain == default_toolchain) { chrome_public_apk_or_module_tmpl("chrome_public_apk") { target_type = "android_apk" - apk_name = "ThoriumPublic" + apk_name = "Thorium_Public" art_profile_path = "//chrome/android/baseline_profiles/profile.txt" } chrome_public_bundle("chrome_public_bundle") { - bundle_name = "ThoriumPublic" + bundle_name = "Thorium_Public" } android_library("monochrome_java") { diff --git a/src/chrome/installer/linux/common/apt.include b/src/chrome/installer/linux/common/apt.include index 04e606dd..36f3c6e6 100644 --- a/src/chrome/installer/linux/common/apt.include +++ b/src/chrome/installer/linux/common/apt.include @@ -1,4 +1,4 @@ -# Copyright (c) 2023 Alex313031. +# Copyright (c) 2024 Alex313031. APT_GET="`command -v apt-get 2> /dev/null`" APT_CONFIG="`command -v apt-config 2> /dev/null`" diff --git a/src/chrome/installer/linux/common/chromium-browser/chromium-browser.info b/src/chrome/installer/linux/common/chromium-browser/chromium-browser.info index 8a4295a2..06a619ed 100644 --- a/src/chrome/installer/linux/common/chromium-browser/chromium-browser.info +++ b/src/chrome/installer/linux/common/chromium-browser/chromium-browser.info @@ -1,4 +1,4 @@ -# Copyright (c) 2022 The Chromium Authors and Alex313031. All rights reserved. +# Copyright (c) 2024 The Chromium Authors and Alex313031. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. # diff --git a/src/chrome/installer/linux/common/installer.include b/src/chrome/installer/linux/common/installer.include index 51c1c7f6..2bfd6bd1 100644 --- a/src/chrome/installer/linux/common/installer.include +++ b/src/chrome/installer/linux/common/installer.include @@ -1,4 +1,4 @@ -# Copyright (c) 2023 Alex313031 and Iridium +# Copyright (c) 2024 Alex313031 and Iridium # Shows the output of a given command only on failure, or when VERBOSE is set. log_cmd() { if [ "${VERBOSE:-}" ]; then diff --git a/src/chrome/installer/linux/common/repo.cron b/src/chrome/installer/linux/common/repo.cron index 97347f99..66695f9d 100644 --- a/src/chrome/installer/linux/common/repo.cron +++ b/src/chrome/installer/linux/common/repo.cron @@ -1,6 +1,6 @@ #!/bin/sh # -# Copyright 2023 The Chromium Authors and Alex313031. +# Copyright 2024 The Chromium Authors and Alex313031. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. # diff --git a/src/chrome/installer/linux/common/wrapper b/src/chrome/installer/linux/common/wrapper index 336bd565..6322ace5 100644 --- a/src/chrome/installer/linux/common/wrapper +++ b/src/chrome/installer/linux/common/wrapper @@ -1,6 +1,6 @@ #!/bin/bash # -# Copyright (c) 2023 The Chromium Authors and Alex313031. All rights reserved. +# Copyright (c) 2024 The Chromium Authors and Alex313031. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/src/chrome/installer/linux/debian/build.sh b/src/chrome/installer/linux/debian/build.sh index e353bf54..80e5441d 100755 --- a/src/chrome/installer/linux/debian/build.sh +++ b/src/chrome/installer/linux/debian/build.sh @@ -1,6 +1,6 @@ #!/bin/bash # -# Copyright 2023 The Chromium Authors and Alex313031 +# Copyright 2024 The Chromium Authors and Alex313031 # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/src/chrome/installer/linux/debian/postinst b/src/chrome/installer/linux/debian/postinst index e6bc93fa..0d7ef184 100644 --- a/src/chrome/installer/linux/debian/postinst +++ b/src/chrome/installer/linux/debian/postinst @@ -1,6 +1,6 @@ #!/bin/sh # -# Copyright (c) 2022 The Chromium Authors and Alex313031. All rights reserved. +# Copyright (c) 2024 The Chromium Authors and Alex313031. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/src/chrome/installer/linux/debian/postrm b/src/chrome/installer/linux/debian/postrm index 86fe5620..878ad12d 100644 --- a/src/chrome/installer/linux/debian/postrm +++ b/src/chrome/installer/linux/debian/postrm @@ -1,6 +1,6 @@ #!/bin/sh # -# Copyright (c) 2022 The Chromium Authors and Alex313031. All rights reserved. +# Copyright (c) 2024 The Chromium Authors and Alex313031. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/src/chrome/installer/linux/debian/prerm b/src/chrome/installer/linux/debian/prerm index a718a1b1..151f130f 100755 --- a/src/chrome/installer/linux/debian/prerm +++ b/src/chrome/installer/linux/debian/prerm @@ -1,6 +1,6 @@ #!/bin/sh # -# Copyright 2023 The Chromium Authors and Alex313031 +# Copyright 2024 The Chromium Authors and Alex313031 # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/src/chrome/installer/linux/rpm/build.sh b/src/chrome/installer/linux/rpm/build.sh index f56c09e5..efa4d6b3 100755 --- a/src/chrome/installer/linux/rpm/build.sh +++ b/src/chrome/installer/linux/rpm/build.sh @@ -1,6 +1,6 @@ #!/bin/bash # -# Copyright 2023 The Chromium Authors and Alex313031 +# Copyright 2024 The Chromium Authors and Alex313031 # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/src/content/shell/android/BUILD.gn b/src/content/shell/android/BUILD.gn index d78e9204..c9345cbc 100644 --- a/src/content/shell/android/BUILD.gn +++ b/src/content/shell/android/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright 2023 The Chromium Authors and Alex313031 +# Copyright 2024 The Chromium Authors and Alex313031 # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. @@ -83,7 +83,6 @@ android_library("content_shell_java") { ":content_shell_java_resources", ":content_shell_manifest", "//base:base_java", - "//base:jni_java", "//build/android:build_java", "//components/download/internal/common:internal_java", "//components/embedder_support/android:content_view_java", @@ -94,6 +93,7 @@ android_library("content_shell_java") { "//media/capture/video/android:capture_java", "//mojo/public/java:system_java", "//net/android:net_java", + "//third_party/jni_zero:jni_zero_java", "//ui/android:ui_java", "//ui/base/cursor/mojom:cursor_type_java", "//url:gurl_java", diff --git a/src/third_party/widevine/cdm/BUILD.gn b/src/third_party/widevine/cdm/BUILD.gn index 0c2c4e21..52824149 100644 --- a/src/third_party/widevine/cdm/BUILD.gn +++ b/src/third_party/widevine/cdm/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright 2023 The Chromium Authors and Alex313031 +# Copyright 2024 The Chromium Authors and Alex313031 # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/src/third_party/widevine/cdm/chromeos/arm64/widevine_cdm_version.h b/src/third_party/widevine/cdm/chromeos/arm64/widevine_cdm_version.h index dbdd9a61..998fb84c 100644 --- a/src/third_party/widevine/cdm/chromeos/arm64/widevine_cdm_version.h +++ b/src/third_party/widevine/cdm/chromeos/arm64/widevine_cdm_version.h @@ -1,4 +1,4 @@ -// Copyright (c) 2023 The Chromium Authors and Alex313031. All rights reserved. +// Copyright (c) 2024 The Chromium Authors and Alex313031. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/src/third_party/widevine/cdm/chromeos/x64/widevine_cdm_version.h b/src/third_party/widevine/cdm/chromeos/x64/widevine_cdm_version.h index c473f0f0..0d447442 100644 --- a/src/third_party/widevine/cdm/chromeos/x64/widevine_cdm_version.h +++ b/src/third_party/widevine/cdm/chromeos/x64/widevine_cdm_version.h @@ -1,4 +1,4 @@ -// Copyright (c) 2023 The Chromium Authors and Alex313031. All rights reserved. +// Copyright (c) 2024 The Chromium Authors and Alex313031. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/src/third_party/widevine/cdm/widevine.gni b/src/third_party/widevine/cdm/widevine.gni index 2bf91cb0..b70b3546 100644 --- a/src/third_party/widevine/cdm/widevine.gni +++ b/src/third_party/widevine/cdm/widevine.gni @@ -1,4 +1,4 @@ -# Copyright 2023 The Chromium Authors and Alex313031 +# Copyright 2024 The Chromium Authors and Alex313031 # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. @@ -8,8 +8,8 @@ import("//build/config/chromeos/ui_mode.gni") import("//media/media_options.gni") declare_args() { - # Enables Widevine key system support. Enabled by default in Google Chrome and - # on Android. For Fuchsia, see crbug.com/1354347. + # Enables Widevine key system support. Enabled by default in Google Chrome, + # Google Chrome for Testing and Android. For Fuchsia, see crbug.com/1354347. # Can be optionally enabled in Chromium on non-Android platforms. Please see # //src/third_party/widevine/LICENSE file for details. enable_widevine = !is_fuchsia @@ -52,7 +52,8 @@ assert(!enable_media_foundation_widevine_cdm || is_win) assert(!enable_media_foundation_widevine_cdm || enable_widevine) declare_args() { - # Widevine CDM is bundled as part of Google Chrome builds. + # Widevine CDM is bundled as part of Google Chrome and + # Google Chrome for Testing builds. bundle_widevine_cdm = false # Relative root directory to //third_party/widevine/cdm for CDM files. @@ -63,7 +64,8 @@ declare_args() { declare_args() { # Enable Widevine CDM host verification, which will sign additional binaries # with Widevine certs and copy signature files as needed. - enable_widevine_cdm_host_verification = enable_library_widevine_cdm && enable_cdm_host_verification + enable_widevine_cdm_host_verification = + enable_library_widevine_cdm && enable_cdm_host_verification # If set, and Widevine CDM host verification signing failed due to no signing # cert, the failure will be ignored. Otherwise the build process will fail. diff --git a/src/third_party/widevine/cdm/widevine_cdm_version.h b/src/third_party/widevine/cdm/widevine_cdm_version.h index 06e78698..d884b700 100644 --- a/src/third_party/widevine/cdm/widevine_cdm_version.h +++ b/src/third_party/widevine/cdm/widevine_cdm_version.h @@ -1,4 +1,4 @@ -// Copyright 2023 The Chromium Authors and Alex313031 +// Copyright 2024 The Chromium Authors and Alex313031 // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/thorium-libjxl b/thorium-libjxl index 63f44d9b..eccb57ae 160000 --- a/thorium-libjxl +++ b/thorium-libjxl @@ -1 +1 @@ -Subproject commit 63f44d9bee552359522bb0b2c28e8c6adb6bc218 +Subproject commit eccb57ae3043304462c6e709efd65b2a5edf1d16