]>
Commit | Line | Data |
---|---|---|
1e59de90 TL |
1 | vcpkg_fail_port_install( |
2 | ON_ARCH "x86" "arm" "arm64" | |
3 | ON_TARGET "UWP") | |
4 | ||
5 | # Patches may be provided at the end | |
6 | function(checkout_in_path PATH URL REF) | |
7 | if(EXISTS "${PATH}") | |
8 | file(GLOB FILES "${PATH}") | |
9 | list(LENGTH FILES COUNT) | |
10 | if(COUNT GREATER 0) | |
11 | return() | |
12 | endif() | |
13 | file(REMOVE_RECURSE "${PATH}") | |
14 | endif() | |
15 | ||
16 | vcpkg_from_git( | |
17 | OUT_SOURCE_PATH DEP_SOURCE_PATH | |
18 | URL "${URL}" | |
19 | REF "${REF}" | |
20 | PATCHES "${ARGN}" | |
21 | ) | |
22 | file(RENAME "${DEP_SOURCE_PATH}" "${PATH}") | |
23 | file(REMOVE_RECURSE "${DEP_SOURCE_PATH}") | |
24 | endfunction() | |
25 | ||
26 | # Commits are based on https://chromium.googlesource.com/chromium/src/+/refs/tags/86.0.4199.1 | |
27 | set(SOURCE_PATH "${CURRENT_BUILDTREES_DIR}/src/25ce732") | |
28 | file(MAKE_DIRECTORY "${SOURCE_PATH}/third_party") | |
29 | ||
30 | set(CHROMIUM_GIT "https://chromium.googlesource.com/chromium/src") | |
31 | checkout_in_path( | |
32 | "${SOURCE_PATH}/base" | |
33 | "${CHROMIUM_GIT}/base" | |
34 | "25ce73258703a5ac018da0e203fb3d4a98c2136e" | |
35 | res/0001-base.patch) | |
36 | checkout_in_path( | |
37 | "${SOURCE_PATH}/build" | |
38 | "${CHROMIUM_GIT}/build" | |
39 | "312532ee66abdacbe58afb5df7ddf05e3a6399f9" | |
40 | res/0002-build.patch) | |
41 | checkout_in_path( | |
42 | "${SOURCE_PATH}/third_party/apple_apsl" | |
43 | "${CHROMIUM_GIT}/third_party/apple_apsl" | |
44 | "4cc25bbf65194f6726f7f10da0a885818e35d53e") | |
45 | checkout_in_path( | |
46 | "${SOURCE_PATH}/third_party/ced" | |
47 | "${CHROMIUM_GIT}/third_party/ced" | |
48 | "4cd87a44674edd9fe1f01c4cb5f1b73907ce4236") | |
49 | checkout_in_path( | |
50 | "${SOURCE_PATH}/third_party/modp_b64" | |
51 | "${CHROMIUM_GIT}/third_party/modp_b64" | |
52 | "509f005fa65e652dc4a6f636da6fa1002b6dce16") | |
53 | ||
54 | set(RES "${CMAKE_CURRENT_LIST_DIR}/res") | |
55 | file(COPY "${RES}/.gn" DESTINATION "${SOURCE_PATH}") | |
56 | file(COPY "${RES}/BUILD.gn" DESTINATION "${SOURCE_PATH}") | |
57 | file(COPY "${RES}/build_overrides" DESTINATION "${SOURCE_PATH}") | |
58 | file(COPY "${RES}/testing" DESTINATION "${SOURCE_PATH}") | |
59 | file(COPY "${RES}/tools" DESTINATION "${SOURCE_PATH}") | |
60 | file(COPY "${RES}/gclient_args.gni" DESTINATION "${SOURCE_PATH}/build/config") | |
61 | file(COPY "${RES}/LASTCHANGE.committime" DESTINATION "${SOURCE_PATH}/build/util") | |
62 | file(COPY "${RES}/icu" DESTINATION "${SOURCE_PATH}/third_party") | |
63 | file(COPY "${RES}/libxml" DESTINATION "${SOURCE_PATH}/third_party") | |
64 | file(COPY "${RES}/protobuf" DESTINATION "${SOURCE_PATH}/third_party") | |
65 | file(COPY "${RES}/fontconfig" DESTINATION "${SOURCE_PATH}/third_party") | |
66 | file(COPY "${RES}/test_fonts" DESTINATION "${SOURCE_PATH}/third_party") | |
67 | ||
68 | set(OPTIONS "\ | |
69 | use_custom_libcxx=false \ | |
70 | clang_use_chrome_plugins=false \ | |
71 | forbid_non_component_debug_builds=false \ | |
72 | treat_warnings_as_errors=false") | |
73 | set(DEFINITIONS "") | |
74 | ||
75 | if(WIN32) | |
76 | # Windows 10 SDK >= (10.0.19041.0) is required | |
77 | # https://developer.microsoft.com/en-us/windows/downloads/windows-10-sdk | |
78 | SET(VCPKG_POLICY_SKIP_ARCHITECTURE_CHECK enabled) | |
79 | set(ENV{DEPOT_TOOLS_WIN_TOOLCHAIN} 0) | |
80 | set(OPTIONS "${OPTIONS} use_lld=false") | |
81 | endif() | |
82 | ||
83 | if(VCPKG_CMAKE_SYSTEM_NAME STREQUAL Linux) | |
84 | set(OPTIONS "${OPTIONS} use_allocator=\"none\" use_sysroot=false use_glib=false") | |
85 | endif() | |
86 | ||
87 | # Find the directory that contains "bin/clang" | |
88 | # Note: Only clang-cl is supported on Windows, see https://crbug.com/988071 | |
89 | vcpkg_find_acquire_program(CLANG) | |
90 | if(CLANG MATCHES "-NOTFOUND") | |
91 | message(FATAL_ERROR "Clang is required.") | |
92 | endif() | |
93 | get_filename_component(CLANG "${CLANG}" DIRECTORY) | |
94 | get_filename_component(CLANG "${CLANG}" DIRECTORY) | |
95 | if((WIN32 AND NOT EXISTS "${CLANG}/bin/clang-cl.exe") OR | |
96 | (APPLE AND NOT EXISTS "${CLANG}/bin/clang")) | |
97 | message(FATAL_ERROR "Clang needs to be inside a bin directory.") | |
98 | endif() | |
99 | set(OPTIONS "${OPTIONS} clang_base_path=\"${CLANG}\"") | |
100 | ||
101 | if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic) | |
102 | set(OPTIONS "${OPTIONS} is_component_build=true") | |
103 | list(APPEND DEFINITIONS COMPONENT_BUILD) | |
104 | else() | |
105 | set(OPTIONS "${OPTIONS} is_component_build=false") | |
106 | endif() | |
107 | ||
108 | if(APPLE) | |
109 | set(OPTIONS "${OPTIONS} enable_dsyms=true") | |
110 | endif() | |
111 | ||
112 | set(OPTIONS_DBG "${OPTIONS} is_debug=true symbol_level=2") | |
113 | set(OPTIONS_REL "${OPTIONS} is_debug=false symbol_level=0") | |
114 | set(DEFINITIONS_DBG ${DEFINITIONS}) | |
115 | set(DEFINITIONS_REL ${DEFINITIONS}) | |
116 | ||
117 | vcpkg_configure_gn( | |
118 | SOURCE_PATH "${SOURCE_PATH}" | |
119 | OPTIONS_DEBUG "${OPTIONS_DBG}" | |
120 | OPTIONS_RELEASE "${OPTIONS_REL}" | |
121 | ) | |
122 | ||
123 | # Prevent a ninja re-config loop | |
124 | set(NINJA_REBUILD "build build.ninja: gn\n generator = 1\n depfile = build.ninja.d") | |
125 | vcpkg_replace_string("${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg/build.ninja" "${NINJA_REBUILD}" "") | |
126 | vcpkg_replace_string("${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/build.ninja" "${NINJA_REBUILD}" "") | |
127 | ||
128 | set(TARGETS | |
129 | base base:base_static | |
130 | base/third_party/dynamic_annotations | |
131 | base/third_party/double_conversion) | |
132 | ||
133 | if(WIN32) | |
134 | list(APPEND TARGETS base/win:pe_image) | |
135 | endif() | |
136 | ||
137 | vcpkg_install_gn( | |
138 | SOURCE_PATH "${SOURCE_PATH}" | |
139 | TARGETS ${TARGETS} | |
140 | ) | |
141 | ||
142 | # Install includes | |
143 | set(PACKAGES_INCLUDE_DIR "${CURRENT_PACKAGES_DIR}/include/${PORT}") | |
144 | file(GLOB_RECURSE INCLUDE_FILES LIST_DIRECTORIES false RELATIVE "${SOURCE_PATH}" "${SOURCE_PATH}/*.h") | |
145 | foreach(file_ ${INCLUDE_FILES}) | |
146 | configure_file("${SOURCE_PATH}/${file_}" "${PACKAGES_INCLUDE_DIR}/${file_}" COPYONLY) | |
147 | endforeach() | |
148 | ||
149 | configure_file("${CMAKE_CURRENT_LIST_DIR}/chromium-baseConfig.cmake.in" | |
150 | "${CURRENT_PACKAGES_DIR}/share/${PORT}/chromium-baseConfig.cmake" @ONLY) | |
151 | ||
152 | vcpkg_copy_pdbs() | |
153 | ||
154 | file(INSTALL "${SOURCE_PATH}/third_party/ced/LICENSE" | |
155 | DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" | |
156 | RENAME copyright) |