aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Formula/zeromq.rb
blob: cf8ca1b5a69dc181472ccd4c27e0db11517300fd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
require 'formula'

class Zeromq < Formula
  homepage 'http://www.zeromq.org/'
  url 'http://download.zeromq.org/zeromq-3.2.3.tar.gz'
  sha1 '6857a3a0e908eca58f7c0f90e2ba4695f6700957'

  head 'https://github.com/zeromq/libzmq.git'

  option :universal
  option 'with-pgm', 'Build with PGM extension'

  depends_on 'pkg-config' => :build
  depends_on 'libpgm' if build.include? 'with-pgm'

  if build.head?
    depends_on :automake
    depends_on :libtool
  end

  fails_with :llvm do
    build 2326
    cause "Segfault while linking"
  end

  # Address lack of strndup on 10.6, fixed upstream
  # https://github.com/zeromq/zeromq3-x/commit/400cbc208a768c4df5039f401dd2688eede6e1ca
  def patches; DATA; end

  def install
    ENV.universal_binary if build.universal?

    args = ["--disable-dependency-tracking", "--prefix=#{prefix}"]
    if build.include? 'with-pgm'
      # Use HB libpgm-5.2 because their internal 5.1 is b0rked.
      ENV['OpenPGM_CFLAGS'] = %x[pkg-config --cflags openpgm-5.2].chomp
      ENV['OpenPGM_LIBS'] = %x[pkg-config --libs openpgm-5.2].chomp
      args << "--with-system-pgm"
    end

    system "./autogen.sh" if build.head?
    system "./configure", *args
    system "make"
    system "make install"
  end

  def caveats; <<-EOS.undent
    To install the zmq gem on 10.6 with the system Ruby on a 64-bit machine,
    you may need to do:

        ARCHFLAGS="-arch x86_64" gem install zmq -- --with-zmq-dir=#{opt_prefix}
    EOS
  end
end

__END__
diff --git a/tests/test_disconnect_inproc.cpp b/tests/test_disconnect_inproc.cpp
index 7875083..d6b68c6 100644
--- a/tests/test_disconnect_inproc.cpp
+++ b/tests/test_disconnect_inproc.cpp
@@ -40,16 +40,14 @@ int main(int argc, char** argv) {
                 zmq_msg_t msg;
                 zmq_msg_init (&msg);
                 zmq_msg_recv (&msg, pubSocket, 0);
-                int msgSize = zmq_msg_size(&msg);
                 char* buffer = (char*)zmq_msg_data(&msg);
 
                 if (buffer[0] == 0) {
                     assert(isSubscribed);
-                    printf("unsubscribing from '%s'\n", strndup(buffer + 1, msgSize - 1));
                     isSubscribed = false;
-                } else {
+                } 
+                else {
                     assert(!isSubscribed);
-                    printf("subscribing on '%s'\n", strndup(buffer + 1, msgSize - 1));
                     isSubscribed = true;
                 }
 
@@ -66,11 +64,6 @@ int main(int argc, char** argv) {
                 zmq_msg_t msg;
                 zmq_msg_init (&msg);
                 zmq_msg_recv (&msg, subSocket, 0);
-                int msgSize = zmq_msg_size(&msg);
-                char* buffer = (char*)zmq_msg_data(&msg);
-        
-                printf("received on subscriber '%s'\n", strndup(buffer, msgSize));
-        
                 zmq_getsockopt (subSocket, ZMQ_RCVMORE, &more, &more_size);
                 zmq_msg_close (&msg);