rbuv 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (233) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +5 -0
  3. data/.rspec +2 -0
  4. data/.travis.yml +5 -0
  5. data/Gemfile +0 -1
  6. data/README.md +6 -1
  7. data/Rakefile +42 -0
  8. data/deps/libuv/.gitignore +34 -0
  9. data/deps/libuv/.mailmap +16 -0
  10. data/deps/libuv/AUTHORS +81 -0
  11. data/deps/libuv/ChangeLog +45 -0
  12. data/deps/libuv/LICENSE +41 -0
  13. data/deps/libuv/Makefile +53 -0
  14. data/deps/libuv/README.md +118 -0
  15. data/deps/libuv/build.mk +164 -0
  16. data/deps/libuv/checksparse.sh +230 -0
  17. data/deps/libuv/common.gypi +197 -0
  18. data/deps/libuv/config-mingw.mk +48 -0
  19. data/deps/libuv/config-unix.mk +167 -0
  20. data/deps/libuv/gyp_uv +98 -0
  21. data/deps/libuv/include/uv-private/ngx-queue.h +129 -0
  22. data/deps/libuv/include/uv-private/stdint-msvc2008.h +247 -0
  23. data/deps/libuv/include/uv-private/tree.h +768 -0
  24. data/deps/libuv/include/uv-private/uv-bsd.h +34 -0
  25. data/deps/libuv/include/uv-private/uv-darwin.h +61 -0
  26. data/deps/libuv/include/uv-private/uv-linux.h +34 -0
  27. data/deps/libuv/include/uv-private/uv-sunos.h +44 -0
  28. data/deps/libuv/include/uv-private/uv-unix.h +332 -0
  29. data/deps/libuv/include/uv-private/uv-win.h +585 -0
  30. data/deps/libuv/include/uv.h +1987 -0
  31. data/deps/libuv/src/fs-poll.c +248 -0
  32. data/deps/libuv/src/inet.c +298 -0
  33. data/deps/libuv/src/unix/aix.c +393 -0
  34. data/deps/libuv/src/unix/async.c +281 -0
  35. data/deps/libuv/src/unix/core.c +714 -0
  36. data/deps/libuv/src/unix/cygwin.c +93 -0
  37. data/deps/libuv/src/unix/darwin-proctitle.m +78 -0
  38. data/deps/libuv/src/unix/darwin.c +431 -0
  39. data/deps/libuv/src/unix/dl.c +83 -0
  40. data/deps/libuv/src/unix/error.c +109 -0
  41. data/deps/libuv/src/unix/freebsd.c +343 -0
  42. data/deps/libuv/src/unix/fs.c +869 -0
  43. data/deps/libuv/src/unix/fsevents.c +299 -0
  44. data/deps/libuv/src/unix/getaddrinfo.c +159 -0
  45. data/deps/libuv/src/unix/internal.h +259 -0
  46. data/deps/libuv/src/unix/kqueue.c +347 -0
  47. data/deps/libuv/src/unix/linux-core.c +724 -0
  48. data/deps/libuv/src/unix/linux-inotify.c +236 -0
  49. data/deps/libuv/src/unix/linux-syscalls.c +388 -0
  50. data/deps/libuv/src/unix/linux-syscalls.h +150 -0
  51. data/deps/libuv/src/unix/loop-watcher.c +64 -0
  52. data/deps/libuv/src/unix/loop.c +114 -0
  53. data/deps/libuv/src/unix/netbsd.c +353 -0
  54. data/deps/libuv/src/unix/openbsd.c +304 -0
  55. data/deps/libuv/src/unix/pipe.c +261 -0
  56. data/deps/libuv/src/unix/poll.c +108 -0
  57. data/deps/libuv/src/unix/process.c +501 -0
  58. data/deps/libuv/src/unix/proctitle.c +103 -0
  59. data/deps/libuv/src/unix/signal.c +455 -0
  60. data/deps/libuv/src/unix/stream.c +1380 -0
  61. data/deps/libuv/src/unix/sunos.c +647 -0
  62. data/deps/libuv/src/unix/tcp.c +357 -0
  63. data/deps/libuv/src/unix/thread.c +431 -0
  64. data/deps/libuv/src/unix/threadpool.c +286 -0
  65. data/deps/libuv/src/unix/timer.c +153 -0
  66. data/deps/libuv/src/unix/tty.c +179 -0
  67. data/deps/libuv/src/unix/udp.c +715 -0
  68. data/deps/libuv/src/uv-common.c +431 -0
  69. data/deps/libuv/src/uv-common.h +204 -0
  70. data/deps/libuv/src/version.c +60 -0
  71. data/deps/libuv/src/win/async.c +99 -0
  72. data/deps/libuv/src/win/atomicops-inl.h +56 -0
  73. data/deps/libuv/src/win/core.c +310 -0
  74. data/deps/libuv/src/win/dl.c +86 -0
  75. data/deps/libuv/src/win/error.c +164 -0
  76. data/deps/libuv/src/win/fs-event.c +506 -0
  77. data/deps/libuv/src/win/fs.c +1951 -0
  78. data/deps/libuv/src/win/getaddrinfo.c +365 -0
  79. data/deps/libuv/src/win/handle-inl.h +164 -0
  80. data/deps/libuv/src/win/handle.c +153 -0
  81. data/deps/libuv/src/win/internal.h +346 -0
  82. data/deps/libuv/src/win/loop-watcher.c +124 -0
  83. data/deps/libuv/src/win/pipe.c +1656 -0
  84. data/deps/libuv/src/win/poll.c +615 -0
  85. data/deps/libuv/src/win/process-stdio.c +503 -0
  86. data/deps/libuv/src/win/process.c +1048 -0
  87. data/deps/libuv/src/win/req-inl.h +224 -0
  88. data/deps/libuv/src/win/req.c +25 -0
  89. data/deps/libuv/src/win/signal.c +354 -0
  90. data/deps/libuv/src/win/stream-inl.h +67 -0
  91. data/deps/libuv/src/win/stream.c +198 -0
  92. data/deps/libuv/src/win/tcp.c +1422 -0
  93. data/deps/libuv/src/win/thread.c +666 -0
  94. data/deps/libuv/src/win/threadpool.c +82 -0
  95. data/deps/libuv/src/win/timer.c +230 -0
  96. data/deps/libuv/src/win/tty.c +1857 -0
  97. data/deps/libuv/src/win/udp.c +744 -0
  98. data/deps/libuv/src/win/util.c +946 -0
  99. data/deps/libuv/src/win/winapi.c +152 -0
  100. data/deps/libuv/src/win/winapi.h +4476 -0
  101. data/deps/libuv/src/win/winsock.c +560 -0
  102. data/deps/libuv/src/win/winsock.h +171 -0
  103. data/deps/libuv/test/benchmark-async-pummel.c +119 -0
  104. data/deps/libuv/test/benchmark-async.c +139 -0
  105. data/deps/libuv/test/benchmark-fs-stat.c +136 -0
  106. data/deps/libuv/test/benchmark-getaddrinfo.c +91 -0
  107. data/deps/libuv/test/benchmark-list.h +163 -0
  108. data/deps/libuv/test/benchmark-loop-count.c +90 -0
  109. data/deps/libuv/test/benchmark-million-async.c +112 -0
  110. data/deps/libuv/test/benchmark-million-timers.c +77 -0
  111. data/deps/libuv/test/benchmark-multi-accept.c +432 -0
  112. data/deps/libuv/test/benchmark-ping-pongs.c +212 -0
  113. data/deps/libuv/test/benchmark-pound.c +325 -0
  114. data/deps/libuv/test/benchmark-pump.c +459 -0
  115. data/deps/libuv/test/benchmark-sizes.c +45 -0
  116. data/deps/libuv/test/benchmark-spawn.c +163 -0
  117. data/deps/libuv/test/benchmark-tcp-write-batch.c +141 -0
  118. data/deps/libuv/test/benchmark-thread.c +64 -0
  119. data/deps/libuv/test/benchmark-udp-pummel.c +238 -0
  120. data/deps/libuv/test/blackhole-server.c +118 -0
  121. data/deps/libuv/test/dns-server.c +329 -0
  122. data/deps/libuv/test/echo-server.c +384 -0
  123. data/deps/libuv/test/fixtures/empty_file +0 -0
  124. data/deps/libuv/test/fixtures/load_error.node +1 -0
  125. data/deps/libuv/test/run-benchmarks.c +64 -0
  126. data/deps/libuv/test/run-tests.c +159 -0
  127. data/deps/libuv/test/runner-unix.c +328 -0
  128. data/deps/libuv/test/runner-unix.h +36 -0
  129. data/deps/libuv/test/runner-win.c +318 -0
  130. data/deps/libuv/test/runner-win.h +43 -0
  131. data/deps/libuv/test/runner.c +394 -0
  132. data/deps/libuv/test/runner.h +165 -0
  133. data/deps/libuv/test/task.h +122 -0
  134. data/deps/libuv/test/test-active.c +83 -0
  135. data/deps/libuv/test/test-async.c +136 -0
  136. data/deps/libuv/test/test-barrier.c +98 -0
  137. data/deps/libuv/test/test-callback-order.c +77 -0
  138. data/deps/libuv/test/test-callback-stack.c +204 -0
  139. data/deps/libuv/test/test-condvar.c +173 -0
  140. data/deps/libuv/test/test-connection-fail.c +150 -0
  141. data/deps/libuv/test/test-cwd-and-chdir.c +64 -0
  142. data/deps/libuv/test/test-delayed-accept.c +189 -0
  143. data/deps/libuv/test/test-dlerror.c +58 -0
  144. data/deps/libuv/test/test-embed.c +136 -0
  145. data/deps/libuv/test/test-error.c +59 -0
  146. data/deps/libuv/test/test-fail-always.c +29 -0
  147. data/deps/libuv/test/test-fs-event.c +504 -0
  148. data/deps/libuv/test/test-fs-poll.c +148 -0
  149. data/deps/libuv/test/test-fs.c +1899 -0
  150. data/deps/libuv/test/test-get-currentexe.c +63 -0
  151. data/deps/libuv/test/test-get-loadavg.c +36 -0
  152. data/deps/libuv/test/test-get-memory.c +38 -0
  153. data/deps/libuv/test/test-getaddrinfo.c +120 -0
  154. data/deps/libuv/test/test-getsockname.c +344 -0
  155. data/deps/libuv/test/test-hrtime.c +54 -0
  156. data/deps/libuv/test/test-idle.c +82 -0
  157. data/deps/libuv/test/test-ipc-send-recv.c +218 -0
  158. data/deps/libuv/test/test-ipc.c +625 -0
  159. data/deps/libuv/test/test-list.h +492 -0
  160. data/deps/libuv/test/test-loop-handles.c +337 -0
  161. data/deps/libuv/test/test-loop-stop.c +73 -0
  162. data/deps/libuv/test/test-multiple-listen.c +103 -0
  163. data/deps/libuv/test/test-mutexes.c +63 -0
  164. data/deps/libuv/test/test-pass-always.c +28 -0
  165. data/deps/libuv/test/test-ping-pong.c +250 -0
  166. data/deps/libuv/test/test-pipe-bind-error.c +144 -0
  167. data/deps/libuv/test/test-pipe-connect-error.c +98 -0
  168. data/deps/libuv/test/test-platform-output.c +87 -0
  169. data/deps/libuv/test/test-poll-close.c +73 -0
  170. data/deps/libuv/test/test-poll.c +575 -0
  171. data/deps/libuv/test/test-process-title.c +49 -0
  172. data/deps/libuv/test/test-ref.c +415 -0
  173. data/deps/libuv/test/test-run-nowait.c +46 -0
  174. data/deps/libuv/test/test-run-once.c +49 -0
  175. data/deps/libuv/test/test-semaphore.c +111 -0
  176. data/deps/libuv/test/test-shutdown-close.c +105 -0
  177. data/deps/libuv/test/test-shutdown-eof.c +184 -0
  178. data/deps/libuv/test/test-signal-multiple-loops.c +270 -0
  179. data/deps/libuv/test/test-signal.c +152 -0
  180. data/deps/libuv/test/test-spawn.c +938 -0
  181. data/deps/libuv/test/test-stdio-over-pipes.c +250 -0
  182. data/deps/libuv/test/test-tcp-bind-error.c +198 -0
  183. data/deps/libuv/test/test-tcp-bind6-error.c +159 -0
  184. data/deps/libuv/test/test-tcp-close-while-connecting.c +81 -0
  185. data/deps/libuv/test/test-tcp-close.c +130 -0
  186. data/deps/libuv/test/test-tcp-connect-error-after-write.c +96 -0
  187. data/deps/libuv/test/test-tcp-connect-error.c +71 -0
  188. data/deps/libuv/test/test-tcp-connect-timeout.c +86 -0
  189. data/deps/libuv/test/test-tcp-connect6-error.c +69 -0
  190. data/deps/libuv/test/test-tcp-flags.c +52 -0
  191. data/deps/libuv/test/test-tcp-open.c +175 -0
  192. data/deps/libuv/test/test-tcp-read-stop.c +73 -0
  193. data/deps/libuv/test/test-tcp-shutdown-after-write.c +132 -0
  194. data/deps/libuv/test/test-tcp-unexpected-read.c +114 -0
  195. data/deps/libuv/test/test-tcp-write-to-half-open-connection.c +136 -0
  196. data/deps/libuv/test/test-tcp-writealot.c +171 -0
  197. data/deps/libuv/test/test-thread.c +183 -0
  198. data/deps/libuv/test/test-threadpool-cancel.c +311 -0
  199. data/deps/libuv/test/test-threadpool.c +77 -0
  200. data/deps/libuv/test/test-timer-again.c +142 -0
  201. data/deps/libuv/test/test-timer.c +266 -0
  202. data/deps/libuv/test/test-tty.c +111 -0
  203. data/deps/libuv/test/test-udp-dgram-too-big.c +87 -0
  204. data/deps/libuv/test/test-udp-ipv6.c +158 -0
  205. data/deps/libuv/test/test-udp-multicast-join.c +140 -0
  206. data/deps/libuv/test/test-udp-multicast-ttl.c +87 -0
  207. data/deps/libuv/test/test-udp-open.c +154 -0
  208. data/deps/libuv/test/test-udp-options.c +87 -0
  209. data/deps/libuv/test/test-udp-send-and-recv.c +210 -0
  210. data/deps/libuv/test/test-util.c +97 -0
  211. data/deps/libuv/test/test-walk-handles.c +78 -0
  212. data/deps/libuv/uv.gyp +431 -0
  213. data/deps/libuv/vcbuild.bat +128 -0
  214. data/ext/rbuv/debug.h +27 -0
  215. data/ext/rbuv/error.c +7 -0
  216. data/ext/rbuv/error.h +10 -0
  217. data/ext/rbuv/extconf.rb +35 -0
  218. data/ext/rbuv/handle.c +40 -0
  219. data/ext/rbuv/handle.h +14 -0
  220. data/ext/rbuv/libuv.mk +12 -0
  221. data/ext/rbuv/loop.c +50 -0
  222. data/ext/rbuv/loop.h +13 -0
  223. data/ext/rbuv/rbuv.c +15 -0
  224. data/ext/rbuv/rbuv.h +27 -0
  225. data/ext/rbuv/timer.c +133 -0
  226. data/ext/rbuv/timer.h +13 -0
  227. data/lib/rbuv/timer.rb +7 -0
  228. data/lib/rbuv/version.rb +1 -1
  229. data/lib/rbuv.rb +24 -2
  230. data/rbuv.gemspec +5 -1
  231. data/spec/spec_helper.rb +22 -0
  232. data/spec/timer_spec.rb +144 -0
  233. metadata +278 -9
