zmq 2.1.3 → 2.1.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/Makefile +35 -29
  2. data/extconf.rb +12 -1
  3. data/rbzmq.c +22 -23
  4. metadata +3 -5
data/Makefile CHANGED
@@ -4,17 +4,19 @@ SHELL = /bin/sh
4
4
  #### Start of system configuration section. ####
5
5
 
6
6
  srcdir = .
7
- topdir = /usr/local/Cellar/ruby/1.9.1-p378/include/ruby-1.9.1
8
- hdrdir = /usr/local/Cellar/ruby/1.9.1-p378/include/ruby-1.9.1
9
- arch_hdrdir = /usr/local/Cellar/ruby/1.9.1-p378/include/ruby-1.9.1/$(arch)
7
+ topdir = /Users/brian/.rvm/rubies/ruby-1.9.2-p180/include/ruby-1.9.1
8
+ hdrdir = /Users/brian/.rvm/rubies/ruby-1.9.2-p180/include/ruby-1.9.1
9
+ arch_hdrdir = /Users/brian/.rvm/rubies/ruby-1.9.2-p180/include/ruby-1.9.1/$(arch)
10
10
  VPATH = $(srcdir):$(arch_hdrdir)/ruby:$(hdrdir)/ruby
11
- prefix = $(DESTDIR)/usr/local/Cellar/ruby/1.9.1-p378
11
+ prefix = $(DESTDIR)/Users/brian/.rvm/rubies/ruby-1.9.2-p180
12
+ rubylibprefix = $(libdir)/$(RUBY_BASE_NAME)
12
13
  exec_prefix = $(prefix)
13
14
  vendorhdrdir = $(rubyhdrdir)/vendor_ruby
14
15
  sitehdrdir = $(rubyhdrdir)/site_ruby
15
- rubyhdrdir = $(includedir)/$(RUBY_INSTALL_NAME)-$(ruby_version)
16
- vendordir = $(libdir)/$(RUBY_INSTALL_NAME)/vendor_ruby
17
- sitedir = $(DESTDIR)/Library/Ruby/Site
16
+ rubyhdrdir = $(includedir)/$(RUBY_BASE_NAME)-$(ruby_version)
17
+ vendordir = $(rubylibprefix)/vendor_ruby
18
+ sitedir = $(rubylibprefix)/site_ruby
19
+ ridir = $(datarootdir)/$(RI_BASE_NAME)
18
20
  mandir = $(datarootdir)/man
19
21
  localedir = $(datarootdir)/locale
20
22
  libdir = $(exec_prefix)/lib
@@ -34,15 +36,15 @@ datarootdir = $(prefix)/share
34
36
  libexecdir = $(exec_prefix)/libexec
35
37
  sbindir = $(exec_prefix)/sbin
36
38
  bindir = $(exec_prefix)/bin
37
- rubylibdir = $(libdir)/$(ruby_install_name)/$(ruby_version)
39
+ rubylibdir = $(rubylibprefix)/$(ruby_version)
38
40
  archdir = $(rubylibdir)/$(arch)
39
41
  sitelibdir = $(sitedir)/$(ruby_version)
40
42
  sitearchdir = $(sitelibdir)/$(sitearch)
41
43
  vendorlibdir = $(vendordir)/$(ruby_version)
42
44
  vendorarchdir = $(vendorlibdir)/$(sitearch)
43
45
 
44
- CC = /usr/bin/cc
45
- CXX = /usr/bin/c++
46
+ CC = gcc
47
+ CXX = g++
46
48
  LIBRUBY = $(LIBRUBY_SO)
47
49
  LIBRUBY_A = lib$(RUBY_SO_NAME)-static.a
48
50
  LIBRUBYARG_SHARED = -l$(RUBY_SO_NAME)
@@ -51,30 +53,31 @@ OUTFLAG = -o
51
53
  COUTFLAG = -o
52
54
 
53
55
  RUBY_EXTCONF_H =
