1{ 2 'variables': { 3 'conditions': [ 4 ['OS=="win"', { 5 'shared_unix_defines': [ ], 6 }, { 7 'shared_unix_defines': [ 8 '_LARGEFILE_SOURCE', 9 '_FILE_OFFSET_BITS=64', 10 ], 11 }], 12 ['OS in "mac ios"', { 13 'shared_mac_defines': [ '_DARWIN_USE_64_BIT_INODE=1' ], 14 }, { 15 'shared_mac_defines': [ ], 16 }], 17 ['OS=="zos"', { 18 'shared_zos_defines': [ 19 '_UNIX03_THREADS', 20 '_UNIX03_SOURCE', 21 '_UNIX03_WITHDRAWN', 22 '_OPEN_SYS_IF_EXT', 23 '_OPEN_SYS_SOCK_EXT3', 24 '_OPEN_SYS_SOCK_IPV6', 25 '_OPEN_MSGQ_EXT', 26 '_XOPEN_SOURCE_EXTENDED', 27 '_ALL_SOURCE', 28 '_LARGE_TIME_API', 29 '_OPEN_SYS_FILE_EXT', 30 '_AE_BIMODAL', 31 'PATH_MAX=255' 32 ], 33 }, { 34 'shared_zos_defines': [ ], 35 }], 36 ], 37 }, 38 39 'targets': [ 40 { 41 'target_name': 'libuv', 42 'type': '<(uv_library)', 43 'include_dirs': [ 44 'include', 45 'src/', 46 ], 47 'defines': [ 48 '<@(shared_mac_defines)', 49 '<@(shared_unix_defines)', 50 '<@(shared_zos_defines)', 51 ], 52 'direct_dependent_settings': { 53 'defines': [ 54 '<@(shared_mac_defines)', 55 '<@(shared_unix_defines)', 56 '<@(shared_zos_defines)', 57 ], 58 'include_dirs': [ 'include' ], 59 'conditions': [ 60 ['OS == "linux"', { 61 'defines': [ '_POSIX_C_SOURCE=200112' ], 62 }], 63 ], 64 }, 65 'sources': [ 66 'common.gypi', 67 'include/uv.h', 68 'include/uv/tree.h', 69 'include/uv/errno.h', 70 'include/uv/threadpool.h', 71 'include/uv/version.h', 72 'src/fs-poll.c', 73 'src/heap-inl.h', 74 'src/idna.c', 75 'src/idna.h', 76 'src/inet.c', 77 'src/queue.h', 78 'src/random.c', 79 'src/strscpy.c', 80 'src/strscpy.h', 81 'src/strtok.c', 82 'src/strtok.h', 83 'src/threadpool.c', 84 'src/timer.c', 85 'src/uv-data-getter-setters.c', 86 'src/uv-common.c', 87 'src/uv-common.h', 88 'src/version.c' 89 ], 90 'xcode_settings': { 91 'GCC_SYMBOLS_PRIVATE_EXTERN': 'YES', # -fvisibility=hidden 92 'WARNING_CFLAGS': [ 93 '-Wall', 94 '-Wextra', 95 '-Wno-unused-parameter', 96 '-Wstrict-prototypes', 97 ], 98 'OTHER_CFLAGS': [ '-g', '--std=gnu89' ], 99 }, 100 'conditions': [ 101 [ 'OS=="win"', { 102 'defines': [ 103 '_WIN32_WINNT=0x0600', 104 '_GNU_SOURCE', 105 ], 106 'sources': [ 107 'include/uv/win.h', 108 'src/win/async.c', 109 'src/win/atomicops-inl.h', 110 'src/win/core.c', 111 'src/win/detect-wakeup.c', 112 'src/win/dl.c', 113 'src/win/error.c', 114 'src/win/fs.c', 115 'src/win/fs-event.c', 116 'src/win/getaddrinfo.c', 117 'src/win/getnameinfo.c', 118 'src/win/handle.c', 119 'src/win/handle-inl.h', 120 'src/win/internal.h', 121 'src/win/loop-watcher.c', 122 'src/win/pipe.c', 123 'src/win/thread.c', 124 'src/win/poll.c', 125 'src/win/process.c', 126 'src/win/process-stdio.c', 127 'src/win/req-inl.h', 128 'src/win/signal.c', 129 'src/win/snprintf.c', 130 'src/win/stream.c', 131 'src/win/stream-inl.h', 132 'src/win/tcp.c', 133 'src/win/tty.c', 134 'src/win/udp.c', 135 'src/win/util.c', 136 'src/win/winapi.c', 137 'src/win/winapi.h', 138 'src/win/winsock.c', 139 'src/win/winsock.h', 140 ], 141 'link_settings': { 142 'libraries': [ 143 '-ladvapi32', 144 '-liphlpapi', 145 '-lpsapi', 146 '-lshell32', 147 '-luser32', 148 '-luserenv', 149 '-lws2_32' 150 ], 151 }, 152 }, { # Not Windows i.e. POSIX 153 'sources': [ 154 'include/uv/unix.h', 155 'include/uv/linux.h', 156 'include/uv/sunos.h', 157 'include/uv/darwin.h', 158 'include/uv/bsd.h', 159 'include/uv/aix.h', 160 'src/unix/async.c', 161 'src/unix/atomic-ops.h', 162 'src/unix/core.c', 163 'src/unix/dl.c', 164 'src/unix/fs.c', 165 'src/unix/getaddrinfo.c', 166 'src/unix/getnameinfo.c', 167 'src/unix/internal.h', 168 'src/unix/loop.c', 169 'src/unix/loop-watcher.c', 170 'src/unix/pipe.c', 171 'src/unix/poll.c', 172 'src/unix/process.c', 173 'src/unix/random-devurandom.c', 174 'src/unix/signal.c', 175 'src/unix/spinlock.h', 176 'src/unix/stream.c', 177 'src/unix/tcp.c', 178 'src/unix/thread.c', 179 'src/unix/tty.c', 180 'src/unix/udp.c', 181 ], 182 'link_settings': { 183 'libraries': [ '-lm' ], 184 'conditions': [ 185 ['OS=="solaris"', { 186 'ldflags': [ '-pthreads' ], 187 }], 188 [ 'OS=="zos" and uv_library=="shared_library"', { 189 'ldflags': [ '-Wl,DLL' ], 190 }], 191 ['OS != "solaris" and OS != "android" and OS != "zos"', { 192 'ldflags': [ '-pthread' ], 193 }], 194 ], 195 }, 196 'conditions': [ 197 ['uv_library=="shared_library"', { 198 'conditions': [ 199 ['OS=="zos"', { 200 'cflags': [ '-qexportall' ], 201 }, { 202 'cflags': [ '-fPIC' ], 203 }], 204 ], 205 }], 206 ['uv_library=="shared_library" and OS!="mac" and OS!="zos"', { 207 # This will cause gyp to set soname 208 # Must correspond with UV_VERSION_MAJOR 209 # in include/uv/version.h 210 'product_extension': 'so.1', 211 }], 212 ], 213 }], 214 [ 'OS in "linux mac ios android zos"', { 215 'sources': [ 'src/unix/proctitle.c' ], 216 }], 217 [ 'OS != "zos"', { 218 'cflags': [ 219 '-fvisibility=hidden', 220 '-g', 221 '--std=gnu89', 222 '-Wall', 223 '-Wextra', 224 '-Wno-unused-parameter', 225 '-Wstrict-prototypes', 226 '-fno-strict-aliasing', 227 ], 228 }], 229 [ 'OS in "mac ios"', { 230 'sources': [ 231 'src/unix/darwin.c', 232 'src/unix/fsevents.c', 233 'src/unix/darwin-proctitle.c', 234 'src/unix/random-getentropy.c', 235 ], 236 'defines': [ 237 '_DARWIN_USE_64_BIT_INODE=1', 238 '_DARWIN_UNLIMITED_SELECT=1', 239 ] 240 }], 241 [ 'OS=="linux"', { 242 'defines': [ '_GNU_SOURCE' ], 243 'sources': [ 244 'src/unix/epoll.c', 245 'src/unix/linux-core.c', 246 'src/unix/linux-inotify.c', 247 'src/unix/linux-syscalls.c', 248 'src/unix/linux-syscalls.h', 249 'src/unix/procfs-exepath.c', 250 'src/unix/random-getrandom.c', 251 'src/unix/random-sysctl-linux.c', 252 ], 253 'link_settings': { 254 'libraries': [ '-ldl', '-lrt' ], 255 }, 256 }], 257 [ 'OS=="android"', { 258 'defines': [ 259 '_GNU_SOURCE', 260 ], 261 'sources': [ 262 'src/unix/linux-core.c', 263 'src/unix/linux-inotify.c', 264 'src/unix/linux-syscalls.c', 265 'src/unix/procfs-exepath.c', 266 'src/unix/pthread-fixes.c', 267 'src/unix/random-getentropy.c', 268 'src/unix/random-getrandom.c', 269 'src/unix/random-sysctl-linux.c', 270 'src/unix/epoll.c', 271 ], 272 'link_settings': { 273 'libraries': [ '-ldl' ], 274 }, 275 }], 276 [ 'OS=="solaris"', { 277 'sources': [ 278 'src/unix/no-proctitle.c', 279 'src/unix/sunos.c', 280 ], 281 'defines': [ 282 '__EXTENSIONS__', 283 '_XOPEN_SOURCE=500', 284 '_REENTRANT', 285 ], 286 'link_settings': { 287 'libraries': [ 288 '-lkstat', 289 '-lnsl', 290 '-lsendfile', 291 '-lsocket', 292 ], 293 }, 294 }], 295 [ 'OS=="aix"', { 296 'variables': { 297 'os_name': '<!(uname -s)', 298 }, 299 'sources': [ 300 'src/unix/aix-common.c', 301 ], 302 'defines': [ 303 '_ALL_SOURCE', 304 '_XOPEN_SOURCE=500', 305 '_LINUX_SOURCE_COMPAT', 306 '_THREAD_SAFE', 307 ], 308 'conditions': [ 309 [ '"<(os_name)"=="OS400"', { 310 'sources': [ 311 'src/unix/ibmi.c', 312 'src/unix/posix-poll.c', 313 'src/unix/no-fsevents.c', 314 'src/unix/no-proctitle.c', 315 ], 316 }, { 317 'sources': [ 318 'src/unix/aix.c' 319 ], 320 'defines': [ 321 'HAVE_SYS_AHAFS_EVPRODS_H' 322 ], 323 'link_settings': { 324 'libraries': [ 325 '-lperfstat', 326 ], 327 }, 328 }], 329 ] 330 }], 331 [ 'OS=="os400"', { 332 'sources': [ 333 'src/unix/aix-common.c', 334 'src/unix/ibmi.c', 335 'src/unix/posix-poll.c', 336 'src/unix/no-fsevents.c', 337 'src/unix/no-proctitle.c', 338 ], 339 'defines': [ 340 '_ALL_SOURCE', 341 '_XOPEN_SOURCE=500', 342 '_LINUX_SOURCE_COMPAT', 343 '_THREAD_SAFE', 344 ], 345 }], 346 [ 'OS=="freebsd" or OS=="dragonflybsd"', { 347 'sources': [ 'src/unix/freebsd.c' ], 348 }], 349 [ 'OS=="freebsd"', { 350 'sources': [ 'src/unix/random-getrandom.c' ], 351 }], 352 [ 'OS=="openbsd"', { 353 'sources': [ 354 'src/unix/openbsd.c', 355 'src/unix/random-getentropy.c', 356 ], 357 }], 358 [ 'OS=="netbsd"', { 359 'link_settings': { 360 'libraries': [ '-lkvm' ], 361 }, 362 'sources': [ 'src/unix/netbsd.c' ], 363 }], 364 [ 'OS in "freebsd dragonflybsd openbsd netbsd".split()', { 365 'sources': [ 366 'src/unix/posix-hrtime.c', 367 'src/unix/bsd-proctitle.c' 368 ], 369 }], 370 [ 'OS in "ios mac freebsd dragonflybsd openbsd netbsd".split()', { 371 'sources': [ 372 'src/unix/bsd-ifaddrs.c', 373 'src/unix/kqueue.c', 374 ], 375 }], 376 ['uv_library=="shared_library"', { 377 'defines': [ 'BUILDING_UV_SHARED=1' ] 378 }], 379 ['OS=="zos"', { 380 'sources': [ 381 'src/unix/pthread-fixes.c', 382 'src/unix/os390.c', 383 'src/unix/os390-syscalls.c' 384 ] 385 }], 386 ] 387 }, 388 ] 389} 390