zeromq: apply patch for strndup on 10.6

Fixes Homebrew/homebrew#19877.
This commit is contained in:
Jack Nagel 2013-05-20 20:31:17 -05:00
parent a9ad65c5f2
commit 15337e0984

View file

@ -7,6 +7,9 @@ class Zeromq < Formula
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'
@ -20,8 +23,9 @@ class Zeromq < Formula
cause "Segfault while linking"
end
option :universal
option 'with-pgm', 'Build with PGM extension'
# 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?
@ -44,10 +48,48 @@ class Zeromq < Formula
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=#{HOMEBREW_PREFIX}
ARCHFLAGS="-arch x86_64" gem install zmq -- --with-zmq-dir=#{opt_prefix}
If you want to build the Java bindings from https://github.com/zeromq/jzmq
you will need the Java Developer Package from http://connect.apple.com/
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);