54
- cflags = $(optflags) $(debugflags) $(warnflags)
55
- optflags = -O2
56
- debugflags = -g
57
- warnflags = -Wall -Wno-parentheses
58
- CFLAGS = -fno-common -O3 -march=core2 -msse4.1 -w -pipe $(cflags) -fno-common -pipe -fno-common
56
+ cflags = $(optflags) $(debugflags) $(warnflags)
57
+ optflags = -O3
58
+ debugflags = -ggdb
59
+ warnflags = -Wextra -Wno-unused-parameter -Wno-parentheses -Wpointer-arith -Wwrite-strings -Wno-missing-field-initializers -Wshorten-64-to-32 -Wno-long-long
60
+ CFLAGS = -fno-common $(cflags) -fno-common -pipe
59
61
  INCFLAGS = -I. -I$(arch_hdrdir) -I$(hdrdir)/ruby/backward -I$(hdrdir) -I$(srcdir)
60
62
  DEFS =
61
- CPPFLAGS = -I/usr/local/Cellar/readline/6.0/include -I/usr/local/Cellar/readline/6.0/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE $(DEFS) $(cppflags)
62
- CXXFLAGS = $(CFLAGS) -O3 -march=core2 -msse4.1 -w -pipe $(cxxflags)
63
- ldflags = -L. -L/usr/local/Cellar/readline/6.0/lib -L/usr/local/Cellar/readline/6.0/lib
64
- dldflags =
65
- archflag =
66
- DLDFLAGS = $(ldflags) $(dldflags) $(archflag)
67
- LDSHARED = cc -dynamic -bundle -undefined suppress -flat_namespace
68
- LDSHAREDXX = $(LDSHARED)
63
+ CPPFLAGS = -DHAVE_ZMQ_H -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE $(DEFS) $(cppflags)
64
+ CXXFLAGS = $(CFLAGS) $(cxxflags)
65
+ ldflags = -L. -L/usr/local/lib
66
+ dldflags = -Wl,-undefined,dynamic_lookup -Wl,-multiply_defined,suppress -Wl,-flat_namespace
67
+ ARCH_FLAG =
68
+ DLDFLAGS = $(ldflags) $(dldflags)
69
+ LDSHARED = $(CC) -dynamic -bundle
70
+ LDSHAREDXX = $(CXX) -dynamic -bundle
69
71
  AR = ar
70
72
  EXEEXT =
71
73
 
74
+ RUBY_BASE_NAME = ruby
72
75
  RUBY_INSTALL_NAME = ruby
73
- RUBY_SO_NAME = ruby
74
- arch = i386-darwin10.3.0
75
- sitearch = i386-darwin10.3.0
76
+ RUBY_SO_NAME = ruby.1.9.1
77
+ arch = x86_64-darwin10.7.0
78
+ sitearch = $(arch)
76
79
  ruby_version = 1.9.1
77
- ruby = /usr/local/Cellar/ruby/1.9.1-p378/bin/ruby
80
+ ruby = /Users/brian/.rvm/rubies/ruby-1.9.2-p180/bin/ruby
78
81
  RUBY = $(ruby)
79
82
  RM = rm -f
80
83
  RM_RF = $(RUBY) -run -e rm -- -rf
@@ -101,7 +104,7 @@ extout =
101
104
  extout_prefix =
102
105
  target_prefix =
103
106
  LOCAL_LIBS =
104
- LIBS = $(LIBRUBYARG_SHARED) -lzmq -lpthread -ldl -lobjc
107
+ LIBS = $(LIBRUBYARG_SHARED) -lzmq -lpthread -ldl -lobjc
105
108
  SRCS = rbzmq.c
106
109
  OBJS = rbzmq.o
107
110
  TARGET = zmq
@@ -122,6 +125,8 @@ CLEANOBJS = *.o *.bak
122
125
 
123
126
  all: $(DLLIB)
124
127
  static: $(STATIC_LIB)
128
+ .PHONY: all install static install-so install-rb
129
+ .PHONY: clean clean-so clean-rb
125
130
 
126
131
  clean-rb-default::
127
132
  clean-rb::
@@ -143,7 +148,8 @@ install: install-so install-rb
143
148
  install-so: $(RUBYARCHDIR)
144
149
  install-so: $(RUBYARCHDIR)/$(DLLIB)
145
150
  $(RUBYARCHDIR)/$(DLLIB): $(DLLIB)
146
- $(INSTALL_PROG) $(DLLIB) $(RUBYARCHDIR)
151
+ @-$(MAKEDIRS) $(@D)
152
+ $(INSTALL_PROG) $(DLLIB) $(@D)
147
153
  install-rb: pre-install-rb install-rb-default
148
154
  install-rb-default: pre-install-rb-default
