1COMMON_LIBUV_HEADERS = [ 2 "include/uv.h", 3 "include/uv/errno.h", 4 "include/uv/threadpool.h", 5 "include/uv/version.h", 6 "include/uv/tree.h", 7] 8 9UNIX_LIBUV_HEADERS = [ 10 "include/uv/unix.h", 11 "src/unix/atomic-ops.h", 12 "src/unix/internal.h", 13 "src/unix/spinlock.h", 14] 15 16LINUX_LIBUV_HEADERS = [ 17 "include/uv/linux.h", 18 "src/unix/linux-syscalls.h", 19] 20 21ANDROID_LIBUV_HEADERS = [ 22 "include/uv/android-ifaddrs.h", 23] 24 25DARWIN_LIBUV_HEADERS = [ 26 "include/uv/darwin.h", 27] 28 29WINDOWS_LIBUV_HEADERS = [ 30 "include/uv/win.h", 31 "src/win/atomicops-inl.h", 32 "src/win/handle-inl.h", 33 "src/win/internal.h", 34 "src/win/req-inl.h", 35 "src/win/stream-inl.h", 36 "src/win/winapi.h", 37 "src/win/winsock.h", 38] 39 40COMMON_LIBUV_SOURCES = [ 41 "src/fs-poll.c", 42 "src/heap-inl.h", 43 "src/idna.c", 44 "src/idna.h", 45 "src/inet.c", 46 "src/queue.h", 47 "src/strscpy.c", 48 "src/strscpy.h", 49 "src/threadpool.c", 50 "src/timer.c", 51 "src/uv-data-getter-setters.c", 52 "src/uv-common.c", 53 "src/uv-common.h", 54 "src/version.c", 55] 56 57UNIX_LIBUV_SOURCES = [ 58 "src/unix/async.c", 59 "src/unix/atomic-ops.h", 60 "src/unix/core.c", 61 "src/unix/dl.c", 62 "src/unix/fs.c", 63 "src/unix/getaddrinfo.c", 64 "src/unix/getnameinfo.c", 65 "src/unix/internal.h", 66 "src/unix/loop.c", 67 "src/unix/loop-watcher.c", 68 "src/unix/pipe.c", 69 "src/unix/poll.c", 70 "src/unix/process.c", 71 "src/unix/signal.c", 72 "src/unix/spinlock.h", 73 "src/unix/stream.c", 74 "src/unix/tcp.c", 75 "src/unix/thread.c", 76 "src/unix/tty.c", 77 "src/unix/udp.c", 78] 79 80LINUX_LIBUV_SOURCES = [ 81 "src/unix/linux-core.c", 82 "src/unix/linux-inotify.c", 83 "src/unix/linux-syscalls.c", 84 "src/unix/linux-syscalls.h", 85 "src/unix/procfs-exepath.c", 86 "src/unix/proctitle.c", 87 "src/unix/sysinfo-loadavg.c", 88 "src/unix/sysinfo-memory.c", 89] 90 91ANDROID_LIBUV_SOURCES = [ 92 "src/unix/android-ifaddrs.c", 93 "src/unix/pthread-fixes.c", 94] 95 96DARWIN_LIBUV_SOURCES = [ 97 "src/unix/bsd-ifaddrs.c", 98 "src/unix/darwin.c", 99 "src/unix/fsevents.c", 100 "src/unix/kqueue.c", 101 "src/unix/darwin-proctitle.c", 102 "src/unix/proctitle.c", 103] 104 105WINDOWS_LIBUV_SOURCES = [ 106 "src/win/async.c", 107 "src/win/atomicops-inl.h", 108 "src/win/core.c", 109 "src/win/detect-wakeup.c", 110 "src/win/dl.c", 111 "src/win/error.c", 112 "src/win/fs-event.c", 113 "src/win/fs.c", 114 "src/win/getaddrinfo.c", 115 "src/win/getnameinfo.c", 116 "src/win/handle.c", 117 "src/win/handle-inl.h", 118 "src/win/internal.h", 119 "src/win/loop-watcher.c", 120 "src/win/pipe.c", 121 "src/win/poll.c", 122 "src/win/process-stdio.c", 123 "src/win/process.c", 124 "src/win/req-inl.h", 125 "src/win/signal.c", 126 "src/win/stream.c", 127 "src/win/stream-inl.h", 128 "src/win/tcp.c", 129 "src/win/thread.c", 130 "src/win/tty.c", 131 "src/win/udp.c", 132 "src/win/util.c", 133 "src/win/winapi.c", 134 "src/win/winapi.h", 135 "src/win/winsock.c", 136 "src/win/winsock.h", 137] 138 139cc_library( 140 name = "libuv", 141 srcs = select({ 142 "//tools/cc_target_os:android": COMMON_LIBUV_SOURCES + UNIX_LIBUV_SOURCES + LINUX_LIBUV_SOURCES + ANDROID_LIBUV_SOURCES, 143 "//tools/cc_target_os:apple": COMMON_LIBUV_SOURCES + UNIX_LIBUV_SOURCES + DARWIN_LIBUV_SOURCES, 144 "//tools/cc_target_os:windows": COMMON_LIBUV_SOURCES + WINDOWS_LIBUV_SOURCES, 145 "//conditions:default": COMMON_LIBUV_SOURCES + UNIX_LIBUV_SOURCES + LINUX_LIBUV_SOURCES, 146 }), 147 hdrs = [ 148 "include/uv.h", 149 ] + select({ 150 "//tools/cc_target_os:android": COMMON_LIBUV_HEADERS + UNIX_LIBUV_HEADERS + LINUX_LIBUV_HEADERS + ANDROID_LIBUV_HEADERS, 151 "//tools/cc_target_os:apple": COMMON_LIBUV_HEADERS + UNIX_LIBUV_HEADERS + DARWIN_LIBUV_HEADERS, 152 "//tools/cc_target_os:windows": COMMON_LIBUV_HEADERS + WINDOWS_LIBUV_HEADERS, 153 "//conditions:default": COMMON_LIBUV_HEADERS + UNIX_LIBUV_HEADERS + LINUX_LIBUV_HEADERS, 154 }), 155 copts = [ 156 "-D_LARGEFILE_SOURCE", 157 "-D_FILE_OFFSET_BITS=64", 158 "-D_GNU_SOURCE", 159 "-pthread", 160 "--std=gnu89", 161 "-pedantic", 162 "-Wno-error", 163 "-Wno-strict-aliasing", 164 "-Wstrict-aliasing", 165 "-O2", 166 "-Wno-implicit-function-declaration", 167 "-Wno-unused-function", 168 "-Wno-unused-variable", 169 ] + select({ 170 "//tools/cc_target_os:apple": [], 171 "//tools/cc_target_os:windows": [ 172 "-DWIN32_LEAN_AND_MEAN", 173 "-D_WIN32_WINNT=0x0600", 174 ], 175 "//conditions:default": [ 176 "-Wno-tree-vrp", 177 "-Wno-omit-frame-pointer", 178 "-D_DARWIN_USE_64_BIT_INODE=1", 179 "-D_DARWIN_UNLIMITED_SELECT=1", 180 ], 181 }), 182 includes = [ 183 "include", 184 "src", 185 ], 186 linkopts = select({ 187 "//tools/cc_target_os:windows": [ 188 "-Xcrosstool-compilation-mode=$(COMPILATION_MODE)", 189 "-Wl,Iphlpapi.lib", 190 "-Wl,Psapi.lib", 191 "-Wl,User32.lib", 192 "-Wl,Userenv.lib", 193 ], 194 "//conditions:default": [], 195 }), 196 visibility = [ 197 "//visibility:public", 198 ], 199) 200