aboutsummaryrefslogtreecommitdiffhomepage
path: root/third_party/systemlibs
diff options
context:
space:
mode:
authorGravatar Yifei Feng <yifeif@google.com>2018-08-17 13:53:06 -0700
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2018-08-17 13:57:13 -0700
commit5198cb8b3d3e426b58da7b3781fdb6db2652c6ee (patch)
tree67875cda829705303cd7cafb2ae8af94010e935c /third_party/systemlibs
parent3aed7858222043ca16d177b50d949a9fc3447ba1 (diff)
PR #21373: nsync dep updates
Please approve this CL. It will be submitted automatically, and its GitHub pull request will be marked as merged. Imported from GitHub PR #21373 A new version of nsync is released, this updates the workspace.bzl and adds nsync to the libs that can be unbundled. I've packaged nsync on Gentoo Linux and tested the full unbundled build. The CMake build is also updated to the latest version, the patch is no longer required and is removed. I have tested the cmake build on my machine but the CI needs to test windows since I can't. The last commits update ./configure to handle adding TF_SYSTEM_LIBS and an option to disable stripping. @m3bm3b, can you review too? Copybara import of the project: - 3d224b29fcf699b84cf538e2d16e3dd4e78e6a91 workspace: update nsync dep to 1.20.1 by Jason Zaman <jason@perfinion.com> - 34536b88bedc5a83ad939438a49a3cc53aea210c CMake: nsync: update to 1.20.1 by Jason Zaman <jason@perfinion.com> - f2444ba218ae280e03710f936b249b6b650ea3dd third_party: unbundle nsync by Jason Zaman <jason@perfinion.com> - 4386d8c4b01020ba1c979258e5102ac1947d2574 configure: Add TF_SYSTEM_LIBS handling by Jason Zaman <jason@perfinion.com> - f3fd1f110781cfb8cc941241a69eb41114787bfd Merge 4386d8c4b01020ba1c979258e5102ac1947d2574 into a05c7... by Jason Zaman <jasonzaman@gmail.com> COPYBARA_INTEGRATE_REVIEW=https://github.com/tensorflow/tensorflow/pull/21373 from perfinion:nsync 4386d8c4b01020ba1c979258e5102ac1947d2574 PiperOrigin-RevId: 209201545
Diffstat (limited to 'third_party/systemlibs')
-rw-r--r--third_party/systemlibs/nsync.BUILD23
-rw-r--r--third_party/systemlibs/syslibs_configure.bzl174
2 files changed, 109 insertions, 88 deletions
diff --git a/third_party/systemlibs/nsync.BUILD b/third_party/systemlibs/nsync.BUILD
new file mode 100644
index 0000000000..c5d4ad0a76
--- /dev/null
+++ b/third_party/systemlibs/nsync.BUILD
@@ -0,0 +1,23 @@
+licenses(["notice"]) # BSD 3-Clause
+
+filegroup(
+ name = "LICENSE",
+ visibility = ["//visibility:public"],
+)
+
+cc_library(
+ name = "nsync_headers",
+ visibility = ["//visibility:public"],
+)
+
+cc_library(
+ name = "nsync",
+ linkopts = ["-lnsync"],
+ visibility = ["//visibility:public"],
+)
+
+cc_library(
+ name = "nsync_cpp",
+ linkopts = ["-lnsync_cpp"],
+ visibility = ["//visibility:public"],
+)
diff --git a/third_party/systemlibs/syslibs_configure.bzl b/third_party/systemlibs/syslibs_configure.bzl
index 07a44c317e..8b09c9ac1f 100644
--- a/third_party/systemlibs/syslibs_configure.bzl
+++ b/third_party/systemlibs/syslibs_configure.bzl
@@ -7,9 +7,9 @@
the system version instead
"""
-_TF_SYSTEM_LIBS="TF_SYSTEM_LIBS"
+_TF_SYSTEM_LIBS = "TF_SYSTEM_LIBS"
-VALID_LIBS=[
+VALID_LIBS = [
"astor_archive",
"com_googlesource_code_re2",
"curl",
@@ -22,6 +22,7 @@ VALID_LIBS=[
"jsoncpp_git",
"lmdb",
"nasm",
+ "nsync",
"org_sqlite",
"pcre",
"png_archive",
@@ -32,112 +33,109 @@ VALID_LIBS=[
"zlib_archive",
]
-
def auto_configure_fail(msg):
- """Output failure message when syslibs configuration fails."""
- red = "\033[0;31m"
- no_color = "\033[0m"
- fail("\n%sSystem Library Configuration Error:%s %s\n" % (red, no_color, msg))
-
+ """Output failure message when syslibs configuration fails."""
+ red = "\033[0;31m"
+ no_color = "\033[0m"
+ fail("\n%sSystem Library Configuration Error:%s %s\n" % (red, no_color, msg))
def _is_windows(repository_ctx):
- """Returns true if the host operating system is windows."""
- os_name = repository_ctx.os.name.lower()
- if os_name.find("windows") != -1:
- return True
- return False
-
+ """Returns true if the host operating system is windows."""
+ os_name = repository_ctx.os.name.lower()
+ if os_name.find("windows") != -1:
+ return True
+ return False
def _enable_syslibs(repository_ctx):
- s = repository_ctx.os.environ.get(_TF_SYSTEM_LIBS, '').strip()
- if not _is_windows(repository_ctx) and s != None and s != '':
- return True
- return False
-
+ s = repository_ctx.os.environ.get(_TF_SYSTEM_LIBS, "").strip()
+ if not _is_windows(repository_ctx) and s != None and s != "":
+ return True
+ return False
def _get_system_lib_list(repository_ctx):
- """Gets the list of deps that should use the system lib.
+ """Gets the list of deps that should use the system lib.
- Args:
- repository_ctx: The repository context.
+ Args:
+ repository_ctx: The repository context.
- Returns:
- A string version of a python list
- """
- if _TF_SYSTEM_LIBS not in repository_ctx.os.environ:
- return []
+ Returns:
+ A string version of a python list
+ """
+ if _TF_SYSTEM_LIBS not in repository_ctx.os.environ:
+ return []
- libenv = repository_ctx.os.environ[_TF_SYSTEM_LIBS].strip()
- libs = []
+ libenv = repository_ctx.os.environ[_TF_SYSTEM_LIBS].strip()
+ libs = []
- for lib in list(libenv.split(',')):
- lib = lib.strip()
- if lib == "":
- continue
- if lib not in VALID_LIBS:
- auto_configure_fail("Invalid system lib set: %s" % lib)
- return []
- libs.append(lib)
-
- return libs
+ for lib in list(libenv.split(",")):
+ lib = lib.strip()
+ if lib == "":
+ continue
+ if lib not in VALID_LIBS:
+ auto_configure_fail("Invalid system lib set: %s" % lib)
+ return []
+ libs.append(lib)
+ return libs
def _format_system_lib_list(repository_ctx):
- """Formats the list of deps that should use the system lib.
-
- Args:
- repository_ctx: The repository context.
-
- Returns:
- A list of the names of deps that should use the system lib.
- """
- libs = _get_system_lib_list(repository_ctx)
- ret = ''
- for lib in libs:
- ret += "'%s',\n" % lib
-
- return ret
-
-
-def _tpl(repository_ctx, tpl, substitutions={}, out=None):
- if not out:
- out = tpl.replace(":", "")
- repository_ctx.template(
- out,
- Label("//third_party/systemlibs%s.tpl" % tpl),
- substitutions,
- False)
-
+ """Formats the list of deps that should use the system lib.
+
+ Args:
+ repository_ctx: The repository context.
+
+ Returns:
+ A list of the names of deps that should use the system lib.
+ """
+ libs = _get_system_lib_list(repository_ctx)
+ ret = ""
+ for lib in libs:
+ ret += "'%s',\n" % lib
+
+ return ret
+
+def _tpl(repository_ctx, tpl, substitutions = {}, out = None):
+ if not out:
+ out = tpl.replace(":", "")
+ repository_ctx.template(
+ out,
+ Label("//third_party/systemlibs%s.tpl" % tpl),
+ substitutions,
+ False,
+ )
def _create_dummy_repository(repository_ctx):
- """Creates the dummy repository to build with all bundled libraries."""
-
- _tpl(repository_ctx, ":BUILD")
- _tpl(repository_ctx, ":build_defs.bzl",
- {
- "%{syslibs_enabled}": 'False',
- "%{syslibs_list}": '',
- })
-
+ """Creates the dummy repository to build with all bundled libraries."""
+
+ _tpl(repository_ctx, ":BUILD")
+ _tpl(
+ repository_ctx,
+ ":build_defs.bzl",
+ {
+ "%{syslibs_enabled}": "False",
+ "%{syslibs_list}": "",
+ },
+ )
def _create_local_repository(repository_ctx):
- """Creates the repository to build with system libraries."""
-
- _tpl(repository_ctx, ":BUILD")
- _tpl(repository_ctx, ":build_defs.bzl",
- {
- "%{syslibs_enabled}": 'True',
- "%{syslibs_list}": _format_system_lib_list(repository_ctx),
- })
-
+ """Creates the repository to build with system libraries."""
+
+ _tpl(repository_ctx, ":BUILD")
+ _tpl(
+ repository_ctx,
+ ":build_defs.bzl",
+ {
+ "%{syslibs_enabled}": "True",
+ "%{syslibs_list}": _format_system_lib_list(repository_ctx),
+ },
+ )
def _syslibs_autoconf_impl(repository_ctx):
- """Implementation of the syslibs_configure repository rule."""
- if not _enable_syslibs(repository_ctx):
- _create_dummy_repository(repository_ctx)
- else:
- _create_local_repository(repository_ctx)
-
+ """Implementation of the syslibs_configure repository rule."""
+ if not _enable_syslibs(repository_ctx):
+ _create_dummy_repository(repository_ctx)
+ else:
+ _create_local_repository(repository_ctx)
syslibs_configure = repository_rule(
implementation = _syslibs_autoconf_impl,