From 735797d7c16ae63ad876ddcc64ab24c034929a4f Mon Sep 17 00:00:00 2001
From: Yun Peng <pcloudy@google.com>
Date: Thu, 23 Jul 2020 15:41:00 +0000
Subject: [PATCH] ** Make boringssl installed by Debian work

Google's boringssl is packaged in Debian via android-libboringssl-dev,
which is not in the standard location. We need to add extra compiler and
linker flag to make it work.
---
 tensorflow/core/platform/s3/BUILD      | 1 +
 third_party/aws/BUILD.bazel            | 2 ++
 third_party/systemlibs/boringssl.BUILD | 4 ++--
 3 files changed, 5 insertions(+), 2 deletions(-)

--- a/tensorflow/core/platform/s3/BUILD
+++ b/tensorflow/core/platform/s3/BUILD
@@ -49,6 +49,7 @@ cc_library(
     hdrs = [
         "aws_crypto.h",
     ],
+    copts = ["-isystem", "/usr/include/android"],
     deps = [
         "@aws",
         "@boringssl//:crypto",
--- a/third_party/aws/BUILD.bazel
+++ b/third_party/aws/BUILD.bazel
@@ -74,6 +74,8 @@ cc_library(
         "aws-cpp-sdk-core/include/aws/core/SDKConfig.h",
     ],
     copts = [
+        "-isystem",
+        "/usr/include/android",
         "-DENABLE_OPENSSL_ENCRYPTION",
         "-DAWS_SDK_VERSION_MAJOR=1",
         "-DAWS_SDK_VERSION_MINOR=7",
--- a/third_party/systemlibs/boringssl.BUILD
+++ b/third_party/systemlibs/boringssl.BUILD
@@ -7,13 +7,13 @@ filegroup(
 
 cc_library(
     name = "crypto",
-    linkopts = ["-lcrypto"],
+    linkopts = ["-L/usr/lib/x86_64-linux-gnu/android", "-lcrypto"],
     visibility = ["//visibility:public"],
 )
 
 cc_library(
     name = "ssl",
-    linkopts = ["-lssl"],
+    linkopts = ["-L/usr/lib/x86_64-linux-gnu/android", "-lssl"],
     visibility = ["//visibility:public"],
     deps = [
         ":crypto",
