|
| 1 | +# @libevent//:event_core |
| 2 | +# All core event and buffer functionality. This library contains all |
| 3 | +# the event_base, evbuffer, bufferevent, and utility functions. |
| 4 | +# |
| 5 | +# @libevent//:event_extra |
| 6 | +# This library defines protocol-specific functionality that you may |
| 7 | +# or may not want for your application, including HTTP, DNS, and |
| 8 | +# RPC. |
| 9 | +# |
| 10 | +# @libevent//:event |
| 11 | +# This library exists for historical reasons; it contains the |
| 12 | +# contents of both libevent_core and libevent_extra. You shouldn’t |
| 13 | +# use it; it may go away in a future version of Libevent. |
| 14 | +# |
| 15 | +# @libevent//:event_pthreads |
| 16 | +# This library adds threading and locking implementations based on |
| 17 | +# the pthreads portable threading library. It is separated from |
| 18 | +# libevent_core so that you don’t need to link against pthreads to |
| 19 | +# use Libevent unless you are actually using Libevent in a |
| 20 | +# multithreaded way. |
| 21 | +# |
| 22 | +# @libevent//:event_openssl |
| 23 | +# This library provides support for encrypted communications using |
| 24 | +# bufferevents and the OpenSSL library. It is separated from |
| 25 | +# libevent_core so that you don’t need to link against OpenSSL to |
| 26 | +# use Libevent unless you are actually using encrypted connections. |
| 27 | + |
| 28 | +load("@rules_cc//cc:defs.bzl", "cc_library") |
| 29 | +load("@rules_license//rules:license.bzl", "license") |
| 30 | + |
| 31 | +package( |
| 32 | + default_visibility = ["//visibility:private"], |
| 33 | +) |
| 34 | + |
| 35 | +license( |
| 36 | + name = "license", |
| 37 | + license_kinds = [ |
| 38 | + "@rules_license//licenses/spdx:BSD-3-Clause", |
| 39 | + "@rules_license//licenses/spdx:ISC", |
| 40 | + "@rules_license//licenses/spdx:MIT", |
| 41 | + ], |
| 42 | + license_text = "LICENSE", |
| 43 | +) |
| 44 | + |
| 45 | +exports_files([ |
| 46 | + "LICENSE", |
| 47 | +]) |
| 48 | + |
| 49 | +cc_library( |
| 50 | + name = "event_core_private_headers", |
| 51 | + hdrs = [ |
| 52 | + "bufferevent-internal.h", |
| 53 | + "changelist-internal.h", |
| 54 | + "defer-internal.h", |
| 55 | + "epolltable-internal.h", |
| 56 | + "evbuffer-internal.h", |
| 57 | + "evconfig-private.h", |
| 58 | + "evconfig-private_apple.h", |
| 59 | + "evconfig-private_linux.h", |
| 60 | + "event-internal.h", |
| 61 | + "event2-config_apple.h", |
| 62 | + "event2-config_linux.h", |
| 63 | + "event2-config_msvc.h", |
| 64 | + "evmap-internal.h", |
| 65 | + "evsignal-internal.h", |
| 66 | + "evthread-internal.h", |
| 67 | + "ht-internal.h", |
| 68 | + "iocp-internal.h", |
| 69 | + "ipv6-internal.h", |
| 70 | + "kqueue-internal.h", |
| 71 | + "log-internal.h", |
| 72 | + "minheap-internal.h", |
| 73 | + "mm-internal.h", |
| 74 | + "ratelim-internal.h", |
| 75 | + "strlcpy-internal.h", |
| 76 | + "time-internal.h", |
| 77 | + "util-internal.h", |
| 78 | + ], |
| 79 | + visibility = [":__subpackages__"], |
| 80 | +) |
| 81 | + |
| 82 | +EVENT_CORE_PUBLIC_HEADERS = [ |
| 83 | + "include/event.h", |
| 84 | + "include/event2/buffer.h", |
| 85 | + "include/event2/buffer_compat.h", |
| 86 | + "include/event2/bufferevent.h", |
| 87 | + "include/event2/bufferevent_compat.h", |
| 88 | + "include/event2/bufferevent_ssl.h", |
| 89 | + "include/event2/bufferevent_struct.h", |
| 90 | + "include/event2/event.h", |
| 91 | + "include/event2/event-config.h", |
| 92 | + "include/event2/event_compat.h", |
| 93 | + "include/event2/event_struct.h", |
| 94 | + "include/event2/keyvalq_struct.h", |
| 95 | + "include/event2/listener.h", |
| 96 | + "include/event2/tag.h", |
| 97 | + "include/event2/tag_compat.h", |
| 98 | + "include/event2/thread.h", |
| 99 | + "include/event2/util.h", |
| 100 | + "include/event2/visibility.h", |
| 101 | + "include/evutil.h", |
| 102 | +] |
| 103 | + |
| 104 | +cc_library( |
| 105 | + name = "event_core", |
| 106 | + srcs = [ |
| 107 | + "buffer.c", |
| 108 | + "bufferevent.c", |
| 109 | + "bufferevent_filter.c", |
| 110 | + "bufferevent_pair.c", |
| 111 | + "bufferevent_ratelim.c", |
| 112 | + "bufferevent_sock.c", |
| 113 | + "devpoll.c", |
| 114 | + "epoll.c", |
| 115 | + "event.c", |
| 116 | + "event_tagging.c", |
| 117 | + "evmap.c", |
| 118 | + "evport.c", |
| 119 | + "evthread.c", |
| 120 | + "evutil.c", |
| 121 | + "evutil_rand.c", |
| 122 | + "evutil_time.c", |
| 123 | + "kqueue.c", |
| 124 | + "listener.c", |
| 125 | + "log.c", |
| 126 | + "poll.c", |
| 127 | + "select.c", |
| 128 | + "signal.c", |
| 129 | + "strlcpy.c", |
| 130 | + ] + select({ |
| 131 | + "@platforms//os:windows": [ |
| 132 | + "buffer_iocp.c", |
| 133 | + "bufferevent_async.c", |
| 134 | + "event_iocp.c", |
| 135 | + "evthread_win32.c", |
| 136 | + "win32select.c", |
| 137 | + ], |
| 138 | + "//conditions:default": [], |
| 139 | + }), |
| 140 | + hdrs = EVENT_CORE_PUBLIC_HEADERS, |
| 141 | + includes = ["include"], |
| 142 | + linkopts = select({ |
| 143 | + "@platforms//os:windows": [ |
| 144 | + "advapi32.lib", |
| 145 | + "crypt32.lib", |
| 146 | + "iphlpapi.lib", |
| 147 | + "ws2_32.lib", |
| 148 | + ], |
| 149 | + "//conditions:default": [], |
| 150 | + }), |
| 151 | + strip_include_prefix = "include", |
| 152 | + textual_hdrs = [ |
| 153 | + # arc4random.c is textually included by evutil_rand.c when |
| 154 | + # arc4random() is not available. It is not compiled by itself. |
| 155 | + "arc4random.c", |
| 156 | + ], |
| 157 | + visibility = ["//visibility:public"], |
| 158 | + deps = [ |
| 159 | + ":event_core_private_headers", |
| 160 | + ] + select({ |
| 161 | + "@platforms//os:windows": [ |
| 162 | + "//compat", |
| 163 | + ], |
| 164 | + "//conditions:default": [], |
| 165 | + }), |
| 166 | +) |
| 167 | + |
| 168 | +cc_library( |
| 169 | + name = "event_extra_private_headers", |
| 170 | + hdrs = [ |
| 171 | + "evrpc-internal.h", |
| 172 | + "http-internal.h", |
| 173 | + ], |
| 174 | + visibility = [":__subpackages__"], |
| 175 | +) |
| 176 | + |
| 177 | +EVENT_EXTRA_PUBLIC_HEADERS = [ |
| 178 | + "include/evdns.h", |
| 179 | + "include/event2/dns.h", |
| 180 | + "include/event2/dns_compat.h", |
| 181 | + "include/event2/dns_struct.h", |
| 182 | + "include/event2/http.h", |
| 183 | + "include/event2/http_compat.h", |
| 184 | + "include/event2/http_struct.h", |
| 185 | + "include/event2/rpc.h", |
| 186 | + "include/event2/rpc_compat.h", |
| 187 | + "include/event2/rpc_struct.h", |
| 188 | + "include/evhttp.h", |
| 189 | + "include/evrpc.h", |
| 190 | +] |
| 191 | + |
| 192 | +cc_library( |
| 193 | + name = "event_extra", |
| 194 | + srcs = [ |
| 195 | + "evdns.c", |
| 196 | + "evrpc.c", |
| 197 | + "http.c", |
| 198 | + ], |
| 199 | + hdrs = EVENT_EXTRA_PUBLIC_HEADERS, |
| 200 | + includes = ["include"], |
| 201 | + linkopts = select({ |
| 202 | + "@platforms//os:windows": [ |
| 203 | + "shell32.lib", |
| 204 | + ], |
| 205 | + "//conditions:default": [], |
| 206 | + }), |
| 207 | + strip_include_prefix = "include", |
| 208 | + visibility = ["//visibility:public"], |
| 209 | + deps = [ |
| 210 | + ":event_core", |
| 211 | + ":event_core_private_headers", |
| 212 | + ":event_extra_private_headers", |
| 213 | + ] + select({ |
| 214 | + "@platforms//os:windows": [ |
| 215 | + "//compat", |
| 216 | + ], |
| 217 | + "//conditions:default": [], |
| 218 | + }), |
| 219 | +) |
| 220 | + |
| 221 | +cc_library( |
| 222 | + name = "event", |
| 223 | + hdrs = EVENT_CORE_PUBLIC_HEADERS + EVENT_EXTRA_PUBLIC_HEADERS, |
| 224 | + visibility = ["//visibility:public"], |
| 225 | + deps = [ |
| 226 | + ":event_core", |
| 227 | + ":event_extra", |
| 228 | + ], |
| 229 | +) |
| 230 | + |
| 231 | +cc_library( |
| 232 | + name = "event_openssl_private_headers", |
| 233 | + hdrs = [ |
| 234 | + "openssl-compat.h", |
| 235 | + ], |
| 236 | + tags = [ |
| 237 | + "requires_openssl", |
| 238 | + ], |
| 239 | + visibility = [":__subpackages__"], |
| 240 | + deps = [ |
| 241 | + ":event_core", |
| 242 | + ":event_core_private_headers", |
| 243 | + "@openssl//:crypto", |
| 244 | + "@openssl//:ssl", |
| 245 | + ], |
| 246 | +) |
| 247 | + |
| 248 | +cc_library( |
| 249 | + name = "event_openssl", |
| 250 | + srcs = [ |
| 251 | + "bufferevent_openssl.c", |
| 252 | + ], |
| 253 | + includes = ["include"], |
| 254 | + tags = [ |
| 255 | + "requires_openssl", |
| 256 | + ], |
| 257 | + visibility = ["//visibility:public"], |
| 258 | + deps = [ |
| 259 | + ":event_core", |
| 260 | + ":event_core_private_headers", |
| 261 | + ":event_openssl_private_headers", |
| 262 | + "@openssl//:crypto", |
| 263 | + "@openssl//:ssl", |
| 264 | + ], |
| 265 | +) |
| 266 | + |
| 267 | +cc_library( |
| 268 | + name = "event_pthreads", |
| 269 | + srcs = select({ |
| 270 | + "@platforms//os:linux": ["evthread_pthread.c"], |
| 271 | + "@platforms//os:macos": ["evthread_pthread.c"], |
| 272 | + "//conditions:default": [], |
| 273 | + }), |
| 274 | + includes = ["include"], |
| 275 | + linkopts = select({ |
| 276 | + "@platforms//os:linux": ["-pthread"], |
| 277 | + "@platforms//os:macos": ["-pthread"], |
| 278 | + "//conditions:default": [], |
| 279 | + }), |
| 280 | + visibility = ["//visibility:public"], |
| 281 | + deps = [ |
| 282 | + ":event_core", |
| 283 | + ":event_core_private_headers", |
| 284 | + ], |
| 285 | +) |
0 commit comments