Mercurial
diff seobeo/BUILD @ 124:dbf14f84d51c
Refactor Seobeo and mrjunejune build files so it works.
| author | June Park <parkjune1995@gmail.com> |
|---|---|
| date | Thu, 08 Jan 2026 07:31:32 -0800 |
| parents | 7b1719fa918c |
| children | f236c895604e |
line wrap: on
line diff
--- a/seobeo/BUILD Thu Jan 08 06:46:10 2026 -0800 +++ b/seobeo/BUILD Thu Jan 08 07:31:32 2026 -0800 @@ -1,7 +1,6 @@ -load("@rules_cc//cc:cc_binary.bzl", "cc_binary") load("@rules_cc//cc:cc_library.bzl", "cc_library") -load("@rules_cc//cc:cc_test.bzl", "cc_test") +# File group filegroup( name = "seobeo_hdrs", srcs = [ @@ -12,31 +11,72 @@ visibility = ["//visibility:public"], ) +# Minimal TCP/SSL handling only (no HTTP, no WebSocket) alias( - name = "seobeo_server", + name = "seobeo_min", actual = select({ - "//config:macos": ":seobeo_server_macos", - "//config:linux": ":seobeo_server_linux", - "//conditions:default": ":seobeo_server_linux", - }), - visibility = ["//visibility:public"], -) - -alias( - name = "seobeo_server_dev", - actual = select({ - "//config:macos": ":seobeo_server_macos_dev", - "//config:linux": ":seobeo_server_linux_dev", - "//conditions:default": ":seobeo_server_linux_dev", + "//config:macos": ":seobeo_min_macos", + "//config:linux": ":seobeo_min_linux", + "//conditions:default": ":seobeo_min_linux", }), visibility = ["//visibility:public"], ) cc_library( - name = "seobeo_server_macos", + name = "seobeo_min_macos", + srcs = [ + "s_network.c", + "s_logging.c", + "s_ssl.c", + "os/s_macos_edge.c", + ], + hdrs = [":seobeo_hdrs"], + deps = [ + "//dowa:dowa", + "@openssl//:ssl", + ], + target_compatible_with = [ + "@platforms//os:osx", + ], + visibility = ["//visibility:public"], +) + +cc_library( + name = "seobeo_min_linux", srcs = [ - "s__network.c", + "s_network.c", + "s_logging.c", + "s_ssl.c", + "os/s_linux_edge.c", + ], + hdrs = [":seobeo_hdrs"], + deps = [ + "//dowa:dowa", + "@openssl//:ssl", + ], + target_compatible_with = [ + "@platforms//os:linux", + ], + visibility = ["//visibility:public"], +) + +# TCP Server with HTTP (no WebSocket, no SSL) +alias( + name = "seobeo_tcp_server", + actual = select({ + "//config:macos": ":seobeo_tcp_server_macos", + "//config:linux": ":seobeo_tcp_server_linux", + "//conditions:default": ":seobeo_tcp_server_linux", + }), + visibility = ["//visibility:public"], +) + +cc_library( + name = "seobeo_tcp_server_macos", + srcs = [ + "s_network.c", "s_web.c", + "s_logging.c", "s_ssl.c", "os/s_macos_edge.c", ], @@ -52,29 +92,11 @@ ) cc_library( - name = "seobeo_server_macos_dev", + name = "seobeo_tcp_server_linux", srcs = [ "s_network.c", "s_web.c", - "s_ssl.c", - "os/s_macos_edge.c", - ], - hdrs = [":seobeo_hdrs"], - deps = [ - "//dowa:dowa", - ], - defines = ["SEOBEO_NO_SSL", "SEOBEO_ENABLE_DEBUG"], - target_compatible_with = [ - "@platforms//os:osx", - ], - visibility = ["//visibility:public"], -) - -cc_library( - name = "seobeo_server_linux", - srcs = [ - "s_network.c", - "s_web.c", + "s_logging.c", "s_ssl.c", "os/s_linux_edge.c", ], @@ -89,45 +111,79 @@ visibility = ["//visibility:public"], ) +# TCP Server with HTTP + WebSocket +alias( + name = "seobeo_tcp_server_ws", + actual = select({ + "//config:macos": ":seobeo_tcp_server_ws_macos", + "//config:linux": ":seobeo_tcp_server_ws_linux", + "//conditions:default": ":seobeo_tcp_server_ws_linux", + }), + visibility = ["//visibility:public"], +) + cc_library( - name = "seobeo_server_linux_dev", + name = "seobeo_tcp_server_ws_macos", srcs = [ "s_network.c", "s_web.c", + "s_logging.c", "s_ssl.c", + "s_websocket_server.c", + "os/s_macos_edge.c", + ], + hdrs = [":seobeo_hdrs"], + deps = [ + "//dowa:dowa", + "@openssl//:ssl", + ], + defines = ["SEOBEO_WEBSOCKET_SERVER"], + target_compatible_with = [ + "@platforms//os:osx", + ], + visibility = ["//visibility:public"], +) + +cc_library( + name = "seobeo_tcp_server_ws_linux", + srcs = [ + "s_network.c", + "s_web.c", + "s_logging.c", + "s_ssl.c", + "s_websocket_server.c", "os/s_linux_edge.c", ], hdrs = [":seobeo_hdrs"], deps = [ "//dowa:dowa", + "@openssl//:ssl", ], - defines = ["SEOBEO_NO_SSL", "SEOBEO_ENABLE_DEBUG"], + defines = ["SEOBEO_WEBSOCKET_SERVER"], target_compatible_with = [ "@platforms//os:linux", ], visibility = ["//visibility:public"], ) -# Client target with SSL support (full functionality) +# TCP Client with HTTP alias( - name = "seobeo_client", + name = "seobeo_tcp_client", actual = select({ - "//config:macos": ":seobeo_client_macos", - "//config:linux": ":seobeo_client_linux", - "//conditions:default": ":seobeo_client_linux", + "//config:macos": ":seobeo_tcp_client_macos", + "//config:linux": ":seobeo_tcp_client_linux", + "//conditions:default": ":seobeo_tcp_client_linux", }), visibility = ["//visibility:public"], ) cc_library( - name = "seobeo_client_macos", + name = "seobeo_tcp_client_macos", srcs = [ "s_network.c", - "s_web.c", + "s_logging.c", "s_ssl.c", "s_http_client.c", - "s_websocket.c", - "s_websocket_server.c", "snapshot_creator.c", "os/s_macos_edge.c", ], @@ -143,14 +199,12 @@ ) cc_library( - name = "seobeo_client_linux", + name = "seobeo_tcp_client_linux", srcs = [ "s_network.c", - "s_web.c", + "s_logging.c", "s_ssl.c", "s_http_client.c", - "s_websocket.c", - "s_websocket_server.c", "snapshot_creator.c", "os/s_linux_edge.c", ], @@ -165,46 +219,131 @@ visibility = ["//visibility:public"], ) -# Default target for backward compatibility (points to client with SSL) +# TCP Client with HTTP + WebSocket alias( - name = "seobeo", - actual = ":seobeo_client", + name = "seobeo_tcp_client_ws", + actual = select({ + "//config:macos": ":seobeo_tcp_client_ws_macos", + "//config:linux": ":seobeo_tcp_client_ws_linux", + "//conditions:default": ":seobeo_tcp_client_ws_linux", + }), visibility = ["//visibility:public"], ) -# Examples -cc_binary( - name = "websocket_server_example", - srcs = ["examples/websocket_server_example.c"], - deps = [":seobeo_client"], +cc_library( + name = "seobeo_tcp_client_ws_macos", + srcs = [ + "s_network.c", + "s_logging.c", + "s_ssl.c", + "s_http_client.c", + "s_websocket.c", + "snapshot_creator.c", + "os/s_macos_edge.c", + ], + hdrs = [":seobeo_hdrs"], + deps = [ + "//dowa:dowa", + "@openssl//:ssl", + ], + target_compatible_with = [ + "@platforms//os:osx", + ], + visibility = ["//visibility:public"], +) + +cc_library( + name = "seobeo_tcp_client_ws_linux", + srcs = [ + "s_network.c", + "s_logging.c", + "s_ssl.c", + "s_http_client.c", + "s_websocket.c", + "snapshot_creator.c", + "os/s_linux_edge.c", + ], + hdrs = [":seobeo_hdrs"], + deps = [ + "//dowa:dowa", + "@openssl//:ssl", + ], + target_compatible_with = [ + "@platforms//os:linux", + ], visibility = ["//visibility:public"], ) -# Tests -cc_test( - name = "seobeo_client_test", - srcs = ["tests/seobeo_client_test.c"], - deps = [":seobeo_client"], +# All combined only used this if you don't want to deal with imports and what not... +alias( + name = "seobeo", + actual = select({ + "//config:macos": ":seobeo_macos", + "//config:linux": ":seobeo_linux", + "//conditions:default": ":seobeo_linux", + }), + visibility = ["//visibility:public"], +) + +cc_library( + name = "seobeo_macos", + srcs = [ + "s_network.c", + "s_web.c", + "s_logging.c", + "s_ssl.c", + "s_http_client.c", + "s_websocket.c", + "s_websocket_server.c", + "snapshot_creator.c", + "os/s_macos_edge.c", + ], + hdrs = [":seobeo_hdrs"], + deps = [ + "//dowa:dowa", + "@openssl//:ssl", + ], + defines = ["SEOBEO_WEBSOCKET_SERVER"], + target_compatible_with = [ + "@platforms//os:osx", + ], visibility = ["//visibility:public"], ) -cc_test( - name = "seobeo_websocket_test", - srcs = ["tests/seobeo_websocket_test.c"], - deps = [":seobeo_client"], - size = "small", - timeout = "short", +cc_library( + name = "seobeo_linux", + srcs = [ + "s_network.c", + "s_web.c", + "s_logging.c", + "s_ssl.c", + "s_http_client.c", + "s_websocket.c", + "s_websocket_server.c", + "snapshot_creator.c", + "os/s_linux_edge.c", + ], + hdrs = [":seobeo_hdrs"], + deps = [ + "//dowa:dowa", + "@openssl//:ssl", + ], + defines = ["SEOBEO_WEBSOCKET_SERVER"], + target_compatible_with = [ + "@platforms//os:linux", + ], visibility = ["//visibility:public"], ) -cc_test( - name = "seobeo_websocket_server_test", - srcs = ["tests/seobeo_web_server_test.c"], - deps = [":seobeo_client"], - data = [ - ":websocket_server_example", - ], - size = "large", - timeout = "long", - args = ["$(location //seobeo:websocket_server_example)"], +# Names I often use +alias( + name = "seobeo_server", + actual = ":seobeo_tcp_server", + visibility = ["//visibility:public"], ) + +alias( + name = "seobeo_client", + actual = ":seobeo", + visibility = ["//visibility:public"], +)