@@ -0,0 +1,230 @@
1
+ #!/bin/sh
2
+
3
+ # Copyright (c) 2013, Ben Noordhuis <info@bnoordhuis.nl>
4
+ #
5
+ # Permission to use, copy, modify, and/or distribute this software for any
6
+ # purpose with or without fee is hereby granted, provided that the above
7
+ # copyright notice and this permission notice appear in all copies.
8
+ #
9
+ # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10
+ # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11
+ # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12
+ # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13
+ # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14
+ # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15
+ # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16
+
17
+ SPARSE=${SPARSE:-sparse}
18
+
19
+ SPARSE_FLAGS=${SPARSE_FLAGS:-"
20
+ -D__POSIX__
21
+ -Wsparse-all
22
+ -Wno-do-while
23
+ -Wno-transparent-union
24
+ -Iinclude
25
+ -Iinclude/uv-private
26
+ -Isrc
27
+ "}
28
+
29
+ SOURCES="
30
+ include/uv-private/ngx-queue.h
31
+ include/uv-private/tree.h
32
+ include/uv-private/uv-unix.h
33
+ include/uv.h
34
+ src/fs-poll.c
35
+ src/inet.c
36
+ src/unix/async.c
37
+ src/unix/core.c
38
+ src/unix/dl.c
39
+ src/unix/error.c
40
+ src/unix/fs.c
41
+ src/unix/getaddrinfo.c
42
+ src/unix/internal.h
43
+ src/unix/loop-watcher.c
44
+ src/unix/loop.c
45
+ src/unix/pipe.c
46
+ src/unix/poll.c
47
+ src/unix/process.c
48
+ src/unix/signal.c
49
+ src/unix/stream.c
50
+ src/unix/tcp.c
51
+ src/unix/thread.c
52
+ src/unix/threadpool.c
53
+ src/unix/timer.c
54
+ src/unix/tty.c
55
+ src/unix/udp.c
56
+ src/uv-common.c
57
+ src/uv-common.h
58
+ "
59
+
60
+ TESTS="
61
+ test/benchmark-async-pummel.c
62
+ test/benchmark-async.c
63
+ test/benchmark-fs-stat.c
64
+ test/benchmark-getaddrinfo.c
65
+ test/benchmark-loop-count.c
66
+ test/benchmark-million-async.c
67
+ test/benchmark-million-timers.c
68
+ test/benchmark-multi-accept.c
69
+ test/benchmark-ping-pongs.c
70
+ test/benchmark-pound.c
71
+ test/benchmark-pump.c
72
+ test/benchmark-sizes.c
73
+ test/benchmark-spawn.c
74
+ test/benchmark-tcp-write-batch.c
75
+ test/benchmark-thread.c
76
+ test/benchmark-udp-pummel.c
77
+ test/blackhole-server.c
78
+ test/dns-server.c
79
+ test/echo-server.c
80
+ test/run-benchmarks.c
81
+ test/run-tests.c
82
+ test/runner-unix.c
83
+ test/runner-unix.h
84
+ test/runner.c
85
+ test/runner.h
86
+ test/task.h
87
+ test/test-active.c
88
+ test/test-async.c
89
+ test/test-barrier.c
90
+ test/test-callback-order.c
91
+ test/test-callback-stack.c
92
+ test/test-condvar.c
93
+ test/test-connection-fail.c
94
+ test/test-cwd-and-chdir.c
95
+ test/test-delayed-accept.c
96
+ test/test-dlerror.c
97
+ test/test-embed.c
98
+ test/test-error.c
99
+ test/test-fail-always.c
100
+ test/test-fs-event.c
101
+ test/test-fs-poll.c
102
+ test/test-fs.c
103
+ test/test-get-currentexe.c
104
+ test/test-get-loadavg.c
105
+ test/test-get-memory.c
106
+ test/test-getaddrinfo.c
107
+ test/test-getsockname.c
108
+ test/test-hrtime.c
109
+ test/test-idle.c
110
+ test/test-ipc-send-recv.c
111
+ test/test-ipc.c
112
+ test/test-loop-handles.c
113
+ test/test-multiple-listen.c
114
+ test/test-mutexes.c
115
+ test/test-pass-always.c
116
+ test/test-ping-pong.c
117
+ test/test-pipe-bind-error.c
118
+ test/test-pipe-connect-error.c
119
+ test/test-platform-output.c
120
+ test/test-poll-close.c
121
+ test/test-poll.c
122
+ test/test-process-title.c
123
+ test/test-ref.c
124
+ test/test-run-nowait.c
125
+ test/test-run-once.c
126
+ test/test-semaphore.c
127
+ test/test-shutdown-close.c
128
+ test/test-shutdown-eof.c
129
+ test/test-signal-multiple-loops.c
130
+ test/test-signal.c
131
+ test/test-spawn.c
132
+ test/test-stdio-over-pipes.c
133
+ test/test-tcp-bind-error.c
134
+ test/test-tcp-bind6-error.c
135
+ test/test-tcp-close-while-connecting.c
136
+ test/test-tcp-close.c
137
+ test/test-tcp-connect-error-after-write.c
138
+ test/test-tcp-connect-error.c
139
+ test/test-tcp-connect-timeout.c
140
+ test/test-tcp-connect6-error.c
141
+ test/test-tcp-flags.c
142
+ test/test-tcp-open.c
143
+ test/test-tcp-read-stop.c
144
+ test/test-tcp-shutdown-after-write.c
145
+ test/test-tcp-unexpected-read.c
146
+ test/test-tcp-write-error.c
147
+ test/test-tcp-write-to-half-open-connection.c
148
+ test/test-tcp-writealot.c
149
+ test/test-thread.c
150
+ test/test-threadpool-cancel.c
151
+ test/test-threadpool.c
152
+ test/test-timer-again.c
153
+ test/test-timer.c
154
+ test/test-tty.c
155
+ test/test-udp-dgram-too-big.c
156
+ test/test-udp-ipv6.c
157
+ test/test-udp-multicast-join.c
158
+ test/test-udp-multicast-ttl.c
159
+ test/test-udp-open.c
160
+ test/test-udp-options.c
161
+ test/test-udp-send-and-recv.c
162
+ test/test-util.c
163
+ test/test-walk-handles.c
164
+ "
165
+
166
+ case `uname -s` in
167
+ AIX)
168
+ SPARSE_FLAGS="$SPARSE_FLAGS -D_AIX=1"
169
+ SOURCES="$SOURCES
170
+ src/unix/aix.c"
171
+ ;;
172
+ Darwin)
173
+ SPARSE_FLAGS="$SPARSE_FLAGS -D__APPLE__=1"
174
+ SOURCES="$SOURCES
175
+ include/uv-private/uv-bsd.h
176
+ src/unix/darwin.c
177
+ src/unix/kqueue.c
178
+ src/unix/fsevents.c"
179
+ ;;
180
+ DragonFly)
181
+ SPARSE_FLAGS="$SPARSE_FLAGS -D__DragonFly__=1"
182
+ SOURCES="$SOURCES
183
+ include/uv-private/uv-bsd.h
184
+ src/unix/kqueue.c
185
+ src/unix/freebsd.c"
186
+ ;;
187
+ FreeBSD)
188
+ SPARSE_FLAGS="$SPARSE_FLAGS -D__FreeBSD__=1"
189
+ SOURCES="$SOURCES
190
+ include/uv-private/uv-bsd.h
191
+ src/unix/kqueue.c
192
+ src/unix/freebsd.c"
193
+ ;;
194
+ Linux)
195
+ SPARSE_FLAGS="$SPARSE_FLAGS -D__linux__=1"
196
+ SOURCES="$SOURCES
197
+ include/uv-private/uv-linux.h
198
+ src/unix/linux-inotify.c
199
+ src/unix/linux-core.c
200
+ src/unix/linux-syscalls.c
201
+ src/unix/linux-syscalls.h"
202
+ ;;
203
+ NetBSD)
204
+ SPARSE_FLAGS="$SPARSE_FLAGS -D__NetBSD__=1"
205
+ SOURCES="$SOURCES
206
+ include/uv-private/uv-bsd.h
207
+ src/unix/kqueue.c
208
+ src/unix/netbsd.c"
209
+ ;;
210
+ OpenBSD)
211
+ SPARSE_FLAGS="$SPARSE_FLAGS -D__OpenBSD__=1"
212
+ SOURCES="$SOURCES
213
+ include/uv-private/uv-bsd.h
214
+ src/unix/kqueue.c
215
+ src/unix/openbsd.c"
216
+ ;;
217
+ SunOS)
218
+ SPARSE_FLAGS="$SPARSE_FLAGS -D__sun=1"
219
+ SOURCES="$SOURCES
220
+ include/uv-private/uv-sunos.h
221
+ src/unix/sunos.c"
222
+ ;;
223
+ esac
224
+
225
+ for ARCH in __i386__ __x86_64__ __arm__; do
226
+ $SPARSE $SPARSE_FLAGS -D$ARCH=1 $SOURCES
227
+ done
228
+
229
+ # Tests are architecture independent.
230
+ $SPARSE $SPARSE_FLAGS -Itest $TESTS
@@ -0,0 +1,197 @@
1
+ {
2
+ 'variables': {
3
+ 'visibility%': 'hidden', # V8's visibility setting
4
+ 'target_arch%': 'ia32', # set v8's target architecture
5
+ 'host_arch%': 'ia32', # set v8's host architecture
6
+ 'library%': 'static_library', # allow override to 'shared_library' for DLL/.so builds
7
+ 'component%': 'static_library', # NB. these names match with what V8 expects
8
+ 'msvs_multi_core_compile': '0', # we do enable multicore compiles, but not using the V8 way
9
+ 'gcc_version%': 'unknown',
10
+ 'clang%': 0,
11
+ },
12
+
13
+ 'target_defaults': {
14
+ 'default_configuration': 'Debug',
15
+ 'configurations': {
16
+ 'Debug': {
17
+ 'defines': [ 'DEBUG', '_DEBUG' ],
18
+ 'cflags': [ '-g', '-O0', '-fwrapv' ],
19
+ 'msvs_settings': {
20
+ 'VCCLCompilerTool': {
21
+ 'target_conditions': [
22
+ ['library=="static_library"', {
23
+ 'RuntimeLibrary': 1, # static debug
24
+ }, {
25
+ 'RuntimeLibrary': 3, # DLL debug
26
+ }],
27
+ ],
28
+ 'Optimization': 0, # /Od, no optimization
29
+ 'MinimalRebuild': 'false',
30
+ 'OmitFramePointers': 'false',
31
+ 'BasicRuntimeChecks': 3, # /RTC1
32
+ },
33
+ 'VCLinkerTool': {
34
+ 'LinkIncremental': 2, # enable incremental linking
35
+ },
36
+ },
37
+ 'xcode_settings': {
38
+ 'GCC_OPTIMIZATION_LEVEL': '0',
39
+ },
40
+ 'conditions': [
41
+ ['OS != "win"', {
42
+ 'defines': [ 'EV_VERIFY=2' ],
43
+ }],
44
+ ]
45
+ },
46
+ 'Release': {
47
+ 'defines': [ 'NDEBUG' ],
48
+ 'cflags': [
49
+ '-O3',
50
+ '-fstrict-aliasing',
51
+ '-fomit-frame-pointer',
52
+ '-fdata-sections',
53
+ '-ffunction-sections',
54
+ ],
55
+ 'msvs_settings': {
56
+ 'VCCLCompilerTool': {
57
+ 'target_conditions': [
58
+ ['library=="static_library"', {
59
+ 'RuntimeLibrary': 0, # static release
60
+ }, {
61
+ 'RuntimeLibrary': 2, # debug release
62
+ }],
63
+ ],
64
+ 'Optimization': 3, # /Ox, full optimization
65
+ 'FavorSizeOrSpeed': 1, # /Ot, favour speed over size
66
+ 'InlineFunctionExpansion': 2, # /Ob2, inline anything eligible
67
+ 'WholeProgramOptimization': 'true', # /GL, whole program optimization, needed for LTCG
68
+ 'OmitFramePointers': 'true',
69
+ 'EnableFunctionLevelLinking': 'true',
70
+ 'EnableIntrinsicFunctions': 'true',
71
+ },
72
+ 'VCLibrarianTool': {
73
+ 'AdditionalOptions': [
74
+ '/LTCG', # link time code generation
75
+ ],
76
+ },
77
+ 'VCLinkerTool': {
78
+ 'LinkTimeCodeGeneration': 1, # link-time code generation
79
+ 'OptimizeReferences': 2, # /OPT:REF
80
+ 'EnableCOMDATFolding': 2, # /OPT:ICF
81
+ 'LinkIncremental': 1, # disable incremental linking
82
+ },
83
+ },
84
+ }
85
+ },
86
+ 'msvs_settings': {
87
+ 'VCCLCompilerTool': {
88
+ 'StringPooling': 'true', # pool string literals
89
+ 'DebugInformationFormat': 3, # Generate a PDB
90
+ 'WarningLevel': 3,
91
+ 'BufferSecurityCheck': 'true',
92
+ 'ExceptionHandling': 1, # /EHsc
93
+ 'SuppressStartupBanner': 'true',
94
+ 'WarnAsError': 'false',
95
+ 'AdditionalOptions': [
96
+ '/MP', # compile across multiple CPUs
97
+ ],
98
+ },
99
+ 'VCLibrarianTool': {
100
+ },
101
+ 'VCLinkerTool': {
102
+ 'GenerateDebugInformation': 'true',
103
+ 'RandomizedBaseAddress': 2, # enable ASLR
104
+ 'DataExecutionPrevention': 2, # enable DEP
105
+ 'AllowIsolation': 'true',
106
+ 'SuppressStartupBanner': 'true',
107
+ 'target_conditions': [
108
+ ['_type=="executable"', {
109
+ 'SubSystem': 1, # console executable
110
+ }],
111
+ ],
112
+ },
113
+ },
114
+ 'conditions': [
115
+ ['OS == "win"', {
116
+ 'msvs_cygwin_shell': 0, # prevent actions from trying to use cygwin
117
+ 'defines': [
118
+ 'WIN32',
119
+ # we don't really want VC++ warning us about
120
+ # how dangerous C functions are...
121
+ '_CRT_SECURE_NO_DEPRECATE',
122
+ # ... or that C implementations shouldn't use
123
+ # POSIX names
124
+ '_CRT_NONSTDC_NO_DEPRECATE',
125
+ ],
126
+ 'target_conditions': [
127
+ ['target_arch=="x64"', {
128
+ 'msvs_configuration_platform': 'x64'
129
+ }]
130
+ ]
131
+ }],
132
+ [ 'OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="solaris"', {
133
+ 'cflags': [ '-Wall' ],
134
+ 'cflags_cc': [ '-fno-rtti', '-fno-exceptions' ],
135
+ 'conditions': [
136
+ [ 'host_arch != target_arch and target_arch=="ia32"', {
137
+ 'cflags': [ '-m32' ],
138
+ 'ldflags': [ '-m32' ],
139
+ }],
140
+ [ 'OS=="linux"', {
141
+ 'cflags': [ '-ansi' ],
142
+ }],
143
+ [ 'OS=="solaris"', {
144
+ 'cflags': [ '-pthreads' ],
145
+ 'ldflags': [ '-pthreads' ],
146
+ }, {
147
+ 'cflags': [ '-pthread' ],
148
+ 'ldflags': [ '-pthread' ],
149
+ }],
150
+ [ 'visibility=="hidden" and (clang==1 or gcc_version >= 40)', {
151
+ 'cflags': [ '-fvisibility=hidden' ],
152
+ }],
153
+ ],
154
+ }],
155
+ ['OS=="mac"', {
156
+ 'xcode_settings': {
157
+ 'ALWAYS_SEARCH_USER_PATHS': 'NO',
158
+ 'GCC_CW_ASM_SYNTAX': 'NO', # No -fasm-blocks
159
+ 'GCC_DYNAMIC_NO_PIC': 'NO', # No -mdynamic-no-pic
160
+ # (Equivalent to -fPIC)
161
+ 'GCC_ENABLE_CPP_EXCEPTIONS': 'NO', # -fno-exceptions
162
+ 'GCC_ENABLE_CPP_RTTI': 'NO', # -fno-rtti
163
+ 'GCC_ENABLE_PASCAL_STRINGS': 'NO', # No -mpascal-strings
164
+ # GCC_INLINES_ARE_PRIVATE_EXTERN maps to -fvisibility-inlines-hidden
165
+ 'GCC_INLINES_ARE_PRIVATE_EXTERN': 'YES',
166
+ 'GCC_SYMBOLS_PRIVATE_EXTERN': 'YES', # -fvisibility=hidden
167
+ 'GCC_THREADSAFE_STATICS': 'NO', # -fno-threadsafe-statics
168
+ 'GCC_WARN_ABOUT_MISSING_NEWLINE': 'YES', # -Wnewline-eof
169
+ 'PREBINDING': 'NO', # No -Wl,-prebind
170
+ 'USE_HEADERMAP': 'NO',
171
+ 'OTHER_CFLAGS': [
172
+ '-fstrict-aliasing',
173
+ ],
174
+ 'WARNING_CFLAGS': [
175
+ '-Wall',
176
+ '-Wendif-labels',
177
+ '-W',
178
+ '-Wno-unused-parameter',
179
+ ],
180
+ },
181
+ 'conditions': [
182
+ ['target_arch=="ia32"', {
183
+ 'xcode_settings': {'ARCHS': ['i386']},
184
+ }],
185
+ ['target_arch=="x64"', {
186
+ 'xcode_settings': {'ARCHS': ['x86_64']},
187
+ }],
188
+ ],
189
+ 'target_conditions': [
190
+ ['_type!="static_library"', {
191
+ 'xcode_settings': {'OTHER_LDFLAGS': ['-Wl,-search_paths_first']},
192
+ }],
193
+ ],
194
+ }],
195
+ ],
196
+ },
197
+ }
@@ -0,0 +1,48 @@
1
+ # Copyright Joyent, Inc. and other Node contributors. All rights reserved.
2
+ #
3
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ # of this software and associated documentation files (the "Software"), to
5
+ # deal in the Software without restriction, including without limitation the
6
+ # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
7
+ # sell copies of the Software, and to permit persons to whom the Software is
8
+ # furnished to do so, subject to the following conditions:
9
+ #
10
+ # The above copyright notice and this permission notice shall be included in
11
+ # all copies or substantial portions of the Software.
12
+ #
13
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
18
+ # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
19
+ # IN THE SOFTWARE.
20
+
21
+ # Use make -f Makefile.gcc PREFIX=i686-w64-mingw32-
22
+ # for cross compilation
23
+ CC = $(PREFIX)gcc
24
+ AR = $(PREFIX)ar
25
+ E=.exe
26
+
27
+ CFLAGS=$(CPPFLAGS) -g --std=gnu89 -D_WIN32_WINNT=0x0600
28
+ LDFLAGS=-lm
29
+
30
+ WIN_SRCS=$(wildcard $(SRCDIR)/src/win/*.c)
31
+ WIN_OBJS=$(WIN_SRCS:.c=.o)
32
+
33
+ RUNNER_CFLAGS=$(CFLAGS) -D_GNU_SOURCE # Need _GNU_SOURCE for strdup?
34
+ RUNNER_LDFLAGS=$(LDFLAGS)
35
+ RUNNER_LIBS=-lws2_32 -lpsapi -liphlpapi
36
+ RUNNER_SRC=test/runner-win.c
37
+
38
+ libuv.a: $(WIN_OBJS) src/fs-poll.o src/inet.o src/uv-common.o src/version.o
39
+ $(AR) rcs $@ $^
40
+
41
+ src/%.o: src/%.c include/uv.h include/uv-private/uv-win.h
42
+ $(CC) $(CFLAGS) -c $< -o $@
43
+
44
+ src/win/%.o: src/win/%.c include/uv.h include/uv-private/uv-win.h src/win/internal.h
45
+ $(CC) $(CFLAGS) -o $@ -c $<
46
+
47
+ clean-platform:
48
+ -rm -f src/win/*.o
@@ -0,0 +1,167 @@
1
+ # Copyright Joyent, Inc. and other Node contributors. All rights reserved.
2
+ #
3
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ # of this software and associated documentation files (the "Software"), to
5
+ # deal in the Software without restriction, including without limitation the
6
+ # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
7
+ # sell copies of the Software, and to permit persons to whom the Software is
8
+ # furnished to do so, subject to the following conditions:
9
+ #
10
+ # The above copyright notice and this permission notice shall be included in
11
+ # all copies or substantial portions of the Software.
12
+ #
13
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
18
+ # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
19
+ # IN THE SOFTWARE.
20
+
21
+ OBJC ?= $(CC)
22
+
23
+ E=
24
+ CSTDFLAG=--std=c89 -pedantic -Wall -Wextra -Wno-unused-parameter
25
+ CFLAGS += -g
26
+ CPPFLAGS += -I$(SRCDIR)/src
27
+ LDFLAGS=-lm
28
+
29
+ CPPFLAGS += -D_LARGEFILE_SOURCE
30
+ CPPFLAGS += -D_FILE_OFFSET_BITS=64
31
+
32
+ RUNNER_SRC=test/runner-unix.c
33
+ RUNNER_CFLAGS=$(CFLAGS) -I$(SRCDIR)/test
34
+ RUNNER_LDFLAGS=-L"$(CURDIR)" -luv -Xlinker -rpath -Xlinker "$(CURDIR)"
35
+
36
+ OBJS += src/unix/async.o
37
+ OBJS += src/unix/core.o
38
+ OBJS += src/unix/dl.o
39
+ OBJS += src/unix/error.o
40
+ OBJS += src/unix/fs.o
41
+ OBJS += src/unix/getaddrinfo.o
42
+ OBJS += src/unix/loop.o
43
+ OBJS += src/unix/loop-watcher.o
44
+ OBJS += src/unix/pipe.o
45
+ OBJS += src/unix/poll.o
46
+ OBJS += src/unix/process.o
47
+ OBJS += src/unix/signal.o
48
+ OBJS += src/unix/stream.o
49
+ OBJS += src/unix/tcp.o
50
+ OBJS += src/unix/thread.o
51
+ OBJS += src/unix/threadpool.o
52
+ OBJS += src/unix/timer.o
53
+ OBJS += src/unix/tty.o
54
+ OBJS += src/unix/udp.o
55
+ OBJS += src/fs-poll.o
56
+ OBJS += src/uv-common.o
57
+ OBJS += src/inet.o
58
+ OBJS += src/version.o
59
+
60
+ ifeq (sunos,$(PLATFORM))
61
+ CPPFLAGS += -D__EXTENSIONS__ -D_XOPEN_SOURCE=500
62
+ LDFLAGS+=-lkstat -lnsl -lsendfile -lsocket
63
+ # Library dependencies are not transitive.
64
+ RUNNER_LDFLAGS += $(LDFLAGS)
65
+ OBJS += src/unix/sunos.o
66
+ endif
67
+
68
+ ifeq (aix,$(PLATFORM))
69
+ CPPFLAGS += -D_ALL_SOURCE -D_XOPEN_SOURCE=500
70
+ LDFLAGS+= -lperfstat
71
+ OBJS += src/unix/aix.o
72
+ endif
73
+
74
+ ifeq (darwin,$(PLATFORM))
75
+ CPPFLAGS += -D_DARWIN_USE_64_BIT_INODE=1
76
+ LDFLAGS += -framework Foundation \
77
+ -framework CoreServices \
78
+ -framework ApplicationServices \
79
+ -dynamiclib -install_name "@rpath/libuv.dylib"
80
+ SOEXT = dylib
81
+ OBJS += src/unix/darwin.o
82
+ OBJS += src/unix/kqueue.o
83
+ OBJS += src/unix/fsevents.o
84
+ OBJS += src/unix/proctitle.o
85
+ OBJS += src/unix/darwin-proctitle.o
86
+ endif
87
+
88
+ ifeq (linux,$(PLATFORM))
89
+ CSTDFLAG += -D_GNU_SOURCE
90
+ LDFLAGS+=-ldl -lrt
91
+ RUNNER_CFLAGS += -D_GNU_SOURCE
92
+ OBJS += src/unix/linux-core.o \
93
+ src/unix/linux-inotify.o \
94
+ src/unix/linux-syscalls.o \
95
+ src/unix/proctitle.o
96
+ endif
97
+
98
+ ifeq (freebsd,$(PLATFORM))
99
+ LDFLAGS+=-lkvm
100
+ OBJS += src/unix/freebsd.o
101
+ OBJS += src/unix/kqueue.o
102
+ endif
103
+
104
+ ifeq (dragonfly,$(PLATFORM))
105
+ LDFLAGS+=-lkvm
106
+ OBJS += src/unix/freebsd.o
107
+ OBJS += src/unix/kqueue.o
108
+ endif
109
+
110
+ ifeq (netbsd,$(PLATFORM))
111
+ LDFLAGS+=-lkvm
112
+ OBJS += src/unix/netbsd.o
113
+ OBJS += src/unix/kqueue.o
114
+ endif
115
+
116
+ ifeq (openbsd,$(PLATFORM))
117
+ LDFLAGS+=-lkvm
118
+ OBJS += src/unix/openbsd.o
119
+ OBJS += src/unix/kqueue.o
120
+ endif
121
+
122
+ ifneq (,$(findstring cygwin,$(PLATFORM)))
123
+ # We drop the --std=c89, it hides CLOCK_MONOTONIC on cygwin
124
+ CSTDFLAG = -D_GNU_SOURCE
125
+ LDFLAGS+=
126
+ OBJS += src/unix/cygwin.o
127
+ endif
128
+
129
+ ifeq (sunos,$(PLATFORM))
130
+ RUNNER_LDFLAGS += -pthreads
131
+ else
132
+ RUNNER_LDFLAGS += -pthread
133
+ endif
134
+
135
+ libuv.a: $(OBJS)
136
+ $(AR) rcs $@ $^
137
+
138
+ libuv.$(SOEXT): override CFLAGS += -fPIC
139
+ libuv.$(SOEXT): $(OBJS:%.o=%.pic.o)
140
+ $(CC) -shared -o $@ $^ $(LDFLAGS)
141
+
142
+ include/uv-private/uv-unix.h: \
143
+ include/uv-private/uv-bsd.h \
144
+ include/uv-private/uv-darwin.h \
145
+ include/uv-private/uv-linux.h \
146
+ include/uv-private/uv-sunos.h
147
+
148
+ src/unix/internal.h: src/unix/linux-syscalls.h
149
+
150
+ src/.buildstamp src/unix/.buildstamp test/.buildstamp:
151
+ mkdir -p $(@D)
152
+ touch $@
153
+
154
+ src/unix/%.o src/unix/%.pic.o: src/unix/%.c include/uv.h include/uv-private/uv-unix.h src/unix/internal.h src/unix/.buildstamp
155
+ $(CC) $(CSTDFLAG) $(CPPFLAGS) $(CFLAGS) -c $< -o $@
156
+
157
+ src/%.o src/%.pic.o: src/%.c include/uv.h include/uv-private/uv-unix.h src/.buildstamp
158
+ $(CC) $(CSTDFLAG) $(CPPFLAGS) $(CFLAGS) -c $< -o $@
159
+
160
+ test/%.o: test/%.c include/uv.h test/.buildstamp
161
+ $(CC) $(CSTDFLAG) $(CPPFLAGS) $(CFLAGS) -c $< -o $@
162
+
163
+ clean-platform:
164
+ $(RM) test/run-{tests,benchmarks}.dSYM $(OBJS) $(OBJS:%.o=%.pic.o)
165
+
166
+ %.pic.o %.o: %.m
167
+ $(OBJC) $(CPPFLAGS) $(CFLAGS) -c $^ -o $@