Buildify all the build files

We are slowly upgrading them all.  Bite bullet and do the rest of them.

Change-Id: I15744cf1b0dc1954954e131b35228c98247c92fe
diff --git a/third_party/blasfeo/BUILD b/third_party/blasfeo/BUILD
index ba61061..f6efd3c 100644
--- a/third_party/blasfeo/BUILD
+++ b/third_party/blasfeo/BUILD
@@ -2,24 +2,6 @@
 
 cc_library(
     name = "blasfeo",
-    hdrs = [
-        "include/blasfeo_block_size.h",
-        "include/blasfeo_common.h",
-        "include/blasfeo_d_aux.h",
-        "include/blasfeo_d_kernel.h",
-        "include/blasfeo_s_aux.h",
-        "include/blasfeo_s_kernel.h",
-        "include/blasfeo_target.h",
-        "include/blasfeo_d_blas.h",
-        "include/blasfeo_m_aux.h",
-        "include/blasfeo_s_blas.h",
-        "include/blasfeo_v_aux_ext_dep.h",
-        "include/blasfeo_d_aux_ext_dep.h",
-        "include/blasfeo_i_aux_ext_dep.h",
-    ],
-    includes = [
-        "include",
-    ],
     srcs = [
         # ext
         "auxiliary/d_aux_lib4.c",
@@ -67,6 +49,21 @@
         "auxiliary/v_aux_ext_dep_lib.c",
         "auxiliary/i_aux_ext_dep_lib.c",
     ],
+    hdrs = [
+        "include/blasfeo_block_size.h",
+        "include/blasfeo_common.h",
+        "include/blasfeo_d_aux.h",
+        "include/blasfeo_d_aux_ext_dep.h",
+        "include/blasfeo_d_blas.h",
+        "include/blasfeo_d_kernel.h",
+        "include/blasfeo_i_aux_ext_dep.h",
+        "include/blasfeo_m_aux.h",
+        "include/blasfeo_s_aux.h",
+        "include/blasfeo_s_blas.h",
+        "include/blasfeo_s_kernel.h",
+        "include/blasfeo_target.h",
+        "include/blasfeo_v_aux_ext_dep.h",
+    ],
     copts = [
         "-mavx",
         "-DTARGET_X64_INTEL_SANDY_BRIDGE",
@@ -79,9 +76,12 @@
         "-Wno-unused-label",
         "-Wno-cast-align",
     ],
+    includes = [
+        "include",
+    ],
+    restricted_to = ["//tools:k8"],
     textual_hdrs = [
         "blas/x_blas2_diag_lib.c",
     ],
     visibility = ["//visibility:public"],
-    restricted_to = ["//tools:k8"],
 )
diff --git a/third_party/ceres/bazel/eigen.BUILD b/third_party/ceres/bazel/eigen.BUILD
index cf6391a..2733d48 100644
--- a/third_party/ceres/bazel/eigen.BUILD
+++ b/third_party/ceres/bazel/eigen.BUILD
@@ -31,9 +31,9 @@
 # TODO(keir): Replace this with a better version, like from TensorFlow.
 # See https://github.com/ceres-solver/ceres-solver/issues/337.
 cc_library(
-    name = 'eigen',
+    name = "eigen",
     srcs = [],
-    includes = ['.'],
-    hdrs = glob(['Eigen/**']),
-    visibility = ['//visibility:public'],
+    hdrs = glob(["Eigen/**"]),
+    includes = ["."],
+    visibility = ["//visibility:public"],
 )
diff --git a/third_party/empty_config_h/BUILD b/third_party/empty_config_h/BUILD
index 96ee043..d1a8093 100644
--- a/third_party/empty_config_h/BUILD
+++ b/third_party/empty_config_h/BUILD
@@ -1,9 +1,9 @@
-licenses(['unencumbered'])
+licenses(["unencumbered"])
 
 cc_library(
-  name = 'empty_config_h',
-  visibility = ['//third_party:__subpackages__'],
-  hdrs = [
-    'config.h',
-  ],
+    name = "empty_config_h",
+    hdrs = [
+        "config.h",
+    ],
+    visibility = ["//third_party:__subpackages__"],
 )
diff --git a/third_party/gflags/BUILD b/third_party/gflags/BUILD
index 0e7ccdd..1bccf5a 100644
--- a/third_party/gflags/BUILD
+++ b/third_party/gflags/BUILD
@@ -4,15 +4,31 @@
 
 licenses(["notice"])
 