149
155
  pre-install-rb: Makefile
data/extconf.rb CHANGED
@@ -18,7 +18,18 @@
18
18
 
19
19
  require 'mkmf'
20
20
  dir_config('zmq')
21
- if have_library('zmq', 'zmq_init')
21
+
22
+ def header?
23
+ have_header('zmq.h') ||
24
+ find_header('zmq.h', '/opt/local/include', '/usr/local/include', '/usr/include')
25
+ end
26
+
27
+ def library?
28
+ have_library('zmq', 'zmq_init') ||
29
+ find_library('zmq', 'zmq_init', '/opt/local/lib', '/usr/local/lib', '/usr/lib')
30
+ end
31
+
32
+ if header? && library?
22
33
  puts "Cool, I found your zmq install..."
23
34
  create_makefile("zmq")
24
35
  else
data/rbzmq.c CHANGED
@@ -63,6 +63,7 @@ typedef unsigned __int64 uint64_t;
63
63
  } while(0)
64
64
 
65
65
  VALUE socket_type;
66
+ VALUE exception_type;
66
67
 
67
68
  /*
68
69
  * Document-class: ZMQ
@@ -124,7 +125,7 @@ static VALUE context_initialize (int argc_, VALUE* argv_, VALUE self_)
124
125
  assert (!DATA_PTR (self_));
125
126
  void *ctx = zmq_init (NIL_P (io_threads) ? 1 : NUM2INT (io_threads));
126
127
  if (!ctx) {
127
- rb_raise (rb_eRuntimeError, "%s", zmq_strerror (zmq_errno ()));
128
+ rb_raise (exception_type, "%s", zmq_strerror (zmq_errno ()));
128
129
  return Qnil;
129
130
  }
130
131
 
@@ -328,7 +329,7 @@ static VALUE internal_select(VALUE argval)
328
329
  rc = zmq_poll (ps.items, ps.nitems, arg->timeout_usec);
329
330
 
330
331
  if (rc == -1) {
331
- rb_raise(rb_eRuntimeError, "%s", zmq_strerror (zmq_errno ()));
332
+ rb_raise(exception_type, "%s", zmq_strerror (zmq_errno ()));
332
333
  return Qnil;
333
334
  }
334
335
  else if (rc == 0)
@@ -356,7 +357,7 @@ static VALUE internal_select(VALUE argval)
356
357
 
357
358
  static VALUE module_select_internal(VALUE readset, VALUE writeset, VALUE errset, long timeout_usec)
358
359
  {
359
- int nitems;
360
+ size_t nitems;
360
361
  struct select_arg arg;
361
362
 
362
363
  /* Conservative estimate for nitems before we traverse the lists. */
@@ -370,11 +371,7 @@ static VALUE module_select_internal(VALUE readset, VALUE writeset, VALUE errset,
370
371
  arg.errset = errset;
371
372
  arg.timeout_usec = timeout_usec;
372
373
 
373
- #ifdef HAVE_RUBY_INTERN_H
374
- return rb_ensure(internal_select, (VALUE)&arg, (void (*)())ruby_xfree, (VALUE)arg.items);
375
- #else
376
374
  return rb_ensure(internal_select, (VALUE)&arg, (VALUE (*)())ruby_xfree, (VALUE)arg.items);
377
- #endif
378
375
  }
379
376
 
