From a8824caf56d20eda1b9c91934090210cf33c4dd9 Mon Sep 17 00:00:00 2001
From: Jason Zaman <jason@perfinion.com>
Date: Wed, 7 Oct 2020 17:35:07 -0700
Subject: [PATCH] systemlibs: unbundle @dill_archive dep

Signed-off-by: Jason Zaman <jason@perfinion.com>
---
 tensorflow/workspace.bzl                     |  1 +
 third_party/systemlibs/dill.BUILD            | 12 ++++++++++++
 third_party/systemlibs/syslibs_configure.bzl |  1 +
 3 files changed, 14 insertions(+)
 create mode 100644 third_party/systemlibs/dill.BUILD

diff --git a/tensorflow/workspace.bzl b/tensorflow/workspace.bzl
index 37ae20ab2d4..b4d442ce00d 100755
--- a/tensorflow/workspace.bzl
+++ b/tensorflow/workspace.bzl
@@ -545,6 +545,7 @@ def tf_repositories(path_prefix = "", tf_repo_name = ""):
     tf_http_archive(
         name = "dill_archive",
         build_file = clean_dep("//third_party:dill.BUILD"),
+        system_build_file = clean_dep("//third_party/systemlibs:dill.BUILD"),
         urls = [
             "http://mirror.tensorflow.org/files.pythonhosted.org/packages/c7/11/345f3173809cea7f1a193bfbf02403fff250a3360e0e118a1630985e547d/dill-0.3.1.1.tar.gz",
             "https://files.pythonhosted.org/packages/c7/11/345f3173809cea7f1a193bfbf02403fff250a3360e0e118a1630985e547d/dill-0.3.1.1.tar.gz",
diff --git a/third_party/systemlibs/dill.BUILD b/third_party/systemlibs/dill.BUILD
new file mode 100644
index 00000000000..0a62b21f2b6
--- /dev/null
+++ b/third_party/systemlibs/dill.BUILD
@@ -0,0 +1,12 @@
+licenses(["notice"])  # BSD 3-clause
+
+filegroup(
+    name = "LICENSE",
+    visibility = ["//visibility:public"],
+)
+
+py_library(
+    name = "dill",
+    srcs_version = "PY2AND3",
+    visibility = ["//visibility:public"],
+)
diff --git a/third_party/systemlibs/syslibs_configure.bzl b/third_party/systemlibs/syslibs_configure.bzl
index 76948f2c2cb..87cd44b4596 100644
--- a/third_party/systemlibs/syslibs_configure.bzl
+++ b/third_party/systemlibs/syslibs_configure.bzl
@@ -20,6 +20,7 @@ VALID_LIBS = [
     "com_googlesource_code_re2",
     "curl",
     "cython",
+    "dill_archive",
     "double_conversion",
     "enum34_archive",
     "flatbuffers",