-exports_files(["src/gflags_completions.sh", "COPYING.txt"])
+exports_files([
+    "src/gflags_completions.sh",
+    "COPYING.txt",
+])
 
 config_setting(
     name = "x64_windows",
     values = {"cpu": "x64_windows"},
 )
 
-load(":bazel/gflags.bzl", "gflags_sources", "gflags_library")
+load(":bazel/gflags.bzl", "gflags_library", "gflags_sources")
 
-(hdrs, srcs) = gflags_sources(namespace=["gflags", "google"])
-gflags_library(hdrs=hdrs, srcs=srcs, threads=0)
-gflags_library(hdrs=hdrs, srcs=srcs, threads=1)
+(hdrs, srcs) = gflags_sources(namespace = [
+    "gflags",
+    "google",
+])
+
+gflags_library(
+    srcs = srcs,
+    hdrs = hdrs,
+    threads = 0,
+)
+
+gflags_library(
+    srcs = srcs,
+    hdrs = hdrs,
+    threads = 1,
+)
diff --git a/third_party/google-benchmark/test/BUILD b/third_party/google-benchmark/test/BUILD
index 3f174c4..8d1ef8d 100644
--- a/third_party/google-benchmark/test/BUILD
+++ b/third_party/google-benchmark/test/BUILD
@@ -5,7 +5,7 @@
     "-Wall",
     "-Wextra",
     "-Wshadow",
-#    "-Wshorten-64-to-32",
+    #    "-Wshorten-64-to-32",
     "-Wfloat-equal",
     "-fstrict-aliasing",
 ]
@@ -16,7 +16,6 @@
     "donotoptimize_test.cc": ["-O3"],
 })
 
-
 TEST_ARGS = ["--benchmark_min_time=0.01"]
 
 PER_SRC_TEST_ARGS = ({
@@ -36,24 +35,31 @@
 )
 
 [
-  cc_test(
-    name = test_src[:-len(".cc")],
-    size = "small",
-    srcs = [test_src],
-    args = TEST_ARGS + PER_SRC_TEST_ARGS.get(test_src, []),
-    copts = TEST_COPTS + PER_SRC_COPTS.get(test_src, []),
-    deps = [
-        ":output_test_helper",
-        "//:benchmark",
-        "//:benchmark_internal_headers",
-        "@com_google_googletest//:gtest",
-    ] + (
-        ["@com_google_googletest//:gtest_main"] if (test_src[-len("gtest.cc"):] == "gtest.cc") else []
-    ),
-  # FIXME: Add support for assembly tests to bazel.
-  # See Issue #556
-  # https://github.com/google/benchmark/issues/556
-  ) for test_src in glob(["*test.cc"], exclude = ["*_assembly_test.cc", "link_main_test.cc"])
+    cc_test(
+        name = test_src[:-len(".cc")],
+        size = "small",
+        srcs = [test_src],
+        args = TEST_ARGS + PER_SRC_TEST_ARGS.get(test_src, []),
+        copts = TEST_COPTS + PER_SRC_COPTS.get(test_src, []),
+        deps = [
+            ":output_test_helper",
+            "//:benchmark",
+            "//:benchmark_internal_headers",
+            "@com_google_googletest//:gtest",
+        ] + (
+            ["@com_google_googletest//:gtest_main"] if (test_src[-len("gtest.cc"):] == "gtest.cc") else []
+        ),
+        # FIXME: Add support for assembly tests to bazel.
+        # See Issue #556
+        # https://github.com/google/benchmark/issues/556
+    )
+    for test_src in glob(
+        ["*test.cc"],
+        exclude = [
+            "*_assembly_test.cc",
+            "link_main_test.cc",
+        ],
+    )
 ]
 
 cc_test(
diff --git a/third_party/googletest/googletest/test/BUILD.bazel b/third_party/googletest/googletest/test/BUILD.bazel
index 7d03cac..68f6aef 100644
--- a/third_party/googletest/googletest/test/BUILD.bazel
+++ b/third_party/googletest/googletest/test/BUILD.bazel
@@ -157,7 +157,7 @@
         "googletest-param-test2-test.cc",
     ],
     copts = [
-      "-Wno-unused-private-field",
+        "-Wno-unused-private-field",
     ],
     deps = ["//third_party/googletest:gtest"],
 )
diff --git a/third_party/gperftools/BUILD b/third_party/gperftools/BUILD
index f9cf185..25a8740 100644
--- a/third_party/gperftools/BUILD
+++ b/third_party/gperftools/BUILD
@@ -1,10 +1,10 @@
 licenses(["notice"])
 
