third_party: Adds Bazel rules for boringssl
We already depend on boringssl in the gn build, so there's nothing new
here. This is required to get the targets in pw_software_update that
depend on boringssl to build.
Change-Id: I156275abe145b42d0e973ff9614ab5c230ddb258
Signed-off-by: Nathaniel Brough <nathaniel.brough@gmail.com>
Bug: 232427554
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/91051
Reviewed-by: Ali Zhang <alizhang@google.com>
Reviewed-by: Keir Mierle <keir@google.com>
Commit-Queue: Ted Pudlik <tpudlik@google.com>
diff --git a/WORKSPACE b/WORKSPACE
index f93d4f7..c429378 100644
--- a/WORKSPACE
+++ b/WORKSPACE
@@ -321,3 +321,13 @@
commit = "b335ee812bfcca4cd3fb0e2a436aab39553a555a",
remote = "https://github.com/kmackay/micro-ecc.git",
)
+
+git_repository(
+ name = "boringssl",
+ commit = "b9232f9e27e5668bc0414879dcdedb2a59ea75f2",
+ # Requires patching as pw_polyfill uses c++14, whereas boringssl uses c++11.
+ # This results in a scenario where std::conditional_t is disabled in the
+ # polyfill implementation.
+ patches = ["//third_party/boringssl:cc_version.patch"],
+ remote = "https://boringssl.googlesource.com/boringssl",
+)
diff --git a/third_party/boringssl/BUILD.bazel b/third_party/boringssl/BUILD.bazel
index e0051e3..292b3f5 100644
--- a/third_party/boringssl/BUILD.bazel
+++ b/third_party/boringssl/BUILD.bazel
@@ -22,7 +22,7 @@
name = "sysdeps",
srcs = ["crypto_sysrand.cc"],
hdrs = ["sysdeps/sys/socket.h"],
+ copts = ["-Wno-unused-parameter"],
includes = ["sysdeps"],
+ deps = ["@boringssl//:bssl"],
)
-
-# TODO(zyecheng): Add build recipes for BoringSSL
diff --git a/third_party/boringssl/cc_version.patch b/third_party/boringssl/cc_version.patch
new file mode 100644
index 0000000..0c6f63b
--- /dev/null
+++ b/third_party/boringssl/cc_version.patch
@@ -0,0 +1,16 @@
+diff --git BUILD BUILD
+index 65e0cdc2e..542a10758 100644
+--- BUILD
++++ BUILD
+@@ -144,9 +144,9 @@ boringssl_copts_c11 = boringssl_copts + select({
+ "//conditions:default": [],
+ })
+
+-# For C++ targets only (not C), compile with C++11 support.
++# For C++ targets only (not C), compile with C++14 support.
+ posix_copts_cxx = [
+- "-std=c++11",
++ "-std=c++14",
+ "-Wmissing-declarations",
+ ]
+