event 0.6.0 → 0.8.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ext/event/event.c +10 -10
- data/ext/event/event.h +3 -3
- data/ext/event/extconf.rb +11 -5
- data/ext/event/{backend → selector}/epoll.c +160 -106
- data/ext/event/{backend → selector}/epoll.h +2 -2
- data/ext/event/{backend → selector}/kqueue.c +160 -102
- data/ext/event/{backend → selector}/kqueue.h +2 -2
- data/ext/event/{backend → selector}/pidfd.c +0 -0
- data/ext/event/selector/selector.c +263 -0
- data/ext/event/selector/selector.h +127 -0
- data/ext/event/selector/uring.c +638 -0
- data/ext/event/{backend → selector}/uring.h +3 -3
- data/lib/event.rb +2 -1
- data/lib/event/debug.rb +126 -0
- data/lib/event/selector.rb +25 -2
- data/lib/event/{backend → selector}/select.rb +81 -36
- data/lib/event/version.rb +1 -1
- metadata +13 -21
- data/ext/event/Makefile +0 -267
- data/ext/event/backend.o +0 -0
- data/ext/event/backend/backend.c +0 -108
- data/ext/event/backend/backend.h +0 -45
- data/ext/event/backend/uring.c +0 -498
- data/ext/event/event.bundle +0 -0
- data/ext/event/event.o +0 -0
- data/ext/event/extconf.h +0 -4
- data/ext/event/kqueue.o +0 -0
- data/ext/event/mkmf.log +0 -100
- data/lib/event/backend.rb +0 -49
- data/lib/event/debug/selector.rb +0 -108
@@ -22,7 +22,7 @@
|
|
22
22
|
|
23
23
|
#include <ruby.h>
|
24
24
|
|
25
|
-
#define
|
25
|
+
#define EVENT_SELECTOR_URING
|
26
26
|
|
27
|
-
void
|
28
|
-
VALUE
|
27
|
+
void Init_Event_Selector_URing(VALUE Event_Selector);
|
28
|
+
VALUE Event_Selector_URing_select(VALUE self, VALUE duration);
|
data/lib/event.rb
CHANGED
data/lib/event/debug.rb
ADDED
@@ -0,0 +1,126 @@
|
|
1
|
+
# Copyright, 2021, by Samuel G. D. Williams. <http://www.codeotaku.com>
|
2
|
+
#
|
3
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
+
# of this software and associated documentation files (the "Software"), to deal
|
5
|
+
# in the Software without restriction, including without limitation the rights
|
6
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
+
# copies of the Software, and to permit persons to whom the Software is
|
8
|
+
# furnished to do so, subject to the following conditions:
|
9
|
+
#
|
10
|
+
# The above copyright notice and this permission notice shall be included in
|
11
|
+
# all copies or substantial portions of the Software.
|
12
|
+
#
|
13
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19
|
+
# THE SOFTWARE.
|
20
|
+
|
21
|
+
require "event/version"
|
22
|
+
|
23
|
+
module Event
|
24
|
+
class Debug
|
25
|
+
def initialize(selector)
|
26
|
+
@selector = selector
|
27
|
+
|
28
|
+
@readable = {}
|
29
|
+
@writable = {}
|
30
|
+
@priority = {}
|
31
|
+
end
|
32
|
+
|
33
|
+
def close
|
34
|
+
if @selector.nil?
|
35
|
+
raise "Selector already closed!"
|
36
|
+
end
|
37
|
+
|
38
|
+
@selector.close
|
39
|
+
@selector = nil
|
40
|
+
end
|
41
|
+
|
42
|
+
def transfer(fiber, *arguments)
|
43
|
+
@selector.transfer(fiber, *arguments)
|
44
|
+
end
|
45
|
+
|
46
|
+
def yield
|
47
|
+
@selector.yield
|
48
|
+
end
|
49
|
+
|
50
|
+
def push(fiber)
|
51
|
+
@selector.push(fiber)
|
52
|
+
end
|
53
|
+
|
54
|
+
def raise(fiber, *arguments)
|
55
|
+
@selector.raise(fiber, *arguments)
|
56
|
+
end
|
57
|
+
|
58
|
+
def ready?
|
59
|
+
@selector.ready?
|
60
|
+
end
|
61
|
+
|
62
|
+
def io_wait(fiber, io, events)
|
63
|
+
register_readable(fiber, io, events)
|
64
|
+
end
|
65
|
+
|
66
|
+
def select(duration = nil)
|
67
|
+
@selector.select(duration)
|
68
|
+
end
|
69
|
+
|
70
|
+
private
|
71
|
+
|
72
|
+
def register_readable(fiber, io, events)
|
73
|
+
if (events & READABLE) > 0
|
74
|
+
if @readable.key?(io)
|
75
|
+
raise "Cannot wait for #{io} to become readable from multiple fibers."
|
76
|
+
end
|
77
|
+
|
78
|
+
begin
|
79
|
+
@readable[io] = fiber
|
80
|
+
|
81
|
+
register_writable(fiber, io, events)
|
82
|
+
ensure
|
83
|
+
@readable.delete(io)
|
84
|
+
end
|
85
|
+
else
|
86
|
+
register_writable(fiber, io, events)
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
def register_writable(fiber, io, events)
|
91
|
+
if (events & WRITABLE) > 0
|
92
|
+
if @writable.key?(io)
|
93
|
+
raise "Cannot wait for #{io} to become writable from multiple fibers."
|
94
|
+
end
|
95
|
+
|
96
|
+
begin
|
97
|
+
@writable[io] = fiber
|
98
|
+
|
99
|
+
register_priority(fiber, io, events)
|
100
|
+
ensure
|
101
|
+
@writable.delete(io)
|
102
|
+
end
|
103
|
+
else
|
104
|
+
register_priority(fiber, io, events)
|
105
|
+
end
|
106
|
+
end
|
107
|
+
|
108
|
+
def register_priority(fiber, io, events)
|
109
|
+
if (events & PRIORITY) > 0
|
110
|
+
if @priority.key?(io)
|
111
|
+
raise "Cannot wait for #{io} to become priority from multiple fibers."
|
112
|
+
end
|
113
|
+
|
114
|
+
begin
|
115
|
+
@priority[io] = fiber
|
116
|
+
|
117
|
+
@selector.io_wait(fiber, io, events)
|
118
|
+
ensure
|
119
|
+
@priority.delete(io)
|
120
|
+
end
|
121
|
+
else
|
122
|
+
@selector.io_wait(fiber, io, events)
|
123
|
+
end
|
124
|
+
end
|
125
|
+
end
|
126
|
+
end
|
data/lib/event/selector.rb
CHANGED
@@ -18,9 +18,32 @@
|
|
18
18
|
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19
19
|
# THE SOFTWARE.
|
20
20
|
|
21
|
-
|
21
|
+
require_relative 'selector/select'
|
22
22
|
|
23
23
|
module Event
|
24
|
-
|
24
|
+
module Selector
|
25
|
+
def self.default(env = ENV)
|
26
|
+
if name = env['EVENT_SELECTOR']&.to_sym
|
27
|
+
if Event::Selector.const_defined?(name)
|
28
|
+
return Event::Selector.const_get(name)
|
29
|
+
else
|
30
|
+
warn "Could not find EVENT_SELECTOR=#{name}!"
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
if self.const_defined?(:URing)
|
35
|
+
return Event::Selector::URing
|
36
|
+
elsif self.const_defined?(:KQueue)
|
37
|
+
return Event::Selector::KQueue
|
38
|
+
elsif self.const_defined?(:EPoll)
|
39
|
+
return Event::Selector::EPoll
|
40
|
+
else
|
41
|
+
return Event::Selector::Select
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
def self.new(...)
|
46
|
+
default.new(...)
|
47
|
+
end
|
25
48
|
end
|
26
49
|
end
|
@@ -19,13 +19,15 @@
|
|
19
19
|
# THE SOFTWARE.
|
20
20
|
|
21
21
|
module Event
|
22
|
-
module
|
22
|
+
module Selector
|
23
23
|
class Select
|
24
24
|
def initialize(loop)
|
25
25
|
@loop = loop
|
26
26
|
|
27
27
|
@readable = {}
|
28
28
|
@writable = {}
|
29
|
+
|
30
|
+
@ready = []
|
29
31
|
end
|
30
32
|
|
31
33
|
def close
|
@@ -34,6 +36,36 @@ module Event
|
|
34
36
|
@writable = nil
|
35
37
|
end
|
36
38
|
|
39
|
+
def transfer(fiber, *arguments)
|
40
|
+
@ready.push(Fiber.current)
|
41
|
+
fiber.transfer(*arguments)
|
42
|
+
ensure
|
43
|
+
@ready.delete(fiber)
|
44
|
+
end
|
45
|
+
|
46
|
+
def yield
|
47
|
+
fiber = Fiber.current
|
48
|
+
@ready.push(fiber)
|
49
|
+
@loop.transfer
|
50
|
+
ensure
|
51
|
+
@ready.delete(fiber)
|
52
|
+
end
|
53
|
+
|
54
|
+
def push(fiber)
|
55
|
+
@ready.push(fiber)
|
56
|
+
end
|
57
|
+
|
58
|
+
def raise(fiber, *arguments)
|
59
|
+
@ready.push(Fiber.current)
|
60
|
+
fiber.raise(*arguments)
|
61
|
+
ensure
|
62
|
+
@ready.delete(fiber)
|
63
|
+
end
|
64
|
+
|
65
|
+
def ready?
|
66
|
+
@ready.any?
|
67
|
+
end
|
68
|
+
|
37
69
|
def io_wait(fiber, io, events)
|
38
70
|
remove_readable = remove_writable = false
|
39
71
|
|
@@ -53,47 +85,51 @@ module Event
|
|
53
85
|
@writable.delete(io) if remove_writable
|
54
86
|
end
|
55
87
|
|
56
|
-
|
57
|
-
buffer
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
when :wait_writable
|
64
|
-
self.io_wait(fiber, io, WRITABLE)
|
65
|
-
else
|
66
|
-
result.force_encoding(Encoding::BINARY)
|
67
|
-
buffer[offset, result.bytesize] = result
|
88
|
+
if IO.const_defined?(:Buffer)
|
89
|
+
def io_read(fiber, io, buffer, length)
|
90
|
+
offset = 0
|
91
|
+
|
92
|
+
while length > 0
|
93
|
+
# The maximum size we can read:
|
94
|
+
maximum_size = buffer.size - offset
|
68
95
|
|
69
|
-
|
70
|
-
|
96
|
+
case result = io.read_nonblock(maximum_size, exception: false)
|
97
|
+
when :wait_readable
|
98
|
+
self.io_wait(fiber, io, READABLE)
|
99
|
+
when :wait_writable
|
100
|
+
self.io_wait(fiber, io, WRITABLE)
|
101
|
+
else
|
102
|
+
break if result.empty?
|
103
|
+
|
104
|
+
buffer.copy(result, offset)
|
105
|
+
|
106
|
+
offset += result.bytesize
|
107
|
+
length -= result.bytesize
|
108
|
+
end
|
71
109
|
end
|
110
|
+
|
111
|
+
return offset
|
72
112
|
end
|
73
|
-
rescue EOFError
|
74
|
-
return nil
|
75
|
-
end
|
76
|
-
|
77
|
-
def io_write(fiber, io, buffer, offset, length)
|
78
|
-
buffer.force_encoding(Encoding::BINARY)
|
79
113
|
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
114
|
+
def io_write(fiber, io, buffer, length)
|
115
|
+
offset = 0
|
116
|
+
|
117
|
+
while length > 0
|
118
|
+
# From offset until the end:
|
119
|
+
chunk = buffer.to_str(offset, length)
|
120
|
+
case result = io.write_nonblock(chunk, exception: false)
|
121
|
+
when :wait_readable
|
122
|
+
self.io_wait(fiber, io, READABLE)
|
123
|
+
when :wait_writable
|
124
|
+
self.io_wait(fiber, io, WRITABLE)
|
125
|
+
else
|
126
|
+
offset += result
|
127
|
+
length -= result
|
128
|
+
end
|
93
129
|
end
|
130
|
+
|
131
|
+
return offset
|
94
132
|
end
|
95
|
-
|
96
|
-
return total
|
97
133
|
end
|
98
134
|
|
99
135
|
def process_wait(fiber, pid, flags)
|
@@ -115,6 +151,15 @@ module Event
|
|
115
151
|
end
|
116
152
|
|
117
153
|
def select(duration = nil)
|
154
|
+
if @ready.any?
|
155
|
+
ready = @ready
|
156
|
+
@ready = Array.new
|
157
|
+
|
158
|
+
ready.each do |fiber|
|
159
|
+
fiber.transfer if fiber.alive?
|
160
|
+
end
|
161
|
+
end
|
162
|
+
|
118
163
|
readable, writable, _ = ::IO.select(@readable.keys, @writable.keys, nil, duration)
|
119
164
|
|
120
165
|
ready = Hash.new(0)
|
data/lib/event/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: event
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.8.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Samuel Williams
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-07-
|
11
|
+
date: 2021-07-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bake
|
@@ -73,30 +73,22 @@ extensions:
|
|
73
73
|
- ext/event/extconf.rb
|
74
74
|
extra_rdoc_files: []
|
75
75
|
files:
|
76
|
-
- ext/event/Makefile
|
77
|
-
- ext/event/backend.o
|
78
|
-
- ext/event/backend/backend.c
|
79
|
-
- ext/event/backend/backend.h
|
80
|
-
- ext/event/backend/epoll.c
|
81
|
-
- ext/event/backend/epoll.h
|
82
|
-
- ext/event/backend/kqueue.c
|
83
|
-
- ext/event/backend/kqueue.h
|
84
|
-
- ext/event/backend/pidfd.c
|
85
|
-
- ext/event/backend/uring.c
|
86
|
-
- ext/event/backend/uring.h
|
87
|
-
- ext/event/event.bundle
|
88
76
|
- ext/event/event.c
|
89
77
|
- ext/event/event.h
|
90
|
-
- ext/event/event.o
|
91
|
-
- ext/event/extconf.h
|
92
78
|
- ext/event/extconf.rb
|
93
|
-
- ext/event/
|
94
|
-
- ext/event/
|
79
|
+
- ext/event/selector/epoll.c
|
80
|
+
- ext/event/selector/epoll.h
|
81
|
+
- ext/event/selector/kqueue.c
|
82
|
+
- ext/event/selector/kqueue.h
|
83
|
+
- ext/event/selector/pidfd.c
|
84
|
+
- ext/event/selector/selector.c
|
85
|
+
- ext/event/selector/selector.h
|
86
|
+
- ext/event/selector/uring.c
|
87
|
+
- ext/event/selector/uring.h
|
95
88
|
- lib/event.rb
|
96
|
-
- lib/event/
|
97
|
-
- lib/event/backend/select.rb
|
98
|
-
- lib/event/debug/selector.rb
|
89
|
+
- lib/event/debug.rb
|
99
90
|
- lib/event/selector.rb
|
91
|
+
- lib/event/selector/select.rb
|
100
92
|
- lib/event/version.rb
|
101
93
|
homepage: https://github.com/socketry/event
|
102
94
|
licenses:
|
data/ext/event/Makefile
DELETED
@@ -1,267 +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 = .
|
15
|
-
topdir = /Users/samuel/.rubies/ruby-3.0.1/include/ruby-3.0.0
|
16
|
-
hdrdir = $(topdir)
|
17
|
-
arch_hdrdir = /Users/samuel/.rubies/ruby-3.0.1/include/ruby-3.0.0/x86_64-darwin20
|
18
|
-
PATH_SEPARATOR = :
|
19
|
-
VPATH = $(srcdir):$(arch_hdrdir)/ruby:$(hdrdir)/ruby:$(srcdir)/backend
|
20
|
-
prefix = $(DESTDIR)/Users/samuel/.rubies/ruby-3.0.1
|
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 = $(SDKROOT)/usr/include
|
54
|
-
includedir = $(prefix)/include
|
55
|
-
runstatedir = $(localstatedir)/run
|
56
|
-
localstatedir = $(prefix)/var
|
57
|
-
sharedstatedir = $(prefix)/com
|
58
|
-
sysconfdir = $(prefix)/etc
|
59
|
-
datadir = $(datarootdir)
|
60
|
-
datarootdir = $(prefix)/share
|
61
|
-
libexecdir = $(exec_prefix)/libexec
|
62
|
-
sbindir = $(exec_prefix)/sbin
|
63
|
-
bindir = $(exec_prefix)/bin
|
64
|
-
archdir = $(rubyarchdir)
|
65
|
-
|
66
|
-
|
67
|
-
CC_WRAPPER =
|
68
|
-
CC = clang -fdeclspec
|
69
|
-
CXX = clang++ -fdeclspec
|
70
|
-
LIBRUBY = $(LIBRUBY_A)
|
71
|
-
LIBRUBY_A = lib$(RUBY_SO_NAME)-static.a
|
72
|
-
LIBRUBYARG_SHARED =
|
73
|
-
LIBRUBYARG_STATIC = -l$(RUBY_SO_NAME)-static -framework Security -framework Foundation $(MAINLIBS)
|
74
|
-
empty =
|
75
|
-
OUTFLAG = -o $(empty)
|
76
|
-
COUTFLAG = -o $(empty)
|
77
|
-
CSRCFLAG = $(empty)
|
78
|
-
|
79
|
-
RUBY_EXTCONF_H = extconf.h
|
80
|
-
cflags = $(optflags) $(debugflags) $(warnflags)
|
81
|
-
cxxflags =
|
82
|
-
optflags = -O3
|
83
|
-
debugflags = -ggdb3
|
84
|
-
warnflags = -Wall -Wextra -Wdeprecated-declarations -Wdivision-by-zero -Wimplicit-function-declaration -Wimplicit-int -Wmisleading-indentation -Wpointer-arith -Wshorten-64-to-32 -Wwrite-strings -Wmissing-noreturn -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wunused-variable -Wextra-tokens
|
85
|
-
cppflags =
|
86
|
-
CCDLFLAGS = -fno-common
|
87
|
-
CFLAGS = $(CCDLFLAGS) $(cflags) -pipe -Wall $(ARCH_FLAG)
|
88
|
-
INCFLAGS = -I. -I$(arch_hdrdir) -I$(hdrdir)/ruby/backward -I$(hdrdir) -I$(srcdir)
|
89
|
-
DEFS =
|
90
|
-
CPPFLAGS = -DRUBY_EXTCONF_H=\"$(RUBY_EXTCONF_H)\" -I/opt/local/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT $(DEFS) $(cppflags)
|
91
|
-
CXXFLAGS = $(CCDLFLAGS) $(ARCH_FLAG)
|
92
|
-
ldflags = -L. -fstack-protector-strong -L/opt/local/lib
|
93
|
-
dldflags = -Wl,-undefined,dynamic_lookup -Wl,-multiply_defined,suppress -L/opt/local/lib
|
94
|
-
ARCH_FLAG =
|
95
|
-
DLDFLAGS = $(ldflags) $(dldflags) $(ARCH_FLAG)
|
96
|
-
LDSHARED = $(CC) -dynamic -bundle
|
97
|
-
LDSHAREDXX = $(CXX) -dynamic -bundle
|
98
|
-
AR = ar
|
99
|
-
EXEEXT =
|
100
|
-
|
101
|
-
RUBY_INSTALL_NAME = $(RUBY_BASE_NAME)
|
102
|
-
RUBY_SO_NAME = ruby.3.0
|
103
|
-
RUBYW_INSTALL_NAME =
|
104
|
-
RUBY_VERSION_NAME = $(RUBY_BASE_NAME)-$(ruby_version)
|
105
|
-
RUBYW_BASE_NAME = rubyw
|
106
|
-
RUBY_BASE_NAME = ruby
|
107
|
-
|
108
|
-
arch = x86_64-darwin20
|
109
|
-
sitearch = $(arch)
|
110
|
-
ruby_version = 3.0.0
|
111
|
-
ruby = $(bindir)/$(RUBY_BASE_NAME)
|
112
|
-
RUBY = $(ruby)
|
113
|
-
ruby_headers = $(hdrdir)/ruby.h $(hdrdir)/ruby/backward.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 $(RUBY_EXTCONF_H)
|
114
|
-
|
115
|
-
RM = rm -f
|
116
|
-
RM_RF = $(RUBY) -run -e rm -- -rf
|
117
|
-
RMDIRS = rmdir -p
|
118
|
-
MAKEDIRS = /opt/local/bin/gmkdir -p
|
119
|
-
INSTALL = /usr/bin/install -c
|
120
|
-
INSTALL_PROG = $(INSTALL) -m 0755
|
121
|
-
INSTALL_DATA = $(INSTALL) -m 644
|
122
|
-
COPY = cp
|
123
|
-
TOUCH = exit >
|
124
|
-
|
125
|
-
#### End of system configuration section. ####
|
126
|
-
|
127
|
-
preload =
|
128
|
-
libpath = . $(libdir) /opt/local/lib
|
129
|
-
LIBPATH = -L. -L$(libdir) -L/opt/local/lib
|
130
|
-
DEFFILE =
|
131
|
-
|
132
|
-
CLEANFILES = mkmf.log
|
133
|
-
DISTCLEANFILES =
|
134
|
-
DISTCLEANDIRS =
|
135
|
-
|
136
|
-
extout =
|
137
|
-
extout_prefix =
|
138
|
-
target_prefix = /event
|
139
|
-
LOCAL_LIBS =
|
140
|
-
LIBS =
|
141
|
-
ORIG_SRCS = event.c
|
142
|
-
SRCS = $(ORIG_SRCS) event.c backend.c kqueue.c
|
143
|
-
OBJS = event.o backend.o kqueue.o
|
144
|
-
HDRS = $(srcdir)/event.h $(srcdir)/extconf.h
|
145
|
-
LOCAL_HDRS =
|
146
|
-
TARGET = event
|
147
|
-
TARGET_NAME = event
|
148
|
-
TARGET_ENTRY = Init_$(TARGET_NAME)
|
149
|
-
DLLIB = $(TARGET).bundle
|
150
|
-
EXTSTATIC =
|
151
|
-
STATIC_LIB =
|
152
|
-
|
153
|
-
TIMESTAMP_DIR = .
|
154
|
-
BINDIR = $(bindir)
|
155
|
-
RUBYCOMMONDIR = $(sitedir)$(target_prefix)
|
156
|
-
RUBYLIBDIR = $(sitelibdir)$(target_prefix)
|
157
|
-
RUBYARCHDIR = $(sitearchdir)$(target_prefix)
|
158
|
-
HDRDIR = $(rubyhdrdir)/ruby$(target_prefix)
|
159
|
-
ARCHHDRDIR = $(rubyhdrdir)/$(arch)/ruby$(target_prefix)
|
160
|
-
TARGET_SO_DIR =
|
161
|
-
TARGET_SO = $(TARGET_SO_DIR)$(DLLIB)
|
162
|
-
CLEANLIBS = $(TARGET_SO)
|
163
|
-
CLEANOBJS = *.o *.bak
|
164
|
-
|
165
|
-
all: $(DLLIB)
|
166
|
-
static: $(STATIC_LIB)
|
167
|
-
.PHONY: all install static install-so install-rb
|
168
|
-
.PHONY: clean clean-so clean-static clean-rb
|
169
|
-
|
170
|
-
clean-static::
|
171
|
-
clean-rb-default::
|
172
|
-
clean-rb::
|
173
|
-
clean-so::
|
174
|
-
clean: clean-so clean-static clean-rb-default clean-rb
|
175
|
-
-$(Q)$(RM) $(CLEANLIBS) $(CLEANOBJS) $(CLEANFILES) .*.time
|
176
|
-
|
177
|
-
distclean-rb-default::
|
178
|
-
distclean-rb::
|
179
|
-
distclean-so::
|
180
|
-
distclean-static::
|
181
|
-
distclean: clean distclean-so distclean-static distclean-rb-default distclean-rb
|
182
|
-
-$(Q)$(RM) Makefile $(RUBY_EXTCONF_H) conftest.* mkmf.log
|
183
|
-
-$(Q)$(RM) core ruby$(EXEEXT) *~ $(DISTCLEANFILES)
|
184
|
-
-$(Q)$(RMDIRS) $(DISTCLEANDIRS) 2> /dev/null || true
|
185
|
-
|
186
|
-
realclean: distclean
|
187
|
-
install: install-so install-rb
|
188
|
-
|
189
|
-
install-so: $(DLLIB) $(TIMESTAMP_DIR)/.sitearchdir.-.event.time
|
190
|
-
$(INSTALL_PROG) $(DLLIB) $(RUBYARCHDIR)
|
191
|
-
clean-static::
|
192
|
-
-$(Q)$(RM) $(STATIC_LIB)
|
193
|
-
install-rb: pre-install-rb do-install-rb install-rb-default
|
194
|
-
install-rb-default: pre-install-rb-default do-install-rb-default
|
195
|
-
pre-install-rb: Makefile
|
196
|
-
pre-install-rb-default: Makefile
|
197
|
-
do-install-rb:
|
198
|
-
do-install-rb-default:
|
199
|
-
pre-install-rb-default:
|
200
|
-
@$(NULLCMD)
|
201
|
-
$(TIMESTAMP_DIR)/.sitearchdir.-.event.time:
|
202
|
-
$(Q) $(MAKEDIRS) $(@D) $(RUBYARCHDIR)
|
203
|
-
$(Q) $(TOUCH) $@
|
204
|
-
|
205
|
-
site-install: site-install-so site-install-rb
|
206
|
-
site-install-so: install-so
|
207
|
-
site-install-rb: install-rb
|
208
|
-
|
209
|
-
.SUFFIXES: .c .m .cc .mm .cxx .cpp .o .S
|
210
|
-
|
211
|
-
.cc.o:
|
212
|
-
$(ECHO) compiling $(<)
|
213
|
-
$(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $(CSRCFLAG)$<
|
214
|
-
|
215
|
-
.cc.S:
|
216
|
-
$(ECHO) translating $(<)
|
217
|
-
$(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -S $(CSRCFLAG)$<
|
218
|
-
|
219
|
-
.mm.o:
|
220
|
-
$(ECHO) compiling $(<)
|
221
|
-
$(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $(CSRCFLAG)$<
|
222
|
-
|
223
|
-
.mm.S:
|
224
|
-
$(ECHO) translating $(<)
|
225
|
-
$(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -S $(CSRCFLAG)$<
|
226
|
-
|
227
|
-
.cxx.o:
|
228
|
-
$(ECHO) compiling $(<)
|
229
|
-
$(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $(CSRCFLAG)$<
|
230
|
-
|
231
|
-
.cxx.S:
|
232
|
-
$(ECHO) translating $(<)
|
233
|
-
$(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -S $(CSRCFLAG)$<
|
234
|
-
|
235
|
-
.cpp.o:
|
236
|
-
$(ECHO) compiling $(<)
|
237
|
-
$(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $(CSRCFLAG)$<
|
238
|
-
|
239
|
-
.cpp.S:
|
240
|
-
$(ECHO) translating $(<)
|
241
|
-
$(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -S $(CSRCFLAG)$<
|
242
|
-
|
243
|
-
.c.o:
|
244
|
-
$(ECHO) compiling $(<)
|
245
|
-
$(Q) $(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) $(COUTFLAG)$@ -c $(CSRCFLAG)$<
|
246
|
-
|
247
|
-
.c.S:
|
248
|
-
$(ECHO) translating $(<)
|
249
|
-
$(Q) $(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) $(COUTFLAG)$@ -S $(CSRCFLAG)$<
|
250
|
-
|
251
|
-
.m.o:
|
252
|
-
$(ECHO) compiling $(<)
|
253
|
-
$(Q) $(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) $(COUTFLAG)$@ -c $(CSRCFLAG)$<
|
254
|
-
|
255
|
-
.m.S:
|
256
|
-
$(ECHO) translating $(<)
|
257
|
-
$(Q) $(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) $(COUTFLAG)$@ -S $(CSRCFLAG)$<
|
258
|
-
|
259
|
-
$(TARGET_SO): $(OBJS) Makefile
|
260
|
-
$(ECHO) linking shared-object event/$(DLLIB)
|
261
|
-
-$(Q)$(RM) $(@)
|
262
|
-
$(Q) $(LDSHARED) -o $@ $(OBJS) $(LIBPATH) $(DLDFLAGS) $(LOCAL_LIBS) $(LIBS)
|
263
|
-
$(Q) $(POSTLINK)
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
$(OBJS): $(HDRS) $(ruby_headers)
|