summaryrefslogtreecommitdiffstats
path: root/third_party/libwebrtc/build/win
diff options
context:
space:
mode:
Diffstat (limited to 'third_party/libwebrtc/build/win')
-rw-r--r--third_party/libwebrtc/build/win/BUILD.gn177
-rw-r--r--third_party/libwebrtc/build/win/as_invoker.manifest9
-rw-r--r--third_party/libwebrtc/build/win/common_controls.manifest8
-rw-r--r--third_party/libwebrtc/build/win/compatibility.manifest17
-rwxr-xr-xthird_party/libwebrtc/build/win/copy_cdb_to_output.py127
-rw-r--r--third_party/libwebrtc/build/win/gn_meta_sln.py214
-rw-r--r--third_party/libwebrtc/build/win/message_compiler.gni87
-rw-r--r--third_party/libwebrtc/build/win/message_compiler.py148
-rwxr-xr-xthird_party/libwebrtc/build/win/reorder-imports.py98
-rw-r--r--third_party/libwebrtc/build/win/require_administrator.manifest9
-rw-r--r--third_party/libwebrtc/build/win/segment_heap.manifest8
-rwxr-xr-xthird_party/libwebrtc/build/win/set_appcontainer_acls.py35
-rwxr-xr-xthird_party/libwebrtc/build/win/use_ansi_codes.py12
13 files changed, 949 insertions, 0 deletions
diff --git a/third_party/libwebrtc/build/win/BUILD.gn b/third_party/libwebrtc/build/win/BUILD.gn
new file mode 100644
index 0000000000..d41e55dcbb
--- /dev/null
+++ b/third_party/libwebrtc/build/win/BUILD.gn
@@ -0,0 +1,177 @@
+# Copyright 2015 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import("//webrtc.gni")
+import("//build/config/clang/clang.gni")
+import("//build/config/sanitizers/sanitizers.gni")
+import("//build/config/win/manifest.gni")
+
+# Depending on this target will cause the manifests for Chrome's default
+# Windows and common control compatibility and elevation for executables.
+windows_manifest("default_exe_manifest") {
+ sources = [
+ as_invoker_manifest,
+ common_controls_manifest,
+ default_compatibility_manifest,
+ ]
+}
+
+build_with_mozilla = false
+if (is_win && !build_with_mozilla) {
+# assert(host_os != "mac" || target_cpu != "x86",
+# "Windows cross-builds from Mac must be 64-bit.")
+
+ action("copy_cdb_to_output") {
+ script = "//build/win/copy_cdb_to_output.py"
+ inputs = [
+ script,
+ "//build/vs_toolchain.py",
+ ]
+ outputs = [
+ "$root_out_dir/cdb/cdb.exe",
+ "$root_out_dir/cdb/dbgeng.dll",
+ "$root_out_dir/cdb/dbghelp.dll",
+ "$root_out_dir/cdb/dbgmodel.dll",
+ "$root_out_dir/cdb/winext/ext.dll",
+ "$root_out_dir/cdb/winext/uext.dll",
+ "$root_out_dir/cdb/winxp/exts.dll",
+ "$root_out_dir/cdb/winxp/ntsdexts.dll",
+ ]
+ if (target_cpu != "arm64") {
+ # The UCRT files are not redistributable for ARM64 Win32.
+ outputs += [
+ "$root_out_dir/cdb/api-ms-win-core-console-l1-1-0.dll",
+ "$root_out_dir/cdb/api-ms-win-core-datetime-l1-1-0.dll",
+ "$root_out_dir/cdb/api-ms-win-core-debug-l1-1-0.dll",
+ "$root_out_dir/cdb/api-ms-win-core-errorhandling-l1-1-0.dll",
+ "$root_out_dir/cdb/api-ms-win-core-file-l1-1-0.dll",
+ "$root_out_dir/cdb/api-ms-win-core-file-l1-2-0.dll",
+ "$root_out_dir/cdb/api-ms-win-core-file-l2-1-0.dll",
+ "$root_out_dir/cdb/api-ms-win-core-handle-l1-1-0.dll",
+ "$root_out_dir/cdb/api-ms-win-core-heap-l1-1-0.dll",
+ "$root_out_dir/cdb/api-ms-win-core-interlocked-l1-1-0.dll",
+ "$root_out_dir/cdb/api-ms-win-core-libraryloader-l1-1-0.dll",
+ "$root_out_dir/cdb/api-ms-win-core-localization-l1-2-0.dll",
+ "$root_out_dir/cdb/api-ms-win-core-memory-l1-1-0.dll",
+ "$root_out_dir/cdb/api-ms-win-core-namedpipe-l1-1-0.dll",
+ "$root_out_dir/cdb/api-ms-win-core-processenvironment-l1-1-0.dll",
+ "$root_out_dir/cdb/api-ms-win-core-processthreads-l1-1-0.dll",
+ "$root_out_dir/cdb/api-ms-win-core-processthreads-l1-1-1.dll",
+ "$root_out_dir/cdb/api-ms-win-core-profile-l1-1-0.dll",
+ "$root_out_dir/cdb/api-ms-win-core-rtlsupport-l1-1-0.dll",
+ "$root_out_dir/cdb/api-ms-win-core-string-l1-1-0.dll",
+ "$root_out_dir/cdb/api-ms-win-core-synch-l1-1-0.dll",
+ "$root_out_dir/cdb/api-ms-win-core-synch-l1-2-0.dll",
+ "$root_out_dir/cdb/api-ms-win-core-sysinfo-l1-1-0.dll",
+ "$root_out_dir/cdb/api-ms-win-core-timezone-l1-1-0.dll",
+ "$root_out_dir/cdb/api-ms-win-core-util-l1-1-0.dll",
+ "$root_out_dir/cdb/api-ms-win-crt-conio-l1-1-0.dll",
+ "$root_out_dir/cdb/api-ms-win-crt-convert-l1-1-0.dll",
+ "$root_out_dir/cdb/api-ms-win-crt-environment-l1-1-0.dll",
+ "$root_out_dir/cdb/api-ms-win-crt-filesystem-l1-1-0.dll",
+ "$root_out_dir/cdb/api-ms-win-crt-heap-l1-1-0.dll",
+ "$root_out_dir/cdb/api-ms-win-crt-locale-l1-1-0.dll",
+ "$root_out_dir/cdb/api-ms-win-crt-math-l1-1-0.dll",
+ "$root_out_dir/cdb/api-ms-win-crt-multibyte-l1-1-0.dll",
+ "$root_out_dir/cdb/api-ms-win-crt-private-l1-1-0.dll",
+ "$root_out_dir/cdb/api-ms-win-crt-process-l1-1-0.dll",
+ "$root_out_dir/cdb/api-ms-win-crt-runtime-l1-1-0.dll",
+ "$root_out_dir/cdb/api-ms-win-crt-stdio-l1-1-0.dll",
+ "$root_out_dir/cdb/api-ms-win-crt-string-l1-1-0.dll",
+ "$root_out_dir/cdb/api-ms-win-crt-time-l1-1-0.dll",
+ "$root_out_dir/cdb/api-ms-win-crt-utility-l1-1-0.dll",
+ "$root_out_dir/cdb/api-ms-win-downlevel-kernel32-l2-1-0.dll",
+ "$root_out_dir/cdb/api-ms-win-eventing-provider-l1-1-0.dll",
+ "$root_out_dir/cdb/ucrtbase.dll",
+ ]
+ }
+ args = [
+ rebase_path("$root_out_dir/cdb", root_out_dir),
+ target_cpu,
+ ]
+ }
+
+ group("runtime_libs") {
+ data = []
+ if (is_component_build) {
+ # Copy the VS runtime DLLs into the isolate so that they don't have to be
+ # preinstalled on the target machine. The debug runtimes have a "d" at
+ # the end.
+ if (is_debug) {
+ vcrt_suffix = "d"
+ } else {
+ vcrt_suffix = ""
+ }
+
+ # These runtime files are copied to the output directory by the
+ # vs_toolchain script that runs as part of toolchain configuration.
+ data += [
+ "$root_out_dir/msvcp140${vcrt_suffix}.dll",
+ "$root_out_dir/vccorlib140${vcrt_suffix}.dll",
+ "$root_out_dir/vcruntime140${vcrt_suffix}.dll",
+ ]
+ if (target_cpu == "x64") {
+ data += [ "$root_out_dir/vcruntime140_1${vcrt_suffix}.dll" ]
+ }
+ if (is_debug) {
+ data += [ "$root_out_dir/ucrtbased.dll" ]
+ }
+ if (is_asan) {
+ assert(target_cpu == "x64",
+ "ASan is only supported in 64-bit builds on Windows.")
+ data += [ "$clang_base_path/lib/clang/$clang_version/lib/windows/clang_rt.asan_dynamic-x86_64.dll" ]
+ }
+ if (target_cpu != "arm64") {
+ data += [
+ # Universal Windows 10 CRT files
+ "$root_out_dir/api-ms-win-core-console-l1-1-0.dll",
+ "$root_out_dir/api-ms-win-core-datetime-l1-1-0.dll",
+ "$root_out_dir/api-ms-win-core-debug-l1-1-0.dll",
+ "$root_out_dir/api-ms-win-core-errorhandling-l1-1-0.dll",
+ "$root_out_dir/api-ms-win-core-file-l1-1-0.dll",
+ "$root_out_dir/api-ms-win-core-file-l1-2-0.dll",
+ "$root_out_dir/api-ms-win-core-file-l2-1-0.dll",
+ "$root_out_dir/api-ms-win-core-handle-l1-1-0.dll",
+ "$root_out_dir/api-ms-win-core-heap-l1-1-0.dll",
+ "$root_out_dir/api-ms-win-core-interlocked-l1-1-0.dll",
+ "$root_out_dir/api-ms-win-core-libraryloader-l1-1-0.dll",
+ "$root_out_dir/api-ms-win-core-localization-l1-2-0.dll",
+ "$root_out_dir/api-ms-win-core-memory-l1-1-0.dll",
+ "$root_out_dir/api-ms-win-core-namedpipe-l1-1-0.dll",
+ "$root_out_dir/api-ms-win-core-processenvironment-l1-1-0.dll",
+ "$root_out_dir/api-ms-win-core-processthreads-l1-1-0.dll",
+ "$root_out_dir/api-ms-win-core-processthreads-l1-1-1.dll",
+ "$root_out_dir/api-ms-win-core-profile-l1-1-0.dll",
+ "$root_out_dir/api-ms-win-core-rtlsupport-l1-1-0.dll",
+ "$root_out_dir/api-ms-win-core-string-l1-1-0.dll",
+ "$root_out_dir/api-ms-win-core-synch-l1-1-0.dll",
+ "$root_out_dir/api-ms-win-core-synch-l1-2-0.dll",
+ "$root_out_dir/api-ms-win-core-sysinfo-l1-1-0.dll",
+ "$root_out_dir/api-ms-win-core-timezone-l1-1-0.dll",
+ "$root_out_dir/api-ms-win-core-util-l1-1-0.dll",
+ "$root_out_dir/api-ms-win-crt-conio-l1-1-0.dll",
+ "$root_out_dir/api-ms-win-crt-convert-l1-1-0.dll",
+ "$root_out_dir/api-ms-win-crt-environment-l1-1-0.dll",
+ "$root_out_dir/api-ms-win-crt-filesystem-l1-1-0.dll",
+ "$root_out_dir/api-ms-win-crt-heap-l1-1-0.dll",
+ "$root_out_dir/api-ms-win-crt-locale-l1-1-0.dll",
+ "$root_out_dir/api-ms-win-crt-math-l1-1-0.dll",
+ "$root_out_dir/api-ms-win-crt-multibyte-l1-1-0.dll",
+ "$root_out_dir/api-ms-win-crt-private-l1-1-0.dll",
+ "$root_out_dir/api-ms-win-crt-process-l1-1-0.dll",
+ "$root_out_dir/api-ms-win-crt-runtime-l1-1-0.dll",
+ "$root_out_dir/api-ms-win-crt-stdio-l1-1-0.dll",
+ "$root_out_dir/api-ms-win-crt-string-l1-1-0.dll",
+ "$root_out_dir/api-ms-win-crt-time-l1-1-0.dll",
+ "$root_out_dir/api-ms-win-crt-utility-l1-1-0.dll",
+ "$root_out_dir/api-ms-win-downlevel-kernel32-l2-1-0.dll",
+ "$root_out_dir/api-ms-win-eventing-provider-l1-1-0.dll",
+ ]
+ if (!is_debug) {
+ data += [ "$root_out_dir/ucrtbase.dll" ]
+ }
+ }
+ }
+ }
+}
diff --git a/third_party/libwebrtc/build/win/as_invoker.manifest b/third_party/libwebrtc/build/win/as_invoker.manifest
new file mode 100644
index 0000000000..df046fdf68
--- /dev/null
+++ b/third_party/libwebrtc/build/win/as_invoker.manifest
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
+<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
+ <security>
+ <requestedPrivileges>
+ <requestedExecutionLevel level="asInvoker" uiAccess="false"></requestedExecutionLevel>
+ </requestedPrivileges>
+ </security>
+</trustInfo></assembly>
diff --git a/third_party/libwebrtc/build/win/common_controls.manifest b/third_party/libwebrtc/build/win/common_controls.manifest
new file mode 100644
index 0000000000..1710196fce
--- /dev/null
+++ b/third_party/libwebrtc/build/win/common_controls.manifest
@@ -0,0 +1,8 @@
+<?xml version='1.0' encoding='UTF-8' standalone='yes'?>
+<assembly xmlns='urn:schemas-microsoft-com:asm.v1' manifestVersion='1.0'>
+ <dependency>
+ <dependentAssembly>
+ <assemblyIdentity type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*' />
+ </dependentAssembly>
+ </dependency>
+</assembly>
diff --git a/third_party/libwebrtc/build/win/compatibility.manifest b/third_party/libwebrtc/build/win/compatibility.manifest
new file mode 100644
index 0000000000..10d10da382
--- /dev/null
+++ b/third_party/libwebrtc/build/win/compatibility.manifest
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
+ <compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
+ <application>
+ <!--The ID below indicates application support for Windows Vista -->
+ <supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/>
+ <!--The ID below indicates application support for Windows 7 -->
+ <supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>
+ <!--The ID below indicates application support for Windows 8 -->
+ <supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/>
+ <!--The ID below indicates application support for Windows 8.1 -->
+ <supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/>
+ <!--The ID below indicates application support for Windows 10 -->
+ <supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/>
+ </application>
+ </compatibility>
+</assembly>
diff --git a/third_party/libwebrtc/build/win/copy_cdb_to_output.py b/third_party/libwebrtc/build/win/copy_cdb_to_output.py
new file mode 100755
index 0000000000..a0b99bb776
--- /dev/null
+++ b/third_party/libwebrtc/build/win/copy_cdb_to_output.py
@@ -0,0 +1,127 @@
+#!/usr/bin/env python
+# Copyright 2016 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+from __future__ import print_function
+
+import glob
+import hashlib
+import os
+import shutil
+import sys
+
+script_dir = os.path.dirname(os.path.realpath(__file__))
+src_build_dir = os.path.abspath(os.path.join(script_dir, os.pardir))
+sys.path.insert(0, src_build_dir)
+
+import vs_toolchain
+
+
+def _HexDigest(file_name):
+ hasher = hashlib.sha256()
+ afile = open(file_name, 'rb')
+ blocksize = 65536
+ buf = afile.read(blocksize)
+ while len(buf) > 0:
+ hasher.update(buf)
+ buf = afile.read(blocksize)
+ afile.close()
+ return hasher.hexdigest()
+
+
+def _CopyImpl(file_name, target_dir, source_dir, verbose=False):
+ """Copy |source| to |target| if it doesn't already exist or if it
+ needs to be updated.
+ """
+ target = os.path.join(target_dir, file_name)
+ source = os.path.join(source_dir, file_name)
+ if (os.path.isdir(os.path.dirname(target)) and
+ ((not os.path.isfile(target)) or
+ _HexDigest(source) != _HexDigest(target))):
+ if verbose:
+ print('Copying %s to %s...' % (source, target))
+ if os.path.exists(target):
+ os.unlink(target)
+ shutil.copy(source, target)
+
+
+def _ConditionalMkdir(output_dir):
+ if not os.path.isdir(output_dir):
+ os.makedirs(output_dir)
+
+
+def _CopyCDBToOutput(output_dir, target_arch):
+ """Copies the Windows debugging executable cdb.exe to the output
+ directory, which is created if it does not exist. The output
+ directory, and target architecture that should be copied, are
+ passed. Supported values for the target architecture are the GYP
+ values "ia32", "x64", "arm64" and the GN values "x86", "x64", "arm64".
+ """
+ _ConditionalMkdir(output_dir)
+ vs_toolchain.SetEnvironmentAndGetRuntimeDllDirs()
+ # If WINDOWSSDKDIR is not set use the default SDK path. This will be the case
+ # when DEPOT_TOOLS_WIN_TOOLCHAIN=0 and vcvarsall.bat has not been run.
+ win_sdk_dir = os.path.normpath(
+ os.environ.get('WINDOWSSDKDIR',
+ os.path.expandvars('%ProgramFiles(x86)%'
+ '\\Windows Kits\\10')))
+ if target_arch == 'ia32' or target_arch == 'x86':
+ src_arch = 'x86'
+ elif target_arch in ['x64', 'arm64']:
+ src_arch = target_arch
+ else:
+ print('copy_cdb_to_output.py: unknown target_arch %s' % target_arch)
+ sys.exit(1)
+ # We need to copy multiple files, so cache the computed source directory.
+ src_dir = os.path.join(win_sdk_dir, 'Debuggers', src_arch)
+ # We need to copy some helper DLLs to get access to the !uniqstack
+ # command to dump all threads' stacks.
+ src_winext_dir = os.path.join(src_dir, 'winext')
+ dst_winext_dir = os.path.join(output_dir, 'winext')
+ src_winxp_dir = os.path.join(src_dir, 'winxp')
+ dst_winxp_dir = os.path.join(output_dir, 'winxp')
+ # Starting with the 10.0.17763 SDK the ucrt files are in a version-named
+ # directory - this handles both cases.
+ redist_dir = os.path.join(win_sdk_dir, 'Redist')
+ version_dirs = glob.glob(os.path.join(redist_dir, '10.*'))
+ if len(version_dirs) > 0:
+ version_dirs.sort(reverse=True)
+ redist_dir = version_dirs[0]
+ src_crt_dir = os.path.join(redist_dir, 'ucrt', 'DLLs', src_arch)
+ _ConditionalMkdir(dst_winext_dir)
+ _ConditionalMkdir(dst_winxp_dir)
+ # Note that the outputs from the "copy_cdb_to_output" target need to
+ # be kept in sync with this list.
+ _CopyImpl('cdb.exe', output_dir, src_dir)
+ _CopyImpl('dbgeng.dll', output_dir, src_dir)
+ _CopyImpl('dbghelp.dll', output_dir, src_dir)
+ _CopyImpl('dbgmodel.dll', output_dir, src_dir)
+ _CopyImpl('ext.dll', dst_winext_dir, src_winext_dir)
+ _CopyImpl('uext.dll', dst_winext_dir, src_winext_dir)
+ _CopyImpl('exts.dll', dst_winxp_dir, src_winxp_dir)
+ _CopyImpl('ntsdexts.dll', dst_winxp_dir, src_winxp_dir)
+ if src_arch in ['x64', 'x86']:
+ # Copy all UCRT files from the debuggers directory, for compatibility with
+ # the Windows 10 18362 SDK (one UCRT file) and later versions (two UCRT
+ # files). The new file is api-ms-win-downlevel-kernel32-l2-1-0.dll and
+ # should be added to the copy_cdb_to_output outputs when we require a newer
+ # SDK.
+ for file in glob.glob(os.path.join(src_dir, 'api-ms-win*.dll')):
+ _CopyImpl(os.path.split(file)[1], output_dir, src_dir)
+ _CopyImpl('ucrtbase.dll', output_dir, src_crt_dir)
+ for dll_path in glob.glob(os.path.join(src_crt_dir, 'api-ms-win-*.dll')):
+ _CopyImpl(os.path.split(dll_path)[1], output_dir, src_crt_dir)
+ return 0
+
+
+def main():
+ if len(sys.argv) < 2:
+ print('Usage: copy_cdb_to_output.py <output_dir> ' + \
+ '<target_arch>', file=sys.stderr)
+ return 1
+ return _CopyCDBToOutput(sys.argv[1], sys.argv[2])
+
+
+if __name__ == '__main__':
+ sys.exit(main())
diff --git a/third_party/libwebrtc/build/win/gn_meta_sln.py b/third_party/libwebrtc/build/win/gn_meta_sln.py
new file mode 100644
index 0000000000..862d278248
--- /dev/null
+++ b/third_party/libwebrtc/build/win/gn_meta_sln.py
@@ -0,0 +1,214 @@
+# Copyright 2017 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+#
+# gn_meta_sln.py
+# Helper utility to combine GN-generated Visual Studio projects into
+# a single meta-solution.
+
+from __future__ import print_function
+
+import os
+import glob
+import re
+import sys
+from shutil import copyfile
+
+# Helpers
+def EnsureExists(path):
+ try:
+ os.makedirs(path)
+ except OSError:
+ pass
+
+def WriteLinesToFile(lines, file_name):
+ EnsureExists(os.path.dirname(file_name))
+ with open(file_name, "w") as f:
+ f.writelines(lines)
+
+def ExtractIdg(proj_file_name):
+ result = []
+ with open(proj_file_name) as proj_file:
+ lines = iter(proj_file)
+ for p_line in lines:
+ if "<ItemDefinitionGroup" in p_line:
+ while not "</ItemDefinitionGroup" in p_line:
+ result.append(p_line)
+ p_line = lines.next()
+ result.append(p_line)
+ return result
+
+# [ (name, solution_name, vs_version), ... ]
+configs = []
+
+def GetVSVersion(solution_file):
+ with open(solution_file) as f:
+ f.readline()
+ comment = f.readline().strip()
+ return comment[-4:]
+
+# Find all directories that can be used as configs (and record if they have VS
+# files present)
+for root, dirs, files in os.walk("out"):
+ for out_dir in dirs:
+ gn_file = os.path.join("out", out_dir, "build.ninja.d")
+ if os.path.exists(gn_file):
+ solutions = glob.glob(os.path.join("out", out_dir, "*.sln"))
+ for solution in solutions:
+ vs_version = GetVSVersion(solution)
+ configs.append((out_dir, os.path.basename(solution),
+ vs_version))
+ break
+
+# Every project has a GUID that encodes the type. We only care about C++.
+cpp_type_guid = "8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942"
+
+# Work around MSBuild limitations by always using a fixed arch.
+hard_coded_arch = "x64"
+
+# name -> [ (config, pathToProject, GUID, arch), ... ]
+all_projects = {}
+project_pattern = (r'Project\("\{' + cpp_type_guid +
+ r'\}"\) = "([^"]*)", "([^"]*)", "\{([^\}]*)\}"')
+
+# We need something to work with. Typically, this will fail if no GN folders
+# have IDE files
+if len(configs) == 0:
+ print("ERROR: At least one GN directory must have been built with --ide=vs")
+ sys.exit()
+
+# Filter out configs which don't match the name and vs version of the first.
+name = configs[0][1]
+vs_version = configs[0][2]
+
+for config in configs:
+ if config[1] != name or config[2] != vs_version:
+ continue
+
+ sln_lines = iter(open(os.path.join("out", config[0], config[1])))
+ for sln_line in sln_lines:
+ match_obj = re.match(project_pattern, sln_line)
+ if match_obj:
+ proj_name = match_obj.group(1)
+ if proj_name not in all_projects:
+ all_projects[proj_name] = []
+ all_projects[proj_name].append((config[0], match_obj.group(2),
+ match_obj.group(3)))
+
+# We need something to work with. Typically, this will fail if no GN folders
+# have IDE files
+if len(all_projects) == 0:
+ print("ERROR: At least one GN directory must have been built with --ide=vs")
+ sys.exit()
+
+# Create a new solution. We arbitrarily use the first config as the GUID source
+# (but we need to match that behavior later, when we copy/generate the project
+# files).
+new_sln_lines = []
+new_sln_lines.append(
+ 'Microsoft Visual Studio Solution File, Format Version 12.00\n')
+new_sln_lines.append('# Visual Studio ' + vs_version + '\n')
+for proj_name, proj_configs in all_projects.items():
+ new_sln_lines.append('Project("{' + cpp_type_guid + '}") = "' + proj_name +
+ '", "' + proj_configs[0][1] + '", "{' +
+ proj_configs[0][2] + '}"\n')
+ new_sln_lines.append('EndProject\n')
+
+new_sln_lines.append('Global\n')
+new_sln_lines.append(
+ '\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\n')
+for config in configs:
+ match = config[0] + '|' + hard_coded_arch
+ new_sln_lines.append('\t\t' + match + ' = ' + match + '\n')
+new_sln_lines.append('\tEndGlobalSection\n')
+new_sln_lines.append(
+ '\tGlobalSection(ProjectConfigurationPlatforms) = postSolution\n')
+for proj_name, proj_configs in all_projects.items():
+ proj_guid = proj_configs[0][2]
+ for config in configs:
+ match = config[0] + '|' + hard_coded_arch
+ new_sln_lines.append('\t\t{' + proj_guid + '}.' + match +
+ '.ActiveCfg = ' + match + '\n')
+ new_sln_lines.append('\t\t{' + proj_guid + '}.' + match +
+ '.Build.0 = ' + match + '\n')
+new_sln_lines.append('\tEndGlobalSection\n')
+new_sln_lines.append('\tGlobalSection(SolutionProperties) = preSolution\n')
+new_sln_lines.append('\t\tHideSolutionNode = FALSE\n')
+new_sln_lines.append('\tEndGlobalSection\n')
+new_sln_lines.append('\tGlobalSection(NestedProjects) = preSolution\n')
+new_sln_lines.append('\tEndGlobalSection\n')
+new_sln_lines.append('EndGlobal\n')
+
+# Write solution file
+WriteLinesToFile(new_sln_lines, 'out/sln/' + name)
+
+idg_hdr = "<ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='"
+
+configuration_template = """ <ProjectConfiguration Include="{config}|{arch}">
+ <Configuration>{config}</Configuration>
+ <Platform>{arch}</Platform>
+ </ProjectConfiguration>
+"""
+
+def FormatProjectConfig(config):
+ return configuration_template.format(
+ config = config[0], arch = hard_coded_arch)
+
+# Now, bring over the project files
+for proj_name, proj_configs in all_projects.items():
+ # Paths to project and filter file in src and dst locations
+ src_proj_path = os.path.join("out", proj_configs[0][0], proj_configs[0][1])
+ dst_proj_path = os.path.join("out", "sln", proj_configs[0][1])
+ src_filter_path = src_proj_path + ".filters"
+ dst_filter_path = dst_proj_path + ".filters"
+
+ # Copy the filter file unmodified
+ EnsureExists(os.path.dirname(dst_proj_path))
+ copyfile(src_filter_path, dst_filter_path)
+
+ preferred_tool_arch = None
+ config_arch = {}
+
+ # Bring over the project file, modified with extra configs
+ with open(src_proj_path) as src_proj_file:
+ proj_lines = iter(src_proj_file)
+ new_proj_lines = []
+ for line in proj_lines:
+ if "<ItemDefinitionGroup" in line:
+ # This is a large group that contains many settings. We need to
+ # replicate it, with conditions so it varies per configuration.
+ idg_lines = []
+ while not "</ItemDefinitionGroup" in line:
+ idg_lines.append(line)
+ line = proj_lines.next()
+ idg_lines.append(line)
+ for proj_config in proj_configs:
+ config_idg_lines = ExtractIdg(os.path.join("out",
+ proj_config[0],
+ proj_config[1]))
+ match = proj_config[0] + '|' + hard_coded_arch
+ new_proj_lines.append(idg_hdr + match + "'\">\n")
+ for idg_line in config_idg_lines[1:]:
+ new_proj_lines.append(idg_line)
+ elif "ProjectConfigurations" in line:
+ new_proj_lines.append(line)
+ proj_lines.next()
+ proj_lines.next()
+ proj_lines.next()
+ proj_lines.next()
+ for config in configs:
+ new_proj_lines.append(FormatProjectConfig(config))
+
+ elif "<OutDir" in line:
+ new_proj_lines.append(line.replace(proj_configs[0][0],
+ "$(Configuration)"))
+ elif "<PreferredToolArchitecture" in line:
+ new_proj_lines.append(" <PreferredToolArchitecture>" +
+ hard_coded_arch +
+ "</PreferredToolArchitecture>\n")
+ else:
+ new_proj_lines.append(line)
+ with open(dst_proj_path, "w") as new_proj:
+ new_proj.writelines(new_proj_lines)
+
+print('Wrote meta solution to out/sln/' + name)
diff --git a/third_party/libwebrtc/build/win/message_compiler.gni b/third_party/libwebrtc/build/win/message_compiler.gni
new file mode 100644
index 0000000000..21f4ec8b11
--- /dev/null
+++ b/third_party/libwebrtc/build/win/message_compiler.gni
@@ -0,0 +1,87 @@
+# Copyright 2015 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+assert(is_win, "This only runs on Windows.")
+
+# Runs mc.exe over a list of sources. The outputs (a header and rc file) are
+# placed in the target gen dir, and compiled.
+#
+# sources
+# List of message files to process.
+#
+# user_mode_logging (optional bool)
+# Generates user-mode logging code. Defaults to false (no logging code).
+#
+# compile_generated_code (optional, deafults = true)
+# If unset or true, the generated code will be compiled and linked into
+# targets that depend on it. If set to false, the .h and .rc files will only
+# be generated.
+#
+# deps, public_deps, visibility
+# Normal meaning.
+template("message_compiler") {
+ if (defined(invoker.compile_generated_code) &&
+ !invoker.compile_generated_code) {
+ compile_generated_code = false
+ action_name = target_name
+ } else {
+ compile_generated_code = true
+ action_name = "${target_name}_mc"
+ source_set_name = target_name
+ }
+
+ action_foreach(action_name) {
+ if (compile_generated_code) {
+ visibility = [ ":$source_set_name" ]
+ } else {
+ forward_variables_from(invoker, [ "visibility" ])
+ }
+
+ script = "//build/win/message_compiler.py"
+
+ outputs = [
+ "$target_gen_dir/{{source_name_part}}.h",
+ "$target_gen_dir/{{source_name_part}}.rc",
+ ]
+
+ args = [
+ # The first argument is the environment file saved to the build
+ # directory. This is required because the Windows toolchain setup saves
+ # the VC paths and such so that running "mc.exe" will work with the
+ # configured toolchain. This file is in the root build dir.
+ "environment.$target_cpu",
+
+ # Where to put the header.
+ "-h",
+ rebase_path(target_gen_dir, root_build_dir),
+
+ # Where to put the .rc file.
+ "-r",
+ rebase_path(target_gen_dir, root_build_dir),
+
+ # Input is Unicode.
+ "-u",
+ ]
+ if (defined(invoker.user_mode_logging) && invoker.user_mode_logging) {
+ args += [ "-um" ]
+ }
+ args += [ "{{source}}" ]
+
+ forward_variables_from(invoker,
+ [
+ "deps",
+ "public_deps",
+ "sources",
+ ])
+ }
+
+ if (compile_generated_code) {
+ # Compile the generated rc file.
+ source_set(source_set_name) {
+ forward_variables_from(invoker, [ "visibility" ])
+ sources = get_target_outputs(":$action_name")
+ deps = [ ":$action_name" ]
+ }
+ }
+}
diff --git a/third_party/libwebrtc/build/win/message_compiler.py b/third_party/libwebrtc/build/win/message_compiler.py
new file mode 100644
index 0000000000..51de52f0fc
--- /dev/null
+++ b/third_party/libwebrtc/build/win/message_compiler.py
@@ -0,0 +1,148 @@
+# Copyright 2015 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+# Runs the Microsoft Message Compiler (mc.exe).
+#
+# Usage: message_compiler.py <environment_file> [<args to mc.exe>*]
+
+from __future__ import print_function
+
+import difflib
+import distutils.dir_util
+import filecmp
+import os
+import re
+import shutil
+import subprocess
+import sys
+import tempfile
+
+def main():
+ env_file, rest = sys.argv[1], sys.argv[2:]
+
+ # Parse some argument flags.
+ header_dir = None
+ resource_dir = None
+ input_file = None
+ for i, arg in enumerate(rest):
+ if arg == '-h' and len(rest) > i + 1:
+ assert header_dir == None
+ header_dir = rest[i + 1]
+ elif arg == '-r' and len(rest) > i + 1:
+ assert resource_dir == None
+ resource_dir = rest[i + 1]
+ elif arg.endswith('.mc') or arg.endswith('.man'):
+ assert input_file == None
+ input_file = arg
+
+ # Copy checked-in outputs to final location.
+ THIS_DIR = os.path.abspath(os.path.dirname(__file__))
+ assert header_dir == resource_dir
+ source = os.path.join(THIS_DIR, "..", "..",
+ "third_party", "win_build_output",
+ re.sub(r'^(?:[^/]+/)?gen/', 'mc/', header_dir))
+ distutils.dir_util.copy_tree(source, header_dir, preserve_times=False)
+
+ # On non-Windows, that's all we can do.
+ if sys.platform != 'win32':
+ return
+
+ # On Windows, run mc.exe on the input and check that its outputs are
+ # identical to the checked-in outputs.
+
+ # Read the environment block from the file. This is stored in the format used
+ # by CreateProcess. Drop last 2 NULs, one for list terminator, one for
+ # trailing vs. separator.
+ env_pairs = open(env_file).read()[:-2].split('\0')
+ env_dict = dict([item.split('=', 1) for item in env_pairs])
+
+ extension = os.path.splitext(input_file)[1]
+ if extension in ['.man', '.mc']:
+ # For .man files, mc's output changed significantly from Version 10.0.15063
+ # to Version 10.0.16299. We should always have the output of the current
+ # default SDK checked in and compare to that. Early out if a different SDK
+ # is active. This also happens with .mc files.
+ # TODO(thakis): Check in new baselines and compare to 16299 instead once
+ # we use the 2017 Fall Creator's Update by default.
+ mc_help = subprocess.check_output(['mc.exe', '/?'], env=env_dict,
+ stderr=subprocess.STDOUT, shell=True)
+ version = re.search(br'Message Compiler\s+Version (\S+)', mc_help).group(1)
+ if version != '10.0.15063':
+ return
+
+ # mc writes to stderr, so this explicitly redirects to stdout and eats it.
+ try:
+ tmp_dir = tempfile.mkdtemp()
+ delete_tmp_dir = True
+ if header_dir:
+ rest[rest.index('-h') + 1] = tmp_dir
+ header_dir = tmp_dir
+ if resource_dir:
+ rest[rest.index('-r') + 1] = tmp_dir
+ resource_dir = tmp_dir
+
+ # This needs shell=True to search the path in env_dict for the mc
+ # executable.
+ subprocess.check_output(['mc.exe'] + rest,
+ env=env_dict,
+ stderr=subprocess.STDOUT,
+ shell=True)
+ # We require all source code (in particular, the header generated here) to
+ # be UTF-8. jinja can output the intermediate .mc file in UTF-8 or UTF-16LE.
+ # However, mc.exe only supports Unicode via the -u flag, and it assumes when
+ # that is specified that the input is UTF-16LE (and errors out on UTF-8
+ # files, assuming they're ANSI). Even with -u specified and UTF16-LE input,
+ # it generates an ANSI header, and includes broken versions of the message
+ # text in the comment before the value. To work around this, for any invalid
+ # // comment lines, we simply drop the line in the header after building it.
+ # Also, mc.exe apparently doesn't always write #define lines in
+ # deterministic order, so manually sort each block of #defines.
+ if header_dir:
+ header_file = os.path.join(
+ header_dir, os.path.splitext(os.path.basename(input_file))[0] + '.h')
+ header_contents = []
+ with open(header_file, 'rb') as f:
+ define_block = [] # The current contiguous block of #defines.
+ for line in f.readlines():
+ if line.startswith('//') and '?' in line:
+ continue
+ if line.startswith('#define '):
+ define_block.append(line)
+ continue
+ # On the first non-#define line, emit the sorted preceding #define
+ # block.
+ header_contents += sorted(define_block, key=lambda s: s.split()[-1])
+ define_block = []
+ header_contents.append(line)
+ # If the .h file ends with a #define block, flush the final block.
+ header_contents += sorted(define_block, key=lambda s: s.split()[-1])
+ with open(header_file, 'wb') as f:
+ f.write(''.join(header_contents))
+
+ # mc.exe invocation and post-processing are complete, now compare the output
+ # in tmp_dir to the checked-in outputs.
+ diff = filecmp.dircmp(tmp_dir, source)
+ if diff.diff_files or set(diff.left_list) != set(diff.right_list):
+ print('mc.exe output different from files in %s, see %s' % (source,
+ tmp_dir))
+ diff.report()
+ for f in diff.diff_files:
+ if f.endswith('.bin'): continue
+ fromfile = os.path.join(source, f)
+ tofile = os.path.join(tmp_dir, f)
+ print(''.join(
+ difflib.unified_diff(
+ open(fromfile, 'U').readlines(),
+ open(tofile, 'U').readlines(), fromfile, tofile)))
+ delete_tmp_dir = False
+ sys.exit(1)
+ except subprocess.CalledProcessError as e:
+ print(e.output)
+ sys.exit(e.returncode)
+ finally:
+ if os.path.exists(tmp_dir) and delete_tmp_dir:
+ shutil.rmtree(tmp_dir)
+
+if __name__ == '__main__':
+ main()
diff --git a/third_party/libwebrtc/build/win/reorder-imports.py b/third_party/libwebrtc/build/win/reorder-imports.py
new file mode 100755
index 0000000000..0995ae0058
--- /dev/null
+++ b/third_party/libwebrtc/build/win/reorder-imports.py
@@ -0,0 +1,98 @@
+#!/usr/bin/env python
+# Copyright 2014 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import glob
+import optparse
+import os
+import shutil
+import subprocess
+import sys
+
+sys.path.insert(
+ 0,
+ os.path.join(os.path.dirname(__file__), '..', '..', 'third_party',
+ 'pefile_py3'))
+import pefile
+
+def reorder_imports(input_dir, output_dir, architecture):
+ """Swap chrome_elf.dll to be the first import of chrome.exe.
+ Also copy over any related files that might be needed
+ (pdbs, manifests etc.).
+ """
+ # TODO(thakis): See if there is a reliable way to write the
+ # correct executable in the first place, so that this script
+ # only needs to verify that and not write a whole new exe.
+
+ input_image = os.path.join(input_dir, 'chrome.exe')
+ output_image = os.path.join(output_dir, 'chrome.exe')
+
+ # pefile mmap()s the whole executable, and then parses parts of
+ # it into python data structures for ease of processing.
+ # To write the file again, only the mmap'd data is written back,
+ # so modifying the parsed python objects generally has no effect.
+ # However, parsed raw data ends up in pe.Structure instances,
+ # and these all get serialized back when the file gets written.
+ # So things that are in a Structure must have their data set
+ # through the Structure, while other data must bet set through
+ # the set_bytes_*() methods.
+ pe = pefile.PE(input_image, fast_load=True)
+ if architecture == 'x64' or architecture == 'arm64':
+ assert pe.PE_TYPE == pefile.OPTIONAL_HEADER_MAGIC_PE_PLUS
+ else:
+ assert pe.PE_TYPE == pefile.OPTIONAL_HEADER_MAGIC_PE
+
+ pe.parse_data_directories(directories=[
+ pefile.DIRECTORY_ENTRY['IMAGE_DIRECTORY_ENTRY_IMPORT']])
+
+ found_elf = False
+ for i, peimport in enumerate(pe.DIRECTORY_ENTRY_IMPORT):
+ if peimport.dll.lower() == b'chrome_elf.dll':
+ assert not found_elf, 'only one chrome_elf.dll import expected'
+ found_elf = True
+ if i > 0:
+ swap = pe.DIRECTORY_ENTRY_IMPORT[0]
+
+ # Morally we want to swap peimport.struct and swap.struct here,
+ # but the pe module doesn't expose a public method on Structure
+ # to get all data of a Structure without explicitly listing all
+ # field names.
+ # NB: OriginalFirstThunk and Characteristics are an union both at
+ # offset 0, handling just one of them is enough.
+ peimport.struct.OriginalFirstThunk, swap.struct.OriginalFirstThunk = \
+ swap.struct.OriginalFirstThunk, peimport.struct.OriginalFirstThunk
+ peimport.struct.TimeDateStamp, swap.struct.TimeDateStamp = \
+ swap.struct.TimeDateStamp, peimport.struct.TimeDateStamp
+ peimport.struct.ForwarderChain, swap.struct.ForwarderChain = \
+ swap.struct.ForwarderChain, peimport.struct.ForwarderChain
+ peimport.struct.Name, swap.struct.Name = \
+ swap.struct.Name, peimport.struct.Name
+ peimport.struct.FirstThunk, swap.struct.FirstThunk = \
+ swap.struct.FirstThunk, peimport.struct.FirstThunk
+ assert found_elf, 'chrome_elf.dll import not found'
+
+ pe.write(filename=output_image)
+
+ for fname in glob.iglob(os.path.join(input_dir, 'chrome.exe.*')):
+ shutil.copy(fname, os.path.join(output_dir, os.path.basename(fname)))
+ return 0
+
+
+def main(argv):
+ usage = 'reorder_imports.py -i <input_dir> -o <output_dir> -a <target_arch>'
+ parser = optparse.OptionParser(usage=usage)
+ parser.add_option('-i', '--input', help='reorder chrome.exe in DIR',
+ metavar='DIR')
+ parser.add_option('-o', '--output', help='write new chrome.exe to DIR',
+ metavar='DIR')
+ parser.add_option('-a', '--arch', help='architecture of build (optional)',
+ default='ia32')
+ opts, args = parser.parse_args()
+
+ if not opts.input or not opts.output:
+ parser.error('Please provide and input and output directory')
+ return reorder_imports(opts.input, opts.output, opts.arch)
+
+if __name__ == "__main__":
+ sys.exit(main(sys.argv[1:]))
diff --git a/third_party/libwebrtc/build/win/require_administrator.manifest b/third_party/libwebrtc/build/win/require_administrator.manifest
new file mode 100644
index 0000000000..4142e73342
--- /dev/null
+++ b/third_party/libwebrtc/build/win/require_administrator.manifest
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
+<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
+ <security>
+ <requestedPrivileges>
+ <requestedExecutionLevel level="requireAdministrator" uiAccess="false"></requestedExecutionLevel>
+ </requestedPrivileges>
+ </security>
+</trustInfo></assembly>
diff --git a/third_party/libwebrtc/build/win/segment_heap.manifest b/third_party/libwebrtc/build/win/segment_heap.manifest
new file mode 100644
index 0000000000..fc930a4d56
--- /dev/null
+++ b/third_party/libwebrtc/build/win/segment_heap.manifest
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
+ <application xmlns="urn:schemas-microsoft-com:asm.v3">
+ <windowsSettings>
+ <heapType xmlns="http://schemas.microsoft.com/SMI/2020/WindowsSettings">SegmentHeap</heapType>
+ </windowsSettings>
+ </application>
+</assembly>
diff --git a/third_party/libwebrtc/build/win/set_appcontainer_acls.py b/third_party/libwebrtc/build/win/set_appcontainer_acls.py
new file mode 100755
index 0000000000..4a4e616cf2
--- /dev/null
+++ b/third_party/libwebrtc/build/win/set_appcontainer_acls.py
@@ -0,0 +1,35 @@
+#!/usr/bin/env python3
+# Copyright 2021 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+"""Sets the app container ACLs on directory."""
+
+import os
+import argparse
+import sys
+
+SRC_DIR = os.path.dirname(
+ os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
+
+sys.path.append(os.path.join(SRC_DIR, 'testing', 'scripts'))
+
+import common
+
+
+def main():
+ parser = argparse.ArgumentParser(
+ description='Sets App Container ACL on a directory.')
+ parser.add_argument('--stamp',
+ required=False,
+ help='Touch this stamp file on success.')
+ parser.add_argument('--dir', required=True, help='Set ACL on this directory.')
+ # parser.add_argument('--fail', required=True, help='Argument to fail.')
+ args = parser.parse_args()
+
+ common.set_lpac_acls(os.path.abspath(args.dir))
+ if args.stamp:
+ open(args.stamp, 'w').close() # Update mtime on stamp file.
+
+
+if __name__ == '__main__':
+ main()
diff --git a/third_party/libwebrtc/build/win/use_ansi_codes.py b/third_party/libwebrtc/build/win/use_ansi_codes.py
new file mode 100755
index 0000000000..5951c2ab4d
--- /dev/null
+++ b/third_party/libwebrtc/build/win/use_ansi_codes.py
@@ -0,0 +1,12 @@
+#!/usr/bin/env python
+# Copyright (c) 2015 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+"""Prints if the the terminal is likely to understand ANSI codes."""
+
+from __future__ import print_function
+
+import os
+
+# Add more terminals here as needed.
+print('ANSICON' in os.environ)