380
377
  /*
@@ -433,7 +430,7 @@ static VALUE context_socket (VALUE self_, VALUE type_)
433
430
  Data_Get_Struct (self_, void, c);
434
431
  void * s = zmq_socket (c, NUM2INT (type_));
435
432
  if (!s) {
436
- rb_raise (rb_eRuntimeError, "%s", zmq_strerror (zmq_errno ()));
433
+ rb_raise (exception_type, "%s", zmq_strerror (zmq_errno ()));
437
434
  return Qnil;
438
435
  }
439
436
 
@@ -933,7 +930,7 @@ static VALUE socket_getsockopt (VALUE self_, VALUE option_)
933
930
  &optvalsize);
934
931
 
935
932
  if (rc != 0) {
936
- rb_raise (rb_eRuntimeError, "%s", zmq_strerror (zmq_errno ()));
933
+ rb_raise (exception_type, "%s", zmq_strerror (zmq_errno ()));
937
934
  return Qnil;
938
935
  }
939
936
 
@@ -952,7 +949,7 @@ static VALUE socket_getsockopt (VALUE self_, VALUE option_)
952
949
  &optvalsize);
953
950
 
954
951
  if (rc != 0) {
955
- rb_raise (rb_eRuntimeError, "%s", zmq_strerror (zmq_errno ()));
952
+ rb_raise (exception_type, "%s", zmq_strerror (zmq_errno ()));
956
953
  return Qnil;
957
954
  }
958
955
 
@@ -978,7 +975,7 @@ static VALUE socket_getsockopt (VALUE self_, VALUE option_)
978
975
  &optvalsize);
979
976
 
980
977
  if (rc != 0) {
981
- rb_raise (rb_eRuntimeError, "%s", zmq_strerror (zmq_errno ()));
978
+ rb_raise (exception_type, "%s", zmq_strerror (zmq_errno ()));
982
979
  return Qnil;
983
980
  }
984
981
 
@@ -1006,7 +1003,7 @@ static VALUE socket_getsockopt (VALUE self_, VALUE option_)
1006
1003
  &optvalsize);
1007
1004
 
1008
1005
  if (rc != 0) {
1009
- rb_raise (rb_eRuntimeError, "%s", zmq_strerror (zmq_errno ()));
1006
+ rb_raise (exception_type, "%s", zmq_strerror (zmq_errno ()));
1010
1007
  return Qnil;
1011
1008
  }
1012
1009
 
@@ -1025,7 +1022,7 @@ static VALUE socket_getsockopt (VALUE self_, VALUE option_)
1025
1022
  &optvalsize);
1026
1023
 
1027
1024
  if (rc != 0) {
1028
- rb_raise (rb_eRuntimeError, "%s", zmq_strerror (zmq_errno ()));
1025
+ rb_raise (exception_type, "%s", zmq_strerror (zmq_errno ()));
1029
1026
  return Qnil;
1030
1027
  }
1031
1028
 
@@ -1036,7 +1033,7 @@ static VALUE socket_getsockopt (VALUE self_, VALUE option_)
1036
1033
  }
1037
1034
  break;
1038
1035
  default:
1039
- rb_raise (rb_eRuntimeError, "%s", zmq_strerror (EINVAL));
1036
+ rb_raise (exception_type, "%s", zmq_strerror (EINVAL));
1040
1037
  return Qnil;
1041
1038
  }
1042
1039
 
@@ -1318,7 +1315,7 @@ static VALUE socket_setsockopt (VALUE self_, VALUE option_,
1318
1315
  case ZMQ_RECOVERY_IVL_MSEC:
1319
1316
  #endif
1320
1317
  {
1321
- int optval = FIX2LONG (optval_);
1318
+ int optval = FIX2INT (optval_);
1322
1319
 
1323
1320
  // Forward the code to native 0MQ library.
1324
1321
  rc = zmq_setsockopt (s, NUM2INT (option_),
@@ -1337,12 +1334,12 @@ static VALUE socket_setsockopt (VALUE self_, VALUE option_,
1337
1334
  break;
1338
1335
 
1339
1336
  default:
1340
- rb_raise (rb_eRuntimeError, "%s", zmq_strerror (EINVAL));
1337
+ rb_raise (exception_type, "%s", zmq_strerror (EINVAL));
1341
1338
  return Qnil;
1342
1339
  }
1343
1340
 
1344
1341
  if (rc != 0) {
1345
- rb_raise (rb_eRuntimeError, "%s", zmq_strerror (zmq_errno ()));
1342
+ rb_raise (exception_type, "%s", zmq_strerror (zmq_errno ()));
1346
1343
  return Qnil;
1347
1344
  }
1348
1345
 
@@ -1381,7 +1378,7 @@ static VALUE socket_bind (VALUE self_, VALUE addr_)
1381
1378
 
1382
1379
  int rc = zmq_bind (s, rb_string_value_cstr (&addr_));
1383
1380
  if (rc != 0) {
1384
- rb_raise (rb_eRuntimeError, "%s", zmq_strerror (zmq_errno ()));
1381
+ rb_raise (exception_type, "%s", zmq_strerror (zmq_errno ()));
1385
1382
  return Qnil;
1386
1383
  }
1387
1384
 
@@ -1424,7 +1421,7 @@ static VALUE socket_connect (VALUE self_, VALUE addr_)
1424
1421
 
1425
1422
  int rc = zmq_connect (s, rb_string_value_cstr (&addr_));
1426
1423
  if (rc != 0) {
1427
- rb_raise (rb_eRuntimeError, "%s", zmq_strerror (zmq_errno ()));
1424
+ rb_raise (exception_type, "%s", zmq_strerror (zmq_errno ()));
1428
1425
  return Qnil;
1429
1426
  }
1430
1427
 
@@ -1501,7 +1498,7 @@ static VALUE socket_send (int argc_, VALUE* argv_, VALUE self_)
1501
1498
  zmq_msg_t msg;
1502
1499
  int rc = zmq_msg_init_size (&msg, RSTRING_LEN (msg_));
1503
1500
  if (rc != 0) {
1504
- rb_raise (rb_eRuntimeError, "%s", zmq_strerror (zmq_errno ()));
1501
+ rb_raise (exception_type, "%s", zmq_strerror (zmq_errno ()));
1505
1502
  return Qnil;
1506
1503
  }
1507
1504
  memcpy (zmq_msg_data (&msg), RSTRING_PTR (msg_), RSTRING_LEN (msg_));
@@ -1525,7 +1522,7 @@ static VALUE socket_send (int argc_, VALUE* argv_, VALUE self_)
1525
1522
  }
1526
1523
 
1527
1524
  if (rc != 0) {
1528
- rb_raise (rb_eRuntimeError, "%s", zmq_strerror (zmq_errno ()));
1525
+ rb_raise (exception_type, "%s", zmq_strerror (zmq_errno ()));
1529
1526
  rc = zmq_msg_close (&msg);
1530
1527
  assert (rc == 0);
1531
1528
  return Qnil;
@@ -1610,7 +1607,7 @@ static VALUE socket_recv (int argc_, VALUE* argv_, VALUE self_)
1610
1607
  }
1611
1608
 
1612
1609
  if (rc != 0) {
1613
- rb_raise (rb_eRuntimeError, "%s", zmq_strerror (zmq_errno ()));
1610
+ rb_raise (exception_type, "%s", zmq_strerror (zmq_errno ()));
1614
1611
  rc = zmq_msg_close (&msg);
1615
1612
  assert (rc == 0);
1616
1613
  return Qnil;
@@ -1641,7 +1638,7 @@ static VALUE socket_close (VALUE self_)
1641
1638
  if (s != NULL) {
1642
1639
  int rc = zmq_close (s);
1643
1640
  if (rc != 0) {
1644
- rb_raise (rb_eRuntimeError, "%s", zmq_strerror (zmq_errno ()));
1641
+ rb_raise (exception_type, "%s", zmq_strerror (zmq_errno ()));
1645
1642
  return Qnil;
1646
1643
  }
1647
1644
 
@@ -1656,6 +1653,8 @@ void Init_zmq ()
1656
1653
  rb_define_singleton_method (zmq_module, "version", module_version, 0);
1657
1654
  rb_define_singleton_method (zmq_module, "select", module_select, -1);
1658
1655
 
1656
+ exception_type = rb_define_class_under (zmq_module, "Error", rb_eRuntimeError );
1657
+
1659
1658
  VALUE context_type = rb_define_class_under (zmq_module, "Context",
1660
1659
  rb_cObject);
1661
1660
  rb_define_alloc_func (context_type, context_alloc);
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zmq
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.3
4
+ version: 2.1.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,8 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2011-06-05 00:00:00.000000000 -07:00
14
- default_executable:
13
+ date: 2011-09-14 00:00:00.000000000Z
15
14
  dependencies: []
16
15
  description: This gem provides a Ruby API for the ZeroMQ messaging library.
17
16
  email:
@@ -26,7 +25,6 @@ files:
26
25
  - Makefile
27
26
  - rbzmq.c
28
27
  - extconf.rb
29
- has_rdoc: true
30
28
  homepage: http://www.zeromq.org/bindings:ruby
31
29
  licenses: []
32
30
  post_install_message:
@@ -47,7 +45,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
47
45
  version: '0'
48
46
  requirements: []
49
47
  rubyforge_project:
50
- rubygems_version: 1.6.2
48
+ rubygems_version: 1.8.5
51
49
  signing_key:
52
50
  specification_version: 3
53
51
  summary: Ruby API for ZeroMQ