rbnewt 0.0.4 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/include/newt/rbnewt.h +1 -1
- data/include/newt/stomp.h +4 -0
- data/src/rbnewt.c +92 -45
- metadata +31 -4
- data/Makefile +0 -259
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2504ec989a4cbeeccab2d56fc9f054bc09c95402
|
4
|
+
data.tar.gz: aeda78b1d10c0d65857ea246f2fa8f75c0f5ad3d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 91c6d8ff65a927e4d5fe89ddfe5d7c93065e85d64699c8e3165abda3c390059ac09105578bbfa2a26e2df00b01a2651595d2ca32ad86ac63cdb51d66ecdc2449
|
7
|
+
data.tar.gz: f7203fd60960bbf0d5e054285c5dbd2c37f3515c7477176800c2abb14e04258f8970a06a743c5e7624f39b18e7a0c48d9483a84fcb4cb4b979e1520b7419f8e8
|
data/include/newt/rbnewt.h
CHANGED
data/include/newt/stomp.h
CHANGED
@@ -14,6 +14,10 @@
|
|
14
14
|
#define NEWT_STOMP_DEFAULT_PASSWD "guest"
|
15
15
|
#define NEWT_STOMP_DEFAULT_PORT "61613"
|
16
16
|
|
17
|
+
#define NEWT_STOMP_CB_CONNECTED "cb_connected"
|
18
|
+
#define NEWT_STOMP_CB_MESSAGE "cb_message"
|
19
|
+
#define NEWT_STOMP_CB_ERROR "cb_error"
|
20
|
+
|
17
21
|
int cnewt_stomp_initialize(stomp_session_t *, char *, char *, char *, char *);
|
18
22
|
|
19
23
|
#endif
|
data/src/rbnewt.c
CHANGED
@@ -9,49 +9,92 @@
|
|
9
9
|
#include <newt/rbnewt.h>
|
10
10
|
|
11
11
|
static VALUE get_headers(struct stomp_ctx_message *ctx) {
|
12
|
-
VALUE ret;
|
12
|
+
VALUE ret = rb_hash_new();
|
13
|
+
const struct stomp_hdr *hdrs;
|
14
|
+
int i;
|
13
15
|
|
14
16
|
assert(ctx != NULL);
|
15
17
|
|
16
|
-
|
17
|
-
|
18
|
+
hdrs = ctx->hdrs;
|
19
|
+
for(i=0; i<ctx->hdrc; i++) {
|
20
|
+
rb_hash_aset(ret, rb_str_new2(hdrs[i].key), rb_str_new2(hdrs[i].val));
|
21
|
+
}
|
18
22
|
|
19
23
|
return ret;
|
20
24
|
}
|
21
25
|
|
22
26
|
static VALUE get_body(struct stomp_ctx_message *ctx) {
|
23
|
-
VALUE ret;
|
27
|
+
VALUE ret = Qnil;
|
24
28
|
|
25
29
|
assert(ctx != NULL);
|
26
30
|
|
27
|
-
|
28
|
-
|
31
|
+
if(ctx->body != NULL && ctx->body_len > 0) {
|
32
|
+
ret = rb_str_new2((char *)ctx->body);
|
33
|
+
}
|
29
34
|
|
30
35
|
return ret;
|
31
36
|
}
|
32
37
|
|
33
|
-
|
38
|
+
static struct stomp_hdr *make_stomp_hdr(VALUE rb_opts, int offset, int *header_len) {
|
39
|
+
struct stomp_hdr *headers = NULL;
|
40
|
+
int i;
|
41
|
+
VALUE rb_headers = Qnil;
|
42
|
+
|
43
|
+
assert(header_len != NULL);
|
44
|
+
|
45
|
+
*header_len = offset;
|
46
|
+
|
47
|
+
if(! NIL_P(rb_opts)) {
|
48
|
+
assert(TYPE(rb_opts) == T_HASH);
|
49
|
+
|
50
|
+
rb_headers = rb_funcall(rb_opts, rb_intern("to_a"), 0);
|
51
|
+
|
52
|
+
assert(TYPE(rb_headers) == T_ARRAY);
|
53
|
+
|
54
|
+
*header_len += RARRAY_LEN(rb_headers);
|
55
|
+
}
|
56
|
+
|
57
|
+
headers = (struct stomp_hdr*)malloc(sizeof(struct stomp_hdr) * (*header_len));
|
58
|
+
|
59
|
+
for(i=offset; i<*header_len; i++) {
|
60
|
+
assert(TYPE(rb_headers) == T_ARRAY);
|
61
|
+
|
62
|
+
VALUE entry = rb_ary_entry(rb_headers, i);
|
63
|
+
|
64
|
+
VALUE key = rb_ary_entry(entry, 0);
|
65
|
+
VALUE val = rb_ary_entry(entry, 1);
|
66
|
+
|
67
|
+
headers[i].key = StringValueCStr(key);
|
68
|
+
headers[i].val = StringValueCStr(val);
|
69
|
+
}
|
70
|
+
|
71
|
+
return headers;
|
72
|
+
}
|
73
|
+
|
74
|
+
static void do_newt_stomp_callback(stomp_session_t *s, void *callback_ctx, char *cb_method_name) {
|
34
75
|
rbnewt_context_t *rbnewt_ctx = (rbnewt_context_t *)s->ctx;
|
35
76
|
|
36
77
|
assert(rbnewt_ctx != NULL);
|
78
|
+
assert(cb_method_name != NULL);
|
37
79
|
|
38
|
-
|
39
|
-
if(rb_respond_to(rbnewt_ctx->self, rb_intern("callback_connected"))) {
|
80
|
+
if(rb_respond_to(rbnewt_ctx->callback_obj, rb_intern(cb_method_name))) {
|
40
81
|
VALUE header = get_headers((struct stomp_ctx_message *)callback_ctx);
|
41
82
|
VALUE body = get_body((struct stomp_ctx_message *)callback_ctx);
|
42
83
|
|
43
|
-
rb_funcall(rbnewt_ctx->
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
rb_yield(Qnil);
|
84
|
+
VALUE ret = rb_funcall(rbnewt_ctx->callback_obj, rb_intern(cb_method_name), 2, header, body);
|
85
|
+
if(TYPE(ret) == T_FALSE) {
|
86
|
+
s->run = 0;
|
87
|
+
}
|
48
88
|
}
|
49
89
|
}
|
90
|
+
void newt_stomp_callback_connected(stomp_session_t *s, void *callback_ctx, void *session_ctx) {
|
91
|
+
do_newt_stomp_callback(s, callback_ctx, NEWT_STOMP_CB_CONNECTED);
|
92
|
+
}
|
50
93
|
void newt_stomp_callback_message(stomp_session_t *s, void *callback_ctx, void *session_ctx) {
|
51
|
-
|
94
|
+
do_newt_stomp_callback(s, callback_ctx, NEWT_STOMP_CB_MESSAGE);
|
52
95
|
}
|
53
96
|
void newt_stomp_callback_error(stomp_session_t *s, void *callback_ctx, void *session_ctx) {
|
54
|
-
|
97
|
+
do_newt_stomp_callback(s, callback_ctx, NEWT_STOMP_CB_ERROR);
|
55
98
|
}
|
56
99
|
|
57
100
|
static char *get_str_from_hash(VALUE hash, char *key) {
|
@@ -78,11 +121,11 @@ static int get_int_from_hash(VALUE hash, char *key) {
|
|
78
121
|
|
79
122
|
static VALUE newt_stomp_initialize(int argc, VALUE *argv, VALUE self) {
|
80
123
|
stomp_session_t *session;
|
81
|
-
VALUE opts;
|
124
|
+
VALUE cbobj, opts;
|
82
125
|
char *server, *userid, *passwd, *port;
|
83
126
|
rbnewt_context_t *context;
|
84
127
|
|
85
|
-
rb_scan_args(argc, argv, "
|
128
|
+
rb_scan_args(argc, argv, "02", &cbobj, &opts);
|
86
129
|
|
87
130
|
Data_Get_Struct(self, stomp_session_t, session);
|
88
131
|
|
@@ -104,7 +147,7 @@ static VALUE newt_stomp_initialize(int argc, VALUE *argv, VALUE self) {
|
|
104
147
|
|
105
148
|
// set self object to context
|
106
149
|
context = (rbnewt_context_t *)session->ctx;
|
107
|
-
context->
|
150
|
+
context->callback_obj = cbobj;
|
108
151
|
|
109
152
|
if(cnewt_stomp_initialize(session, server, port, userid, passwd) != RET_SUCCESS) {
|
110
153
|
printf("[warning] failed to connect server\n");
|
@@ -113,59 +156,62 @@ static VALUE newt_stomp_initialize(int argc, VALUE *argv, VALUE self) {
|
|
113
156
|
return self;
|
114
157
|
}
|
115
158
|
|
116
|
-
static VALUE
|
159
|
+
static VALUE newt_stomp_publish(int argc, VALUE *argv, VALUE self) {
|
160
|
+
struct stomp_hdr *headers;
|
117
161
|
stomp_session_t *session;
|
118
|
-
VALUE rb_dest, rb_data, rb_opts
|
119
|
-
int header_len
|
162
|
+
VALUE rb_dest, rb_data, rb_opts;
|
163
|
+
int header_len;
|
120
164
|
|
121
165
|
// initialize each rb values
|
122
|
-
rb_headers = Qnil;
|
123
166
|
rb_scan_args(argc, argv, "21", &rb_dest, &rb_data, &rb_opts);
|
124
167
|
|
125
168
|
Data_Get_Struct(self, stomp_session_t, session);
|
126
169
|
|
127
170
|
char *body = StringValuePtr(rb_data);
|
171
|
+
// making headers
|
172
|
+
headers = make_stomp_hdr(rb_opts, 1, &header_len);
|
173
|
+
headers[0].key = "destination";
|
174
|
+
headers[0].val = StringValuePtr(rb_dest);
|
128
175
|
|
129
|
-
|
130
|
-
assert(TYPE(rb_opts) == T_HASH);
|
176
|
+
stomp_send(session, header_len, headers, body, strlen(body));
|
131
177
|
|
132
|
-
|
178
|
+
free(headers);
|
133
179
|
|
134
|
-
|
180
|
+
return self;
|
181
|
+
}
|
135
182
|
|
136
|
-
|
137
|
-
|
183
|
+
static VALUE newt_stomp_subscribe(int argc, VALUE *argv, VALUE self) {
|
184
|
+
struct stomp_hdr *headers;
|
185
|
+
stomp_session_t *session;
|
186
|
+
VALUE rb_dest, rb_opts;
|
187
|
+
int header_len;
|
188
|
+
|
189
|
+
// initialize each rb values
|
190
|
+
rb_scan_args(argc, argv, "11", &rb_dest, &rb_opts);
|
191
|
+
|
192
|
+
Data_Get_Struct(self, stomp_session_t, session);
|
138
193
|
|
139
194
|
// making headers
|
140
|
-
|
195
|
+
headers = make_stomp_hdr(rb_opts, 1, &header_len);
|
141
196
|
headers[0].key = "destination";
|
142
197
|
headers[0].val = StringValuePtr(rb_dest);
|
143
|
-
int i;
|
144
|
-
for(i=1; i<header_len; i++) {
|
145
|
-
VALUE entry = rb_ary_entry(rb_opts, i);
|
146
198
|
|
147
|
-
|
148
|
-
VALUE val = rb_ary_entry(entry, 1);
|
149
|
-
|
150
|
-
headers[i].key = StringValueCStr(key);
|
151
|
-
headers[i].val = StringValueCStr(val);
|
152
|
-
}
|
153
|
-
|
154
|
-
stomp_send(session, header_len, headers, body, strlen(body));
|
199
|
+
stomp_subscribe(session, header_len, headers);
|
155
200
|
|
156
201
|
free(headers);
|
157
202
|
|
158
203
|
return self;
|
159
204
|
}
|
160
205
|
|
161
|
-
static VALUE
|
206
|
+
static VALUE newt_stomp_run(VALUE self) {
|
162
207
|
stomp_session_t *session;
|
208
|
+
rbnewt_context_t *context;
|
163
209
|
|
164
210
|
Data_Get_Struct(self, stomp_session_t, session);
|
165
211
|
|
166
212
|
cnewt_stomp_start(session);
|
167
213
|
|
168
|
-
return
|
214
|
+
return self;
|
169
215
|
}
|
170
216
|
|
171
217
|
static void context_free(void *ptr) {
|
@@ -198,6 +244,7 @@ void Init_rbnewt(void) {
|
|
198
244
|
|
199
245
|
rb_define_alloc_func(stomp_kls, newt_stomp_alloc);
|
200
246
|
rb_define_method(stomp_kls, "initialize", newt_stomp_initialize, -1);
|
201
|
-
rb_define_method(stomp_kls, "
|
202
|
-
rb_define_method(stomp_kls, "
|
247
|
+
rb_define_method(stomp_kls, "publish", newt_stomp_publish, -1);
|
248
|
+
rb_define_method(stomp_kls, "subscribe", newt_stomp_subscribe, -1);
|
249
|
+
rb_define_method(stomp_kls, "run", newt_stomp_run, 0);
|
203
250
|
}
|
metadata
CHANGED
@@ -1,15 +1,43 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rbnewt
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Hiroyasu OHYAMA
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-06-
|
12
|
-
dependencies:
|
11
|
+
date: 2016-06-05 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rspec
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 3.4.0
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 3.4.0
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
13
41
|
description: This aims to to be the fastest Ruby client for NewtMQ which is an implementation
|
14
42
|
of STOMP server.
|
15
43
|
email:
|
@@ -19,7 +47,6 @@ extensions:
|
|
19
47
|
- extconf.rb
|
20
48
|
extra_rdoc_files: []
|
21
49
|
files:
|
22
|
-
- Makefile
|
23
50
|
- extconf.rb
|
24
51
|
- include/newt/common.h
|
25
52
|
- include/newt/rbnewt.h
|
data/Makefile
DELETED
@@ -1,259 +0,0 @@
|
|
1
|
-
|
2
|
-
SHELL = /bin/sh
|
3
|
-
|
4
|
-
# V=0 quiet, V=1 verbose. other values don't work.
|
5
|
-
V = 0
|
6
|
-
Q1 = $(V:1=)
|
7
|
-
Q = $(Q1:0=@)
|
8
|
-
ECHO1 = $(V:1=@:)
|
9
|
-
ECHO = $(ECHO1:0=@echo)
|
10
|
-
NULLCMD = :
|
11
|
-
|
12
|
-
#### Start of system configuration section. ####
|
13
|
-
|
14
|
-
srcdir = src
|
15
|
-
topdir = /home/vagrant/.rbenv/versions/2.2.2/include/ruby-2.2.0
|
16
|
-
hdrdir = $(topdir)
|
17
|
-
arch_hdrdir = /home/vagrant/.rbenv/versions/2.2.2/include/ruby-2.2.0/x86_64-linux
|
18
|
-
PATH_SEPARATOR = :
|
19
|
-
VPATH = $(srcdir):$(arch_hdrdir)/ruby:$(hdrdir)/ruby
|
20
|
-
prefix = $(DESTDIR)/home/vagrant/.rbenv/versions/2.2.2
|
21
|
-
rubysitearchprefix = $(rubylibprefix)/$(sitearch)
|
22
|
-
rubyarchprefix = $(rubylibprefix)/$(arch)
|
23
|
-
rubylibprefix = $(libdir)/$(RUBY_BASE_NAME)
|
24
|
-
exec_prefix = $(prefix)
|
25
|
-
vendorarchhdrdir = $(vendorhdrdir)/$(sitearch)
|
26
|
-
sitearchhdrdir = $(sitehdrdir)/$(sitearch)
|
27
|
-
rubyarchhdrdir = $(rubyhdrdir)/$(arch)
|
28
|
-
vendorhdrdir = $(rubyhdrdir)/vendor_ruby
|
29
|
-
sitehdrdir = $(rubyhdrdir)/site_ruby
|
30
|
-
rubyhdrdir = $(includedir)/$(RUBY_VERSION_NAME)
|
31
|
-
vendorarchdir = $(vendorlibdir)/$(sitearch)
|
32
|
-
vendorlibdir = $(vendordir)/$(ruby_version)
|
33
|
-
vendordir = $(rubylibprefix)/vendor_ruby
|
34
|
-
sitearchdir = $(sitelibdir)/$(sitearch)
|
35
|
-
sitelibdir = $(sitedir)/$(ruby_version)
|
36
|
-
sitedir = $(rubylibprefix)/site_ruby
|
37
|
-
rubyarchdir = $(rubylibdir)/$(arch)
|
38
|
-
rubylibdir = $(rubylibprefix)/$(ruby_version)
|
39
|
-
sitearchincludedir = $(includedir)/$(sitearch)
|
40
|
-
archincludedir = $(includedir)/$(arch)
|
41
|
-
sitearchlibdir = $(libdir)/$(sitearch)
|
42
|
-
archlibdir = $(libdir)/$(arch)
|
43
|
-
ridir = $(datarootdir)/$(RI_BASE_NAME)
|
44
|
-
mandir = $(datarootdir)/man
|
45
|
-
localedir = $(datarootdir)/locale
|
46
|
-
libdir = $(exec_prefix)/lib
|
47
|
-
psdir = $(docdir)
|
48
|
-
pdfdir = $(docdir)
|
49
|
-
dvidir = $(docdir)
|
50
|
-
htmldir = $(docdir)
|
51
|
-
infodir = $(datarootdir)/info
|
52
|
-
docdir = $(datarootdir)/doc/$(PACKAGE)
|
53
|
-
oldincludedir = $(DESTDIR)/usr/include
|
54
|
-
includedir = $(prefix)/include
|
55
|
-
localstatedir = $(prefix)/var
|
56
|
-
sharedstatedir = $(prefix)/com
|
57
|
-
sysconfdir = $(prefix)/etc
|
58
|
-
datadir = $(datarootdir)
|
59
|
-
datarootdir = $(prefix)/share
|
60
|
-
libexecdir = $(exec_prefix)/libexec
|
61
|
-
sbindir = $(exec_prefix)/sbin
|
62
|
-
bindir = $(exec_prefix)/bin
|
63
|
-
archdir = $(rubyarchdir)
|
64
|
-
|
65
|
-
|
66
|
-
CC = gcc
|
67
|
-
CXX = g++
|
68
|
-
LIBRUBY = $(LIBRUBY_A)
|
69
|
-
LIBRUBY_A = lib$(RUBY_SO_NAME)-static.a
|
70
|
-
LIBRUBYARG_SHARED = -Wl,-R$(libdir) -L$(libdir)
|
71
|
-
LIBRUBYARG_STATIC = -Wl,-R$(libdir) -L$(libdir) -l$(RUBY_SO_NAME)-static
|
72
|
-
empty =
|
73
|
-
OUTFLAG = -o $(empty)
|
74
|
-
COUTFLAG = -o $(empty)
|
75
|
-
|
76
|
-
RUBY_EXTCONF_H =
|
77
|
-
cflags = $(optflags) $(debugflags) $(warnflags)
|
78
|
-
optflags = -O3 -fno-fast-math
|
79
|
-
debugflags = -ggdb3
|
80
|
-
warnflags = -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wunused-variable -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration -Wdeprecated-declarations -Wno-packed-bitfield-compat
|
81
|
-
CCDLFLAGS = -fPIC
|
82
|
-
CFLAGS = $(CCDLFLAGS) -I./include $(ARCH_FLAG)
|
83
|
-
INCFLAGS = -I. -I$(arch_hdrdir) -I$(hdrdir)/ruby/backward -I$(hdrdir) -I$(srcdir)
|
84
|
-
DEFS =
|
85
|
-
CPPFLAGS = -DHAVE_STOMP_STOMP_H -DHAVE_PTHREAD_H -I/home/vagrant/.rbenv/versions/2.2.2/include $(DEFS) $(cppflags)
|
86
|
-
CXXFLAGS = $(CCDLFLAGS) $(cxxflags) $(ARCH_FLAG)
|
87
|
-
ldflags = -L. -L/home/vagrant/.rbenv/versions/2.2.2/lib -fstack-protector -rdynamic -Wl,-export-dynamic
|
88
|
-
dldflags =
|
89
|
-
ARCH_FLAG =
|
90
|
-
DLDFLAGS = $(ldflags) $(dldflags) $(ARCH_FLAG)
|
91
|
-
LDSHARED = $(CC) -shared
|
92
|
-
LDSHAREDXX = $(CXX) -shared
|
93
|
-
AR = ar
|
94
|
-
EXEEXT =
|
95
|
-
|
96
|
-
RUBY_INSTALL_NAME = $(RUBY_BASE_NAME)
|
97
|
-
RUBY_SO_NAME = ruby
|
98
|
-
RUBYW_INSTALL_NAME =
|
99
|
-
RUBY_VERSION_NAME = $(RUBY_BASE_NAME)-$(ruby_version)
|
100
|
-
RUBYW_BASE_NAME = rubyw
|
101
|
-
RUBY_BASE_NAME = ruby
|
102
|
-
|
103
|
-
arch = x86_64-linux
|
104
|
-
sitearch = $(arch)
|
105
|
-
ruby_version = 2.2.0
|
106
|
-
ruby = $(bindir)/$(RUBY_BASE_NAME)
|
107
|
-
RUBY = $(ruby)
|
108
|
-
ruby_headers = $(hdrdir)/ruby.h $(hdrdir)/ruby/ruby.h $(hdrdir)/ruby/defines.h $(hdrdir)/ruby/missing.h $(hdrdir)/ruby/intern.h $(hdrdir)/ruby/st.h $(hdrdir)/ruby/subst.h $(arch_hdrdir)/ruby/config.h
|
109
|
-
|
110
|
-
RM = rm -f
|
111
|
-
RM_RF = $(RUBY) -run -e rm -- -rf
|
112
|
-
RMDIRS = rmdir --ignore-fail-on-non-empty -p
|
113
|
-
MAKEDIRS = /bin/mkdir -p
|
114
|
-
INSTALL = /usr/bin/install -c
|
115
|
-
INSTALL_PROG = $(INSTALL) -m 0755
|
116
|
-
INSTALL_DATA = $(INSTALL) -m 644
|
117
|
-
COPY = cp
|
118
|
-
TOUCH = exit >
|
119
|
-
|
120
|
-
#### End of system configuration section. ####
|
121
|
-
|
122
|
-
preload =
|
123
|
-
|
124
|
-
libpath = . $(libdir)
|
125
|
-
LIBPATH = -L. -L$(libdir) -Wl,-R$(libdir)
|
126
|
-
DEFFILE =
|
127
|
-
|
128
|
-
CLEANFILES = mkmf.log
|
129
|
-
DISTCLEANFILES =
|
130
|
-
DISTCLEANDIRS =
|
131
|
-
|
132
|
-
extout =
|
133
|
-
extout_prefix =
|
134
|
-
target_prefix =
|
135
|
-
LOCAL_LIBS =
|
136
|
-
LIBS = -lpthread -lstomp -lpthread -lstomp -lpthread -ldl -lcrypt -lm -lc
|
137
|
-
ORIG_SRCS = stomp.c rbframe.c rbnewt.c
|
138
|
-
SRCS = $(ORIG_SRCS)
|
139
|
-
OBJS = stomp.o rbframe.o rbnewt.o
|
140
|
-
HDRS =
|
141
|
-
TARGET = rbnewt
|
142
|
-
TARGET_NAME = rbnewt
|
143
|
-
TARGET_ENTRY = Init_$(TARGET_NAME)
|
144
|
-
DLLIB = $(TARGET).so
|
145
|
-
EXTSTATIC =
|
146
|
-
STATIC_LIB =
|
147
|
-
|
148
|
-
TIMESTAMP_DIR = .
|
149
|
-
BINDIR = $(bindir)
|
150
|
-
RUBYCOMMONDIR = $(sitedir)$(target_prefix)
|
151
|
-
RUBYLIBDIR = $(sitelibdir)$(target_prefix)
|
152
|
-
RUBYARCHDIR = $(sitearchdir)$(target_prefix)
|
153
|
-
HDRDIR = $(rubyhdrdir)/ruby$(target_prefix)
|
154
|
-
ARCHHDRDIR = $(rubyhdrdir)/$(arch)/ruby$(target_prefix)
|
155
|
-
|
156
|
-
TARGET_SO = $(DLLIB)
|
157
|
-
CLEANLIBS = $(TARGET).so
|
158
|
-
CLEANOBJS = *.o *.bak
|
159
|
-
|
160
|
-
all: $(DLLIB)
|
161
|
-
static: $(STATIC_LIB)
|
162
|
-
.PHONY: all install static install-so install-rb
|
163
|
-
.PHONY: clean clean-so clean-static clean-rb
|
164
|
-
|
165
|
-
clean-static::
|
166
|
-
clean-rb-default::
|
167
|
-
clean-rb::
|
168
|
-
clean-so::
|
169
|
-
clean: clean-so clean-static clean-rb-default clean-rb
|
170
|
-
-$(Q)$(RM) $(CLEANLIBS) $(CLEANOBJS) $(CLEANFILES) .*.time
|
171
|
-
|
172
|
-
distclean-rb-default::
|
173
|
-
distclean-rb::
|
174
|
-
distclean-so::
|
175
|
-
distclean-static::
|
176
|
-
distclean: clean distclean-so distclean-static distclean-rb-default distclean-rb
|
177
|
-
-$(Q)$(RM) Makefile $(RUBY_EXTCONF_H) conftest.* mkmf.log
|
178
|
-
-$(Q)$(RM) core ruby$(EXEEXT) *~ $(DISTCLEANFILES)
|
179
|
-
-$(Q)$(RMDIRS) $(DISTCLEANDIRS) 2> /dev/null || true
|
180
|
-
|
181
|
-
realclean: distclean
|
182
|
-
install: install-so install-rb
|
183
|
-
|
184
|
-
install-so: $(DLLIB) $(TIMESTAMP_DIR)/.RUBYARCHDIR.time
|
185
|
-
$(INSTALL_PROG) $(DLLIB) $(RUBYARCHDIR)
|
186
|
-
clean-static::
|
187
|
-
-$(Q)$(RM) $(STATIC_LIB)
|
188
|
-
install-rb: pre-install-rb install-rb-default
|
189
|
-
install-rb-default: pre-install-rb-default
|
190
|
-
pre-install-rb: Makefile
|
191
|
-
pre-install-rb-default: Makefile
|
192
|
-
pre-install-rb-default:
|
193
|
-
@$(NULLCMD)
|
194
|
-
$(TIMESTAMP_DIR)/.RUBYARCHDIR.time:
|
195
|
-
$(Q) $(MAKEDIRS) $(@D) $(RUBYARCHDIR)
|
196
|
-
$(Q) $(TOUCH) $@
|
197
|
-
|
198
|
-
site-install: site-install-so site-install-rb
|
199
|
-
site-install-so: install-so
|
200
|
-
site-install-rb: install-rb
|
201
|
-
|
202
|
-
.SUFFIXES: .c .m .cc .mm .cxx .cpp .o .S
|
203
|
-
|
204
|
-
.cc.o:
|
205
|
-
$(ECHO) compiling $(<)
|
206
|
-
$(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $<
|
207
|
-
|
208
|
-
.cc.S:
|
209
|
-
$(ECHO) translating $(<)
|
210
|
-
$(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -S $<
|
211
|
-
|
212
|
-
.mm.o:
|
213
|
-
$(ECHO) compiling $(<)
|
214
|
-
$(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $<
|
215
|
-
|
216
|
-
.mm.S:
|
217
|
-
$(ECHO) translating $(<)
|
218
|
-
$(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -S $<
|
219
|
-
|
220
|
-
.cxx.o:
|
221
|
-
$(ECHO) compiling $(<)
|
222
|
-
$(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $<
|
223
|
-
|
224
|
-
.cxx.S:
|
225
|
-
$(ECHO) translating $(<)
|
226
|
-
$(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -S $<
|
227
|
-
|
228
|
-
.cpp.o:
|
229
|
-
$(ECHO) compiling $(<)
|
230
|
-
$(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $<
|
231
|
-
|
232
|
-
.cpp.S:
|
233
|
-
$(ECHO) translating $(<)
|
234
|
-
$(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -S $<
|
235
|
-
|
236
|
-
.c.o:
|
237
|
-
$(ECHO) compiling $(<)
|
238
|
-
$(Q) $(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) $(COUTFLAG)$@ -c $<
|
239
|
-
|
240
|
-
.c.S:
|
241
|
-
$(ECHO) translating $(<)
|
242
|
-
$(Q) $(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) $(COUTFLAG)$@ -S $<
|
243
|
-
|
244
|
-
.m.o:
|
245
|
-
$(ECHO) compiling $(<)
|
246
|
-
$(Q) $(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) $(COUTFLAG)$@ -c $<
|
247
|
-
|
248
|
-
.m.S:
|
249
|
-
$(ECHO) translating $(<)
|
250
|
-
$(Q) $(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) $(COUTFLAG)$@ -S $<
|
251
|
-
|
252
|
-
$(DLLIB): $(OBJS) Makefile
|
253
|
-
$(ECHO) linking shared-object $(DLLIB)
|
254
|
-
-$(Q)$(RM) $(@)
|
255
|
-
$(Q) $(LDSHARED) -o $@ $(OBJS) $(LIBPATH) $(DLDFLAGS) $(LOCAL_LIBS) $(LIBS)
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
$(OBJS): $(HDRS) $(ruby_headers)
|