-load("//tools/build_rules:select.bzl", "cpu_select", "compiler_select")
+load("//tools/build_rules:select.bzl", "compiler_select", "cpu_select")
 load("//tools/build_rules:empty_main.bzl", "empty_main_if_asan")
 
 common_copts = [
-#Stuff from their Makefile.
+    #Stuff from their Makefile.
     "-Wno-cast-align",
     "-Wno-sign-compare",
     "-fno-builtin-malloc",
@@ -20,7 +20,7 @@
     "-fno-omit-frame-pointer",
     "-DNDEBUG",
 
-#Stuff to make it work for us.
+    #Stuff to make it work for us.
     "-Ithird_party/gperftools/src/",
     "-Ithird_party/empty_config_h",
     "-Wno-unused-parameter",
@@ -32,7 +32,7 @@
     "-Wno-error=cast-align",
     "-Wno-error=cast-qual",
 
-#Stuff pulled out of config.h.
+    #Stuff pulled out of config.h.
     "-DHAVE_BUILTIN_EXPECT=1",
     "-DHAVE_DECL_CFREE=1",
     "-DHAVE_DECL_MEMALIGN=1",
@@ -136,6 +136,7 @@
         "src/third_party/valgrind.h",
     ],
     copts = common_copts,
+    includes = ["src"],
     linkopts = [
         "-lrt",
         "-lpthread",
@@ -145,7 +146,6 @@
     deps = [
         "//third_party/empty_config_h",
     ],
-    includes = ["src"],
     alwayslink = True,
 )
 
