From f7cd54fcd4d99be697b6cfb3d4edaf08c3412338 Mon Sep 17 00:00:00 2001 From: Martin Vejdarski Date: Sun, 6 Sep 2020 04:50:30 +0200 Subject: [PATCH] [chromium-base] Add new port (#12396) Co-authored-by: JackBoosY Co-authored-by: Huahua --- .../maintainers/vcpkg_find_acquire_program.md | 1 + ports/chromium-base/CONTROL | 5 + .../chromium-baseConfig.cmake.in | 81 +++++++++ ports/chromium-base/portfile.cmake | 155 ++++++++++++++++++ ports/chromium-base/res/.gn | 1 + ports/chromium-base/res/0001-base.patch | 101 ++++++++++++ ports/chromium-base/res/0002-build.patch | 144 ++++++++++++++++ ports/chromium-base/res/BUILD.gn | 5 + ports/chromium-base/res/LASTCHANGE.committime | 1 + .../res/build_overrides/build.gni | 16 ++ ports/chromium-base/res/fontconfig/BUILD.gn | 1 + ports/chromium-base/res/gclient_args.gni | 7 + ports/chromium-base/res/icu/BUILD.gn | 2 + ports/chromium-base/res/icu/config.gni | 3 + ports/chromium-base/res/libxml/BUILD.gn | 2 + .../res/protobuf/proto_library.gni | 0 ports/chromium-base/res/test_fonts/BUILD.gn | 1 + .../chromium-base/res/testing/gmock/BUILD.gn | 1 + .../chromium-base/res/testing/gtest/BUILD.gn | 1 + .../res/testing/libfuzzer/fuzzer_test.gni | 1 + ports/chromium-base/res/testing/test.gni | 20 +++ .../res/tools/win/DebugVisualizers/BUILD.gn | 1 + .../tools/win/DebugVisualizers/chrome.natvis | 0 scripts/ci.baseline.txt | 2 + .../cmake/vcpkg_find_acquire_program.cmake | 32 ++++ 25 files changed, 584 insertions(+) create mode 100644 ports/chromium-base/CONTROL create mode 100644 ports/chromium-base/chromium-baseConfig.cmake.in create mode 100644 ports/chromium-base/portfile.cmake create mode 100644 ports/chromium-base/res/.gn create mode 100644 ports/chromium-base/res/0001-base.patch create mode 100644 ports/chromium-base/res/0002-build.patch create mode 100644 ports/chromium-base/res/BUILD.gn create mode 100644 ports/chromium-base/res/LASTCHANGE.committime create mode 100644 ports/chromium-base/res/build_overrides/build.gni create mode 100644 ports/chromium-base/res/fontconfig/BUILD.gn create mode 100644 ports/chromium-base/res/gclient_args.gni create mode 100644 ports/chromium-base/res/icu/BUILD.gn create mode 100644 ports/chromium-base/res/icu/config.gni create mode 100644 ports/chromium-base/res/libxml/BUILD.gn create mode 100644 ports/chromium-base/res/protobuf/proto_library.gni create mode 100644 ports/chromium-base/res/test_fonts/BUILD.gn create mode 100644 ports/chromium-base/res/testing/gmock/BUILD.gn create mode 100644 ports/chromium-base/res/testing/gtest/BUILD.gn create mode 100644 ports/chromium-base/res/testing/libfuzzer/fuzzer_test.gni create mode 100644 ports/chromium-base/res/testing/test.gni create mode 100644 ports/chromium-base/res/tools/win/DebugVisualizers/BUILD.gn create mode 100644 ports/chromium-base/res/tools/win/DebugVisualizers/chrome.natvis diff --git a/docs/maintainers/vcpkg_find_acquire_program.md b/docs/maintainers/vcpkg_find_acquire_program.md index a838bb974e..ae83ccb92f 100644 --- a/docs/maintainers/vcpkg_find_acquire_program.md +++ b/docs/maintainers/vcpkg_find_acquire_program.md @@ -16,6 +16,7 @@ The current list of programs includes: - 7Z - ARIA2 (Downloader) - BISON +- CLANG - DARK - DOXYGEN - FLEX diff --git a/ports/chromium-base/CONTROL b/ports/chromium-base/CONTROL new file mode 100644 index 0000000000..91b0590181 --- /dev/null +++ b/ports/chromium-base/CONTROL @@ -0,0 +1,5 @@ +Source: chromium-base +Version: 86.0.4199.1 +Homepage: https://chromium.googlesource.com/chromium/src +Description: Chromium is an open-source browser project that aims to build a safer, faster, and more stable way for all users to experience the web. +Supports: x64 & (osx|windows|linux) & !uwp \ No newline at end of file diff --git a/ports/chromium-base/chromium-baseConfig.cmake.in b/ports/chromium-base/chromium-baseConfig.cmake.in new file mode 100644 index 0000000000..95ce316c65 --- /dev/null +++ b/ports/chromium-base/chromium-baseConfig.cmake.in @@ -0,0 +1,81 @@ +if(TARGET chromium-base) + return() +endif() + +set(DEFINITIONS_DBG @DEFINITIONS_DBG@) +set(DEFINITIONS_REL @DEFINITIONS_DBG@) + +# Compute the installation prefix relative to this file. +get_filename_component(_IMPORT_PREFIX "${CMAKE_CURRENT_LIST_FILE}" PATH) +get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH) +get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH) +if(_IMPORT_PREFIX STREQUAL "/") + set(_IMPORT_PREFIX "") +endif() + +add_library(chromium-base INTERFACE IMPORTED GLOBAL) +add_library(chromium-base::chromium-base ALIAS chromium-base) + +set(LIBRARIES_ chromium_base chromium_base_static dynamic_annotations double_conversion) + +if(WIN32) + list(APPEND LIBRARIES_ + cfgmgr32 + powrprof + propsys + setupapi + userenv + wbemuuid + winmm + advapi32 + comdlg32 + dbghelp + dnsapi + gdi32 + msimg32 + odbc32 + odbccp32 + oleaut32 + shell32 + shlwapi + user32 + usp10 + uuid + version + wininet + winspool + ws2_32 + delayimp + kernel32 + ole32) +elseif(APPLE) + list(APPEND LIBRARIES_ + ApplicationServices + AppKit + CoreFoundation + IOKit + OpenDirectory + Security + bsm + pmenergy + pmsample) +endif() + +foreach(LIB_NAME ${LIBRARIES_}) + find_library(_LIB NAMES ${LIB_NAME} ${LIB_NAME}.dll) + target_link_libraries(chromium-base INTERFACE ${_LIB}) + unset(_LIB CACHE) +endforeach() + +if(UNIX AND NOT APPLE) + target_link_libraries(chromium-base INTERFACE -ldl -latomic -lpthread) +endif() + +target_include_directories(chromium-base + INTERFACE ${_IMPORT_PREFIX}/include/chromium-base) + +target_compile_definitions(chromium-base INTERFACE + $<$:${DEFINITIONS_DBG}> + $<$:${DEFINITIONS_REL}>) + +target_compile_features(chromium-base INTERFACE cxx_std_14) diff --git a/ports/chromium-base/portfile.cmake b/ports/chromium-base/portfile.cmake new file mode 100644 index 0000000000..409c2d589e --- /dev/null +++ b/ports/chromium-base/portfile.cmake @@ -0,0 +1,155 @@ +vcpkg_fail_port_install( + ON_ARCH "x86" "arm" "arm64" + ON_TARGET "UWP") + +# Patches may be provided at the end +function(checkout_in_path PATH URL REF) + if(EXISTS "${PATH}") + file(GLOB FILES "${PATH}") + list(LENGTH FILES COUNT) + if(COUNT GREATER 0) + return() + endif() + file(REMOVE_RECURSE "${PATH}") + endif() + + vcpkg_from_git( + OUT_SOURCE_PATH DEP_SOURCE_PATH + URL "${URL}" + REF "${REF}" + PATCHES "${ARGN}" + ) + file(RENAME "${DEP_SOURCE_PATH}" "${PATH}") + file(REMOVE_RECURSE "${DEP_SOURCE_PATH}") +endfunction() + +# Commits are based on https://chromium.googlesource.com/chromium/src/+/refs/tags/86.0.4199.1 +set(SOURCE_PATH "${CURRENT_BUILDTREES_DIR}/src/25ce732") +file(MAKE_DIRECTORY "${SOURCE_PATH}/third_party") + +set(CHROMIUM_GIT "https://chromium.googlesource.com/chromium/src") +checkout_in_path( + "${SOURCE_PATH}/base" + "${CHROMIUM_GIT}/base" + "25ce73258703a5ac018da0e203fb3d4a98c2136e" + res/0001-base.patch) +checkout_in_path( + "${SOURCE_PATH}/build" + "${CHROMIUM_GIT}/build" + "312532ee66abdacbe58afb5df7ddf05e3a6399f9" + res/0002-build.patch) +checkout_in_path( + "${SOURCE_PATH}/third_party/apple_apsl" + "${CHROMIUM_GIT}/third_party/apple_apsl" + "4cc25bbf65194f6726f7f10da0a885818e35d53e") +checkout_in_path( + "${SOURCE_PATH}/third_party/ced" + "${CHROMIUM_GIT}/third_party/ced" + "4cd87a44674edd9fe1f01c4cb5f1b73907ce4236") +checkout_in_path( + "${SOURCE_PATH}/third_party/modp_b64" + "${CHROMIUM_GIT}/third_party/modp_b64" + "509f005fa65e652dc4a6f636da6fa1002b6dce16") + +set(RES "${CMAKE_CURRENT_LIST_DIR}/res") +file(COPY "${RES}/.gn" DESTINATION "${SOURCE_PATH}") +file(COPY "${RES}/BUILD.gn" DESTINATION "${SOURCE_PATH}") +file(COPY "${RES}/build_overrides" DESTINATION "${SOURCE_PATH}") +file(COPY "${RES}/testing" DESTINATION "${SOURCE_PATH}") +file(COPY "${RES}/tools" DESTINATION "${SOURCE_PATH}") +file(COPY "${RES}/gclient_args.gni" DESTINATION "${SOURCE_PATH}/build/config") +file(COPY "${RES}/LASTCHANGE.committime" DESTINATION "${SOURCE_PATH}/build/util") +file(COPY "${RES}/icu" DESTINATION "${SOURCE_PATH}/third_party") +file(COPY "${RES}/libxml" DESTINATION "${SOURCE_PATH}/third_party") +file(COPY "${RES}/protobuf" DESTINATION "${SOURCE_PATH}/third_party") +file(COPY "${RES}/fontconfig" DESTINATION "${SOURCE_PATH}/third_party") +file(COPY "${RES}/test_fonts" DESTINATION "${SOURCE_PATH}/third_party") + +set(OPTIONS "\ + use_custom_libcxx=false \ + clang_use_chrome_plugins=false \ + forbid_non_component_debug_builds=false") +set(DEFINITIONS "") + +if(WIN32) + # Windows 10 SDK >= (10.0.19041.0) is required + # https://developer.microsoft.com/en-us/windows/downloads/windows-10-sdk + SET(VCPKG_POLICY_SKIP_ARCHITECTURE_CHECK enabled) + set(ENV{DEPOT_TOOLS_WIN_TOOLCHAIN} 0) + set(OPTIONS "${OPTIONS} treat_warnings_as_errors=false use_lld=false") +endif() + +if(VCPKG_CMAKE_SYSTEM_NAME STREQUAL Linux) + set(OPTIONS "${OPTIONS} use_allocator=\"none\" use_sysroot=false use_glib=false") +endif() + +# Find the directory that contains "bin/clang" +# Note: Only clang-cl is supported on Windows, see https://crbug.com/988071 +vcpkg_find_acquire_program(CLANG) +if(CLANG MATCHES "-NOTFOUND") + message(FATAL_ERROR "Clang is required.") +endif() +get_filename_component(CLANG "${CLANG}" DIRECTORY) +get_filename_component(CLANG "${CLANG}" DIRECTORY) +if((WIN32 AND NOT EXISTS "${CLANG}/bin/clang-cl.exe") OR + (APPLE AND NOT EXISTS "${CLANG}/bin/clang")) + message(FATAL_ERROR "Clang needs to be inside a bin directory.") +endif() +set(OPTIONS "${OPTIONS} clang_base_path=\"${CLANG}\"") + +if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic) + set(OPTIONS "${OPTIONS} is_component_build=true") + list(APPEND DEFINITIONS COMPONENT_BUILD) +else() + set(OPTIONS "${OPTIONS} is_component_build=false") +endif() + +if(APPLE) + set(OPTIONS "${OPTIONS} enable_dsyms=true") +endif() + +set(OPTIONS_DBG "${OPTIONS} is_debug=true symbol_level=2") +set(OPTIONS_REL "${OPTIONS} is_debug=false symbol_level=0") +set(DEFINITIONS_DBG ${DEFINITIONS}) +set(DEFINITIONS_REL ${DEFINITIONS}) + +vcpkg_configure_gn( + SOURCE_PATH "${SOURCE_PATH}" + OPTIONS_DEBUG "${OPTIONS_DBG}" + OPTIONS_RELEASE "${OPTIONS_REL}" +) + +# Prevent a ninja re-config loop +set(NINJA_REBUILD "build build.ninja: gn\n generator = 1\n depfile = build.ninja.d") +vcpkg_replace_string("${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg/build.ninja" "${NINJA_REBUILD}" "") +vcpkg_replace_string("${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/build.ninja" "${NINJA_REBUILD}" "") + +set(TARGETS + base base:base_static + base/third_party/dynamic_annotations + base/third_party/double_conversion) + +if(WIN32) + list(APPEND TARGETS base/win:pe_image) +endif() + +vcpkg_install_gn( + SOURCE_PATH "${SOURCE_PATH}" + TARGETS ${TARGETS} +) + +# Install includes +set(PACKAGES_INCLUDE_DIR "${CURRENT_PACKAGES_DIR}/include/${PORT}") +file(GLOB_RECURSE INCLUDE_FILES LIST_DIRECTORIES false RELATIVE "${SOURCE_PATH}" "${SOURCE_PATH}/*.h") +foreach(file_ ${INCLUDE_FILES}) + configure_file("${SOURCE_PATH}/${file_}" "${PACKAGES_INCLUDE_DIR}/${file_}" COPYONLY) +endforeach() + +configure_file("${CMAKE_CURRENT_LIST_DIR}/chromium-baseConfig.cmake.in" + "${CURRENT_PACKAGES_DIR}/share/${PORT}/chromium-baseConfig.cmake" @ONLY) + +vcpkg_copy_pdbs() + +file(INSTALL "${SOURCE_PATH}/third_party/ced/LICENSE" + DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" + RENAME copyright) diff --git a/ports/chromium-base/res/.gn b/ports/chromium-base/res/.gn new file mode 100644 index 0000000000..4fcb7c405f --- /dev/null +++ b/ports/chromium-base/res/.gn @@ -0,0 +1 @@ +buildconfig = "//build/config/BUILDCONFIG.gn" \ No newline at end of file diff --git a/ports/chromium-base/res/0001-base.patch b/ports/chromium-base/res/0001-base.patch new file mode 100644 index 0000000000..ca8c059756 --- /dev/null +++ b/ports/chromium-base/res/0001-base.patch @@ -0,0 +1,101 @@ +diff --git a/BUILD.gn b/BUILD.gn +index 7b7cd51..2961688 100644 +--- a/BUILD.gn ++++ b/BUILD.gn +@@ -155,6 +155,7 @@ if (is_android) { + # test code (test support and anything in the test directory) which should use + # source_set as is recommended for GN targets). + jumbo_component("base") { ++ output_name = "chromium_base" + if (is_nacl || is_ios) { + # Link errors related to malloc functions if libbase for nacl is + # compiled with jumbo: https://crbug.com/775959. +@@ -162,6 +163,11 @@ jumbo_component("base") { + never_build_jumbo = true + } + ++ if (!is_component_build) { ++ complete_static_lib = true ++ configs -= [ "//build/config/compiler:thin_archive" ] ++ } ++ + sources = [ + "allocator/allocator_check.cc", + "allocator/allocator_check.h", +@@ -1638,7 +1644,7 @@ jumbo_component("base") { + "hash/md5_constexpr_internal.h", + "hash/sha1.h", + ] +- if (is_nacl) { ++ if (true) { + sources += [ + "hash/md5_nacl.cc", + "hash/md5_nacl.h", +@@ -2298,6 +2304,7 @@ buildflag_header("tracing_buildflags") { + # library. Note that this library cannot depend on base because base depends on + # base_static. + static_library("base_static") { ++ output_name = "chromium_base_static" + sources = [ + "base_switches.cc", + "base_switches.h", +@@ -2325,7 +2332,7 @@ static_library("base_static") { + } + + component("i18n") { +- output_name = "base_i18n" ++ output_name = "chromium_base_i18n" + sources = [ + "i18n/base_i18n_export.h", + "i18n/base_i18n_switches.cc", +diff --git a/gtest_prod_util.h b/gtest_prod_util.h +index 2ca267e..0a0b6df 100644 +--- a/gtest_prod_util.h ++++ b/gtest_prod_util.h +@@ -5,7 +5,8 @@ + #ifndef BASE_GTEST_PROD_UTIL_H_ + #define BASE_GTEST_PROD_UTIL_H_ + +-#include "testing/gtest/include/gtest/gtest_prod.h" // nogncheck ++#define FRIEND_TEST(test_case_name, test_name)\ ++friend class test_case_name##_##test_name##_Test + + // This is a wrapper for gtest's FRIEND_TEST macro that friends + // test with all possible prefixes. This is very helpful when changing the test +diff --git a/hash/md5.h b/hash/md5.h +index 8a49f08..24acdab 100644 +--- a/hash/md5.h ++++ b/hash/md5.h +@@ -11,7 +11,7 @@ + #include "base/strings/string_piece.h" + #include "build/build_config.h" + +-#if defined(OS_NACL) ++#if true + #include "base/hash/md5_nacl.h" + #else + #include "base/hash/md5_boringssl.h" +diff --git a/hash/md5_nacl.cc b/hash/md5_nacl.cc +index 827bbbd..4b22c59 100644 +--- a/hash/md5_nacl.cc ++++ b/hash/md5_nacl.cc +@@ -22,6 +22,7 @@ + */ + + #include ++#include + + #include "base/hash/md5.h" + +diff --git a/profiler/stack_copier_signal.cc b/profiler/stack_copier_signal.cc +index 5a7d8b9..f959f2f 100644 +--- a/profiler/stack_copier_signal.cc ++++ b/profiler/stack_copier_signal.cc +@@ -6,6 +6,7 @@ + + #include + #include ++#include + #include + #include + diff --git a/ports/chromium-base/res/0002-build.patch b/ports/chromium-base/res/0002-build.patch new file mode 100644 index 0000000000..94568d1690 --- /dev/null +++ b/ports/chromium-base/res/0002-build.patch @@ -0,0 +1,144 @@ +diff --git a/config/BUILDCONFIG.gn b/config/BUILDCONFIG.gn +index 4cc6bfc..9ea83a9 100644 +--- a/config/BUILDCONFIG.gn ++++ b/config/BUILDCONFIG.gn +@@ -657,6 +657,7 @@ template("component") { + # See http://crbug.com/594610 + forward_variables_from(invoker, [ "visibility" ]) + forward_variables_from(invoker, "*", [ "visibility" ]) ++ not_needed("*") + } + } + +diff --git a/config/clang/BUILD.gn b/config/clang/BUILD.gn +index 960726e..87886dc 100644 +--- a/config/clang/BUILD.gn ++++ b/config/clang/BUILD.gn +@@ -38,5 +38,7 @@ config("extra_warnings") { + "-Wstring-conversion", + + "-Wtautological-overlap-compare", ++ "-Wno-unknown-warning-option", ++ "-Wno-unknown-pragmas" + ] + } +diff --git a/config/mac/sdk_info.py b/config/mac/sdk_info.py +index 1ad11d3..99b21f9 100644 +--- a/config/mac/sdk_info.py ++++ b/config/mac/sdk_info.py +@@ -61,10 +61,15 @@ def FillXcodeVersion(settings, developer_dir): + settings['xcode_build'] = version_plist['ProductBuildVersion'] + return + +- lines = subprocess.check_output(['xcodebuild', '-version']).splitlines() +- settings['xcode_version'] = FormatVersion(lines[0].split()[-1]) +- settings['xcode_version_int'] = int(settings['xcode_version'], 10) +- settings['xcode_build'] = lines[-1].split()[-1] ++ try: ++ lines = subprocess.check_output(['xcodebuild', '-version']).splitlines() ++ settings['xcode_version'] = FormatVersion(lines[0].split()[-1]) ++ settings['xcode_version_int'] = int(settings['xcode_version'], 10) ++ settings['xcode_build'] = lines[-1].split()[-1] ++ except: ++ settings['xcode_version'] = "" ++ settings['xcode_version_int'] = 0 ++ settings['xcode_build'] = "" + + + def FillMachineOSBuild(settings): +diff --git a/mac/find_sdk.py b/mac/find_sdk.py +index 58362bf..a6069b6 100755 +--- a/mac/find_sdk.py ++++ b/mac/find_sdk.py +@@ -68,6 +68,8 @@ def main(): + dev_dir = out.rstrip() + sdk_dir = os.path.join( + dev_dir, 'Platforms/MacOSX.platform/Developer/SDKs') ++ if not os.path.isdir(sdk_dir): ++ sdk_dir = os.path.join(dev_dir, 'SDKs') + + if not os.path.isdir(sdk_dir): + raise SdkError('Install Xcode, launch it, accept the license ' + +@@ -87,7 +89,10 @@ def main(): + + if options.print_bin_path: + bin_path = 'Toolchains/XcodeDefault.xctoolchain/usr/bin/' +- print(os.path.join(dev_dir, bin_path)) ++ if os.path.isdir(os.path.join(dev_dir, bin_path)): ++ print(os.path.join(dev_dir, bin_path)) ++ else: ++ print(os.path.join(dev_dir, 'usr/bin/')) + + return best_sdk + +diff --git a/toolchain/mac/BUILD.gn b/toolchain/mac/BUILD.gn +index 8fdada0..8d5e6b7 100644 +--- a/toolchain/mac/BUILD.gn ++++ b/toolchain/mac/BUILD.gn +@@ -184,9 +184,9 @@ template("mac_toolchain") { + # If dSYMs are enabled, this flag will be added to the link tools. + if (_enable_dsyms) { + dsym_switch = " -Wcrl,dsym,{{root_out_dir}} " +- dsym_switch += "-Wcrl,dsymutilpath," + +- rebase_path("//tools/clang/dsymutil/bin/dsymutil", +- root_build_dir) + " " ++ # dsym_switch += "-Wcrl,dsymutilpath," + ++ # rebase_path("//tools/clang/dsymutil/bin/dsymutil", ++ # root_build_dir) + " " + + dsym_output_dir = + "{{root_out_dir}}/{{target_output_name}}{{output_extension}}.dSYM" +diff --git a/toolchain/win/BUILD.gn b/toolchain/win/BUILD.gn +index be08930..04fb374 100644 +--- a/toolchain/win/BUILD.gn ++++ b/toolchain/win/BUILD.gn +@@ -98,7 +98,7 @@ template("msvc_toolchain") { + } else { + lld_link = "lld-link" + } +- prefix = rebase_path("$clang_base_path/bin", root_build_dir) ++ prefix = "$clang_base_path/bin" + + # lld-link includes a replacement for lib.exe that can produce thin + # archives and understands bitcode (for lto builds). +@@ -190,7 +190,7 @@ template("msvc_toolchain") { + # amount of data to parse and store in .ninja_deps. We do this on non-Windows too, + # and already make sure rebuilds after win sdk / libc++ / clang header updates happen via + # changing commandline flags. +- show_includes = "/showIncludes:user" ++ show_includes = "" + } else { + show_includes = "/showIncludes" + } +@@ -235,7 +235,7 @@ template("msvc_toolchain") { + + if (toolchain_args.current_cpu == "arm64") { + if (is_clang) { +- prefix = rebase_path("$clang_base_path/bin", root_build_dir) ++ prefix = "$clang_base_path/bin" + ml = "${clang_prefix}${prefix}/${clang_cl} --target=arm64-windows" + if (host_os == "win") { + # Flip the slashes so that copy/paste of the command works. +@@ -444,11 +444,9 @@ template("win_toolchains") { + + msvc_toolchain("win_clang_" + target_name) { + environment = "environment." + toolchain_arch +- prefix = rebase_path("$clang_base_path/bin", root_build_dir) ++ prefix = "$clang_base_path/bin" + cl = "${clang_prefix}$prefix/${clang_cl}" +- _clang_lib_dir = +- rebase_path("$clang_base_path/lib/clang/$clang_version/lib/windows", +- root_build_dir) ++ _clang_lib_dir = "$clang_base_path/lib/clang/$clang_version/lib/windows" + if (host_os == "win") { + # Flip the slashes so that copy/paste of the command works. + cl = string_replace(cl, "/", "\\") +@@ -459,7 +457,7 @@ template("win_toolchains") { + + sys_include_flags = "${win_toolchain_data.include_flags_imsvc}" + sys_lib_flags = +- "-libpath:$_clang_lib_dir ${win_toolchain_data.libpath_flags}" ++ "-libpath:\"$_clang_lib_dir\" ${win_toolchain_data.libpath_flags}" + + toolchain_args = { + if (defined(invoker.toolchain_args)) { diff --git a/ports/chromium-base/res/BUILD.gn b/ports/chromium-base/res/BUILD.gn new file mode 100644 index 0000000000..01d935ba02 --- /dev/null +++ b/ports/chromium-base/res/BUILD.gn @@ -0,0 +1,5 @@ +static_library("chromium-base") { + deps = [ + "//base", + ] +} diff --git a/ports/chromium-base/res/LASTCHANGE.committime b/ports/chromium-base/res/LASTCHANGE.committime new file mode 100644 index 0000000000..6acbbf6910 --- /dev/null +++ b/ports/chromium-base/res/LASTCHANGE.committime @@ -0,0 +1 @@ +1594430814 \ No newline at end of file diff --git a/ports/chromium-base/res/build_overrides/build.gni b/ports/chromium-base/res/build_overrides/build.gni new file mode 100644 index 0000000000..47ac036443 --- /dev/null +++ b/ports/chromium-base/res/build_overrides/build.gni @@ -0,0 +1,16 @@ +import("//build/config/gclient_args.gni") + +# Some non-Chromium builds don't support building java targets. +enable_java_templates = true + +# Don't use Chromium's third_party/binutils. +linux_use_bundled_binutils_override = false + +# Tracing requires //third_party/perfetto. +enable_base_tracing = false + +# Skip assertions about 4GiB file size limit. See https://crbug.com/648948. +ignore_elf32_limitations = false + +# Use the system install of Xcode for tools like ibtool, libtool, etc. +use_system_xcode = true diff --git a/ports/chromium-base/res/fontconfig/BUILD.gn b/ports/chromium-base/res/fontconfig/BUILD.gn new file mode 100644 index 0000000000..5c26eaf19c --- /dev/null +++ b/ports/chromium-base/res/fontconfig/BUILD.gn @@ -0,0 +1 @@ +component("fontconfig") {} \ No newline at end of file diff --git a/ports/chromium-base/res/gclient_args.gni b/ports/chromium-base/res/gclient_args.gni new file mode 100644 index 0000000000..bd1145a79d --- /dev/null +++ b/ports/chromium-base/res/gclient_args.gni @@ -0,0 +1,7 @@ +build_with_chromium = true +checkout_android = false +checkout_android_native_support = false +checkout_ios_webkit = false +checkout_nacl = false +checkout_oculus_sdk = false +checkout_openxr = false \ No newline at end of file diff --git a/ports/chromium-base/res/icu/BUILD.gn b/ports/chromium-base/res/icu/BUILD.gn new file mode 100644 index 0000000000..22356981f3 --- /dev/null +++ b/ports/chromium-base/res/icu/BUILD.gn @@ -0,0 +1,2 @@ +component("icuuc") {} +component("icu") {} \ No newline at end of file diff --git a/ports/chromium-base/res/icu/config.gni b/ports/chromium-base/res/icu/config.gni new file mode 100644 index 0000000000..4e9ad6a5ee --- /dev/null +++ b/ports/chromium-base/res/icu/config.gni @@ -0,0 +1,3 @@ +declare_args() { + icu_use_data_file = false +} \ No newline at end of file diff --git a/ports/chromium-base/res/libxml/BUILD.gn b/ports/chromium-base/res/libxml/BUILD.gn new file mode 100644 index 0000000000..b48056ab88 --- /dev/null +++ b/ports/chromium-base/res/libxml/BUILD.gn @@ -0,0 +1,2 @@ +component("libxml_utils") {} +component("xml_reader") {} \ No newline at end of file diff --git a/ports/chromium-base/res/protobuf/proto_library.gni b/ports/chromium-base/res/protobuf/proto_library.gni new file mode 100644 index 0000000000..e69de29bb2 diff --git a/ports/chromium-base/res/test_fonts/BUILD.gn b/ports/chromium-base/res/test_fonts/BUILD.gn new file mode 100644 index 0000000000..b95c104e1f --- /dev/null +++ b/ports/chromium-base/res/test_fonts/BUILD.gn @@ -0,0 +1 @@ +component("test_fonts") {} \ No newline at end of file diff --git a/ports/chromium-base/res/testing/gmock/BUILD.gn b/ports/chromium-base/res/testing/gmock/BUILD.gn new file mode 100644 index 0000000000..acd0ec30c0 --- /dev/null +++ b/ports/chromium-base/res/testing/gmock/BUILD.gn @@ -0,0 +1 @@ +component("gmock") {} \ No newline at end of file diff --git a/ports/chromium-base/res/testing/gtest/BUILD.gn b/ports/chromium-base/res/testing/gtest/BUILD.gn new file mode 100644 index 0000000000..2463cc7c0d --- /dev/null +++ b/ports/chromium-base/res/testing/gtest/BUILD.gn @@ -0,0 +1 @@ +component("gtest") {} \ No newline at end of file diff --git a/ports/chromium-base/res/testing/libfuzzer/fuzzer_test.gni b/ports/chromium-base/res/testing/libfuzzer/fuzzer_test.gni new file mode 100644 index 0000000000..6e2a4c20fe --- /dev/null +++ b/ports/chromium-base/res/testing/libfuzzer/fuzzer_test.gni @@ -0,0 +1 @@ +import("//testing/test.gni") \ No newline at end of file diff --git a/ports/chromium-base/res/testing/test.gni b/ports/chromium-base/res/testing/test.gni new file mode 100644 index 0000000000..2d6f8c1035 --- /dev/null +++ b/ports/chromium-base/res/testing/test.gni @@ -0,0 +1,20 @@ +template("test") { + not_needed(invoker, "*") + not_needed("*") +} + +set_defaults("test") { + configs = [ + "//build/config/compiler:chromium_code" + ] +} + +template("fuzzer_test") { + not_needed(invoker, "*") + not_needed("*") +} + +template("protoc_convert") { + not_needed(invoker, "*") + not_needed("*") +} \ No newline at end of file diff --git a/ports/chromium-base/res/tools/win/DebugVisualizers/BUILD.gn b/ports/chromium-base/res/tools/win/DebugVisualizers/BUILD.gn new file mode 100644 index 0000000000..5c2c1f68e1 --- /dev/null +++ b/ports/chromium-base/res/tools/win/DebugVisualizers/BUILD.gn @@ -0,0 +1 @@ +config("chrome") {} \ No newline at end of file diff --git a/ports/chromium-base/res/tools/win/DebugVisualizers/chrome.natvis b/ports/chromium-base/res/tools/win/DebugVisualizers/chrome.natvis new file mode 100644 index 0000000000..e69de29bb2 diff --git a/scripts/ci.baseline.txt b/scripts/ci.baseline.txt index e19bcfbb89..58dc392669 100644 --- a/scripts/ci.baseline.txt +++ b/scripts/ci.baseline.txt @@ -200,6 +200,8 @@ chipmunk:x64-osx=fail chipmunk:x64-uwp=fail chmlib:arm-uwp=fail chmlib:x64-uwp=fail +# Chromium Base requires a recent version of Clang to be installed. +chromium-base:x64-linux=skip civetweb:arm64-windows = skip civetweb:arm-uwp = skip civetweb:x64-uwp = skip diff --git a/scripts/cmake/vcpkg_find_acquire_program.cmake b/scripts/cmake/vcpkg_find_acquire_program.cmake index 30809e32b2..0a6158c77c 100644 --- a/scripts/cmake/vcpkg_find_acquire_program.cmake +++ b/scripts/cmake/vcpkg_find_acquire_program.cmake @@ -16,6 +16,7 @@ ## - 7Z ## - ARIA2 (Downloader) ## - BISON +## - CLANG ## - DARK ## - DOXYGEN ## - FLEX @@ -284,6 +285,37 @@ function(vcpkg_find_acquire_program VAR) set(PATHS /usr/local/opt/bison/bin) endif() endif() + elseif(VAR MATCHES "CLANG") + set(PROGNAME clang) + set(SUBDIR "clang-10.0.0") + if(CMAKE_HOST_WIN32) + set(PATHS + # Support LLVM in Visual Studio 2019 + "$ENV{LLVMInstallDir}/x64/bin" + "$ENV{LLVMInstallDir}/bin" + "$ENV{VCINSTALLDIR}/Tools/Llvm/x64/bin" + "$ENV{VCINSTALLDIR}/Tools/Llvm/bin" + "${DOWNLOADS}/tools/${SUBDIR}-windows/bin" + "${DOWNLOADS}/tools/clang/${SUBDIR}/bin") + + if(DEFINED ENV{PROCESSOR_ARCHITEW6432}) + set(HOST_ARCH_ $ENV{PROCESSOR_ARCHITEW6432}) + else() + set(HOST_ARCH_ $ENV{PROCESSOR_ARCHITECTURE}) + endif() + + if(HOST_ARCH_ MATCHES "64") + set(URL "https://github.com/llvm/llvm-project/releases/download/llvmorg-10.0.0/LLVM-10.0.0-win64.exe") + set(ARCHIVE "LLVM-10.0.0-win64.7z.exe") + set(HASH 3603a4be3548dabc7dda94f3ed4384daf8a94337e44ee62c0d54776c79f802b0cb98fc106e902409942e841c39bc672cc6d61153737ad1cc386b609ef25db71c) + else() + set(URL "https://github.com/llvm/llvm-project/releases/download/llvmorg-10.0.0/LLVM-10.0.0-win32.exe") + set(ARCHIVE "LLVM-10.0.0-win32.7z.exe") + set(HASH 8494922b744ca0dc8d075a1d3a35a0db5a9287544afd5c4984fa328bc26f291209f6030175896b4895019126f5832045e06d8ad48072b549916df29a2228348b) + endif() + endif() + set(BREW_PACKAGE_NAME "llvm") + set(APT_PACKAGE_NAME "clang") elseif(VAR MATCHES "GPERF") set(PROGNAME gperf) set(GPERF_VERSION 3.0.1)