rbczmq 1.6.2 → 1.6.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (398) hide show
  1. data/.gitignore +4 -3
  2. data/.gitmodules +6 -0
  3. data/.travis.yml +5 -1
  4. data/CHANGELOG.rdoc +15 -0
  5. data/Gemfile.lock +2 -2
  6. data/README.rdoc +5 -2
  7. data/Rakefile +8 -3
  8. data/ext/czmq/.gitignore +52 -0
  9. data/ext/czmq/.travis.yml +18 -0
  10. data/ext/czmq/AUTHORS +9 -0
  11. data/ext/czmq/COPYING +674 -0
  12. data/ext/czmq/COPYING.LESSER +178 -0
  13. data/ext/czmq/ChangeLog +0 -0
  14. data/ext/czmq/Makefile.am +22 -0
  15. data/ext/czmq/NEWS +263 -0
  16. data/ext/czmq/README +0 -0
  17. data/ext/czmq/README.md +1122 -0
  18. data/ext/czmq/README.txt +327 -0
  19. data/ext/czmq/autogen.sh +46 -0
  20. data/ext/czmq/builds/android/Android.mk +35 -0
  21. data/ext/czmq/builds/android/Application.mk +1 -0
  22. data/ext/czmq/builds/android/build.sh +59 -0
  23. data/ext/czmq/builds/android/clean.sh +26 -0
  24. data/ext/czmq/builds/mingw32/Makefile.mingw32 +38 -0
  25. data/ext/czmq/builds/mingw32/platform.h +0 -0
  26. data/ext/czmq/builds/msvc/.gitignore +18 -0
  27. data/ext/czmq/builds/msvc/README.txt +17 -0
  28. data/ext/czmq/builds/msvc/czmq.sln +69 -0
  29. data/ext/czmq/builds/msvc/czmq.vcproj +2246 -0
  30. data/ext/czmq/builds/msvc/czmq.vcxproj +329 -0
  31. data/ext/czmq/builds/msvc/czmq.vcxproj.filters +117 -0
  32. data/ext/czmq/builds/msvc/czmq11.sln +36 -0
  33. data/ext/czmq/builds/msvc/czmq_selftest.vcproj +840 -0
  34. data/ext/czmq/builds/msvc/czmq_selftest.vcxproj +189 -0
  35. data/ext/czmq/builds/msvc/czmq_selftest.vcxproj.filters +14 -0
  36. data/ext/czmq/c +520 -0
  37. data/ext/czmq/configure.ac +229 -0
  38. data/ext/czmq/doc/Makefile.am +49 -0
  39. data/ext/czmq/doc/asciidoc.conf +57 -0
  40. data/ext/czmq/doc/czmq.txt +334 -0
  41. data/ext/czmq/doc/mkman +100 -0
  42. data/ext/czmq/doc/mksite +65 -0
  43. data/ext/czmq/doc/wdput +43 -0
  44. data/ext/czmq/doc/xml2wd.pl +242 -0
  45. data/ext/czmq/doc/zbeacon.txt +173 -0
  46. data/ext/czmq/doc/zclock.txt +51 -0
  47. data/ext/czmq/doc/zconfig.txt +92 -0
  48. data/ext/czmq/doc/zctx.txt +111 -0
  49. data/ext/czmq/doc/zfile.txt +77 -0
  50. data/ext/czmq/doc/zframe.txt +222 -0
  51. data/ext/czmq/doc/zhash.txt +225 -0
  52. data/ext/czmq/doc/zlist.txt +176 -0
  53. data/ext/czmq/doc/zloop.txt +106 -0
  54. data/ext/czmq/doc/zmsg.txt +315 -0
  55. data/ext/czmq/doc/zmutex.txt +54 -0
  56. data/ext/czmq/doc/zsocket.txt +110 -0
  57. data/ext/czmq/doc/zsockopt.txt +528 -0
  58. data/ext/czmq/doc/zstr.txt +80 -0
  59. data/ext/czmq/doc/zsys.txt +44 -0
  60. data/ext/czmq/doc/zthread.txt +126 -0
  61. data/ext/czmq/doc/ztree.txt +236 -0
  62. data/ext/czmq/images/README_1.png +0 -0
  63. data/ext/czmq/images/README_2.png +0 -0
  64. data/ext/czmq/include/czmq.h +64 -0
  65. data/ext/czmq/include/czmq_prelude.h +504 -0
  66. data/ext/czmq/include/zbeacon.h +91 -0
  67. data/ext/czmq/include/zclock.h +56 -0
  68. data/ext/czmq/include/zconfig.h +117 -0
  69. data/ext/czmq/include/zctx.h +96 -0
  70. data/ext/czmq/include/zfile.h +82 -0
  71. data/ext/czmq/include/zframe.h +145 -0
  72. data/ext/czmq/include/zhash.h +127 -0
  73. data/ext/czmq/include/zlist.h +113 -0
  74. data/ext/czmq/include/zloop.h +98 -0
  75. data/ext/czmq/include/zmsg.h +165 -0
  76. data/ext/czmq/include/zmutex.h +62 -0
  77. data/ext/czmq/include/zsocket.h +104 -0
  78. data/ext/czmq/include/zsockopt.h +249 -0
  79. data/ext/czmq/include/zstr.h +69 -0
  80. data/ext/czmq/include/zsys.h +66 -0
  81. data/ext/czmq/include/zthread.h +62 -0
  82. data/ext/czmq/include/ztree.h +133 -0
  83. data/ext/czmq/mkdoc +14 -0
  84. data/ext/czmq/model/generate +2 -0
  85. data/ext/czmq/model/sockopts.xml +101 -0
  86. data/ext/czmq/notes.txt +21 -0
  87. data/ext/czmq/scripts/sockopts.gsl +325 -0
  88. data/ext/czmq/src/Makefile.am +61 -0
  89. data/ext/czmq/src/czmq_selftest.c +60 -0
  90. data/ext/czmq/src/libczmq.pc.in +11 -0
  91. data/ext/czmq/src/selftest +7 -0
  92. data/ext/czmq/src/selftest.cfg +5 -0
  93. data/ext/czmq/src/valgrind.supp +14 -0
  94. data/ext/czmq/src/vg +2 -0
  95. data/ext/czmq/src/zbeacon.c +787 -0
  96. data/ext/czmq/src/zclock.c +143 -0
  97. data/ext/czmq/src/zconfig.c +691 -0
  98. data/ext/czmq/src/zctx.c +287 -0
  99. data/ext/czmq/src/zfile.c +237 -0
  100. data/ext/czmq/src/zframe.c +551 -0
  101. data/ext/czmq/src/zhash.c +664 -0
  102. data/ext/czmq/src/zlist.c +459 -0
  103. data/ext/czmq/src/zloop.c +496 -0
  104. data/ext/czmq/src/zmsg.c +854 -0
  105. data/ext/czmq/src/zmutex.c +134 -0
  106. data/ext/czmq/src/zsocket.c +313 -0
  107. data/ext/czmq/src/zsockopt.c +1756 -0
  108. data/ext/czmq/src/zstr.c +297 -0
  109. data/ext/czmq/src/zsys.c +136 -0
  110. data/ext/czmq/src/zthread.c +269 -0
  111. data/ext/czmq/src/ztree.c +888 -0
  112. data/ext/czmq/version.sh +21 -0
  113. data/ext/rbczmq/extconf.rb +1 -18
  114. data/ext/rbczmq/poller.c +4 -1
  115. data/ext/rbczmq/socket.c +28 -5
  116. data/ext/rbczmq/socket.h +1 -0
  117. data/ext/zeromq/AUTHORS +110 -0
  118. data/ext/zeromq/CMakeLists.txt +392 -0
  119. data/ext/zeromq/COPYING +674 -0
  120. data/ext/zeromq/COPYING.LESSER +179 -0
  121. data/ext/zeromq/INSTALL +246 -0
  122. data/ext/zeromq/MAINTAINERS +56 -0
  123. data/ext/zeromq/Makefile.am +40 -0
  124. data/ext/zeromq/NEWS +333 -0
  125. data/ext/zeromq/README +39 -0
  126. data/ext/zeromq/acinclude.m4 +930 -0
  127. data/ext/zeromq/autogen.sh +45 -0
  128. data/ext/zeromq/branding.bmp +0 -0
  129. data/ext/zeromq/builds/msvc/Makefile.am +33 -0
  130. data/ext/zeromq/builds/msvc/c_local_lat/c_local_lat.vcproj +176 -0
  131. data/ext/zeromq/builds/msvc/c_local_lat/c_local_lat.vcxproj +87 -0
  132. data/ext/zeromq/builds/msvc/c_local_thr/c_local_thr.vcproj +176 -0
  133. data/ext/zeromq/builds/msvc/c_local_thr/c_local_thr.vcxproj +87 -0
  134. data/ext/zeromq/builds/msvc/c_remote_lat/c_remote_lat.vcproj +176 -0
  135. data/ext/zeromq/builds/msvc/c_remote_lat/c_remote_lat.vcxproj +87 -0
  136. data/ext/zeromq/builds/msvc/c_remote_thr/c_remote_thr.vcproj +176 -0
  137. data/ext/zeromq/builds/msvc/c_remote_thr/c_remote_thr.vcxproj +87 -0
  138. data/ext/zeromq/builds/msvc/errno.cpp +32 -0
  139. data/ext/zeromq/builds/msvc/errno.hpp +56 -0
  140. data/ext/zeromq/builds/msvc/inproc_lat/inproc_lat.vcproj +174 -0
  141. data/ext/zeromq/builds/msvc/inproc_lat/inproc_lat.vcxproj +86 -0
  142. data/ext/zeromq/builds/msvc/inproc_thr/inproc_thr.vcproj +174 -0
  143. data/ext/zeromq/builds/msvc/inproc_thr/inproc_thr.vcxproj +86 -0
  144. data/ext/zeromq/builds/msvc/libzmq/libzmq.vcproj +804 -0
  145. data/ext/zeromq/builds/msvc/libzmq/libzmq.vcxproj +252 -0
  146. data/ext/zeromq/builds/msvc/libzmq/libzmq.vcxproj.filters +431 -0
  147. data/ext/zeromq/builds/msvc/msvc.sln +89 -0
  148. data/ext/zeromq/builds/msvc/msvc10.sln +116 -0
  149. data/ext/zeromq/builds/msvc/platform.hpp +32 -0
  150. data/ext/zeromq/builds/msvc/properties/Common.props +21 -0
  151. data/ext/zeromq/builds/msvc/properties/Debug.props +19 -0
  152. data/ext/zeromq/builds/msvc/properties/Dynamic.props +20 -0
  153. data/ext/zeromq/builds/msvc/properties/Executable.props +19 -0
  154. data/ext/zeromq/builds/msvc/properties/Precompiled.props +14 -0
  155. data/ext/zeromq/builds/msvc/properties/Release.props +22 -0
  156. data/ext/zeromq/builds/msvc/properties/Win32.props +12 -0
  157. data/ext/zeromq/builds/msvc/properties/Win32_Release.props +17 -0
  158. data/ext/zeromq/builds/msvc/properties/WithOpenPGM.props +12 -0
  159. data/ext/zeromq/builds/msvc/properties/ZeroMQ.props +23 -0
  160. data/ext/zeromq/builds/msvc/properties/x64.props +12 -0
  161. data/ext/zeromq/builds/redhat/zeromq.spec.in +160 -0
  162. data/ext/zeromq/builds/valgrind/valgrind.supp +14 -0
  163. data/ext/zeromq/builds/valgrind/vg +1 -0
  164. data/ext/zeromq/cmake/Modules/TestZMQVersion.cmake +35 -0
  165. data/ext/zeromq/cmake/Modules/zmq_version.cpp +31 -0
  166. data/ext/zeromq/cmake/NSIS.template32.in +952 -0
  167. data/ext/zeromq/cmake/NSIS.template64.in +960 -0
  168. data/ext/zeromq/configure.in +428 -0
  169. data/ext/zeromq/doc/Makefile.am +51 -0
  170. data/ext/zeromq/doc/asciidoc.conf +56 -0
  171. data/ext/zeromq/doc/zmq.txt +233 -0
  172. data/ext/zeromq/doc/zmq_bind.txt +102 -0
  173. data/ext/zeromq/doc/zmq_close.txt +52 -0
  174. data/ext/zeromq/doc/zmq_connect.txt +98 -0
  175. data/ext/zeromq/doc/zmq_ctx_destroy.txt +66 -0
  176. data/ext/zeromq/doc/zmq_ctx_get.txt +67 -0
  177. data/ext/zeromq/doc/zmq_ctx_new.txt +49 -0
  178. data/ext/zeromq/doc/zmq_ctx_set.txt +75 -0
  179. data/ext/zeromq/doc/zmq_disconnect.txt +67 -0
  180. data/ext/zeromq/doc/zmq_epgm.txt +162 -0
  181. data/ext/zeromq/doc/zmq_errno.txt +50 -0
  182. data/ext/zeromq/doc/zmq_getsockopt.txt +516 -0
  183. data/ext/zeromq/doc/zmq_init.txt +52 -0
  184. data/ext/zeromq/doc/zmq_inproc.txt +85 -0
  185. data/ext/zeromq/doc/zmq_ipc.txt +85 -0
  186. data/ext/zeromq/doc/zmq_msg_close.txt +55 -0
  187. data/ext/zeromq/doc/zmq_msg_copy.txt +57 -0
  188. data/ext/zeromq/doc/zmq_msg_data.txt +48 -0
  189. data/ext/zeromq/doc/zmq_msg_get.txt +72 -0
  190. data/ext/zeromq/doc/zmq_msg_init.txt +65 -0
  191. data/ext/zeromq/doc/zmq_msg_init_data.txt +85 -0
  192. data/ext/zeromq/doc/zmq_msg_init_size.txt +58 -0
  193. data/ext/zeromq/doc/zmq_msg_more.txt +63 -0
  194. data/ext/zeromq/doc/zmq_msg_move.txt +52 -0
  195. data/ext/zeromq/doc/zmq_msg_recv.txt +125 -0
  196. data/ext/zeromq/doc/zmq_msg_send.txt +122 -0
  197. data/ext/zeromq/doc/zmq_msg_set.txt +45 -0
  198. data/ext/zeromq/doc/zmq_msg_size.txt +48 -0
  199. data/ext/zeromq/doc/zmq_pgm.txt +162 -0
  200. data/ext/zeromq/doc/zmq_poll.txt +132 -0
  201. data/ext/zeromq/doc/zmq_proxy.txt +97 -0
  202. data/ext/zeromq/doc/zmq_recv.txt +93 -0
  203. data/ext/zeromq/doc/zmq_recvmsg.txt +123 -0
  204. data/ext/zeromq/doc/zmq_send.txt +100 -0
  205. data/ext/zeromq/doc/zmq_sendmsg.txt +119 -0
  206. data/ext/zeromq/doc/zmq_setsockopt.txt +523 -0
  207. data/ext/zeromq/doc/zmq_socket.txt +369 -0
  208. data/ext/zeromq/doc/zmq_socket_monitor.txt +288 -0
  209. data/ext/zeromq/doc/zmq_strerror.txt +55 -0
  210. data/ext/zeromq/doc/zmq_tcp.txt +101 -0
  211. data/ext/zeromq/doc/zmq_term.txt +66 -0
  212. data/ext/zeromq/doc/zmq_unbind.txt +65 -0
  213. data/ext/zeromq/doc/zmq_version.txt +53 -0
  214. data/ext/zeromq/foreign/openpgm/Makefile.am +8 -0
  215. data/ext/zeromq/foreign/openpgm/libpgm-5.1.118~dfsg.tar.gz +0 -0
  216. data/ext/zeromq/include/zmq.h +402 -0
  217. data/ext/zeromq/include/zmq_utils.h +64 -0
  218. data/ext/zeromq/installer.ico +0 -0
  219. data/ext/zeromq/perf/Makefile.am +22 -0
  220. data/ext/zeromq/perf/inproc_lat.cpp +233 -0
  221. data/ext/zeromq/perf/inproc_thr.cpp +241 -0
  222. data/ext/zeromq/perf/local_lat.cpp +109 -0
  223. data/ext/zeromq/perf/local_thr.cpp +133 -0
  224. data/ext/zeromq/perf/remote_lat.cpp +122 -0
  225. data/ext/zeromq/perf/remote_thr.cpp +105 -0
  226. data/ext/zeromq/src/Makefile.am +171 -0
  227. data/ext/zeromq/src/address.cpp +78 -0
  228. data/ext/zeromq/src/address.hpp +52 -0
  229. data/ext/zeromq/src/array.hpp +155 -0
  230. data/ext/zeromq/src/atomic_counter.hpp +197 -0
  231. data/ext/zeromq/src/atomic_ptr.hpp +196 -0
  232. data/ext/zeromq/src/blob.hpp +129 -0
  233. data/ext/zeromq/src/clock.cpp +147 -0
  234. data/ext/zeromq/src/clock.hpp +60 -0
  235. data/ext/zeromq/src/command.hpp +154 -0
  236. data/ext/zeromq/src/config.hpp +89 -0
  237. data/ext/zeromq/src/ctx.cpp +352 -0
  238. data/ext/zeromq/src/ctx.hpp +173 -0
  239. data/ext/zeromq/src/dealer.cpp +133 -0
  240. data/ext/zeromq/src/dealer.hpp +92 -0
  241. data/ext/zeromq/src/decoder.cpp +166 -0
  242. data/ext/zeromq/src/decoder.hpp +248 -0
  243. data/ext/zeromq/src/devpoll.cpp +190 -0
  244. data/ext/zeromq/src/devpoll.hpp +105 -0
  245. data/ext/zeromq/src/dist.cpp +194 -0
  246. data/ext/zeromq/src/dist.hpp +105 -0
  247. data/ext/zeromq/src/encoder.cpp +102 -0
  248. data/ext/zeromq/src/encoder.hpp +200 -0
  249. data/ext/zeromq/src/epoll.cpp +178 -0
  250. data/ext/zeromq/src/epoll.hpp +101 -0
  251. data/ext/zeromq/src/err.cpp +291 -0
  252. data/ext/zeromq/src/err.hpp +155 -0
  253. data/ext/zeromq/src/fd.hpp +45 -0
  254. data/ext/zeromq/src/fq.cpp +141 -0
  255. data/ext/zeromq/src/fq.hpp +74 -0
  256. data/ext/zeromq/src/i_decoder.hpp +49 -0
  257. data/ext/zeromq/src/i_encoder.hpp +55 -0
  258. data/ext/zeromq/src/i_engine.hpp +55 -0
  259. data/ext/zeromq/src/i_msg_sink.hpp +43 -0
  260. data/ext/zeromq/src/i_msg_source.hpp +44 -0
  261. data/ext/zeromq/src/i_poll_events.hpp +47 -0
  262. data/ext/zeromq/src/io_object.cpp +108 -0
  263. data/ext/zeromq/src/io_object.hpp +81 -0
  264. data/ext/zeromq/src/io_thread.cpp +104 -0
  265. data/ext/zeromq/src/io_thread.hpp +91 -0
  266. data/ext/zeromq/src/ip.cpp +109 -0
  267. data/ext/zeromq/src/ip.hpp +41 -0
  268. data/ext/zeromq/src/ipc_address.cpp +84 -0
  269. data/ext/zeromq/src/ipc_address.hpp +67 -0
  270. data/ext/zeromq/src/ipc_connecter.cpp +265 -0
  271. data/ext/zeromq/src/ipc_connecter.hpp +128 -0
  272. data/ext/zeromq/src/ipc_listener.cpp +206 -0
  273. data/ext/zeromq/src/ipc_listener.hpp +99 -0
  274. data/ext/zeromq/src/kqueue.cpp +201 -0
  275. data/ext/zeromq/src/kqueue.hpp +107 -0
  276. data/ext/zeromq/src/lb.cpp +148 -0
  277. data/ext/zeromq/src/lb.hpp +73 -0
  278. data/ext/zeromq/src/libzmq.pc.in +10 -0
  279. data/ext/zeromq/src/likely.hpp +33 -0
  280. data/ext/zeromq/src/mailbox.cpp +87 -0
  281. data/ext/zeromq/src/mailbox.hpp +75 -0
  282. data/ext/zeromq/src/msg.cpp +299 -0
  283. data/ext/zeromq/src/msg.hpp +148 -0
  284. data/ext/zeromq/src/mtrie.cpp +428 -0
  285. data/ext/zeromq/src/mtrie.hpp +93 -0
  286. data/ext/zeromq/src/mutex.hpp +118 -0
  287. data/ext/zeromq/src/object.cpp +393 -0
  288. data/ext/zeromq/src/object.hpp +134 -0
  289. data/ext/zeromq/src/options.cpp +562 -0
  290. data/ext/zeromq/src/options.hpp +135 -0
  291. data/ext/zeromq/src/own.cpp +206 -0
  292. data/ext/zeromq/src/own.hpp +145 -0
  293. data/ext/zeromq/src/pair.cpp +136 -0
  294. data/ext/zeromq/src/pair.hpp +79 -0
  295. data/ext/zeromq/src/pgm_receiver.cpp +283 -0
  296. data/ext/zeromq/src/pgm_receiver.hpp +141 -0
  297. data/ext/zeromq/src/pgm_sender.cpp +218 -0
  298. data/ext/zeromq/src/pgm_sender.hpp +113 -0
  299. data/ext/zeromq/src/pgm_socket.cpp +706 -0
  300. data/ext/zeromq/src/pgm_socket.hpp +124 -0
  301. data/ext/zeromq/src/pipe.cpp +447 -0
  302. data/ext/zeromq/src/pipe.hpp +207 -0
  303. data/ext/zeromq/src/poll.cpp +176 -0
  304. data/ext/zeromq/src/poll.hpp +105 -0
  305. data/ext/zeromq/src/poller.hpp +82 -0
  306. data/ext/zeromq/src/poller_base.cpp +99 -0
  307. data/ext/zeromq/src/poller_base.hpp +86 -0
  308. data/ext/zeromq/src/precompiled.cpp +21 -0
  309. data/ext/zeromq/src/precompiled.hpp +47 -0
  310. data/ext/zeromq/src/proxy.cpp +150 -0
  311. data/ext/zeromq/src/proxy.hpp +32 -0
  312. data/ext/zeromq/src/pub.cpp +57 -0
  313. data/ext/zeromq/src/pub.hpp +69 -0
  314. data/ext/zeromq/src/pull.cpp +79 -0
  315. data/ext/zeromq/src/pull.hpp +81 -0
  316. data/ext/zeromq/src/push.cpp +76 -0
  317. data/ext/zeromq/src/push.hpp +80 -0
  318. data/ext/zeromq/src/random.cpp +52 -0
  319. data/ext/zeromq/src/random.hpp +37 -0
  320. data/ext/zeromq/src/reaper.cpp +117 -0
  321. data/ext/zeromq/src/reaper.hpp +80 -0
  322. data/ext/zeromq/src/rep.cpp +137 -0
  323. data/ext/zeromq/src/rep.hpp +80 -0
  324. data/ext/zeromq/src/req.cpp +185 -0
  325. data/ext/zeromq/src/req.hpp +91 -0
  326. data/ext/zeromq/src/router.cpp +364 -0
  327. data/ext/zeromq/src/router.hpp +138 -0
  328. data/ext/zeromq/src/select.cpp +216 -0
  329. data/ext/zeromq/src/select.hpp +126 -0
  330. data/ext/zeromq/src/session_base.cpp +503 -0
  331. data/ext/zeromq/src/session_base.hpp +156 -0
  332. data/ext/zeromq/src/signaler.cpp +406 -0
  333. data/ext/zeromq/src/signaler.hpp +63 -0
  334. data/ext/zeromq/src/socket_base.cpp +1236 -0
  335. data/ext/zeromq/src/socket_base.hpp +255 -0
  336. data/ext/zeromq/src/stdint.hpp +63 -0
  337. data/ext/zeromq/src/stream_engine.cpp +594 -0
  338. data/ext/zeromq/src/stream_engine.hpp +149 -0
  339. data/ext/zeromq/src/sub.cpp +93 -0
  340. data/ext/zeromq/src/sub.hpp +71 -0
  341. data/ext/zeromq/src/tcp.cpp +131 -0
  342. data/ext/zeromq/src/tcp.hpp +38 -0
  343. data/ext/zeromq/src/tcp_address.cpp +613 -0
  344. data/ext/zeromq/src/tcp_address.hpp +100 -0
  345. data/ext/zeromq/src/tcp_connecter.cpp +319 -0
  346. data/ext/zeromq/src/tcp_connecter.hpp +123 -0
  347. data/ext/zeromq/src/tcp_listener.cpp +293 -0
  348. data/ext/zeromq/src/tcp_listener.hpp +91 -0
  349. data/ext/zeromq/src/thread.cpp +107 -0
  350. data/ext/zeromq/src/thread.hpp +79 -0
  351. data/ext/zeromq/src/trie.cpp +337 -0
  352. data/ext/zeromq/src/trie.hpp +79 -0
  353. data/ext/zeromq/src/v1_decoder.cpp +162 -0
  354. data/ext/zeromq/src/v1_decoder.hpp +68 -0
  355. data/ext/zeromq/src/v1_encoder.cpp +103 -0
  356. data/ext/zeromq/src/v1_encoder.hpp +60 -0
  357. data/ext/zeromq/src/v1_protocol.hpp +43 -0
  358. data/ext/zeromq/src/version.rc.in +93 -0
  359. data/ext/zeromq/src/windows.hpp +181 -0
  360. data/ext/zeromq/src/wire.hpp +99 -0
  361. data/ext/zeromq/src/xpub.cpp +200 -0
  362. data/ext/zeromq/src/xpub.hpp +110 -0
  363. data/ext/zeromq/src/xsub.cpp +242 -0
  364. data/ext/zeromq/src/xsub.hpp +108 -0
  365. data/ext/zeromq/src/ypipe.hpp +210 -0
  366. data/ext/zeromq/src/yqueue.hpp +199 -0
  367. data/ext/zeromq/src/zmq.cpp +1058 -0
  368. data/ext/zeromq/src/zmq_utils.cpp +61 -0
  369. data/ext/zeromq/tests/Makefile.am +55 -0
  370. data/ext/zeromq/tests/test_connect_delay.cpp +260 -0
  371. data/ext/zeromq/tests/test_connect_resolve.cpp +54 -0
  372. data/ext/zeromq/tests/test_disconnect_inproc.cpp +120 -0
  373. data/ext/zeromq/tests/test_hwm.cpp +83 -0
  374. data/ext/zeromq/tests/test_invalid_rep.cpp +92 -0
  375. data/ext/zeromq/tests/test_last_endpoint.cpp +60 -0
  376. data/ext/zeromq/tests/test_monitor.cpp +289 -0
  377. data/ext/zeromq/tests/test_msg_flags.cpp +78 -0
  378. data/ext/zeromq/tests/test_pair_inproc.cpp +53 -0
  379. data/ext/zeromq/tests/test_pair_ipc.cpp +53 -0
  380. data/ext/zeromq/tests/test_pair_tcp.cpp +54 -0
  381. data/ext/zeromq/tests/test_reqrep_device.cpp +143 -0
  382. data/ext/zeromq/tests/test_reqrep_inproc.cpp +53 -0
  383. data/ext/zeromq/tests/test_reqrep_ipc.cpp +53 -0
  384. data/ext/zeromq/tests/test_reqrep_tcp.cpp +54 -0
  385. data/ext/zeromq/tests/test_router_mandatory.cpp +62 -0
  386. data/ext/zeromq/tests/test_shutdown_stress.cpp +93 -0
  387. data/ext/zeromq/tests/test_sub_forward.cpp +99 -0
  388. data/ext/zeromq/tests/test_term_endpoint.cpp +118 -0
  389. data/ext/zeromq/tests/test_timeo.cpp +119 -0
  390. data/ext/zeromq/tests/testutil.hpp +77 -0
  391. data/ext/zeromq/version.sh +21 -0
  392. data/lib/zmq/version.rb +1 -1
  393. data/rbczmq.gemspec +16 -3
  394. data/test/test_socket.rb +13 -1
  395. metadata +398 -9
  396. checksums.yaml +0 -15
  397. data/ext/czmq-1.4.1.tar.gz +0 -0
  398. data/ext/zeromq-3.2.3.tar.gz +0 -0