@@ -210,8 +210,8 @@
     ]),
     copts = common_copts + [
         "-fno-builtin",
-#Add this back in when we upgrade clang.
-#'-Wno-mismatched-new-delete',
+        #Add this back in when we upgrade clang.
+        #'-Wno-mismatched-new-delete',
     ],
     deps = [
         ":tcmalloc",
diff --git a/third_party/hpipm/BUILD b/third_party/hpipm/BUILD
index 32729e1..f152d5a 100644
--- a/third_party/hpipm/BUILD
+++ b/third_party/hpipm/BUILD
@@ -2,33 +2,6 @@
 
 cc_library(
     name = "hpipm",
-    includes = [ "include" ],
-    hdrs = [
-        "include/hpipm_s_core_qp_ipm_hard.h",
-        "include/hpipm_d_dense_qp.h",
-        "include/hpipm_s_ocp_qp.h",
-        "include/hpipm_s_ocp_qp_sol.h",
-        "include/hpipm_d_ocp_qp.h",
-        "include/hpipm_d_ocp_qp_sol.h",
-        "include/hpipm_s_dense_qp.h",
-        "include/hpipm_d_ocp_qp_ipm_hard.h",
-        "include/hpipm_s_dense_qp_sol.h",
-        "include/hpipm_s_dense_qp_ipm_hard.h",
-        "include/hpipm_s_core_qp_ipm_hard_aux.h",
-        "include/hpipm_s_dense_qp_kkt.h",
-        "include/hpipm_m_ocp_qp_ipm_hard.h",
-        "include/hpipm_d_core_qp_ipm_hard.h",
-        "include/hpipm_d_core_qp_ipm_hard_aux.h",
-        "include/hpipm_d_dense_qp_sol.h",
-        "include/hpipm_d_ocp_qp_kkt.h",
-        "include/hpipm_d_cond.h",
-        "include/hpipm_m_ocp_qp_kkt.h",
-        "include/hpipm_d_cond_aux.h",
-        "include/hpipm_s_ocp_qp_ipm_hard.h",
-        "include/hpipm_s_ocp_qp_kkt.h",
-        "include/hpipm_d_dense_qp_ipm_hard.h",
-        "include/hpipm_d_dense_qp_kkt.h",
-    ],
     srcs = [
         # dense qp
         "dense_qp/d_dense_qp.c",
@@ -61,6 +34,39 @@
         "cond/d_cond.c",
         "cond/d_part_cond.c",
     ],
+    hdrs = [
+        "include/hpipm_d_cond.h",
+        "include/hpipm_d_cond_aux.h",
+        "include/hpipm_d_core_qp_ipm_hard.h",
+        "include/hpipm_d_core_qp_ipm_hard_aux.h",
+        "include/hpipm_d_dense_qp.h",
+        "include/hpipm_d_dense_qp_ipm_hard.h",
+        "include/hpipm_d_dense_qp_kkt.h",
+        "include/hpipm_d_dense_qp_sol.h",
+        "include/hpipm_d_ocp_qp.h",
+        "include/hpipm_d_ocp_qp_ipm_hard.h",
+        "include/hpipm_d_ocp_qp_kkt.h",
+        "include/hpipm_d_ocp_qp_sol.h",
+        "include/hpipm_m_ocp_qp_ipm_hard.h",
+        "include/hpipm_m_ocp_qp_kkt.h",
+        "include/hpipm_s_core_qp_ipm_hard.h",
+        "include/hpipm_s_core_qp_ipm_hard_aux.h",
+        "include/hpipm_s_dense_qp.h",
+        "include/hpipm_s_dense_qp_ipm_hard.h",
+        "include/hpipm_s_dense_qp_kkt.h",
+        "include/hpipm_s_dense_qp_sol.h",
+        "include/hpipm_s_ocp_qp.h",
+        "include/hpipm_s_ocp_qp_ipm_hard.h",
+        "include/hpipm_s_ocp_qp_kkt.h",
+        "include/hpipm_s_ocp_qp_sol.h",
+    ],
+    copts = [
+        "-Wno-pointer-arith",
+        "-Wno-unused-variable",
+        "-Wno-unused-parameter",
+    ],
+    includes = ["include"],
+    restricted_to = ["//tools:k8"],
     textual_hdrs = [
         "ocp_qp/x_ocp_qp_sol.c",
         "dense_qp/x_dense_qp.c",
@@ -73,14 +79,8 @@
         "ocp_qp/x_ocp_qp_kkt.c",
         "dense_qp/x_dense_qp_kkt.c",
     ],
+    visibility = ["//visibility:public"],
     deps = [
         "//third_party/blasfeo",
     ],
-    copts = [
-        "-Wno-pointer-arith",
-        "-Wno-unused-variable",
-        "-Wno-unused-parameter",
-    ],
-    visibility = ["//visibility:public"],
-    restricted_to = ["//tools:k8"],
 )
diff --git a/third_party/libevent/BUILD b/third_party/libevent/BUILD
index 463b758..da05f3c 100644
--- a/third_party/libevent/BUILD
+++ b/third_party/libevent/BUILD
@@ -1,179 +1,176 @@
-licenses(['notice'])
+licenses(["notice"])
 
-load('//tools/build_rules:select.bzl', 'compiler_select', 'address_size_select')
+load("//tools/build_rules:select.bzl", "address_size_select", "compiler_select")
 
 cc_library(
-  name = 'libevent',
-  visibility = ['//visibility:public'],
-  srcs = [
-    'select.c',
-    'poll.c',
-    'epoll.c',
-    'signal.c',
+    name = "libevent",
+    srcs = [
+        "select.c",
+        "poll.c",
+        "epoll.c",
+        "signal.c",
+        "event.c",
+        "evthread.c",
+        "buffer.c",
+        "bufferevent.c",
+        "bufferevent_sock.c",
+        "bufferevent_filter.c",
+        "bufferevent_pair.c",
+        "listener.c",
+        "bufferevent_ratelim.c",
+        "evmap.c",
+        "log.c",
+        "evutil.c",
+        "evutil_rand.c",
+        "strlcpy.c",
+        "event_tagging.c",
+        "http.c",
+        "evdns.c",
+        "evrpc.c",
+        "evthread_pthread.c",
 
-    'event.c',
-    'evthread.c',
-    'buffer.c',
-    'bufferevent.c',
-    'bufferevent_sock.c',
-    'bufferevent_filter.c',
-    'bufferevent_pair.c',
-    'listener.c',
-    'bufferevent_ratelim.c',
-    'evmap.c',
-    'log.c',
-    'evutil.c',
-    'evutil_rand.c',
-    'strlcpy.c',
-
-    'event_tagging.c',
-    'http.c',
-    'evdns.c',
-    'evrpc.c',
-
-    'evthread_pthread.c',
-
-    #'compat/sys/queue.h',
-  ] + glob([
-    '*-internal.h',
-    'include/event2/*.h',
-  ]),
-  textual_hdrs = [
-    'arc4random.c',
-  ],
-  hdrs = [
-    'event.h',
-    'evhttp.h',
-    'evdns.h',
-    'evrpc.h',
-    'evutil.h',
-  ],
-  includes = ['.', 'include'],
-  defines = [
-    '_EVENT_HAVE_ARPA_INET_H=1',
-    '_EVENT_HAVE_CLOCK_GETTIME=1',
-    '_EVENT_HAVE_DECL_CTL_KERN=1',
-    '_EVENT_HAVE_DECL_KERN_ARND=0',
-    '_EVENT_HAVE_DECL_KERN_RANDOM=1',
-    '_EVENT_HAVE_DECL_RANDOM_UUID=1',
-    '_EVENT_HAVE_DLFCN_H=1',
-    '_EVENT_HAVE_EPOLL=1',
-    '_EVENT_HAVE_EPOLL_CTL=1',
-    '_EVENT_HAVE_EVENTFD=1',
-    '_EVENT_HAVE_FCNTL=1',
-    '_EVENT_HAVE_FCNTL_H=1',
-    '_EVENT_HAVE_FD_MASK=1',
-    '_EVENT_HAVE_GETADDRINFO=1',
-    '_EVENT_HAVE_GETEGID=1',
-    '_EVENT_HAVE_GETEUID=1',
-    '_EVENT_HAVE_GETNAMEINFO=1',
-    '_EVENT_HAVE_GETPROTOBYNUMBER=1',
-    '_EVENT_HAVE_GETTIMEOFDAY=1',
-    '_EVENT_HAVE_INET_ATON=1',
-    '_EVENT_HAVE_INET_NTOP=1',
-    '_EVENT_HAVE_INET_PTON=1',
-    '_EVENT_HAVE_INTTYPES_H=1',
-    '_EVENT_HAVE_MEMORY_H=1',
-    '_EVENT_HAVE_MMAP=1',
-    '_EVENT_HAVE_NETDB_H=1',
-    '_EVENT_HAVE_NETINET_IN_H=1',
-    '_EVENT_HAVE_PIPE=1',
-    '_EVENT_HAVE_POLL=1',
-    '_EVENT_HAVE_POLL_H=1',
-    '_EVENT_HAVE_PTHREADS=1',
-    '_EVENT_HAVE_PUTENV=1',
-    '_EVENT_HAVE_SA_FAMILY_T=1',
-    '_EVENT_HAVE_SELECT=1',
-    '_EVENT_HAVE_SENDFILE=1',
-    '_EVENT_HAVE_SETENV=1',
-    '_EVENT_HAVE_SETFD=1',
-    '_EVENT_HAVE_SIGACTION=1',
-    '_EVENT_HAVE_SIGNAL=1',
-    '_EVENT_HAVE_SPLICE=1',
-    '_EVENT_HAVE_STDARG_H=1',
-    '_EVENT_HAVE_STDDEF_H=1',
-    '_EVENT_HAVE_STDINT_H=1',
-    '_EVENT_HAVE_STDLIB_H=1',
-    '_EVENT_HAVE_STRINGS_H=1',
-    '_EVENT_HAVE_STRING_H=1',
-    '_EVENT_HAVE_STRSEP=1',
-    '_EVENT_HAVE_STRTOK_R=1',
-    '_EVENT_HAVE_STRTOLL=1',
-    '_EVENT_HAVE_STRUCT_ADDRINFO=1',
-    '_EVENT_HAVE_STRUCT_IN6_ADDR=1',
-    '_EVENT_HAVE_STRUCT_IN6_ADDR_S6_ADDR16=1',
-    '_EVENT_HAVE_STRUCT_IN6_ADDR_S6_ADDR32=1',
-    '_EVENT_HAVE_STRUCT_SOCKADDR_IN6=1',
-    '_EVENT_HAVE_STRUCT_SOCKADDR_STORAGE=1',
-    '_EVENT_HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY=1',
-    '_EVENT_HAVE_SYSCTL=1',
-    '_EVENT_HAVE_SYS_EPOLL_H=1',
-    '_EVENT_HAVE_SYS_EVENTFD_H=1',
-    '_EVENT_HAVE_SYS_IOCTL_H=1',
-    '_EVENT_HAVE_SYS_MMAN_H=1',
-    '_EVENT_HAVE_SYS_PARAM_H=1',
-    '_EVENT_HAVE_SYS_QUEUE_H=1',
-    '_EVENT_HAVE_SYS_SELECT_H=1',
-    '_EVENT_HAVE_SYS_SENDFILE_H=1',
-    '_EVENT_HAVE_SYS_SOCKET_H=1',
-    '_EVENT_HAVE_SYS_STAT_H=1',
-    '_EVENT_HAVE_SYS_SYSCTL_H=1',
-    '_EVENT_HAVE_SYS_TIME_H=1',
-    '_EVENT_HAVE_SYS_TYPES_H=1',
-    '_EVENT_HAVE_SYS_UIO_H=1',
-    '_EVENT_HAVE_SYS_WAIT_H=1',
-    '_EVENT_HAVE_TIMERADD=1',
-    '_EVENT_HAVE_TIMERCLEAR=1',
-    '_EVENT_HAVE_TIMERCMP=1',
-    '_EVENT_HAVE_TIMERISSET=1',
-    '_EVENT_HAVE_UINT16_T=1',
-    '_EVENT_HAVE_UINT32_T=1',
-    '_EVENT_HAVE_UINT64_T=1',
-    '_EVENT_HAVE_UINT8_T=1',
-    '_EVENT_HAVE_UINTPTR_T=1',
-    '_EVENT_HAVE_UMASK=1',
-    '_EVENT_HAVE_UNISTD_H=1',
-    '_EVENT_HAVE_UNSETENV=1',
-    '_EVENT_HAVE_VASPRINTF=1',
-    '_EVENT_SIZEOF_INT=4',
-    '_EVENT_SIZEOF_LONG=8',
-    '_EVENT_SIZEOF_SHORT=2',
-    '_EVENT_STDC_HEADERS=1',
-    '_EVENT_TIME_WITH_SYS_TIME=1',
-
-    '_EVENT_NUMERIC_VERSION=0x02001600',
-    '_EVENT_VERSION=\\"2.0.22-stable\\"',
-  ] + address_size_select({
-    '32': [
-      '_EVENT_SIZEOF_LONG_LONG=4',
-      '_EVENT_SIZEOF_OFF_T=4',
-      '_EVENT_SIZEOF_PTHREAD_T=4',
-      '_EVENT_SIZEOF_SIZE_T=4',
-      '_EVENT_SIZEOF_VOID_P=4',
+        #'compat/sys/queue.h',
+    ] + glob([
+        "*-internal.h",
+        "include/event2/*.h",
+    ]),
+    hdrs = [
+        "evdns.h",
+        "event.h",
+        "evhttp.h",
+        "evrpc.h",
+        "evutil.h",
     ],
-    '64': [
-      '_EVENT_SIZEOF_LONG_LONG=8',
-      '_EVENT_SIZEOF_OFF_T=8',
-      '_EVENT_SIZEOF_PTHREAD_T=8',
-      '_EVENT_SIZEOF_SIZE_T=8',
-      '_EVENT_SIZEOF_VOID_P=8',
+    copts = [
+        "-Ithird_party/libevent/compat",
+        "-Ithird_party/libevent/include",
+
+        # TODO(Brian): Fix the places in the code it uses char* as an intermediate
+        # type while doing offsetof stuff.
+        "-Wno-cast-align",
+        "-Wno-unused-parameter",
+        "-Wno-format-nonliteral",
+        "-Wno-cast-qual",
+        "-Wno-unused-function",
+    ] + compiler_select({
+        "gcc": [],
+        "clang": ["-Wno-incompatible-pointer-types-discards-qualifiers"],
+    }),
+    defines = [
+        "_EVENT_HAVE_ARPA_INET_H=1",
+        "_EVENT_HAVE_CLOCK_GETTIME=1",
+        "_EVENT_HAVE_DECL_CTL_KERN=1",
+        "_EVENT_HAVE_DECL_KERN_ARND=0",
+        "_EVENT_HAVE_DECL_KERN_RANDOM=1",
+        "_EVENT_HAVE_DECL_RANDOM_UUID=1",
+        "_EVENT_HAVE_DLFCN_H=1",
+        "_EVENT_HAVE_EPOLL=1",
+        "_EVENT_HAVE_EPOLL_CTL=1",
+        "_EVENT_HAVE_EVENTFD=1",
+        "_EVENT_HAVE_FCNTL=1",
+        "_EVENT_HAVE_FCNTL_H=1",
+        "_EVENT_HAVE_FD_MASK=1",
+        "_EVENT_HAVE_GETADDRINFO=1",
+        "_EVENT_HAVE_GETEGID=1",
+        "_EVENT_HAVE_GETEUID=1",
+        "_EVENT_HAVE_GETNAMEINFO=1",
+        "_EVENT_HAVE_GETPROTOBYNUMBER=1",
+        "_EVENT_HAVE_GETTIMEOFDAY=1",
+        "_EVENT_HAVE_INET_ATON=1",
+        "_EVENT_HAVE_INET_NTOP=1",
+        "_EVENT_HAVE_INET_PTON=1",
+        "_EVENT_HAVE_INTTYPES_H=1",
+        "_EVENT_HAVE_MEMORY_H=1",
+        "_EVENT_HAVE_MMAP=1",
+        "_EVENT_HAVE_NETDB_H=1",
+        "_EVENT_HAVE_NETINET_IN_H=1",
+        "_EVENT_HAVE_PIPE=1",
+        "_EVENT_HAVE_POLL=1",
+        "_EVENT_HAVE_POLL_H=1",
+        "_EVENT_HAVE_PTHREADS=1",
+        "_EVENT_HAVE_PUTENV=1",
+        "_EVENT_HAVE_SA_FAMILY_T=1",
+        "_EVENT_HAVE_SELECT=1",
+        "_EVENT_HAVE_SENDFILE=1",
+        "_EVENT_HAVE_SETENV=1",
+        "_EVENT_HAVE_SETFD=1",
+        "_EVENT_HAVE_SIGACTION=1",
+        "_EVENT_HAVE_SIGNAL=1",
+        "_EVENT_HAVE_SPLICE=1",
+        "_EVENT_HAVE_STDARG_H=1",
+        "_EVENT_HAVE_STDDEF_H=1",
+        "_EVENT_HAVE_STDINT_H=1",
+        "_EVENT_HAVE_STDLIB_H=1",
+        "_EVENT_HAVE_STRINGS_H=1",
+        "_EVENT_HAVE_STRING_H=1",
+        "_EVENT_HAVE_STRSEP=1",
+        "_EVENT_HAVE_STRTOK_R=1",
+        "_EVENT_HAVE_STRTOLL=1",
+        "_EVENT_HAVE_STRUCT_ADDRINFO=1",
+        "_EVENT_HAVE_STRUCT_IN6_ADDR=1",
+        "_EVENT_HAVE_STRUCT_IN6_ADDR_S6_ADDR16=1",
+        "_EVENT_HAVE_STRUCT_IN6_ADDR_S6_ADDR32=1",
+        "_EVENT_HAVE_STRUCT_SOCKADDR_IN6=1",
+        "_EVENT_HAVE_STRUCT_SOCKADDR_STORAGE=1",
+        "_EVENT_HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY=1",
+        "_EVENT_HAVE_SYSCTL=1",
+        "_EVENT_HAVE_SYS_EPOLL_H=1",
+        "_EVENT_HAVE_SYS_EVENTFD_H=1",
+        "_EVENT_HAVE_SYS_IOCTL_H=1",
+        "_EVENT_HAVE_SYS_MMAN_H=1",
+        "_EVENT_HAVE_SYS_PARAM_H=1",
+        "_EVENT_HAVE_SYS_QUEUE_H=1",
+        "_EVENT_HAVE_SYS_SELECT_H=1",
+        "_EVENT_HAVE_SYS_SENDFILE_H=1",
+        "_EVENT_HAVE_SYS_SOCKET_H=1",
+        "_EVENT_HAVE_SYS_STAT_H=1",
+        "_EVENT_HAVE_SYS_SYSCTL_H=1",
+        "_EVENT_HAVE_SYS_TIME_H=1",
+        "_EVENT_HAVE_SYS_TYPES_H=1",
+        "_EVENT_HAVE_SYS_UIO_H=1",
+        "_EVENT_HAVE_SYS_WAIT_H=1",
+        "_EVENT_HAVE_TIMERADD=1",
+        "_EVENT_HAVE_TIMERCLEAR=1",
+        "_EVENT_HAVE_TIMERCMP=1",
+        "_EVENT_HAVE_TIMERISSET=1",
+        "_EVENT_HAVE_UINT16_T=1",
+        "_EVENT_HAVE_UINT32_T=1",
+        "_EVENT_HAVE_UINT64_T=1",
+        "_EVENT_HAVE_UINT8_T=1",
+        "_EVENT_HAVE_UINTPTR_T=1",
+        "_EVENT_HAVE_UMASK=1",
+        "_EVENT_HAVE_UNISTD_H=1",
+        "_EVENT_HAVE_UNSETENV=1",
+        "_EVENT_HAVE_VASPRINTF=1",
+        "_EVENT_SIZEOF_INT=4",
+        "_EVENT_SIZEOF_LONG=8",
+        "_EVENT_SIZEOF_SHORT=2",
+        "_EVENT_STDC_HEADERS=1",
+        "_EVENT_TIME_WITH_SYS_TIME=1",
+        "_EVENT_NUMERIC_VERSION=0x02001600",
+        '_EVENT_VERSION=\\"2.0.22-stable\\"',
+    ] + address_size_select({
+        "32": [
+            "_EVENT_SIZEOF_LONG_LONG=4",
+            "_EVENT_SIZEOF_OFF_T=4",
+            "_EVENT_SIZEOF_PTHREAD_T=4",
+            "_EVENT_SIZEOF_SIZE_T=4",
+            "_EVENT_SIZEOF_VOID_P=4",
+        ],
+        "64": [
+            "_EVENT_SIZEOF_LONG_LONG=8",
+            "_EVENT_SIZEOF_OFF_T=8",
+            "_EVENT_SIZEOF_PTHREAD_T=8",
+            "_EVENT_SIZEOF_SIZE_T=8",
+            "_EVENT_SIZEOF_VOID_P=8",
+        ],
+    }),
+    includes = [
+        ".",
+        "include",
     ],
-  }),
-
-  copts = [
-    '-Ithird_party/libevent/compat',
-    '-Ithird_party/libevent/include',
-
-    # TODO(Brian): Fix the places in the code it uses char* as an intermediate
-    # type while doing offsetof stuff.
-    '-Wno-cast-align',
-
-    '-Wno-unused-parameter',
-    '-Wno-format-nonliteral',
-    '-Wno-cast-qual',
-    '-Wno-unused-function',
-  ] + compiler_select({
-      'gcc': [],
-      'clang': ['-Wno-incompatible-pointer-types-discards-qualifiers']
-  }),
- )
+    textual_hdrs = [
+        "arc4random.c",
+    ],
+    visibility = ["//visibility:public"],
+)
diff --git a/third_party/matplotlib-cpp/BUILD b/third_party/matplotlib-cpp/BUILD
index 3d3959c..85249c0 100644
--- a/third_party/matplotlib-cpp/BUILD
+++ b/third_party/matplotlib-cpp/BUILD
@@ -3,13 +3,13 @@
 cc_library(
     name = "matplotlib-cpp",
     hdrs = [
-        "matplotlibcpp.h"
+        "matplotlibcpp.h",
     ],
+    restricted_to = ["//tools:k8"],
+    visibility = ["//visibility:public"],
     deps = [
         "@python_repo//:python2.7_lib",
     ],
-    visibility = ["//visibility:public"],
-    restricted_to = ["//tools:k8"],
 )
 
 cc_binary(
@@ -17,10 +17,10 @@
     srcs = [
         "examples/basic.cpp",
     ],
+    restricted_to = ["//tools:k8"],
     deps = [
         "matplotlib-cpp",
     ],
-    restricted_to = ["//tools:k8"],
 )
 
 cc_binary(
@@ -28,8 +28,8 @@
     srcs = [
         "examples/animation.cpp",
     ],
+    restricted_to = ["//tools:k8"],
     deps = [
         "matplotlib-cpp",
     ],
-    restricted_to = ["//tools:k8"],
 )
diff --git a/third_party/protobuf/BUILD b/third_party/protobuf/BUILD
index ea13eed..9b5c4ff 100644
--- a/third_party/protobuf/BUILD
+++ b/third_party/protobuf/BUILD
@@ -44,12 +44,12 @@
 
 load(
     ":protobuf.bzl",
+    "COPTS",
     "cc_proto_library",
-    "py_proto_library",
     "internal_copied_filegroup",
     "internal_gen_well_known_protos_java",
     "internal_protobuf_py_tests",
-    "COPTS",
+    "py_proto_library",
 )
 
 cc_library(
diff --git a/third_party/protobuf/six.BUILD b/third_party/protobuf/six.BUILD
index fb0b360..b18cd78 100644
--- a/third_party/protobuf/six.BUILD
+++ b/third_party/protobuf/six.BUILD
@@ -1,13 +1,13 @@
 genrule(
-  name = "copy_six",
-  srcs = ["six-1.10.0/six.py"],
-  outs = ["six.py"],
-  cmd = "cp $< $(@)",
+    name = "copy_six",
+    srcs = ["six-1.10.0/six.py"],
+    outs = ["six.py"],
+    cmd = "cp $< $(@)",
 )
 
 py_library(
-  name = "six",
-  srcs = ["six.py"],
-  srcs_version = "PY2AND3",
-  visibility = ["//visibility:public"],
+    name = "six",
+    srcs = ["six.py"],
+    srcs_version = "PY2AND3",
+    visibility = ["//visibility:public"],
 )