diff options
author | iphydf <iphydf@users.noreply.github.com> | 2018-01-18 15:14:50 +0000 |
---|---|---|
committer | iphydf <iphydf@users.noreply.github.com> | 2018-01-18 16:11:52 +0000 |
commit | 18a33169b8d9b96fc85d8819a1700c729cf794f6 (patch) | |
tree | 69d7fcc22663da7682b4ea66cf8e112751904dab | |
parent | 643eea60bb9dcf4ecb33d64666b1bc77cbfd7438 (diff) |
Add bazel build scripts for c-toxcore.
This allows us and users to reproducibly build verified versions of the
library with checksums. It will power the toktok-stack continuous build
with checked-in checksums at specific git revisions.
-rw-r--r-- | BUILD | 29 | ||||
-rw-r--r-- | auto_tests/BUILD | 25 | ||||
-rw-r--r-- | auto_tests/helpers.h | 2 | ||||
-rw-r--r-- | other/BUILD | 10 | ||||
-rw-r--r-- | testing/BUILD | 7 | ||||
-rw-r--r-- | toxav/BUILD | 46 | ||||
-rw-r--r-- | toxcore/BUILD | 95 | ||||
-rw-r--r-- | toxencryptsave/BUILD | 31 |
8 files changed, 245 insertions, 0 deletions
@@ -0,0 +1,29 @@ | |||
1 | genrule( | ||
2 | name = "copy_headers", | ||
3 | srcs = [ | ||
4 | "//c-toxcore/toxav:public", | ||
5 | "//c-toxcore/toxcore:public", | ||
6 | "//c-toxcore/toxencryptsave:public", | ||
7 | ], | ||
8 | outs = [ | ||
9 | "tox/toxav.h", | ||
10 | "tox/tox.h", | ||
11 | "tox/toxencryptsave.h", | ||
12 | ], | ||
13 | cmd = """ | ||
14 | cp $(location //c-toxcore/toxav:public) $(GENDIR)/c-toxcore/tox/toxav.h | ||
15 | cp $(location //c-toxcore/toxcore:public) $(GENDIR)/c-toxcore/tox/tox.h | ||
16 | cp $(location //c-toxcore/toxencryptsave:public) $(GENDIR)/c-toxcore/tox/toxencryptsave.h | ||
17 | """, | ||
18 | ) | ||
19 | |||
20 | cc_library( | ||
21 | name = "headers", | ||
22 | hdrs = [ | ||
23 | "tox/tox.h", | ||
24 | "tox/toxav.h", | ||
25 | "tox/toxencryptsave.h", | ||
26 | ], | ||
27 | includes = ["."], | ||
28 | visibility = ["//visibility:public"], | ||
29 | ) | ||
diff --git a/auto_tests/BUILD b/auto_tests/BUILD new file mode 100644 index 00000000..d94442a1 --- /dev/null +++ b/auto_tests/BUILD | |||
@@ -0,0 +1,25 @@ | |||
1 | cc_library( | ||
2 | name = "helpers", | ||
3 | testonly = True, | ||
4 | hdrs = [ | ||
5 | "check_compat.h", | ||
6 | "helpers.h", | ||
7 | ], | ||
8 | ) | ||
9 | |||
10 | [cc_test( | ||
11 | name = src[:-2], | ||
12 | size = "small", | ||
13 | srcs = [src], | ||
14 | copts = [ | ||
15 | "-Wno-parentheses", | ||
16 | ], | ||
17 | deps = [ | ||
18 | ":helpers", | ||
19 | "//c-toxcore/other:monolith", | ||
20 | "//c-toxcore/testing:misc_tools", | ||
21 | "//c-toxcore/toxav", | ||
22 | "//c-toxcore/toxcore", | ||
23 | "@check", | ||
24 | ], | ||
25 | ) for src in glob(["*_test.c"])] | ||
diff --git a/auto_tests/helpers.h b/auto_tests/helpers.h index 745c5d22..373b4a37 100644 --- a/auto_tests/helpers.h +++ b/auto_tests/helpers.h | |||
@@ -42,6 +42,8 @@ static const char *tox_log_level_name(TOX_LOG_LEVEL level) | |||
42 | case TOX_LOG_LEVEL_ERROR: | 42 | case TOX_LOG_LEVEL_ERROR: |
43 | return "ERROR"; | 43 | return "ERROR"; |
44 | } | 44 | } |
45 | |||
46 | return "<unknown>"; | ||
45 | } | 47 | } |
46 | 48 | ||
47 | static void print_debug_log(Tox *m, TOX_LOG_LEVEL level, const char *path, uint32_t line, const char *func, | 49 | static void print_debug_log(Tox *m, TOX_LOG_LEVEL level, const char *path, uint32_t line, const char *func, |
diff --git a/other/BUILD b/other/BUILD new file mode 100644 index 00000000..5c8997ec --- /dev/null +++ b/other/BUILD | |||
@@ -0,0 +1,10 @@ | |||
1 | cc_library( | ||
2 | name = "monolith", | ||
3 | hdrs = ["monolith.h"], | ||
4 | visibility = ["//c-toxcore/auto_tests:__pkg__"], | ||
5 | deps = [ | ||
6 | "//c-toxcore/toxav:monolith", | ||
7 | "//c-toxcore/toxcore:monolith", | ||
8 | "//c-toxcore/toxencryptsave:monolith", | ||
9 | ], | ||
10 | ) | ||
diff --git a/testing/BUILD b/testing/BUILD new file mode 100644 index 00000000..cf7cd40f --- /dev/null +++ b/testing/BUILD | |||
@@ -0,0 +1,7 @@ | |||
1 | cc_library( | ||
2 | name = "misc_tools", | ||
3 | hdrs = [ | ||
4 | "misc_tools.c", | ||
5 | ], | ||
6 | visibility = ["//visibility:public"], | ||
7 | ) | ||
diff --git a/toxav/BUILD b/toxav/BUILD new file mode 100644 index 00000000..ab074841 --- /dev/null +++ b/toxav/BUILD | |||
@@ -0,0 +1,46 @@ | |||
1 | filegroup( | ||
2 | name = "public", | ||
3 | srcs = ["toxav.h"], | ||
4 | visibility = ["//visibility:public"], | ||
5 | ) | ||
6 | |||
7 | cc_library( | ||
8 | name = "toxav", | ||
9 | srcs = [ | ||
10 | "audio.c", | ||
11 | "bwcontroller.c", | ||
12 | "groupav.c", | ||
13 | "msi.c", | ||
14 | "ring_buffer.c", | ||
15 | "rtp.c", | ||
16 | "toxav.c", | ||
17 | "toxav_old.c", | ||
18 | "video.c", | ||
19 | ], | ||
20 | hdrs = [ | ||
21 | "audio.h", | ||
22 | "bwcontroller.h", | ||
23 | "groupav.h", | ||
24 | "msi.h", | ||
25 | "ring_buffer.h", | ||
26 | "rtp.h", | ||
27 | "toxav.api.h", | ||
28 | "toxav.h", | ||
29 | "video.h", | ||
30 | ], | ||
31 | visibility = ["//visibility:public"], | ||
32 | deps = [ | ||
33 | "//c-toxcore/toxcore", | ||
34 | "@libvpx", | ||
35 | "@opus", | ||
36 | ], | ||
37 | ) | ||
38 | |||
39 | cc_library( | ||
40 | name = "monolith", | ||
41 | hdrs = glob([ | ||
42 | "*.c", | ||
43 | "*.h", | ||
44 | ]), | ||
45 | visibility = ["//c-toxcore/other:__pkg__"], | ||
46 | ) | ||
diff --git a/toxcore/BUILD b/toxcore/BUILD new file mode 100644 index 00000000..48ac56fe --- /dev/null +++ b/toxcore/BUILD | |||
@@ -0,0 +1,95 @@ | |||
1 | filegroup( | ||
2 | name = "public", | ||
3 | srcs = ["tox.h"], | ||
4 | visibility = ["//visibility:public"], | ||
5 | ) | ||
6 | |||
7 | cc_library( | ||
8 | name = "ccompat", | ||
9 | hdrs = [ | ||
10 | "ccompat.h", | ||
11 | ], | ||
12 | visibility = ["//visibility:public"], | ||
13 | ) | ||
14 | |||
15 | cc_library( | ||
16 | name = "crypto_core", | ||
17 | srcs = [ | ||
18 | "crypto_core.c", | ||
19 | "crypto_core_mem.c", | ||
20 | ], | ||
21 | hdrs = [ | ||
22 | "crypto_core.h", | ||
23 | ], | ||
24 | visibility = ["//visibility:public"], | ||
25 | deps = [ | ||
26 | ":ccompat", | ||
27 | "@libsodium", | ||
28 | ], | ||
29 | ) | ||
30 | |||
31 | cc_library( | ||
32 | name = "toxcore", | ||
33 | srcs = [ | ||
34 | "DHT.c", | ||
35 | "DHT.h", | ||
36 | "LAN_discovery.c", | ||
37 | "LAN_discovery.h", | ||
38 | "Messenger.c", | ||
39 | "Messenger.h", | ||
40 | "TCP_client.c", | ||
41 | "TCP_client.h", | ||
42 | "TCP_connection.c", | ||
43 | "TCP_connection.h", | ||
44 | "TCP_server.c", | ||
45 | "TCP_server.h", | ||
46 | "friend_connection.c", | ||
47 | "friend_connection.h", | ||
48 | "friend_requests.c", | ||
49 | "friend_requests.h", | ||
50 | "group.c", | ||
51 | "group.h", | ||
52 | "list.c", | ||
53 | "list.h", | ||
54 | "logger.c", | ||
55 | "logger.h", | ||
56 | "net_crypto.c", | ||
57 | "net_crypto.h", | ||
58 | "network.c", | ||
59 | "network.h", | ||
60 | "onion.c", | ||
61 | "onion.h", | ||
62 | "onion_announce.c", | ||
63 | "onion_announce.h", | ||
64 | "onion_client.c", | ||
65 | "onion_client.h", | ||
66 | "ping.c", | ||
67 | "ping.h", | ||
68 | "ping_array.c", | ||
69 | "ping_array.h", | ||
70 | "tox.c", | ||
71 | "tox.h", | ||
72 | "tox_api.c", | ||
73 | "util.c", | ||
74 | "util.h", | ||
75 | ], | ||
76 | copts = [ | ||
77 | "-Wno-parentheses", | ||
78 | ], | ||
79 | linkopts = ["-lpthread"], | ||
80 | visibility = ["//visibility:public"], | ||
81 | deps = [ | ||
82 | ":ccompat", | ||
83 | ":crypto_core", | ||
84 | "//c-toxcore/toxencryptsave", | ||
85 | ], | ||
86 | ) | ||
87 | |||
88 | cc_library( | ||
89 | name = "monolith", | ||
90 | hdrs = glob([ | ||
91 | "*.c", | ||
92 | "*.h", | ||
93 | ]), | ||
94 | visibility = ["//c-toxcore/other:__pkg__"], | ||
95 | ) | ||
diff --git a/toxencryptsave/BUILD b/toxencryptsave/BUILD new file mode 100644 index 00000000..8b49d554 --- /dev/null +++ b/toxencryptsave/BUILD | |||
@@ -0,0 +1,31 @@ | |||
1 | filegroup( | ||
2 | name = "public", | ||
3 | srcs = ["toxencryptsave.h"], | ||
4 | visibility = ["//visibility:public"], | ||
5 | ) | ||
6 | |||
7 | cc_library( | ||
8 | name = "toxencryptsave", | ||
9 | srcs = [ | ||
10 | "toxencryptsave.c", | ||
11 | ], | ||
12 | hdrs = [ | ||
13 | "defines.h", | ||
14 | "toxencryptsave.h", | ||
15 | ], | ||
16 | visibility = [ | ||
17 | "//visibility:public", | ||
18 | ], | ||
19 | deps = [ | ||
20 | "//c-toxcore/toxcore:crypto_core", | ||
21 | ], | ||
22 | ) | ||
23 | |||
24 | cc_library( | ||
25 | name = "monolith", | ||
26 | hdrs = glob([ | ||
27 | "*.c", | ||
28 | "*.h", | ||
29 | ]), | ||
30 | visibility = ["//c-toxcore/other:__pkg__"], | ||
31 | ) | ||