@@ -0,0 +1,160 @@
1
+ Name: zeromq
2
+ Version: @PACKAGE_VERSION@
3
+ Release: 1%{?dist}
4
+ Summary: The ZeroMQ messaging library
5
+ Group: Applications/Internet
6
+ License: LGPLv3+
7
+ URL: http://www.zeromq.org/
8
+ Source: http://download.zeromq.org/%{name}-%{version}.tar.gz
9
+ Prefix: %{_prefix}
10
+ Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root
11
+ BuildRequires: gcc, make, gcc-c++, libstdc++-devel
12
+ Requires: libstdc++
13
+
14
+ %if 0%{?rhel}
15
+ %if 0%{?rhel} == 6
16
+ BuildRequires: libuuid-devel
17
+ Requires: libuuid
18
+ %endif
19
+ %if 0%{?rhel} == 5
20
+ BuildRequires: e2fsprogs-devel
21
+ Requires: e2fsprogs
22
+ %endif
23
+ %else
24
+ BuildRequires: uuid-devel
25
+ Requires: uuid
26
+ %endif
27
+
28
+ # Build pgm only on supported archs
29
+ %ifarch pentium3 pentium4 athlon i386 i486 i586 i686 x86_64
30
+ BuildRequires: python, perl
31
+ %endif
32
+
33
+ %description
34
+ The 0MQ lightweight messaging kernel is a library which extends the
35
+ standard socket interfaces with features traditionally provided by
36
+ specialised messaging middleware products. 0MQ sockets provide an
37
+ abstraction of asynchronous message queues, multiple messaging
38
+ patterns, message filtering (subscriptions), seamless access to
39
+ multiple transport protocols and more.
40
+
41
+ This package contains the ZeroMQ shared library.
42
+
43
+ %package devel
44
+ Summary: Development files and static library for the ZeroMQ library
45
+ Group: Development/Libraries
46
+ Requires: %{name} = %{version}-%{release}, pkgconfig
47
+
48
+ %description devel
49
+ The 0MQ lightweight messaging kernel is a library which extends the
50
+ standard socket interfaces with features traditionally provided by
51
+ specialised messaging middleware products. 0MQ sockets provide an
52
+ abstraction of asynchronous message queues, multiple messaging
53
+ patterns, message filtering (subscriptions), seamless access to
54
+ multiple transport protocols and more.
55
+
56
+ This package contains ZeroMQ related development libraries and header files.
57
+
58
+ %prep
59
+ %setup -q
60
+
61
+ %build
62
+ %ifarch pentium3 pentium4 athlon i386 i486 i586 i686 x86_64
63
+ %configure --with-pgm --with-pic --with-gnu-ld
64
+ %else
65
+ %configure
66
+ %endif
67
+
68
+ %{__make} %{?_smp_mflags}
69
+
70
+ %install
71
+ [ "%{buildroot}" != "/" ] && %{__rm} -rf %{buildroot}
72
+
73
+ # Install the package to build area
74
+ %{__make} check
75
+ %makeinstall
76
+
77
+ %post
78
+ /sbin/ldconfig
79
+
80
+ %postun
81
+ /sbin/ldconfig
82
+
83
+ %clean
84
+ [ "%{buildroot}" != "/" ] && %{__rm} -rf %{buildroot}
85
+
86
+ %files
87
+ %defattr(-,root,root,-)
88
+
89
+ # docs in the main package
90
+ %doc AUTHORS ChangeLog COPYING COPYING.LESSER NEWS README
91
+
92
+ # libraries
93
+ %{_libdir}/libzmq.so.3
94
+ %{_libdir}/libzmq.so.3.0.0
95
+
96
+ %{_mandir}/man7/zmq.7.gz
97
+
98
+ %files devel
99
+ %defattr(-,root,root,-)
100
+ %{_includedir}/zmq.h
101
+ %{_includedir}/zmq_utils.h
102
+
103
+ %{_libdir}/libzmq.la
104
+ %{_libdir}/libzmq.a
105
+ %{_libdir}/pkgconfig/libzmq.pc
106
+ %{_libdir}/libzmq.so
107
+
108
+ %{_mandir}/man3/zmq_bind.3.gz
109
+ %{_mandir}/man3/zmq_close.3.gz
110
+ %{_mandir}/man3/zmq_connect.3.gz
111
+ %{_mandir}/man3/zmq_disconnect.3.gz
112
+ %{_mandir}/man3/zmq_ctx_destroy.3.gz
113
+ %{_mandir}/man3/zmq_ctx_get.3.gz
114
+ %{_mandir}/man3/zmq_ctx_new.3.gz
115
+ %{_mandir}/man3/zmq_ctx_set.3.gz
116
+ %{_mandir}/man3/zmq_msg_recv.3.gz
117
+ %{_mandir}/man3/zmq_errno.3.gz
118
+ %{_mandir}/man3/zmq_getsockopt.3.gz
119
+ %{_mandir}/man3/zmq_init.3.gz
120
+ %{_mandir}/man3/zmq_msg_close.3.gz
121
+ %{_mandir}/man3/zmq_msg_copy.3.gz
122
+ %{_mandir}/man3/zmq_msg_data.3.gz
123
+ %{_mandir}/man3/zmq_msg_init.3.gz
124
+ %{_mandir}/man3/zmq_msg_init_data.3.gz
125
+ %{_mandir}/man3/zmq_msg_init_size.3.gz
126
+ %{_mandir}/man3/zmq_msg_move.3.gz
127
+ %{_mandir}/man3/zmq_msg_size.3.gz
128
+ %{_mandir}/man3/zmq_msg_get.3.gz
129
+ %{_mandir}/man3/zmq_msg_more.3.gz
130
+ %{_mandir}/man3/zmq_msg_recv.3.gz
131
+ %{_mandir}/man3/zmq_msg_send.3.gz
132
+ %{_mandir}/man3/zmq_msg_set.3.gz
133
+ %{_mandir}/man3/zmq_poll.3.gz
134
+ %{_mandir}/man3/zmq_proxy.3.gz
135
+ %{_mandir}/man3/zmq_recv.3.gz
136
+ %{_mandir}/man3/zmq_recvmsg.3.gz
137
+ %{_mandir}/man3/zmq_send.3.gz
138
+ %{_mandir}/man3/zmq_sendmsg.3.gz
139
+ %{_mandir}/man3/zmq_setsockopt.3.gz
140
+ %{_mandir}/man3/zmq_socket.3.gz
141
+ %{_mandir}/man3/zmq_socket_monitor.3.gz
142
+ %{_mandir}/man3/zmq_strerror.3.gz
143
+ %{_mandir}/man3/zmq_term.3.gz
144
+ %{_mandir}/man3/zmq_version.3.gz
145
+ %{_mandir}/man3/zmq_unbind.3.gz
146
+ %{_mandir}/man7/zmq_epgm.7.gz
147
+ %{_mandir}/man7/zmq_inproc.7.gz
148
+ %{_mandir}/man7/zmq_ipc.7.gz
149
+ %{_mandir}/man7/zmq_pgm.7.gz
150
+ %{_mandir}/man7/zmq_tcp.7.gz
151
+
152
+ %changelog
153
+ * Mon Nov 26 2012 Justin Cook <jhcook@gmail.com> 3.2.2
154
+ - Update packaged files
155
+
156
+ * Fri Apr 8 2011 Mikko Koppanen <mikko@kuut.io> 3.0.0-1
157
+ - Update dependencies and packaged files
158
+
159
+ * Sat Apr 10 2010 Mikko Koppanen <mkoppanen@php.net> 2.0.7-1
160
+ - Initial packaging
@@ -0,0 +1,14 @@
1
+ {
2
+ <socketcall_sendto>
3
+ Memcheck:Param
4
+ socketcall.sendto(msg)
5
+ fun:send
6
+ ...
7
+ }
8
+ {
9
+ <socketcall_sendto>
10
+ Memcheck:Param
11
+ socketcall.send(msg)
12
+ fun:send
13
+ ...
14
+ }
@@ -0,0 +1 @@
1
+ valgrind --tool=memcheck --leak-check=full --suppressions=valgrind.supp $*
@@ -0,0 +1,35 @@
1
+
2
+ MESSAGE(STATUS "Detecting ZMQ")
3
+ SET(TRY_RUN_DIR ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_FILES_DIRECTORY}/zmq_run.dir)
4
+
5
+ TRY_RUN(RUN_RESULT COMPILE_RESULT
6
+ ${TRY_RUN_DIR}
7
+ ${CMAKE_SOURCE_DIR}/cmake/Modules/zmq_version.cpp
8
+ CMAKE_FLAGS
9
+ "-DINCLUDE_DIRECTORIES:STRING=${CMAKE_SOURCE_DIR}/include"
10
+ COMPILE_OUTPUT_VARIABLE COMPILE_OUTPUT
11
+ RUN_OUTPUT_VARIABLE RUN_OUTPUT)
12
+
13
+ IF(COMPILE_RESULT)
14
+ IF(RUN_RESULT MATCHES "FAILED_TO_RUN")
15
+ MESSAGE(STATUS "Detecting ZMQ - failed")
16
+ ELSE()
17
+ STRING(REGEX REPLACE "([0-9]+)\\.([0-9]+)\\.([0-9]+).*" "\\1" ZMQ_VERSION_MAJOR "${RUN_OUTPUT}")
18
+ STRING(REGEX REPLACE "([0-9]+)\\.([0-9]+)\\.([0-9]+).*" "\\2" ZMQ_VERSION_MINOR "${RUN_OUTPUT}")
19
+ STRING(REGEX REPLACE "([0-9]+)\\.([0-9]+)\\.([0-9]+).*" "\\3" ZMQ_VERSION_PATCH "${RUN_OUTPUT}")
20
+ MESSAGE(STATUS "Detecting ZMQ - ${ZMQ_VERSION_MAJOR}.${ZMQ_VERSION_MINOR}.${ZMQ_VERSION_PATCH}")
21
+ ENDIF()
22
+ ELSE()
23
+ MESSAGE(STATUS "Check for ZMQ version - not found")
24
+ MESSAGE(STATUS "Detecting ZMQ - failed")
25
+ ENDIF()
26
+
27
+ if(MSVC_VERSION MATCHES "1700")
28
+ set(_zmq_COMPILER "-v110")
29
+ elseif(MSVC10)
30
+ set(_zmq_COMPILER "-v100")
31
+ elseif(MSVC90)
32
+ set(_zmq_COMPILER "-v90")
33
+ else()
34
+ set(_zmq_COMPILER "")
35
+ endif()
@@ -0,0 +1,31 @@
1
+ /*
2
+ Copyright (c) 2007-2012 iMatix Corporation
3
+ Copyright (c) 2009-2011 250bpm s.r.o.
4
+ Copyright (c) 2007-2011 Other contributors as noted in the AUTHORS file
5
+
6
+ This file is part of 0MQ.
7
+
8
+ 0MQ is free software; you can redistribute it and/or modify it under
9
+ the terms of the GNU Lesser General Public License as published by
10
+ the Free Software Foundation; either version 3 of the License, or
11
+ (at your option) any later version.
12
+
13
+ 0MQ is distributed in the hope that it will be useful,
14
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
+ GNU Lesser General Public License for more details.
17
+
18
+ You should have received a copy of the GNU Lesser General Public License
19
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
20
+ */
21
+
22
+ #include "zmq.h"
23
+
24
+ #include <stdio.h>
25
+
26
+ int main ()
27
+ {
28
+ printf ("%d.%d.%d\n", ZMQ_VERSION_MAJOR, ZMQ_VERSION_MINOR, ZMQ_VERSION_PATCH);
29
+ return 0;
30
+ }
31
+
@@ -0,0 +1,952 @@
1
+ ; CPack install script designed for a nmake build
2
+
3
+ ;--------------------------------
4
+ ; You must define these values
5
+
6
+ !define VERSION "@CPACK_PACKAGE_VERSION@"
7
+ !define PATCH "@CPACK_PACKAGE_VERSION_PATCH@"
8
+ !define INST_DIR "@CPACK_TEMPORARY_DIRECTORY@"
9
+
10
+ ;--------------------------------
11
+ ;Variables
12
+
13
+ Var MUI_TEMP
14
+ Var STARTMENU_FOLDER
15
+ Var SV_ALLUSERS
16
+ Var START_MENU
17
+ Var DO_NOT_ADD_TO_PATH
18
+ Var ADD_TO_PATH_ALL_USERS
19
+ Var ADD_TO_PATH_CURRENT_USER
20
+ Var INSTALL_DESKTOP
21
+ Var IS_DEFAULT_INSTALLDIR
22
+ ;--------------------------------
23
+ ;Include Modern UI
24
+
25
+ !include "MUI.nsh"
26
+
27
+ ;Default installation folder
28
+ InstallDir "$PROGRAMFILES\@CPACK_PACKAGE_INSTALL_DIRECTORY@"
29
+ ;InstallDir "$PROGRAMFILES64\@CPACK_PACKAGE_INSTALL_DIRECTORY@"
30
+
31
+ ;--------------------------------
32
+ ;General
33
+
34
+ ;Name and file
35
+ Name "@CPACK_NSIS_PACKAGE_NAME@"
36
+ OutFile "@CPACK_TOPLEVEL_DIRECTORY@/@CPACK_OUTPUT_FILE_NAME@"
37
+
38
+ ;Set compression
39
+ SetCompressor @CPACK_NSIS_COMPRESSOR@
40
+
41
+ @CPACK_NSIS_DEFINES@
42
+
43
+ !include Sections.nsh
44
+
45
+ ;--- Component support macros: ---
46
+ ; The code for the add/remove functionality is from:
47
+ ; http://nsis.sourceforge.net/Add/Remove_Functionality
48
+ ; It has been modified slightly and extended to provide
49
+ ; inter-component dependencies.
50
+ Var AR_SecFlags
51
+ Var AR_RegFlags
52
+ @CPACK_NSIS_SECTION_SELECTED_VARS@
53
+
54
+ ; Loads the "selected" flag for the section named SecName into the
55
+ ; variable VarName.
56
+ !macro LoadSectionSelectedIntoVar SecName VarName
57
+ SectionGetFlags ${${SecName}} $${VarName}
58
+ IntOp $${VarName} $${VarName} & ${SF_SELECTED} ;Turn off all other bits
59
+ !macroend
60
+
61
+ ; Loads the value of a variable... can we get around this?
62
+ !macro LoadVar VarName
63
+ IntOp $R0 0 + $${VarName}
64
+ !macroend
65
+
66
+ ; Sets the value of a variable
67
+ !macro StoreVar VarName IntValue
68
+ IntOp $${VarName} 0 + ${IntValue}
69
+ !macroend
70
+
71
+ !macro InitSection SecName
72
+ ; This macro reads component installed flag from the registry and
73
+ ;changes checked state of the section on the components page.
74
+ ;Input: section index constant name specified in Section command.
75
+
76
+ ClearErrors
77
+ ;Reading component status from registry
78
+ ReadRegDWORD $AR_RegFlags HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_NAME@\Components\${SecName}" "Installed"
79
+ IfErrors "default_${SecName}"
80
+ ;Status will stay default if registry value not found
81
+ ;(component was never installed)
82
+ IntOp $AR_RegFlags $AR_RegFlags & ${SF_SELECTED} ;Turn off all other bits
83
+ SectionGetFlags ${${SecName}} $AR_SecFlags ;Reading default section flags
84
+ IntOp $AR_SecFlags $AR_SecFlags & 0xFFFE ;Turn lowest (enabled) bit off
85
+ IntOp $AR_SecFlags $AR_RegFlags | $AR_SecFlags ;Change lowest bit
86
+
87
+ ; Note whether this component was installed before
88
+ !insertmacro StoreVar ${SecName}_was_installed $AR_RegFlags
89
+ IntOp $R0 $AR_RegFlags & $AR_RegFlags
90
+
91
+ ;Writing modified flags
92
+ SectionSetFlags ${${SecName}} $AR_SecFlags
93
+
94
+ "default_${SecName}:"
95
+ !insertmacro LoadSectionSelectedIntoVar ${SecName} ${SecName}_selected
96
+ !macroend
97
+
98
+ !macro FinishSection SecName
99
+ ; This macro reads section flag set by user and removes the section
100
+ ;if it is not selected.
101
+ ;Then it writes component installed flag to registry
102
+ ;Input: section index constant name specified in Section command.
103
+
104
+ SectionGetFlags ${${SecName}} $AR_SecFlags ;Reading section flags
105
+ ;Checking lowest bit:
106
+ IntOp $AR_SecFlags $AR_SecFlags & ${SF_SELECTED}
107
+ IntCmp $AR_SecFlags 1 "leave_${SecName}"
108
+ ;Section is not selected:
109
+ ;Calling Section uninstall macro and writing zero installed flag
110
+ !insertmacro "Remove_${${SecName}}"
111
+ WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_NAME@\Components\${SecName}" \
112
+ "Installed" 0
113
+ Goto "exit_${SecName}"
114
+
115
+ "leave_${SecName}:"
116
+ ;Section is selected:
117
+ WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_NAME@\Components\${SecName}" \
118
+ "Installed" 1
119
+
120
+ "exit_${SecName}:"
121
+ !macroend
122
+
123
+ !macro RemoveSection SecName
124
+ ; This macro is used to call section's Remove_... macro
125
+ ;from the uninstaller.
126
+ ;Input: section index constant name specified in Section command.
127
+
128
+ !insertmacro "Remove_${${SecName}}"
129
+ !macroend
130
+
131
+ ; Determine whether the selection of SecName changed
132
+ !macro MaybeSelectionChanged SecName
133
+ !insertmacro LoadVar ${SecName}_selected
134
+ SectionGetFlags ${${SecName}} $R1
135
+ IntOp $R1 $R1 & ${SF_SELECTED} ;Turn off all other bits
136
+
137
+ ; See if the status has changed:
138
+ IntCmp $R0 $R1 "${SecName}_unchanged"
139
+ !insertmacro LoadSectionSelectedIntoVar ${SecName} ${SecName}_selected
140
+
141
+ IntCmp $R1 ${SF_SELECTED} "${SecName}_was_selected"
142
+ !insertmacro "Deselect_required_by_${SecName}"
143
+ goto "${SecName}_unchanged"
144
+
145
+ "${SecName}_was_selected:"
146
+ !insertmacro "Select_${SecName}_depends"
147
+
148
+ "${SecName}_unchanged:"
149
+ !macroend
150
+ ;--- End of Add/Remove macros ---
151
+
152
+ ;--------------------------------
153
+ ;Interface Settings
154
+
155
+ !define MUI_HEADERIMAGE
156
+ !define MUI_ABORTWARNING
157
+
158
+ ;--------------------------------
159
+ ; path functions
160
+
161
+ !verbose 3
162
+ !include "WinMessages.NSH"
163
+ !verbose 4
164
+
165
+ ;----------------------------------------
166
+ ; based upon a script of "Written by KiCHiK 2003-01-18 05:57:02"
167
+ ;----------------------------------------
168
+ !verbose 3
169
+ !include "WinMessages.NSH"
170
+ !verbose 4
171
+ ;====================================================
172
+ ; get_NT_environment
173
+ ; Returns: the selected environment
174
+ ; Output : head of the stack
175
+ ;====================================================
176
+ !macro select_NT_profile UN
177
+ Function ${UN}select_NT_profile
178
+ StrCmp $ADD_TO_PATH_ALL_USERS "1" 0 environment_single
179
+ DetailPrint "Selected environment for all users"
180
+ Push "all"
181
+ Return
182
+ environment_single:
183
+ DetailPrint "Selected environment for current user only."
184
+ Push "current"
185
+ Return
186
+ FunctionEnd
187
+ !macroend
188
+ !insertmacro select_NT_profile ""
189
+ !insertmacro select_NT_profile "un."
190
+ ;----------------------------------------------------
191
+ !define NT_current_env 'HKCU "Environment"'
192
+ !define NT_all_env 'HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"'
193
+
194
+ !ifndef WriteEnvStr_RegKey
195
+ !ifdef ALL_USERS
196
+ !define WriteEnvStr_RegKey \
197
+ 'HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"'
198
+ !else
199
+ !define WriteEnvStr_RegKey 'HKCU "Environment"'
200
+ !endif
201
+ !endif
202
+
203
+ ; AddToPath - Adds the given dir to the search path.
204
+ ; Input - head of the stack
205
+ ; Note - Win9x systems requires reboot
206
+
207
+ Function AddToPath
208
+ Exch $0
209
+ Push $1
210
+ Push $2
211
+ Push $3
212
+
213
+ # don't add if the path doesn't exist
214
+ IfFileExists "$0\*.*" "" AddToPath_done
215
+
216
+ ReadEnvStr $1 PATH
217
+ ; if the path is too long for a NSIS variable NSIS will return a 0
218
+ ; length string. If we find that, then warn and skip any path
219
+ ; modification as it will trash the existing path.
220
+ StrLen $2 $1
221
+ IntCmp $2 0 CheckPathLength_ShowPathWarning CheckPathLength_Done CheckPathLength_Done
222
+ CheckPathLength_ShowPathWarning:
223
+ Messagebox MB_OK|MB_ICONEXCLAMATION "Warning! PATH too long installer unable to modify PATH!"
224
+ Goto AddToPath_done
225
+ CheckPathLength_Done:
226
+ Push "$1;"
227
+ Push "$0;"
228
+ Call StrStr
229
+ Pop $2
230
+ StrCmp $2 "" "" AddToPath_done
231
+ Push "$1;"
232
+ Push "$0\;"
233
+ Call StrStr
234
+ Pop $2
235
+ StrCmp $2 "" "" AddToPath_done
236
+ GetFullPathName /SHORT $3 $0
237
+ Push "$1;"
238
+ Push "$3;"
239
+ Call StrStr
240
+ Pop $2
241
+ StrCmp $2 "" "" AddToPath_done
242
+ Push "$1;"
243
+ Push "$3\;"
244
+ Call StrStr
245
+ Pop $2
246
+ StrCmp $2 "" "" AddToPath_done
247
+
248
+ Call IsNT
249
+ Pop $1
250
+ StrCmp $1 1 AddToPath_NT
251
+ ; Not on NT
252
+ StrCpy $1 $WINDIR 2
253
+ FileOpen $1 "$1\autoexec.bat" a
254
+ FileSeek $1 -1 END
255
+ FileReadByte $1 $2
256
+ IntCmp $2 26 0 +2 +2 # DOS EOF
257
+ FileSeek $1 -1 END # write over EOF
258
+ FileWrite $1 "$\r$\nSET PATH=%PATH%;$3$\r$\n"
259
+ FileClose $1
260
+ SetRebootFlag true
261
+ Goto AddToPath_done
262
+
263
+ AddToPath_NT:
264
+ StrCmp $ADD_TO_PATH_ALL_USERS "1" ReadAllKey
265
+ ReadRegStr $1 ${NT_current_env} "PATH"
266
+ Goto DoTrim
267
+ ReadAllKey:
268
+ ReadRegStr $1 ${NT_all_env} "PATH"
269
+ DoTrim:
270
+ StrCmp $1 "" AddToPath_NTdoIt
271
+ Push $1
272
+ Call Trim
273
+ Pop $1
274
+ StrCpy $0 "$1;$0"
275
+ AddToPath_NTdoIt:
276
+ StrCmp $ADD_TO_PATH_ALL_USERS "1" WriteAllKey
277
+ WriteRegExpandStr ${NT_current_env} "PATH" $0
278
+ Goto DoSend
279
+ WriteAllKey:
280
+ WriteRegExpandStr ${NT_all_env} "PATH" $0
281
+ DoSend:
282
+ SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000
283
+
284
+ AddToPath_done:
285
+ Pop $3
286
+ Pop $2
287
+ Pop $1
288
+ Pop $0
289
+ FunctionEnd
290
+
291
+
292
+ ; RemoveFromPath - Remove a given dir from the path
293
+ ; Input: head of the stack
294
+
295
+ Function un.RemoveFromPath
296
+ Exch $0
297
+ Push $1
298
+ Push $2
299
+ Push $3
300
+ Push $4
301
+ Push $5
302
+ Push $6
303
+
304
+ IntFmt $6 "%c" 26 # DOS EOF
305
+
306
+ Call un.IsNT
307
+ Pop $1
308
+ StrCmp $1 1 unRemoveFromPath_NT
309
+ ; Not on NT
310
+ StrCpy $1 $WINDIR 2
311
+ FileOpen $1 "$1\autoexec.bat" r
312
+ GetTempFileName $4
313
+ FileOpen $2 $4 w
314
+ GetFullPathName /SHORT $0 $0
315
+ StrCpy $0 "SET PATH=%PATH%;$0"
316
+ Goto unRemoveFromPath_dosLoop
317
+
318
+ unRemoveFromPath_dosLoop:
319
+ FileRead $1 $3
320
+ StrCpy $5 $3 1 -1 # read last char
321
+ StrCmp $5 $6 0 +2 # if DOS EOF
322
+ StrCpy $3 $3 -1 # remove DOS EOF so we can compare
323
+ StrCmp $3 "$0$\r$\n" unRemoveFromPath_dosLoopRemoveLine
324
+ StrCmp $3 "$0$\n" unRemoveFromPath_dosLoopRemoveLine
325
+ StrCmp $3 "$0" unRemoveFromPath_dosLoopRemoveLine
326
+ StrCmp $3 "" unRemoveFromPath_dosLoopEnd
327
+ FileWrite $2 $3
328
+ Goto unRemoveFromPath_dosLoop
329
+ unRemoveFromPath_dosLoopRemoveLine:
330
+ SetRebootFlag true
331
+ Goto unRemoveFromPath_dosLoop
332
+
333
+ unRemoveFromPath_dosLoopEnd:
334
+ FileClose $2
335
+ FileClose $1
336
+ StrCpy $1 $WINDIR 2
337
+ Delete "$1\autoexec.bat"
338
+ CopyFiles /SILENT $4 "$1\autoexec.bat"
339
+ Delete $4
340
+ Goto unRemoveFromPath_done
341
+
342
+ unRemoveFromPath_NT:
343
+ StrCmp $ADD_TO_PATH_ALL_USERS "1" unReadAllKey
344
+ ReadRegStr $1 ${NT_current_env} "PATH"
345
+ Goto unDoTrim
346
+ unReadAllKey:
347
+ ReadRegStr $1 ${NT_all_env} "PATH"
348
+ unDoTrim:
349
+ StrCpy $5 $1 1 -1 # copy last char
350
+ StrCmp $5 ";" +2 # if last char != ;
351
+ StrCpy $1 "$1;" # append ;
352
+ Push $1
353
+ Push "$0;"
354
+ Call un.StrStr ; Find `$0;` in $1
355
+ Pop $2 ; pos of our dir
356
+ StrCmp $2 "" unRemoveFromPath_done
357
+ ; else, it is in path
358
+ # $0 - path to add
359
+ # $1 - path var
360
+ StrLen $3 "$0;"
361
+ StrLen $4 $2
362
+ StrCpy $5 $1 -$4 # $5 is now the part before the path to remove
363
+ StrCpy $6 $2 "" $3 # $6 is now the part after the path to remove
364
+ StrCpy $3 $5$6
365
+
366
+ StrCpy $5 $3 1 -1 # copy last char
367
+ StrCmp $5 ";" 0 +2 # if last char == ;
368
+ StrCpy $3 $3 -1 # remove last char
369
+
370
+ StrCmp $ADD_TO_PATH_ALL_USERS "1" unWriteAllKey
371
+ WriteRegExpandStr ${NT_current_env} "PATH" $3
372
+ Goto unDoSend
373
+ unWriteAllKey:
374
+ WriteRegExpandStr ${NT_all_env} "PATH" $3
375
+ unDoSend:
376
+ SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000
377
+
378
+ unRemoveFromPath_done:
379
+ Pop $6
380
+ Pop $5
381
+ Pop $4
382
+ Pop $3
383
+ Pop $2
384
+ Pop $1
385
+ Pop $0
386
+ FunctionEnd
387
+
388
+ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
389
+ ; Uninstall sutff
390
+ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
391
+
392
+ ###########################################
393
+ # Utility Functions #
394
+ ###########################################
395
+
396
+ ;====================================================
397
+ ; IsNT - Returns 1 if the current system is NT, 0
398
+ ; otherwise.
399
+ ; Output: head of the stack
400
+ ;====================================================
401
+ ; IsNT
402
+ ; no input
403
+ ; output, top of the stack = 1 if NT or 0 if not
404
+ ;
405
+ ; Usage:
406
+ ; Call IsNT
407
+ ; Pop $R0
408
+ ; ($R0 at this point is 1 or 0)
409
+
410
+ !macro IsNT un
411
+ Function ${un}IsNT
412
+ Push $0
413
+ ReadRegStr $0 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion
414
+ StrCmp $0 "" 0 IsNT_yes
415
+ ; we are not NT.
416
+ Pop $0
417
+ Push 0
418
+ Return
419
+
420
+ IsNT_yes:
421
+ ; NT!!!
422
+ Pop $0
423
+ Push 1
424
+ FunctionEnd
425
+ !macroend
426
+ !insertmacro IsNT ""
427
+ !insertmacro IsNT "un."
428
+
429
+ ; StrStr
430
+ ; input, top of stack = string to search for
431
+ ; top of stack-1 = string to search in
432
+ ; output, top of stack (replaces with the portion of the string remaining)
433
+ ; modifies no other variables.
434
+ ;
435
+ ; Usage:
436
+ ; Push "this is a long ass string"
437
+ ; Push "ass"
438
+ ; Call StrStr
439
+ ; Pop $R0
440
+ ; ($R0 at this point is "ass string")
441
+
442
+ !macro StrStr un
443
+ Function ${un}StrStr
444
+ Exch $R1 ; st=haystack,old$R1, $R1=needle
445
+ Exch ; st=old$R1,haystack
446
+ Exch $R2 ; st=old$R1,old$R2, $R2=haystack
447
+ Push $R3
448
+ Push $R4
449
+ Push $R5
450
+ StrLen $R3 $R1
451
+ StrCpy $R4 0
452
+ ; $R1=needle
453
+ ; $R2=haystack
454
+ ; $R3=len(needle)
455
+ ; $R4=cnt
456
+ ; $R5=tmp
457
+ loop:
458
+ StrCpy $R5 $R2 $R3 $R4
459
+ StrCmp $R5 $R1 done
460
+ StrCmp $R5 "" done
461
+ IntOp $R4 $R4 + 1
462
+ Goto loop
463
+ done:
464
+ StrCpy $R1 $R2 "" $R4
465
+ Pop $R5
466
+ Pop $R4
467
+ Pop $R3
468
+ Pop $R2
469
+ Exch $R1
470
+ FunctionEnd
471
+ !macroend
472
+ !insertmacro StrStr ""
473
+ !insertmacro StrStr "un."
474
+
475
+ Function Trim ; Added by Pelaca
476
+ Exch $R1
477
+ Push $R2
478
+ Loop:
479
+ StrCpy $R2 "$R1" 1 -1
480
+ StrCmp "$R2" " " RTrim
481
+ StrCmp "$R2" "$\n" RTrim
482
+ StrCmp "$R2" "$\r" RTrim
483
+ StrCmp "$R2" ";" RTrim
484
+ GoTo Done
485
+ RTrim:
486
+ StrCpy $R1 "$R1" -1
487
+ Goto Loop
488
+ Done:
489
+ Pop $R2
490
+ Exch $R1
491
+ FunctionEnd
492
+
493
+ Function ConditionalAddToRegisty
494
+ Pop $0
495
+ Pop $1
496
+ StrCmp "$0" "" ConditionalAddToRegisty_EmptyString
497
+ WriteRegStr SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_NAME@" \
498
+ "$1" "$0"
499
+ ;MessageBox MB_OK "Set Registry: '$1' to '$0'"
500
+ DetailPrint "Set install registry entry: '$1' to '$0'"
501
+ ConditionalAddToRegisty_EmptyString:
502
+ FunctionEnd
503
+
504
+ ;--------------------------------
505
+
506
+ !ifdef CPACK_USES_DOWNLOAD
507
+ Function DownloadFile
508
+ IfFileExists $INSTDIR\* +2
509
+ CreateDirectory $INSTDIR
510
+ Pop $0
511
+
512
+ ; Skip if already downloaded
513
+ IfFileExists $INSTDIR\$0 0 +2
514
+ Return
515
+
516
+ StrCpy $1 "@CPACK_DOWNLOAD_SITE@"
517
+
518
+ try_again:
519
+ NSISdl::download "$1/$0" "$INSTDIR\$0"
520
+
521
+ Pop $1
522
+ StrCmp $1 "success" success
523
+ StrCmp $1 "Cancelled" cancel
524
+ MessageBox MB_OK "Download failed: $1"
525
+ cancel:
526
+ Return
527
+ success:
528
+ FunctionEnd
529
+ !endif
530
+
531
+ ;--------------------------------
532
+ ; Installation types
533
+ @CPACK_NSIS_INSTALLATION_TYPES@
534
+
535
+ ;--------------------------------
536
+ ; Component sections
537
+ @CPACK_NSIS_COMPONENT_SECTIONS@
538
+
539
+ ;--------------------------------
540
+ ; Define some macro setting for the gui
541
+ @CPACK_NSIS_INSTALLER_MUI_ICON_CODE@
542
+ @CPACK_NSIS_INSTALLER_ICON_CODE@
543
+ @CPACK_NSIS_INSTALLER_MUI_COMPONENTS_DESC@
544
+
545
+ ;--------------------------------
546
+ ;Pages
547
+ !insertmacro MUI_PAGE_WELCOME
548
+
549
+ !insertmacro MUI_PAGE_LICENSE "@CPACK_RESOURCE_FILE_LICENSE@"
550
+ Page custom InstallOptionsPage
551
+ !insertmacro MUI_PAGE_DIRECTORY
552
+
553
+ ;Start Menu Folder Page Configuration
554
+ !define MUI_STARTMENUPAGE_REGISTRY_ROOT "SHCTX"
555
+ !define MUI_STARTMENUPAGE_REGISTRY_KEY "Software\@CPACK_PACKAGE_VENDOR@\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@"
556
+ !define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "Start Menu Folder"
557
+ !insertmacro MUI_PAGE_STARTMENU Application $STARTMENU_FOLDER
558
+
559
+ !define MUI_FINISHPAGE_SHOWREADME "$INSTDIR\README.txt"
560
+
561
+ @CPACK_NSIS_PAGE_COMPONENTS@
562
+
563
+ !insertmacro MUI_PAGE_INSTFILES
564
+ !insertmacro MUI_PAGE_FINISH
565
+
566
+ !insertmacro MUI_UNPAGE_CONFIRM
567
+ !insertmacro MUI_UNPAGE_INSTFILES
568
+ !insertmacro MUI_UNPAGE_FINISH
569
+
570
+ ;--------------------------------
571
+ ;Languages
572
+
573
+ !insertmacro MUI_LANGUAGE "English" ;first language is the default language
574
+ !insertmacro MUI_LANGUAGE "Albanian"
575
+ !insertmacro MUI_LANGUAGE "Arabic"
576
+ !insertmacro MUI_LANGUAGE "Basque"
577
+ !insertmacro MUI_LANGUAGE "Belarusian"
578
+ !insertmacro MUI_LANGUAGE "Bosnian"
579
+ !insertmacro MUI_LANGUAGE "Breton"
580
+ !insertmacro MUI_LANGUAGE "Bulgarian"
581
+ !insertmacro MUI_LANGUAGE "Croatian"
582
+ !insertmacro MUI_LANGUAGE "Czech"
583
+ !insertmacro MUI_LANGUAGE "Danish"
584
+ !insertmacro MUI_LANGUAGE "Dutch"
585
+ !insertmacro MUI_LANGUAGE "Estonian"
586
+ !insertmacro MUI_LANGUAGE "Farsi"
587
+ !insertmacro MUI_LANGUAGE "Finnish"
588
+ !insertmacro MUI_LANGUAGE "French"
589
+ !insertmacro MUI_LANGUAGE "German"
590
+ !insertmacro MUI_LANGUAGE "Greek"
591
+ !insertmacro MUI_LANGUAGE "Hebrew"
592
+ !insertmacro MUI_LANGUAGE "Hungarian"
593
+ !insertmacro MUI_LANGUAGE "Icelandic"
594
+ !insertmacro MUI_LANGUAGE "Indonesian"
595
+ !insertmacro MUI_LANGUAGE "Irish"
596
+ !insertmacro MUI_LANGUAGE "Italian"
597
+ !insertmacro MUI_LANGUAGE "Japanese"
598
+ !insertmacro MUI_LANGUAGE "Korean"
599
+ !insertmacro MUI_LANGUAGE "Kurdish"
600
+ !insertmacro MUI_LANGUAGE "Latvian"
601
+ !insertmacro MUI_LANGUAGE "Lithuanian"
602
+ !insertmacro MUI_LANGUAGE "Luxembourgish"
603
+ !insertmacro MUI_LANGUAGE "Macedonian"
604
+ !insertmacro MUI_LANGUAGE "Malay"
605
+ !insertmacro MUI_LANGUAGE "Mongolian"
606
+ !insertmacro MUI_LANGUAGE "Norwegian"
607
+ !insertmacro MUI_LANGUAGE "Polish"
608
+ !insertmacro MUI_LANGUAGE "Portuguese"
609
+ !insertmacro MUI_LANGUAGE "PortugueseBR"
610
+ !insertmacro MUI_LANGUAGE "Romanian"
611
+ !insertmacro MUI_LANGUAGE "Russian"
612
+ !insertmacro MUI_LANGUAGE "Serbian"
613
+ !insertmacro MUI_LANGUAGE "SerbianLatin"
614
+ !insertmacro MUI_LANGUAGE "SimpChinese"
615
+ !insertmacro MUI_LANGUAGE "Slovak"
616
+ !insertmacro MUI_LANGUAGE "Slovenian"
617
+ !insertmacro MUI_LANGUAGE "Spanish"
618
+ !insertmacro MUI_LANGUAGE "Swedish"
619
+ !insertmacro MUI_LANGUAGE "Thai"
620
+ !insertmacro MUI_LANGUAGE "TradChinese"
621
+ !insertmacro MUI_LANGUAGE "Turkish"
622
+ !insertmacro MUI_LANGUAGE "Ukrainian"
623
+ !insertmacro MUI_LANGUAGE "Welsh"
624
+
625
+
626
+ ;--------------------------------
627
+ ;Reserve Files
628
+
629
+ ;These files should be inserted before other files in the data block
630
+ ;Keep these lines before any File command
631
+ ;Only for solid compression (by default, solid compression is enabled for BZIP2 and LZMA)
632
+
633
+ ReserveFile "NSIS.InstallOptions.ini"
634
+ !insertmacro MUI_RESERVEFILE_INSTALLOPTIONS
635
+
636
+ ;--------------------------------
637
+ ;Installer Sections
638
+
639
+ Section "-Core installation"
640
+ ;Use the entire tree produced by the INSTALL target. Keep the
641
+ ;list of directories here in sync with the RMDir commands below.
642
+ SetOutPath "$INSTDIR"
643
+ @CPACK_NSIS_FULL_INSTALL@
644
+
645
+ ;Store installation folder
646
+ WriteRegStr SHCTX "Software\@CPACK_PACKAGE_VENDOR@\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@" "" $INSTDIR
647
+
648
+ ;Create uninstaller
649
+ WriteUninstaller "$INSTDIR\Uninstall.exe"
650
+ Push "DisplayName"
651
+ Push "@CPACK_NSIS_DISPLAY_NAME@"
652
+ Call ConditionalAddToRegisty
653
+ Push "DisplayVersion"
654
+ Push "@CPACK_PACKAGE_VERSION@"
655
+ Call ConditionalAddToRegisty
656
+ Push "Publisher"
657
+ Push "@CPACK_PACKAGE_VENDOR@"
658
+ Call ConditionalAddToRegisty
659
+ Push "UninstallString"
660
+ Push "$INSTDIR\Uninstall.exe"
661
+ Call ConditionalAddToRegisty
662
+ Push "NoRepair"
663
+ Push "1"
664
+ Call ConditionalAddToRegisty
665
+
666
+ !ifdef CPACK_NSIS_ADD_REMOVE
667
+ ;Create add/remove functionality
668
+ Push "ModifyPath"
669
+ Push "$INSTDIR\AddRemove.exe"
670
+ Call ConditionalAddToRegisty
671
+ !else
672
+ Push "NoModify"
673
+ Push "1"
674
+ Call ConditionalAddToRegisty
675
+ !endif
676
+
677
+ ; Optional registration
678
+ Push "DisplayIcon"
679
+ Push "$INSTDIR\@CPACK_NSIS_INSTALLED_ICON_NAME@"
680
+ Call ConditionalAddToRegisty
681
+ Push "HelpLink"
682
+ Push "@CPACK_NSIS_HELP_LINK@"
683
+ Call ConditionalAddToRegisty
684
+ Push "URLInfoAbout"
685
+ Push "@CPACK_NSIS_URL_INFO_ABOUT@"
686
+ Call ConditionalAddToRegisty
687
+ Push "Contact"
688
+ Push "@CPACK_NSIS_CONTACT@"
689
+ Call ConditionalAddToRegisty
690
+ !insertmacro MUI_INSTALLOPTIONS_READ $INSTALL_DESKTOP "NSIS.InstallOptions.ini" "Field 5" "State"
691
+ !insertmacro MUI_STARTMENU_WRITE_BEGIN Application
692
+
693
+ ;Create shortcuts
694
+ CreateDirectory "$SMPROGRAMS\$STARTMENU_FOLDER"
695
+ @CPACK_NSIS_CREATE_ICONS@
696
+ @CPACK_NSIS_CREATE_ICONS_EXTRA@
697
+ CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\Uninstall.lnk" "$INSTDIR\Uninstall.exe"
698
+
699
+ ;Read a value from an InstallOptions INI file
700
+ !insertmacro MUI_INSTALLOPTIONS_READ $DO_NOT_ADD_TO_PATH "NSIS.InstallOptions.ini" "Field 2" "State"
701
+ !insertmacro MUI_INSTALLOPTIONS_READ $ADD_TO_PATH_ALL_USERS "NSIS.InstallOptions.ini" "Field 3" "State"
702
+ !insertmacro MUI_INSTALLOPTIONS_READ $ADD_TO_PATH_CURRENT_USER "NSIS.InstallOptions.ini" "Field 4" "State"
703
+
704
+ ; Write special uninstall registry entries
705
+ Push "StartMenu"
706
+ Push "$STARTMENU_FOLDER"
707
+ Call ConditionalAddToRegisty
708
+ Push "DoNotAddToPath"
709
+ Push "$DO_NOT_ADD_TO_PATH"
710
+ Call ConditionalAddToRegisty
711
+ Push "AddToPathAllUsers"
712
+ Push "$ADD_TO_PATH_ALL_USERS"
713
+ Call ConditionalAddToRegisty
714
+ Push "AddToPathCurrentUser"
715
+ Push "$ADD_TO_PATH_CURRENT_USER"
716
+ Call ConditionalAddToRegisty
717
+ Push "InstallToDesktop"
718
+ Push "$INSTALL_DESKTOP"
719
+ Call ConditionalAddToRegisty
720
+
721
+ !insertmacro MUI_STARTMENU_WRITE_END
722
+
723
+ @CPACK_NSIS_EXTRA_INSTALL_COMMANDS@
724
+
725
+ SectionEnd
726
+
727
+ Section "-Add to path"
728
+ Push $INSTDIR\bin
729
+ StrCmp "@CPACK_NSIS_MODIFY_PATH@" "ON" 0 doNotAddToPath
730
+ StrCmp $DO_NOT_ADD_TO_PATH "1" doNotAddToPath 0
731
+ Call AddToPath
732
+ doNotAddToPath:
733
+ SectionEnd
734
+
735
+ ;--------------------------------
736
+ ; Create custom pages
737
+ Function InstallOptionsPage
738
+ !insertmacro MUI_HEADER_TEXT "Install Options" "Choose options for installing @CPACK_NSIS_PACKAGE_NAME@"
739
+ !insertmacro MUI_INSTALLOPTIONS_DISPLAY "NSIS.InstallOptions.ini"
740
+
741
+ FunctionEnd
742
+
743
+ ;--------------------------------
744
+ ; determine admin versus local install
745
+ Function un.onInit
746
+
747
+ ClearErrors
748
+ UserInfo::GetName
749
+ IfErrors noLM
750
+ Pop $0
751
+ UserInfo::GetAccountType
752
+ Pop $1
753
+ StrCmp $1 "Admin" 0 +3
754
+ SetShellVarContext all
755
+ ;MessageBox MB_OK 'User "$0" is in the Admin group'
756
+ Goto done
757
+ StrCmp $1 "Power" 0 +3
758
+ SetShellVarContext all
759
+ ;MessageBox MB_OK 'User "$0" is in the Power Users group'
760
+ Goto done
761
+
762
+ noLM:
763
+ ;Get installation folder from registry if available
764
+
765
+ done:
766
+
767
+ FunctionEnd
768
+
769
+ ;--- Add/Remove callback functions: ---
770
+ !macro SectionList MacroName
771
+ ;This macro used to perform operation on multiple sections.
772
+ ;List all of your components in following manner here.
773
+ @CPACK_NSIS_COMPONENT_SECTION_LIST@
774
+ !macroend
775
+
776
+ Section -FinishComponents
777
+ ;Removes unselected components and writes component status to registry
778
+ !insertmacro SectionList "FinishSection"
779
+
780
+ !ifdef CPACK_NSIS_ADD_REMOVE
781
+ ; Get the name of the installer executable
782
+ System::Call 'kernel32::GetModuleFileNameA(i 0, t .R0, i 1024) i r1'
783
+ StrCpy $R3 $R0
784
+
785
+ ; Strip off the last 13 characters, to see if we have AddRemove.exe
786
+ StrLen $R1 $R0
787
+ IntOp $R1 $R0 - 13
788
+ StrCpy $R2 $R0 13 $R1
789
+ StrCmp $R2 "AddRemove.exe" addremove_installed
790
+
791
+ ; We're not running AddRemove.exe, so install it
792
+ CopyFiles $R3 $INSTDIR\AddRemove.exe
793
+
794
+ addremove_installed:
795
+ !endif
796
+ SectionEnd
797
+ ;--- End of Add/Remove callback functions ---
798
+
799
+ ;--------------------------------
800
+ ; Component dependencies
801
+ Function .onSelChange
802
+ !insertmacro SectionList MaybeSelectionChanged
803
+ FunctionEnd
804
+
805
+ ;--------------------------------
806
+ ;Uninstaller Section
807
+
808
+ Section "Uninstall"
809
+ ReadRegStr $START_MENU SHCTX \
810
+ "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_NAME@" "StartMenu"
811
+ ;MessageBox MB_OK "Start menu is in: $START_MENU"
812
+ ReadRegStr $DO_NOT_ADD_TO_PATH SHCTX \
813
+ "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_NAME@" "DoNotAddToPath"
814
+ ReadRegStr $ADD_TO_PATH_ALL_USERS SHCTX \
815
+ "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_NAME@" "AddToPathAllUsers"
816
+ ReadRegStr $ADD_TO_PATH_CURRENT_USER SHCTX \
817
+ "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_NAME@" "AddToPathCurrentUser"
818
+ ;MessageBox MB_OK "Add to path: $DO_NOT_ADD_TO_PATH all users: $ADD_TO_PATH_ALL_USERS"
819
+ ReadRegStr $INSTALL_DESKTOP SHCTX \
820
+ "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_NAME@" "InstallToDesktop"
821
+ ;MessageBox MB_OK "Install to desktop: $INSTALL_DESKTOP "
822
+
823
+ @CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS@
824
+
825
+ ;Remove files we installed.
826
+ ;Keep the list of directories here in sync with the File commands above.
827
+ @CPACK_NSIS_DELETE_FILES@
828
+ @CPACK_NSIS_DELETE_DIRECTORIES@
829
+
830
+ !ifdef CPACK_NSIS_ADD_REMOVE
831
+ ;Remove the add/remove program
832
+ Delete "$INSTDIR\AddRemove.exe"
833
+ !endif
834
+
835
+ ;Remove the uninstaller itself.
836
+ Delete "$INSTDIR\Uninstall.exe"
837
+ DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_NAME@"
838
+
839
+ ;Remove the installation directory if it is empty.
840
+ RMDir "$INSTDIR"
841
+
842
+ ; Remove the registry entries.
843
+ DeleteRegKey SHCTX "Software\@CPACK_PACKAGE_VENDOR@\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@"
844
+
845
+ ; Removes all optional components
846
+ !insertmacro SectionList "RemoveSection"
847
+
848
+ !insertmacro MUI_STARTMENU_GETFOLDER Application $MUI_TEMP
849
+
850
+ Delete "$SMPROGRAMS\$MUI_TEMP\Uninstall.lnk"
851
+ @CPACK_NSIS_DELETE_ICONS@
852
+ @CPACK_NSIS_DELETE_ICONS_EXTRA@
853
+
854
+ ;Delete empty start menu parent diretories
855
+ StrCpy $MUI_TEMP "$SMPROGRAMS\$MUI_TEMP"
856
+
857
+ startMenuDeleteLoop:
858
+ ClearErrors
859
+ RMDir $MUI_TEMP
860
+ GetFullPathName $MUI_TEMP "$MUI_TEMP\.."
861
+
862
+ IfErrors startMenuDeleteLoopDone
863
+
864
+ StrCmp "$MUI_TEMP" "$SMPROGRAMS" startMenuDeleteLoopDone startMenuDeleteLoop
865
+ startMenuDeleteLoopDone:
866
+
867
+ ; If the user changed the shortcut, then untinstall may not work. This should
868
+ ; try to fix it.
869
+ StrCpy $MUI_TEMP "$START_MENU"
870
+ Delete "$SMPROGRAMS\$MUI_TEMP\Uninstall.lnk"
871
+ @CPACK_NSIS_DELETE_ICONS_EXTRA@
872
+
873
+ ;Delete empty start menu parent diretories
874
+ StrCpy $MUI_TEMP "$SMPROGRAMS\$MUI_TEMP"
875
+
876
+ secondStartMenuDeleteLoop:
877
+ ClearErrors
878
+ RMDir $MUI_TEMP
879
+ GetFullPathName $MUI_TEMP "$MUI_TEMP\.."
880
+
881
+ IfErrors secondStartMenuDeleteLoopDone
882
+
883
+ StrCmp "$MUI_TEMP" "$SMPROGRAMS" secondStartMenuDeleteLoopDone secondStartMenuDeleteLoop
884
+ secondStartMenuDeleteLoopDone:
885
+
886
+ DeleteRegKey /ifempty SHCTX "Software\@CPACK_PACKAGE_VENDOR@\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@"
887
+
888
+ Push $INSTDIR\bin
889
+ StrCmp $DO_NOT_ADD_TO_PATH_ "1" doNotRemoveFromPath 0
890
+ Call un.RemoveFromPath
891
+ doNotRemoveFromPath:
892
+ SectionEnd
893
+
894
+ ;--------------------------------
895
+ ; determine admin versus local install
896
+ ; Is install for "AllUsers" or "JustMe"?
897
+ ; Default to "JustMe" - set to "AllUsers" if admin or on Win9x
898
+ ; This function is used for the very first "custom page" of the installer.
899
+ ; This custom page does not show up visibly, but it executes prior to the
900
+ ; first visible page and sets up $INSTDIR properly...
901
+ ; Choose different default installation folder based on SV_ALLUSERS...
902
+ ; "Program Files" for AllUsers, "My Documents" for JustMe...
903
+
904
+ Function .onInit
905
+ ; Reads components status for registry
906
+ !insertmacro SectionList "InitSection"
907
+
908
+ ; check to see if /D has been used to change
909
+ ; the install directory by comparing it to the
910
+ ; install directory that is expected to be the
911
+ ; default
912
+ StrCpy $IS_DEFAULT_INSTALLDIR 0
913
+ StrCmp "$INSTDIR" "$PROGRAMFILES\@CPACK_PACKAGE_INSTALL_DIRECTORY@" 0 +2
914
+ StrCpy $IS_DEFAULT_INSTALLDIR 1
915
+
916
+ StrCpy $SV_ALLUSERS "JustMe"
917
+ ; if default install dir then change the default
918
+ ; if it is installed for JustMe
919
+ StrCmp "$IS_DEFAULT_INSTALLDIR" "1" 0 +2
920
+ StrCpy $INSTDIR "$DOCUMENTS\@CPACK_PACKAGE_INSTALL_DIRECTORY@"
921
+
922
+ ClearErrors
923
+ UserInfo::GetName
924
+ IfErrors noLM
925
+ Pop $0
926
+ UserInfo::GetAccountType
927
+ Pop $1
928
+ StrCmp $1 "Admin" 0 +3
929
+ SetShellVarContext all
930
+ ;MessageBox MB_OK 'User "$0" is in the Admin group'
931
+ StrCpy $SV_ALLUSERS "AllUsers"
932
+ Goto done
933
+ StrCmp $1 "Power" 0 +3
934
+ SetShellVarContext all
935
+ ;MessageBox MB_OK 'User "$0" is in the Power Users group'
936
+ StrCpy $SV_ALLUSERS "AllUsers"
937
+ Goto done
938
+
939
+ noLM:
940
+ StrCpy $SV_ALLUSERS "AllUsers"
941
+ ;Get installation folder from registry if available
942
+
943
+ done:
944
+ StrCmp $SV_ALLUSERS "AllUsers" 0 +3
945
+ StrCmp "$IS_DEFAULT_INSTALLDIR" "1" 0 +2
946
+ StrCpy $INSTDIR "$PROGRAMFILES\@CPACK_PACKAGE_INSTALL_DIRECTORY@"
947
+
948
+ StrCmp "@CPACK_NSIS_MODIFY_PATH@" "ON" 0 noOptionsPage
949
+ !insertmacro MUI_INSTALLOPTIONS_EXTRACT "NSIS.InstallOptions.ini"
950
+
951
+ noOptionsPage:
952
+ FunctionEnd