Make rawrtc build
Change-Id: I077e43c6aaee27307dadb97a7352c8412b735519
diff --git a/WORKSPACE b/WORKSPACE
index acf815f..857b0a0 100644
--- a/WORKSPACE
+++ b/WORKSPACE
@@ -177,6 +177,36 @@
path = "third_party/eigen",
)
+local_repository(
+ name = "com_github_rawrtc_re",
+ path = "third_party/rawrtc/re",
+)
+
+local_repository(
+ name = "com_github_rawrtc_rew",
+ path = "third_party/rawrtc/rew",
+)
+
+local_repository(
+ name = "com_github_rawrtc_usrsctp",
+ path = "third_party/rawrtc/usrsctp",
+)
+
+local_repository(
+ name = "com_github_rawrtc_rawrtc_common",
+ path = "third_party/rawrtc/rawrtc-common",
+)
+
+local_repository(
+ name = "com_github_rawrtc_rawrtc_data_channel",
+ path = "third_party/rawrtc/rawrtc-data-channel",
+)
+
+local_repository(
+ name = "com_github_rawrtc_rawrtc",
+ path = "third_party/rawrtc/rawrtc",
+)
+
http_archive(
name = "boringssl",
patch_args = ["-p1"],
diff --git a/third_party/rawrtc/rawrtc-common/BUILD b/third_party/rawrtc/rawrtc-common/BUILD
new file mode 100644
index 0000000..379166e
--- /dev/null
+++ b/third_party/rawrtc/rawrtc-common/BUILD
@@ -0,0 +1,11 @@
+cc_library(
+ name = "rawrtcc",
+ srcs = glob(["src/**/*.c"]),
+ hdrs = glob(["include/**/*.h"]),
+ defines = [
+ "RAWRTC_DEBUG_LEVEL=0",
+ ],
+ includes = ["include/"],
+ visibility = ["//visibility:public"],
+ deps = ["@com_github_rawrtc_rew//:rew"],
+)
diff --git a/third_party/rawrtc/rawrtc-common/WORKSPACE b/third_party/rawrtc/rawrtc-common/WORKSPACE
new file mode 100644
index 0000000..f26f019
--- /dev/null
+++ b/third_party/rawrtc/rawrtc-common/WORKSPACE
@@ -0,0 +1 @@
+workspace(name = "com_github_rawrtc_rawrtc_common")
diff --git a/third_party/rawrtc/rawrtc-common/include/rawrtcc/config.h b/third_party/rawrtc/rawrtc-common/include/rawrtcc/config.h
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/third_party/rawrtc/rawrtc-common/include/rawrtcc/config.h
diff --git a/third_party/rawrtc/rawrtc-data-channel/BUILD b/third_party/rawrtc/rawrtc-data-channel/BUILD
new file mode 100644
index 0000000..096024a
--- /dev/null
+++ b/third_party/rawrtc/rawrtc-data-channel/BUILD
@@ -0,0 +1,39 @@
+load("@//tools/build_rules:select.bzl", "compiler_select")
+
+cc_library(
+ name = "rawrtcdc",
+ srcs = glob(
+ [
+ "src/**/*.c",
+ "src/**/*.h",
+ ],
+ exclude = [
+ "src/sctp_redirect_transport",
+ "src/crc32c/sse42*",
+ ],
+ ),
+ hdrs = glob(["include/**/*.h"]),
+ copts = compiler_select({
+ "clang": [
+ "-Wno-incompatible-pointer-types-discards-qualifiers",
+ ],
+ "gcc": [
+ "-Wno-discarded-qualifiers",
+ "-Wno-maybe-uninitialized",
+ ],
+ }) + [
+ "-Wno-cast-qual",
+ "-Wno-cast-align",
+ "-Wno-missing-braces",
+ ],
+ defines = [
+ "RAWRTCDC_HAVE_SCTP_REDIRECT_TRANSPORT=0",
+ "RAWRTCDC_ENABLE_SSE42_CRC32C=0",
+ ],
+ includes = ["include/"],
+ visibility = ["//visibility:public"],
+ deps = [
+ "@com_github_rawrtc_rawrtc_common//:rawrtcc",
+ "@com_github_rawrtc_usrsctp//:usrsctp_crc32",
+ ],
+)
diff --git a/third_party/rawrtc/rawrtc-data-channel/WORKSPACE b/third_party/rawrtc/rawrtc-data-channel/WORKSPACE
new file mode 100644
index 0000000..957c8b1
--- /dev/null
+++ b/third_party/rawrtc/rawrtc-data-channel/WORKSPACE
@@ -0,0 +1 @@
+workspace(name = "com_github_rawrtc_rawrtc_data_channel")
diff --git a/third_party/rawrtc/rawrtc-data-channel/include/rawrtcdc/config.h b/third_party/rawrtc/rawrtc-data-channel/include/rawrtcdc/config.h
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/third_party/rawrtc/rawrtc-data-channel/include/rawrtcdc/config.h
diff --git a/third_party/rawrtc/rawrtc/BUILD b/third_party/rawrtc/rawrtc/BUILD
new file mode 100644
index 0000000..df14384
--- /dev/null
+++ b/third_party/rawrtc/rawrtc/BUILD
@@ -0,0 +1,34 @@
+load("@//tools/build_rules:select.bzl", "compiler_select")
+
+cc_library(
+ name = "rawrtc",
+ srcs = glob([
+ "src/**/*.c",
+ "src/**/*.h",
+ ]),
+ hdrs = glob(["include/**/*.h"]),
+ copts = compiler_select({
+ "clang": [
+ "-Wno-incompatible-pointer-types-discards-qualifiers",
+ ],
+ "gcc": [
+ "-Wno-discarded-qualifiers",
+ "-Wno-implicit-fallthrough",
+ ],
+ }) + [
+ "-Wno-implicit-function-declaration",
+ "-Wno-int-conversion",
+ "-Wno-cast-qual",
+ "-Wno-missing-braces",
+ "-Iexternal/com_github_rawrtc_rawrtc/",
+ ],
+ includes = ["include/"],
+ local_defines = [
+ "RAWRTC_VERSION=\\\"0.5.1\\\"",
+ ],
+ visibility = ["//visibility:public"],
+ deps = [
+ "@com_github_rawrtc_rawrtc_common//:rawrtcc",
+ "@com_github_rawrtc_rawrtc_data_channel//:rawrtcdc",
+ ],
+)
diff --git a/third_party/rawrtc/rawrtc/WORKSPACE b/third_party/rawrtc/rawrtc/WORKSPACE
new file mode 100644
index 0000000..2c6b696
--- /dev/null
+++ b/third_party/rawrtc/rawrtc/WORKSPACE
@@ -0,0 +1 @@
+workspace(name = "com_github_rawrtc_rawrtc")
diff --git a/third_party/rawrtc/rawrtc/include/rawrtc/config.h b/third_party/rawrtc/rawrtc/include/rawrtc/config.h
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/third_party/rawrtc/rawrtc/include/rawrtc/config.h
diff --git a/third_party/rawrtc/re/BUILD b/third_party/rawrtc/re/BUILD
new file mode 100644
index 0000000..af720c5
--- /dev/null
+++ b/third_party/rawrtc/re/BUILD
@@ -0,0 +1,48 @@
+load("@//tools/build_rules:select.bzl", "compiler_select")
+
+cc_library(
+ name = "re",
+ srcs = glob(
+ [
+ "src/**/*.c",
+ "src/**/*.h",
+ ],
+ exclude = [
+ "src/aes/apple/**",
+ "src/aes/stub.c",
+ "src/hmac/apple/**",
+ "src/hmac/hmac.c",
+ "src/mqueue/win32/**",
+ "src/tls/openssl/**",
+ "src/dns/win32/**",
+ "src/mod/win32/**",
+ "src/lock/lock.c",
+ "src/lock/win32/**",
+ "src/dns/darwin/**",
+ "src/net/win32/**",
+ "src/net/bsd/**",
+ ],
+ ),
+ hdrs = glob(["include/*.h"]),
+ copts = compiler_select({
+ "clang": [
+ "-Wno-incompatible-pointer-types-discards-qualifiers",
+ ],
+ "gcc": [
+ "-Wno-discarded-qualifiers",
+ "-Wno-implicit-fallthrough",
+ ],
+ }) + [
+ "-DVER_MAJOR=0",
+ "-DVER_MINOR=6",
+ "-DVER_PATCH=0",
+ "-DHAVE_ROUTE_LIST",
+ "-Wno-cast-qual",
+ "-Wno-cast-align",
+ "-Wno-implicit-function-declaration",
+ ],
+ defines = ["HAVE_INTTYPES_H"],
+ includes = ["include/"],
+ visibility = ["//visibility:public"],
+ deps = ["@boringssl//:ssl"],
+)
diff --git a/third_party/rawrtc/re/WORKSPACE b/third_party/rawrtc/re/WORKSPACE
new file mode 100644
index 0000000..4bf77f1
--- /dev/null
+++ b/third_party/rawrtc/re/WORKSPACE
@@ -0,0 +1 @@
+workspace(name = "com_github_rawrtc_re")
diff --git a/third_party/rawrtc/rew/BUILD b/third_party/rawrtc/rew/BUILD
new file mode 100644
index 0000000..d5295e7
--- /dev/null
+++ b/third_party/rawrtc/rew/BUILD
@@ -0,0 +1,26 @@
+load("@//tools/build_rules:select.bzl", "compiler_select")
+
+cc_library(
+ name = "rew",
+ srcs = glob(
+ [
+ "src/**/*.c",
+ "src/**/*.h",
+ ],
+ ),
+ hdrs = glob(["include/*.h"]),
+ copts = compiler_select({
+ "clang": [
+ "-Wno-incompatible-pointer-types-discards-qualifiers",
+ ],
+ "gcc": [
+ "-Wno-discarded-qualifiers",
+ ],
+ }) + [
+ "-Wno-cast-qual",
+ "-Wno-incompatible-pointer-types-discards-qualifiers",
+ ],
+ includes = ["include/"],
+ visibility = ["//visibility:public"],
+ deps = ["@com_github_rawrtc_re//:re"],
+)
diff --git a/third_party/rawrtc/rew/WORKSPACE b/third_party/rawrtc/rew/WORKSPACE
new file mode 100644
index 0000000..a23ec65
--- /dev/null
+++ b/third_party/rawrtc/rew/WORKSPACE
@@ -0,0 +1 @@
+workspace(name = "com_github_rawrtc_rew")
diff --git a/third_party/rawrtc/usrsctp/BUILD b/third_party/rawrtc/usrsctp/BUILD
new file mode 100644
index 0000000..7704bb9
--- /dev/null
+++ b/third_party/rawrtc/usrsctp/BUILD
@@ -0,0 +1,21 @@
+# usrsctp is only actually being used for the CRC function, and getting
+# the entire library building was being obnoxious.
+cc_library(
+ name = "usrsctp_crc32",
+ srcs = ["usrsctplib/netinet/sctp_crc32.c"],
+ hdrs = glob(["usrsctplib/**/*.h"]),
+ copts = [
+ "-Wno-cast-qual",
+ "-Wno-cast-align",
+ "-Wno-unused-parameter",
+ "-Wno-incompatible-pointer-types-discards-qualifiers",
+ ],
+ defines = [
+ "__Userspace_os_Linux",
+ "__Userspace__",
+ "SCTP_SIMPLE_ALLOCATOR",
+ ],
+ includes = ["usrsctplib/"],
+ target_compatible_with = ["@platforms//os:linux"],
+ visibility = ["//visibility:public"],
+)
diff --git a/third_party/rawrtc/usrsctp/WORKSPACE b/third_party/rawrtc/usrsctp/WORKSPACE
new file mode 100644
index 0000000..e382c02
--- /dev/null
+++ b/third_party/rawrtc/usrsctp/WORKSPACE
@@ -0,0 +1 @@
+workspace(name = "com_github_rawrtc_usrsctp")
diff --git a/tools/ci/buildkite.yaml b/tools/ci/buildkite.yaml
index 3a8008c..d223d89 100644
--- a/tools/ci/buildkite.yaml
+++ b/tools/ci/buildkite.yaml
@@ -1,7 +1,7 @@
env:
STARTUP: --max_idle_secs=0 --watchfs
COMMON: -c opt --stamp=no --curses=no --color=no --symlink_prefix=/ --disk_cache=~/.cache/bazel/disk_cache/
- TARGETS: //... @com_github_google_glog//... @com_google_ceres_solver//...
+ TARGETS: //... @com_github_google_glog//... @com_google_ceres_solver//... @com_github_rawrtc_rawrtc//...
M4F_TARGETS: //...
# Sanity check that we are able to build the y2020 roborio code, which confirms
# that we have the platform compatibility for the roborio set up correctly.
diff --git a/tools/ci/run-tests.sh b/tools/ci/run-tests.sh
index 867e9c3..e012740 100755
--- a/tools/ci/run-tests.sh
+++ b/tools/ci/run-tests.sh
@@ -10,37 +10,5 @@
exit 0
fi
-readonly TARGETS='//... @com_github_google_glog//... @com_google_ceres_solver//...'
-readonly M4F_TARGETS='//...'
-# Sanity check that we are able to build the y2020 roborio code, which confirms
-# that we have the platform compatibility for the roborio set up correctly.
-readonly ROBORIO_TARGETS="${TARGETS} //y2020:download_stripped"
-# Stay up forever and use inotify to find changes quickly
-readonly STARTUP='--max_idle_secs=0 --watchfs'
-readonly COMMON='-c opt --stamp=no --curses=no --color=no --symlink_prefix=/ --disk_cache=~/.cache/bazel/disk_cache/'
-
-# Put everything in different output bases so we can get 5 bazel servers
-# running and keep them all warm.
-
-# Include --config=eigen to enable Eigen assertions so that we catch potential
-# bugs with Eigen.
-tools/bazel ${STARTUP} --output_base=../k8_output_base test \
- ${COMMON} \
- --config=k8 \
- --config=eigen \
- ${TARGETS}
-
-tools/bazel ${STARTUP} --output_base=../roborio_output_base build \
- ${COMMON} \
- --config=roborio \
- ${ROBORIO_TARGETS}
-
-tools/bazel ${STARTUP} --output_base=../armhf-debian_output_base build \
- ${COMMON} \
- --config=armhf-debian \
- ${TARGETS}
-
-tools/bazel ${STARTUP} --output_base=../cortex-m4f_output_base build \
- ${COMMON} \
- --config=cortex-m4f \
- ${M4F_TARGETS}
+echo "This script should only be run from buildkite."
+exit 1