Add //third_party/cpu_features to DEPS
Bug: pdfium:2045
Change-Id: Ic0413839e2e72cf1084ec455b505c10fd919b1a7
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/108270
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Nigi <nigi@chromium.org>
diff --git a/.gitignore b/.gitignore
index 077f605..74e23ca 100644
--- a/.gitignore
+++ b/.gitignore
@@ -7,6 +7,7 @@
/third_party/abseil-cpp
/third_party/android_ndk
/third_party/catapult
+/third_party/cpu_features/src
/third_party/depot_tools
/third_party/freetype/src
/third_party/fuchsia-sdk/images
diff --git a/DEPS b/DEPS
index e73cc10..c5b6bc2 100644
--- a/DEPS
+++ b/DEPS
@@ -64,6 +64,10 @@
# and whatever else without interference from each other.
'code_coverage_revision': 'de759c9da8369a18036f56bb9d7be57543c88057',
# Three lines of non-changing comments so that
+ # the commit queue can handle CLs rolling code_coverage
+ # and whatever else without interference from each other.
+ 'cpu_features_revision': '936b9ab5515dead115606559502e3864958f7f6e',
+ # Three lines of non-changing comments so that
# the commit queue can handle CLs rolling depot_tools
# and whatever else without interference from each other.
'depot_tools_revision': '79f13899e6a718f6b4ab526fc5b4dcd547f90bbe',
@@ -270,6 +274,13 @@
'condition': 'checkout_android',
},
+ 'third_party/cpu_features/src': {
+ 'url': Var('chromium_git') +
+ '/external/github.com/google/cpu_features.git@' +
+ Var('cpu_features_revision'),
+ 'condition': 'checkout_android',
+ },
+
'third_party/depot_tools':
Var('chromium_git') + '/chromium/tools/depot_tools.git@' +
Var('depot_tools_revision'),
diff --git a/third_party/cpu_features/BUILD.gn b/third_party/cpu_features/BUILD.gn
new file mode 100644
index 0000000..8f1c8dc
--- /dev/null
+++ b/third_party/cpu_features/BUILD.gn
@@ -0,0 +1,61 @@
+# Copyright 2023 The PDFium Authors
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+config("cpu_features_config") {
+ cflags = [ "-Wno-unused-function" ]
+ defines = [
+ "STACK_LINE_READER_BUFFER_SIZE=1024",
+ "HAVE_STRONG_GETAUXVAL",
+ ]
+ include_dirs = [ "src/include" ]
+}
+
+config("ndk_compat_headers") {
+ include_dirs = [ "src/ndk_compat" ]
+}
+
+source_set("cpuinfo") {
+ sources = [
+ "src/src/copy.inl",
+ "src/src/define_introspection.inl",
+ "src/src/define_introspection_and_hwcaps.inl",
+ "src/src/equals.inl",
+ "src/src/filesystem.c",
+ "src/src/hwcaps.c",
+ "src/src/stack_line_reader.c",
+ "src/src/string_view.c",
+ ]
+ if (current_cpu == "x86" || current_cpu == "x64") {
+ sources += [
+ "src/src/impl_x86__base_implementation.inl",
+ "src/src/impl_x86_freebsd.c",
+ "src/src/impl_x86_linux_or_android.c",
+ "src/src/impl_x86_macos.c",
+ "src/src/impl_x86_windows.c",
+ ]
+ } else if (current_cpu == "arm") {
+ sources += [ "src/src/impl_arm_linux_or_android.c" ]
+ } else if (current_cpu == "arm64") {
+ sources += [ "src/src/impl_aarch64_linux_or_android.c" ]
+ } else if (current_cpu == "mips") {
+ sources += [ "src/src/impl_mips_linux_or_android.c" ]
+ } else if (current_cpu == "ppc") {
+ sources += [ "src/src/impl_ppc_linux.c" ]
+ } else if (current_cpu == "riscv64") {
+ sources += [ "src/src/impl_riscv_linux.c" ]
+ } else {
+ error("Missing definition for architecture: $current_cpu")
+ }
+ configs += [ ":cpu_features_config" ]
+}
+
+source_set("ndk_compat") {
+ sources = [
+ "src/ndk_compat/cpu-features.c",
+ "src/ndk_compat/cpu-features.h",
+ ]
+ configs += [ ":cpu_features_config" ]
+ public_configs = [ ":ndk_compat_headers" ]
+ deps = [ ":cpuinfo" ]
+}
diff --git a/third_party/cpu_features/README.pdfium b/third_party/cpu_features/README.pdfium
new file mode 100644
index 0000000..b1a8ff7
--- /dev/null
+++ b/third_party/cpu_features/README.pdfium
@@ -0,0 +1,14 @@
+Name: cpu_features
+Short Name: cpu_features
+URL: https://github.com/google/cpu_features
+Version: v0.8.0
+Date: 2023/05/17
+License: Apache 2.0
+License File: src/LICENSE
+Security Critical: Yes
+
+Description:
+cpu_features is a library to retrieve CPU features at runtime. It is used to
+make decisions about performance optimization and features a drop-in replacement
+for Android's cpu-features.h. It is Android's recommended replacement for libraries
+that utilize cpu-features.h.