ffi 1.17.2-java → 1.17.3-java
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
- checksums.yaml.gz.sig +0 -0
- data/CHANGELOG.md +25 -0
- data/Gemfile +7 -4
- data/README.md +1 -0
- data/Rakefile +7 -4
- data/Steepfile +8 -0
- data/ffi.gemspec +4 -5
- data/lib/ffi/autopointer.rb +6 -0
- data/lib/ffi/compat.rb +11 -0
- data/lib/ffi/function.rb +23 -0
- data/lib/ffi/library.rb +19 -3
- data/lib/ffi/struct_by_reference.rb +1 -1
- data/lib/ffi/version.rb +1 -1
- data/samples/hello_ractor.rb +9 -1
- data/samples/qsort_ractor.rb +9 -1
- data/sig/ffi/auto_pointer.rbs +1 -1
- data/sig/ffi/errno.rbs +8 -0
- data/sig/ffi/platform.rbs +49 -0
- data/sig/ffi/struct.rbs +2 -2
- data/sig/ffi/struct_by_reference.rbs +1 -1
- data/sig/ffi.rbs +4 -1
- data.tar.gz.sig +0 -0
- metadata +21 -74
- metadata.gz.sig +0 -0
- data/lib/ffi/tools/types_generator.rb +0 -137
- data/rakelib/ffi_gem_helper.rb +0 -65
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 04b1fd43d494fe843d181656a69cdad812ceac3ae747b7b11a572200efd433f1
|
|
4
|
+
data.tar.gz: 67284fbe786486e12a7e4d6b19198bc00b399cf6877ff27c3e8ad13e285c2035
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 8f12d86bea6c5d894a7a0d0732658ddf1355c56ae674c80159935822f481e54e538a6cdc8430a8f6bd5c5122f6dab94baef2fb0d922146524c375be40e77c999
|
|
7
|
+
data.tar.gz: 876c8d82dd1d2f11afe12245f3e53117f443bd2bf3db4f8922358bd78ff4f364c1d4d2d268b7f615ec63052ad5eb2674199d4f8ad5ec119d3525041ea0f3d619
|
checksums.yaml.gz.sig
CHANGED
|
Binary file
|
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,28 @@
|
|
|
1
|
+
1.17.3 / 2025-12-29
|
|
2
|
+
-------------------
|
|
3
|
+
|
|
4
|
+
Fixed:
|
|
5
|
+
* Opt-in for MFA requirement explicitly. #1159
|
|
6
|
+
* Fix type signature for FFI::AutoPointer#initialize, FFI::StructByReference#native_type and FFI::Struct#auto_ptr . #1158
|
|
7
|
+
* Fix function signature of function_call in FFI trampoline. #1154
|
|
8
|
+
It failed on `aarch64-mingw-ucrt`.
|
|
9
|
+
* Add workaround for segmentation faults on `aarch64-mingw-ucrt`. #1154
|
|
10
|
+
* Call super in `Library#freeze` . #1154
|
|
11
|
+
* Deny duplication of AutoPointer per #dup and #clone . #1173
|
|
12
|
+
They led to double free before.
|
|
13
|
+
|
|
14
|
+
Added:
|
|
15
|
+
* Add binary gems for Ruby-4.0, now providing binary gems for Ruby-3.0 to 4.0.
|
|
16
|
+
* Add msys2_mingw_dependencies for Windows Mingw for automatic installation of libffi. #1143
|
|
17
|
+
* Mark callback dispatcher thread as fork safe for Puma. #1156
|
|
18
|
+
* Add missing FFI::Platform module and LastError signatures. #1169
|
|
19
|
+
|
|
20
|
+
Removed:
|
|
21
|
+
* Drop fat binary gems for Ruby-2.7
|
|
22
|
+
* Remove `FFI::TypesGenerator` from distributed gems. #1164
|
|
23
|
+
* Remove libffi build dir after install, safing some install space. #1157
|
|
24
|
+
|
|
25
|
+
|
|
1
26
|
1.17.2 / 2025-04-15
|
|
2
27
|
-------------------
|
|
3
28
|
|
data/Gemfile
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
source 'https://rubygems.org'
|
|
2
2
|
|
|
3
|
+
gemspec
|
|
4
|
+
|
|
3
5
|
group :development do
|
|
4
6
|
gem 'benchmark' # necessary on ruby-3.5+
|
|
5
7
|
gem 'bigdecimal' # necessary on ruby-3.3+
|
|
6
|
-
gem 'bundler', '>= 1.16', '<
|
|
7
|
-
gem 'fiddle'
|
|
8
|
+
gem 'bundler', '>= 1.16', '< 5.dev'
|
|
9
|
+
gem 'fiddle' # necessary on ruby-4.0+
|
|
8
10
|
gem 'rake', '~> 13.0'
|
|
9
11
|
gem 'rake-compiler', '~> 1.1'
|
|
10
|
-
gem 'rake-compiler-dock', '~> 1.
|
|
12
|
+
gem 'rake-compiler-dock', '~> 1.11.0'
|
|
11
13
|
gem 'rspec', '~> 3.0'
|
|
12
14
|
end
|
|
13
15
|
|
|
@@ -17,7 +19,8 @@ group :doc do
|
|
|
17
19
|
end
|
|
18
20
|
|
|
19
21
|
group :type_check do
|
|
20
|
-
if RUBY_VERSION >= "
|
|
22
|
+
if RUBY_VERSION >= "3.0" && %w[ ruby truffleruby ].include?(RUBY_ENGINE)
|
|
21
23
|
gem 'rbs', '~> 3.0'
|
|
24
|
+
gem 'steep', '~> 1.6'
|
|
22
25
|
end
|
|
23
26
|
end
|
data/README.md
CHANGED
|
@@ -33,6 +33,7 @@ MyLib.puts 'Hello, World using libc!'
|
|
|
33
33
|
|
|
34
34
|
For less minimalistic and more examples you may look at:
|
|
35
35
|
|
|
36
|
+
* The [documentation](https://www.rubydoc.info/gems/ffi)
|
|
36
37
|
* the `samples/` folder
|
|
37
38
|
* the examples on the [wiki](https://github.com/ffi/ffi/wiki)
|
|
38
39
|
* the projects using FFI listed on the wiki: https://github.com/ffi/ffi/wiki/projects-using-ffi
|
data/Rakefile
CHANGED
|
@@ -97,6 +97,7 @@ Bundler::GemHelper.instance.cross_platforms = %w[
|
|
|
97
97
|
arm-linux-musl
|
|
98
98
|
aarch64-linux-gnu
|
|
99
99
|
aarch64-linux-musl
|
|
100
|
+
aarch64-mingw-ucrt
|
|
100
101
|
x86_64-darwin
|
|
101
102
|
arm64-darwin
|
|
102
103
|
]
|
|
@@ -111,6 +112,8 @@ if RUBY_ENGINE == 'ruby' || RUBY_ENGINE == 'rbx'
|
|
|
111
112
|
ext.cross_platform = Bundler::GemHelper.instance.cross_platforms
|
|
112
113
|
ext.cross_compiling do |spec|
|
|
113
114
|
spec.files.reject! { |path| File.fnmatch?('ext/*', path) }
|
|
115
|
+
# Binary gems don't need libffi header+lib files
|
|
116
|
+
spec.metadata.delete("msys2_mingw_dependencies")
|
|
114
117
|
end
|
|
115
118
|
# Enable debug info for 'rake compile' but not for 'gem install'
|
|
116
119
|
ext.config_options << "--enable-debug"
|
|
@@ -126,7 +129,7 @@ end
|
|
|
126
129
|
namespace "gem" do
|
|
127
130
|
task 'prepare' do
|
|
128
131
|
require 'rake_compiler_dock'
|
|
129
|
-
sh "bundle package
|
|
132
|
+
sh "bundle package"
|
|
130
133
|
end
|
|
131
134
|
|
|
132
135
|
Bundler::GemHelper.instance.cross_platforms.each do |plat|
|
|
@@ -137,8 +140,8 @@ namespace "gem" do
|
|
|
137
140
|
task plat => ['prepare', 'build'] do
|
|
138
141
|
RakeCompilerDock.sh <<-EOT, platform: plat
|
|
139
142
|
sudo apt-get update && sudo apt-get install -y libltdl-dev &&
|
|
140
|
-
bundle --local &&
|
|
141
|
-
rake native:#{plat} pkg/#{gem_spec.full_name}-#{plat}.gem MAKE='nice make -j`nproc`' RUBY_CC_VERSION=#{RakeCompilerDock.ruby_cc_version("~>
|
|
143
|
+
bundle install --local &&
|
|
144
|
+
rake native:#{plat} pkg/#{gem_spec.full_name}-#{plat}.gem MAKE='nice make -j`nproc`' RUBY_CC_VERSION=#{RakeCompilerDock.ruby_cc_version("~>4.0", "~>3.0")}
|
|
142
145
|
EOT
|
|
143
146
|
end
|
|
144
147
|
end
|
|
@@ -180,7 +183,7 @@ logfile = File.join(File.dirname(__FILE__), 'types_log')
|
|
|
180
183
|
|
|
181
184
|
task types_conf do |task|
|
|
182
185
|
require 'fileutils'
|
|
183
|
-
require_relative "
|
|
186
|
+
require_relative "rakelib/types_generator"
|
|
184
187
|
options = {}
|
|
185
188
|
FileUtils.mkdir_p(File.dirname(task.name), mode: 0755 )
|
|
186
189
|
File.open(task.name, File::CREAT|File::TRUNC|File::RDWR, 0644) do |f|
|
data/Steepfile
ADDED
data/ffi.gemspec
CHANGED
|
@@ -15,9 +15,10 @@ Gem::Specification.new do |s|
|
|
|
15
15
|
s.metadata['wiki_uri'] = 'https://github.com/ffi/ffi/wiki'
|
|
16
16
|
s.metadata['source_code_uri'] = 'https://github.com/ffi/ffi/'
|
|
17
17
|
s.metadata['mailing_list_uri'] = 'http://groups.google.com/group/ruby-ffi'
|
|
18
|
+
s.metadata['rubygems_mfa_required'] = 'true'
|
|
18
19
|
end
|
|
19
20
|
s.files = `git ls-files -z`.split("\x0").reject do |f|
|
|
20
|
-
f =~ /^(\.|bench|gen|libtest|nbproject|spec)/
|
|
21
|
+
f =~ /^(\.|bench|gen|libtest|nbproject|spec|rakelib)/
|
|
21
22
|
end
|
|
22
23
|
|
|
23
24
|
# Add libffi git files
|
|
@@ -35,8 +36,6 @@ Gem::Specification.new do |s|
|
|
|
35
36
|
s.license = 'BSD-3-Clause'
|
|
36
37
|
s.require_paths << 'ext/ffi_c'
|
|
37
38
|
s.required_ruby_version = '>= 2.5'
|
|
38
|
-
|
|
39
|
-
s.
|
|
40
|
-
s.add_development_dependency 'rake-compiler-dock', '~> 1.0'
|
|
41
|
-
s.add_development_dependency 'rspec', '~> 2.14.1'
|
|
39
|
+
|
|
40
|
+
s.metadata['msys2_mingw_dependencies'] = 'libffi'
|
|
42
41
|
end
|
data/lib/ffi/autopointer.rb
CHANGED
data/lib/ffi/compat.rb
CHANGED
|
@@ -40,4 +40,15 @@ module FFI
|
|
|
40
40
|
obj.freeze
|
|
41
41
|
end
|
|
42
42
|
end
|
|
43
|
+
|
|
44
|
+
if defined?(Ractor.shareable_proc)
|
|
45
|
+
# This is for FFI internal use only.
|
|
46
|
+
def self.shareable_proc(**kwargs, &block)
|
|
47
|
+
Ractor.shareable_proc(**kwargs, &block)
|
|
48
|
+
end
|
|
49
|
+
else
|
|
50
|
+
def self.shareable_proc(**_kwargs, &block)
|
|
51
|
+
block
|
|
52
|
+
end
|
|
53
|
+
end
|
|
43
54
|
end
|
data/lib/ffi/function.rb
CHANGED
|
@@ -51,6 +51,29 @@ module FFI
|
|
|
51
51
|
end
|
|
52
52
|
end
|
|
53
53
|
|
|
54
|
+
if RUBY_PLATFORM == 'aarch64-mingw-ucrt'
|
|
55
|
+
# Use a workaround for https://github.com/libffi/libffi/issues/905
|
|
56
|
+
def attach(mod, name)
|
|
57
|
+
this = self
|
|
58
|
+
body = proc do |*args, &block|
|
|
59
|
+
this.call(*args, &block)
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
mod.define_method(name, body)
|
|
63
|
+
mod.define_singleton_method(name, body)
|
|
64
|
+
|
|
65
|
+
# Store function Proc's for re-definition as Ractor-shareable in Library#freeze
|
|
66
|
+
funcs = mod.instance_variable_get("@ffi_function_procs")
|
|
67
|
+
unless funcs
|
|
68
|
+
funcs = {}
|
|
69
|
+
mod.instance_variable_set("@ffi_function_procs", funcs)
|
|
70
|
+
end
|
|
71
|
+
funcs[name] = self
|
|
72
|
+
|
|
73
|
+
self
|
|
74
|
+
end
|
|
75
|
+
end
|
|
76
|
+
|
|
54
77
|
# Stash the Function in a module variable so it can be inspected by attached_functions.
|
|
55
78
|
# On CRuby it also ensures that it does not get garbage collected.
|
|
56
79
|
module RegisterAttach
|
data/lib/ffi/library.rb
CHANGED
|
@@ -287,7 +287,7 @@ module FFI
|
|
|
287
287
|
if type.is_a?(Class) && type < FFI::Struct
|
|
288
288
|
# If it is a global struct, just attach directly to the pointer
|
|
289
289
|
s = s = type.new(address) # Assigning twice to suppress unused variable warning
|
|
290
|
-
self.module_eval
|
|
290
|
+
self.module_eval(<<-code, __FILE__, __LINE__)
|
|
291
291
|
@ffi_gsvars = {} unless defined?(@ffi_gsvars)
|
|
292
292
|
@ffi_gsvars[#{mname.inspect}] = s
|
|
293
293
|
def self.#{mname}
|
|
@@ -302,7 +302,7 @@ module FFI
|
|
|
302
302
|
#
|
|
303
303
|
# Attach to this module as mname/mname=
|
|
304
304
|
#
|
|
305
|
-
self.module_eval
|
|
305
|
+
self.module_eval(<<-code, __FILE__, __LINE__)
|
|
306
306
|
@ffi_gvars = {} unless defined?(@ffi_gvars)
|
|
307
307
|
@ffi_gvars[#{mname.inspect}] = s
|
|
308
308
|
def self.#{mname}
|
|
@@ -564,12 +564,28 @@ module FFI
|
|
|
564
564
|
# Freeze all definitions of the module
|
|
565
565
|
#
|
|
566
566
|
# This freezes the module's definitions, so that it can be used in a Ractor.
|
|
567
|
-
# No further
|
|
567
|
+
# No further functions or variables can be attached and no further enums or typedefs can be created in this module afterwards.
|
|
568
568
|
def freeze
|
|
569
|
+
# @ffi_function_procs is only used on aarch64-mingw-ucrt
|
|
570
|
+
instance_variable_get("@ffi_function_procs")&.each do |name, func|
|
|
571
|
+
# Redefine attached functions as Ractor-shareable.
|
|
572
|
+
# The function Proc can't be shareable from the beginning, since it references enums and typedefs.
|
|
573
|
+
this = FFI.make_shareable(func)
|
|
574
|
+
body = FFI.shareable_proc(self: nil) do |*args, &block|
|
|
575
|
+
this.call(*args, &block)
|
|
576
|
+
end
|
|
577
|
+
undef_method(name)
|
|
578
|
+
singleton_class.undef_method(name)
|
|
579
|
+
|
|
580
|
+
define_method(name, body)
|
|
581
|
+
define_singleton_method(name, body)
|
|
582
|
+
end
|
|
583
|
+
|
|
569
584
|
instance_variables.each do |name|
|
|
570
585
|
var = instance_variable_get(name)
|
|
571
586
|
FFI.make_shareable(var)
|
|
572
587
|
end
|
|
588
|
+
super
|
|
573
589
|
nil
|
|
574
590
|
end
|
|
575
591
|
end
|
data/lib/ffi/version.rb
CHANGED
data/samples/hello_ractor.rb
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
|
+
# See the ffi wiki for how to use FFI with Ractors:
|
|
2
|
+
# https://github.com/ffi/ffi/wiki/Ractors
|
|
3
|
+
|
|
1
4
|
require 'ffi'
|
|
2
5
|
|
|
6
|
+
class Ractor
|
|
7
|
+
# compat with Ruby-3.4 and older
|
|
8
|
+
alias value take unless method_defined? :value
|
|
9
|
+
end
|
|
10
|
+
|
|
3
11
|
module Foo
|
|
4
12
|
extend FFI::Library
|
|
5
13
|
ffi_lib FFI::Library::LIBC
|
|
@@ -8,4 +16,4 @@ module Foo
|
|
|
8
16
|
end
|
|
9
17
|
Ractor.new do
|
|
10
18
|
Foo.cputs("Hello, World via libc puts using FFI in a Ractor")
|
|
11
|
-
end.
|
|
19
|
+
end.value
|
data/samples/qsort_ractor.rb
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
|
+
# See the ffi wiki for how to use FFI with Ractors:
|
|
2
|
+
# https://github.com/ffi/ffi/wiki/Ractors
|
|
3
|
+
|
|
1
4
|
require 'ffi'
|
|
2
5
|
|
|
6
|
+
class Ractor
|
|
7
|
+
# compat with Ruby-3.4 and older
|
|
8
|
+
alias value take unless method_defined? :value
|
|
9
|
+
end
|
|
10
|
+
|
|
3
11
|
module LibC
|
|
4
12
|
extend FFI::Library
|
|
5
13
|
ffi_lib FFI::Library::LIBC
|
|
@@ -23,6 +31,6 @@ res = Ractor.new(p) do |p|
|
|
|
23
31
|
i1 < i2 ? -1 : i1 > i2 ? 1 : 0
|
|
24
32
|
end
|
|
25
33
|
puts "After qsort #{p.get_array_of_int32(0, 3).join(', ')}"
|
|
26
|
-
end.
|
|
34
|
+
end.value
|
|
27
35
|
|
|
28
36
|
puts "After ractor termination #{p.get_array_of_int32(0, 3).join(', ')}"
|
data/sig/ffi/auto_pointer.rbs
CHANGED
|
@@ -12,7 +12,7 @@ module FFI
|
|
|
12
12
|
def release: (Pointer ptr) -> void
|
|
13
13
|
end
|
|
14
14
|
|
|
15
|
-
def initialize: (Pointer pointer, Method | ^(
|
|
15
|
+
def initialize: (Pointer pointer, Method | ^(instance) -> void | Releaser::_Proc[instance] callable) -> self
|
|
16
16
|
| (Pointer pointer) -> self # where class < `def self.release: (instance pointer) -> void`
|
|
17
17
|
|
|
18
18
|
extend DataConverter[Pointer, instance, nil]
|
data/sig/ffi/errno.rbs
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
module FFI
|
|
2
|
+
class PlatformError < LoadError
|
|
3
|
+
end
|
|
4
|
+
|
|
5
|
+
module Platform
|
|
6
|
+
OS: String
|
|
7
|
+
|
|
8
|
+
OSVERSION: Integer
|
|
9
|
+
|
|
10
|
+
CPU: String
|
|
11
|
+
|
|
12
|
+
ARCH: String
|
|
13
|
+
|
|
14
|
+
IS_GNU: bool
|
|
15
|
+
IS_LINUX: bool
|
|
16
|
+
IS_MAC: bool
|
|
17
|
+
IS_FREEBSD: bool
|
|
18
|
+
IS_NETBSD: bool
|
|
19
|
+
IS_OPENBSD: bool
|
|
20
|
+
IS_DRAGONFLYBSD: bool
|
|
21
|
+
IS_SOLARIS: bool
|
|
22
|
+
IS_WINDOWS: bool
|
|
23
|
+
IS_BSD: bool
|
|
24
|
+
|
|
25
|
+
NAME: String
|
|
26
|
+
|
|
27
|
+
CONF_DIR: String
|
|
28
|
+
|
|
29
|
+
LIBPREFIX: String
|
|
30
|
+
|
|
31
|
+
LIBSUFFIX: String
|
|
32
|
+
|
|
33
|
+
LIBC: String
|
|
34
|
+
|
|
35
|
+
LITTLE_ENDIAN: Integer
|
|
36
|
+
|
|
37
|
+
BIG_ENDIAN: Integer
|
|
38
|
+
|
|
39
|
+
def self.bsd?: () -> bool
|
|
40
|
+
def self.windows?: () -> bool
|
|
41
|
+
def self.mac?: () -> bool
|
|
42
|
+
def self.solaris?: () -> bool
|
|
43
|
+
def self.unix?: () -> bool
|
|
44
|
+
|
|
45
|
+
private
|
|
46
|
+
|
|
47
|
+
def self.is_os: (String os) -> bool
|
|
48
|
+
end
|
|
49
|
+
end
|
data/sig/ffi/struct.rbs
CHANGED
|
@@ -4,7 +4,7 @@ module FFI
|
|
|
4
4
|
|
|
5
5
|
type ptr = Type::Mapped[
|
|
6
6
|
StructByReference[Struct[AbstractMemory, untyped], AbstractMemory],
|
|
7
|
-
AbstractMemory,
|
|
7
|
+
AbstractMemory, Struct[AbstractMemory, untyped], untyped
|
|
8
8
|
]
|
|
9
9
|
def self.ptr: (?untyped flags) -> ptr # https://github.com/ffi/ffi/issues/1073
|
|
10
10
|
alias self.by_ref self.ptr
|
|
@@ -22,7 +22,7 @@ module FFI
|
|
|
22
22
|
|
|
23
23
|
def self.auto_ptr: () -> Type::Mapped[
|
|
24
24
|
ManagedStructConverter[ManagedStruct[AutoPointer, untyped], AutoPointer],
|
|
25
|
-
Pointer,
|
|
25
|
+
Pointer, ManagedStruct[AutoPointer, untyped], untyped
|
|
26
26
|
]
|
|
27
27
|
def self.layout: (*layout | Integer) -> StructLayout
|
|
28
28
|
| (Hash[Symbol, layout]) -> StructLayout
|
data/sig/ffi.rbs
CHANGED
|
@@ -14,9 +14,12 @@ module FFI
|
|
|
14
14
|
CURRENT_PROCESS: current_process
|
|
15
15
|
USE_THIS_PROCESS_AS_LIBRARY: current_process
|
|
16
16
|
|
|
17
|
+
class NotFoundError < LoadError
|
|
18
|
+
end
|
|
19
|
+
|
|
17
20
|
private def self.custom_typedefs: () -> type_map
|
|
18
21
|
def self.errno: () -> Integer
|
|
19
|
-
def self.errno=: (Integer) ->
|
|
22
|
+
def self.errno=: (Integer) -> Integer
|
|
20
23
|
def self.find_type: (ffi_auto_type name, ?type_map? type_map) -> Type
|
|
21
24
|
def self.make_shareable: [T] (T obj) -> T
|
|
22
25
|
def self.map_library_name: (_ToS lib) -> String
|
data.tar.gz.sig
CHANGED
|
Binary file
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: ffi
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.17.
|
|
4
|
+
version: 1.17.3
|
|
5
5
|
platform: java
|
|
6
6
|
authors:
|
|
7
7
|
- Wayne Meissner
|
|
@@ -9,9 +9,9 @@ bindir: bin
|
|
|
9
9
|
cert_chain:
|
|
10
10
|
- |
|
|
11
11
|
-----BEGIN CERTIFICATE-----
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
MIIEBDCCAmygAwIBAgIBBDANBgkqhkiG9w0BAQsFADAoMSYwJAYDVQQDDB1sYXJz
|
|
13
|
+
L0RDPWdyZWl6LXJlaW5zZG9yZi9EQz1kZTAeFw0yNTEyMjkyMDMyMzFaFw0yNjEy
|
|
14
|
+
MjkyMDMyMzFaMCgxJjAkBgNVBAMMHWxhcnMvREM9Z3JlaXotcmVpbnNkb3JmL0RD
|
|
15
15
|
PWRlMIIBojANBgkqhkiG9w0BAQEFAAOCAY8AMIIBigKCAYEAwum6Y1KznfpzXOT/
|
|
16
16
|
mZgJTBbxZuuZF49Fq3K0WA67YBzNlDv95qzSp7V/7Ek3NCcnT7G+2kSuhNo1FhdN
|
|
17
17
|
eSDO/moYebZNAcu3iqLsuzuULXPLuoU0GsMnVMqV9DZPh7cQHE5EBZ7hlzDBK7k/
|
|
@@ -22,74 +22,18 @@ cert_chain:
|
|
|
22
22
|
chQPnWX+N3Gj+jjYxqTFdwT7Mj3pv1VHa+aNUbqSPpvJeDyxRIuo9hvzDaBHb/Cg
|
|
23
23
|
9qRVcm8a96n4t7y2lrX1oookY6bkBaxWOMtWlqIprq8JZXM9AgMBAAGjOTA3MAkG
|
|
24
24
|
A1UdEwQCMAAwCwYDVR0PBAQDAgSwMB0GA1UdDgQWBBQ4h1tIyvdUWtMI739xMzTR
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
25
|
+
7EfMFzANBgkqhkiG9w0BAQsFAAOCAYEAUVIier9xybHmXNsj801xD+Q7Jz7wpRsf
|
|
26
|
+
fMHpV2sAzvYcAa7pn+mbu9nf7RUhe5hiaUv88Usk9nRUYYrjBOO5RuD+wYNowpcE
|
|
27
|
+
kxUiTAP/fgUBdW6hYUJy57CH3xUD6tj1Cg9hxdKy7jItZXbfhX+qPq2BwGaXz7gn
|
|
28
|
+
nhrALITRmpuPnlsccM94dgSArCInSo2SEc12h2oB6FAnFG1Lre3dmQamI5q1EKp0
|
|
29
|
+
Yafb2+cPbFcVYUdE50wf+cdeGDOsCGlAmo2OGqXWxTP2hIfyhsFoamD6UGufLoPG
|
|
30
|
+
Dh6tAEZIuEvLjq93qoNceUQn+xxiiIszjY5mkTu9rVY+/gh5PJzu9IHvyIqBpb2o
|
|
31
|
+
fdWDISWK+KSLCrqkFtKoliLDTZau73GcYCVOkjca+3cxqABKZ+M8r42Sq8JPxPiv
|
|
32
|
+
KyLQBzqPeLN9qRDD1bEFHIcgwdY/zQTs4mWRBSmBWa7w+k8nP8aSV1dN/fvhYwY3
|
|
33
|
+
HCQwtPaMYOznIOcc8shL4zLJpcl8uCqE
|
|
34
34
|
-----END CERTIFICATE-----
|
|
35
|
-
date:
|
|
36
|
-
dependencies:
|
|
37
|
-
- !ruby/object:Gem::Dependency
|
|
38
|
-
name: rake
|
|
39
|
-
requirement: !ruby/object:Gem::Requirement
|
|
40
|
-
requirements:
|
|
41
|
-
- - "~>"
|
|
42
|
-
- !ruby/object:Gem::Version
|
|
43
|
-
version: '13.0'
|
|
44
|
-
type: :development
|
|
45
|
-
prerelease: false
|
|
46
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
47
|
-
requirements:
|
|
48
|
-
- - "~>"
|
|
49
|
-
- !ruby/object:Gem::Version
|
|
50
|
-
version: '13.0'
|
|
51
|
-
- !ruby/object:Gem::Dependency
|
|
52
|
-
name: rake-compiler
|
|
53
|
-
requirement: !ruby/object:Gem::Requirement
|
|
54
|
-
requirements:
|
|
55
|
-
- - "~>"
|
|
56
|
-
- !ruby/object:Gem::Version
|
|
57
|
-
version: '1.1'
|
|
58
|
-
type: :development
|
|
59
|
-
prerelease: false
|
|
60
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
61
|
-
requirements:
|
|
62
|
-
- - "~>"
|
|
63
|
-
- !ruby/object:Gem::Version
|
|
64
|
-
version: '1.1'
|
|
65
|
-
- !ruby/object:Gem::Dependency
|
|
66
|
-
name: rake-compiler-dock
|
|
67
|
-
requirement: !ruby/object:Gem::Requirement
|
|
68
|
-
requirements:
|
|
69
|
-
- - "~>"
|
|
70
|
-
- !ruby/object:Gem::Version
|
|
71
|
-
version: '1.0'
|
|
72
|
-
type: :development
|
|
73
|
-
prerelease: false
|
|
74
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
75
|
-
requirements:
|
|
76
|
-
- - "~>"
|
|
77
|
-
- !ruby/object:Gem::Version
|
|
78
|
-
version: '1.0'
|
|
79
|
-
- !ruby/object:Gem::Dependency
|
|
80
|
-
name: rspec
|
|
81
|
-
requirement: !ruby/object:Gem::Requirement
|
|
82
|
-
requirements:
|
|
83
|
-
- - "~>"
|
|
84
|
-
- !ruby/object:Gem::Version
|
|
85
|
-
version: 2.14.1
|
|
86
|
-
type: :development
|
|
87
|
-
prerelease: false
|
|
88
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
89
|
-
requirements:
|
|
90
|
-
- - "~>"
|
|
91
|
-
- !ruby/object:Gem::Version
|
|
92
|
-
version: 2.14.1
|
|
35
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
36
|
+
dependencies: []
|
|
93
37
|
description: Ruby FFI library
|
|
94
38
|
email: wmeissner@gmail.com
|
|
95
39
|
executables: []
|
|
@@ -103,6 +47,7 @@ files:
|
|
|
103
47
|
- LICENSE.SPECS
|
|
104
48
|
- README.md
|
|
105
49
|
- Rakefile
|
|
50
|
+
- Steepfile
|
|
106
51
|
- ffi.gemspec
|
|
107
52
|
- lib/ffi.rb
|
|
108
53
|
- lib/ffi/abstract_memory.rb
|
|
@@ -189,12 +134,10 @@ files:
|
|
|
189
134
|
- lib/ffi/tools/generator.rb
|
|
190
135
|
- lib/ffi/tools/generator_task.rb
|
|
191
136
|
- lib/ffi/tools/struct_generator.rb
|
|
192
|
-
- lib/ffi/tools/types_generator.rb
|
|
193
137
|
- lib/ffi/types.rb
|
|
194
138
|
- lib/ffi/union.rb
|
|
195
139
|
- lib/ffi/variadic.rb
|
|
196
140
|
- lib/ffi/version.rb
|
|
197
|
-
- rakelib/ffi_gem_helper.rb
|
|
198
141
|
- samples/getlogin.rb
|
|
199
142
|
- samples/getpid.rb
|
|
200
143
|
- samples/gettimeofday.rb
|
|
@@ -211,9 +154,11 @@ files:
|
|
|
211
154
|
- sig/ffi/data_converter.rbs
|
|
212
155
|
- sig/ffi/dynamic_library.rbs
|
|
213
156
|
- sig/ffi/enum.rbs
|
|
157
|
+
- sig/ffi/errno.rbs
|
|
214
158
|
- sig/ffi/function.rbs
|
|
215
159
|
- sig/ffi/library.rbs
|
|
216
160
|
- sig/ffi/native_type.rbs
|
|
161
|
+
- sig/ffi/platform.rbs
|
|
217
162
|
- sig/ffi/pointer.rbs
|
|
218
163
|
- sig/ffi/struct.rbs
|
|
219
164
|
- sig/ffi/struct_by_reference.rbs
|
|
@@ -231,6 +176,8 @@ metadata:
|
|
|
231
176
|
wiki_uri: https://github.com/ffi/ffi/wiki
|
|
232
177
|
source_code_uri: https://github.com/ffi/ffi/
|
|
233
178
|
mailing_list_uri: http://groups.google.com/group/ruby-ffi
|
|
179
|
+
rubygems_mfa_required: 'true'
|
|
180
|
+
msys2_mingw_dependencies: libffi
|
|
234
181
|
rdoc_options:
|
|
235
182
|
- "--exclude=ext/ffi_c/.*\\.o$"
|
|
236
183
|
- "--exclude=ffi_c\\.(bundle|so)$"
|
|
@@ -247,7 +194,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
247
194
|
- !ruby/object:Gem::Version
|
|
248
195
|
version: '0'
|
|
249
196
|
requirements: []
|
|
250
|
-
rubygems_version:
|
|
197
|
+
rubygems_version: 4.0.3
|
|
251
198
|
specification_version: 4
|
|
252
199
|
summary: Ruby FFI
|
|
253
200
|
test_files: []
|
metadata.gz.sig
CHANGED
|
Binary file
|
|
@@ -1,137 +0,0 @@
|
|
|
1
|
-
require 'tempfile'
|
|
2
|
-
|
|
3
|
-
module FFI
|
|
4
|
-
|
|
5
|
-
# @private
|
|
6
|
-
class TypesGenerator
|
|
7
|
-
|
|
8
|
-
##
|
|
9
|
-
# Maps different C types to the C type representations we use
|
|
10
|
-
|
|
11
|
-
TYPE_MAP = {
|
|
12
|
-
"char" => :char,
|
|
13
|
-
"signed char" => :char,
|
|
14
|
-
"__signed char" => :char,
|
|
15
|
-
"unsigned char" => :uchar,
|
|
16
|
-
|
|
17
|
-
"short" => :short,
|
|
18
|
-
"signed short" => :short,
|
|
19
|
-
"signed short int" => :short,
|
|
20
|
-
"unsigned short" => :ushort,
|
|
21
|
-
"unsigned short int" => :ushort,
|
|
22
|
-
|
|
23
|
-
"int" => :int,
|
|
24
|
-
"signed int" => :int,
|
|
25
|
-
"unsigned int" => :uint,
|
|
26
|
-
|
|
27
|
-
"long" => :long,
|
|
28
|
-
"long int" => :long,
|
|
29
|
-
"signed long" => :long,
|
|
30
|
-
"signed long int" => :long,
|
|
31
|
-
"unsigned long" => :ulong,
|
|
32
|
-
"unsigned long int" => :ulong,
|
|
33
|
-
"long unsigned int" => :ulong,
|
|
34
|
-
|
|
35
|
-
"long long" => :long_long,
|
|
36
|
-
"long long int" => :long_long,
|
|
37
|
-
"signed long long" => :long_long,
|
|
38
|
-
"signed long long int" => :long_long,
|
|
39
|
-
"unsigned long long" => :ulong_long,
|
|
40
|
-
"unsigned long long int" => :ulong_long,
|
|
41
|
-
|
|
42
|
-
"char *" => :string,
|
|
43
|
-
"void *" => :pointer,
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
def self.generate(options = {})
|
|
47
|
-
typedefs = nil
|
|
48
|
-
Tempfile.open 'ffi_types_generator' do |io|
|
|
49
|
-
io.puts <<-C
|
|
50
|
-
#include <stdint.h>
|
|
51
|
-
#include <stddef.h>
|
|
52
|
-
#include <sys/types.h>
|
|
53
|
-
#if !(defined(WIN32))
|
|
54
|
-
#include <sys/socket.h>
|
|
55
|
-
#include <netinet/in.h>
|
|
56
|
-
#include <sys/resource.h>
|
|
57
|
-
#endif
|
|
58
|
-
C
|
|
59
|
-
|
|
60
|
-
io.close
|
|
61
|
-
cc = ENV['CC'] || 'gcc'
|
|
62
|
-
cmd = "#{cc} -E -x c #{options[:cppflags]} -D_DARWIN_USE_64_BIT_INODE -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -c"
|
|
63
|
-
if options[:input]
|
|
64
|
-
typedefs = File.read(options[:input])
|
|
65
|
-
elsif options[:remote]
|
|
66
|
-
typedefs = `ssh #{options[:remote]} #{cmd} - < #{io.path}`
|
|
67
|
-
else
|
|
68
|
-
typedefs = `#{cmd} #{io.path}`
|
|
69
|
-
end
|
|
70
|
-
end
|
|
71
|
-
|
|
72
|
-
code = []
|
|
73
|
-
|
|
74
|
-
typedefs.each_line do |type|
|
|
75
|
-
# We only care about single line typedef
|
|
76
|
-
next unless type =~ /typedef/
|
|
77
|
-
# Ignore unions or structs
|
|
78
|
-
next if type =~ /union|struct/
|
|
79
|
-
|
|
80
|
-
# strip off the starting typedef and ending ;
|
|
81
|
-
type.gsub!(/^(.*typedef\s*)/, "")
|
|
82
|
-
type.gsub!(/\s*;\s*$/, "")
|
|
83
|
-
|
|
84
|
-
parts = type.split(/\s+/)
|
|
85
|
-
def_type = parts.join(" ")
|
|
86
|
-
|
|
87
|
-
# GCC does mapping with __attribute__ stuf, also see
|
|
88
|
-
# http://hal.cs.berkeley.edu/cil/cil016.html section 16.2.7. Problem
|
|
89
|
-
# with this is that the __attribute__ stuff can either occur before or
|
|
90
|
-
# after the new type that is defined...
|
|
91
|
-
if type =~ /__attribute__/
|
|
92
|
-
if parts.last =~ /__QI__|__HI__|__SI__|__DI__|__word__/
|
|
93
|
-
|
|
94
|
-
# In this case, the new type is BEFORE __attribute__ we need to
|
|
95
|
-
# find the final_type as the type before the part that starts with
|
|
96
|
-
# __attribute__
|
|
97
|
-
final_type = ""
|
|
98
|
-
parts.each do |p|
|
|
99
|
-
break if p =~ /__attribute__/
|
|
100
|
-
final_type = p
|
|
101
|
-
end
|
|
102
|
-
else
|
|
103
|
-
final_type = parts.pop
|
|
104
|
-
end
|
|
105
|
-
|
|
106
|
-
def_type = case type
|
|
107
|
-
when /__QI__/ then "char"
|
|
108
|
-
when /__HI__/ then "short"
|
|
109
|
-
when /__SI__/ then "int"
|
|
110
|
-
when /__DI__/ then "long long"
|
|
111
|
-
when /__word__/ then "long"
|
|
112
|
-
else "int"
|
|
113
|
-
end
|
|
114
|
-
|
|
115
|
-
def_type = "unsigned #{def_type}" if type =~ /unsigned/
|
|
116
|
-
else
|
|
117
|
-
final_type = parts.pop
|
|
118
|
-
def_type = parts.join(" ")
|
|
119
|
-
end
|
|
120
|
-
|
|
121
|
-
if type = TYPE_MAP[def_type]
|
|
122
|
-
code << "rbx.platform.typedef.#{final_type} = #{type}"
|
|
123
|
-
TYPE_MAP[final_type] = TYPE_MAP[def_type]
|
|
124
|
-
else
|
|
125
|
-
# Fallback to an ordinary pointer if we don't know the type
|
|
126
|
-
if def_type =~ /\*/
|
|
127
|
-
code << "rbx.platform.typedef.#{final_type} = pointer"
|
|
128
|
-
TYPE_MAP[final_type] = :pointer
|
|
129
|
-
end
|
|
130
|
-
end
|
|
131
|
-
end
|
|
132
|
-
|
|
133
|
-
code.sort.join("\n")
|
|
134
|
-
end
|
|
135
|
-
end
|
|
136
|
-
end
|
|
137
|
-
|
data/rakelib/ffi_gem_helper.rb
DELETED
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
require 'bundler'
|
|
2
|
-
require 'bundler/gem_helper'
|
|
3
|
-
|
|
4
|
-
class FfiGemHelper < Bundler::GemHelper
|
|
5
|
-
attr_accessor :cross_platforms
|
|
6
|
-
|
|
7
|
-
def install
|
|
8
|
-
super
|
|
9
|
-
|
|
10
|
-
task "release:guard_clean" => ["release:update_history"]
|
|
11
|
-
|
|
12
|
-
task "release:update_history" do
|
|
13
|
-
update_history
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
task "release:rubygem_push" => ["gem:native", "gem:java"]
|
|
17
|
-
end
|
|
18
|
-
|
|
19
|
-
def hfile
|
|
20
|
-
"CHANGELOG.md"
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
def headline
|
|
24
|
-
'([^\w]*)(\d+\.\d+\.\d+(?:\.\w+)?)([^\w]+)([2Y][0Y][0-9Y][0-9Y]-[0-1M][0-9M]-[0-3D][0-9D])([^\w]*|$)'
|
|
25
|
-
end
|
|
26
|
-
|
|
27
|
-
def reldate
|
|
28
|
-
Time.now.strftime("%Y-%m-%d")
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
def update_history
|
|
32
|
-
hin = File.read(hfile)
|
|
33
|
-
hout = hin.sub(/#{headline}/) do
|
|
34
|
-
raise "#{hfile} isn't up-to-date for version #{version}" unless $2==version.to_s
|
|
35
|
-
$1 + $2 + $3 + reldate + $5
|
|
36
|
-
end
|
|
37
|
-
if hout != hin
|
|
38
|
-
Bundler.ui.confirm "Updating #{hfile} for release."
|
|
39
|
-
File.write(hfile, hout)
|
|
40
|
-
Rake::FileUtilsExt.sh "git", "commit", hfile, "-m", "Update release date in #{hfile}"
|
|
41
|
-
end
|
|
42
|
-
end
|
|
43
|
-
|
|
44
|
-
def tag_version
|
|
45
|
-
Bundler.ui.confirm "Tag release with annotation:"
|
|
46
|
-
m = File.read(hfile).match(/(?<annotation>#{headline}.*?)#{headline}/m) || raise("Unable to find release notes in #{hfile}")
|
|
47
|
-
Bundler.ui.info(m[:annotation].gsub(/^/, " "))
|
|
48
|
-
IO.popen(["git", "tag", "--file=-", version_tag], "w") do |fd|
|
|
49
|
-
fd.write m[:annotation]
|
|
50
|
-
end
|
|
51
|
-
yield if block_given?
|
|
52
|
-
rescue
|
|
53
|
-
Bundler.ui.error "Untagging #{version_tag} due to error."
|
|
54
|
-
sh_with_code "git tag -d #{version_tag}"
|
|
55
|
-
raise
|
|
56
|
-
end
|
|
57
|
-
|
|
58
|
-
def rubygem_push(path)
|
|
59
|
-
cross_platforms.each do |ruby_platform|
|
|
60
|
-
super(path.gsub(/\.gem\z/, "-#{ruby_platform}.gem"))
|
|
61
|
-
end
|
|
62
|
-
super(path.gsub(/\.gem\z/, "-java.gem"))
|
|
63
|
-
super(path)
|
|
64
|
-
end
|
|
65
|
-
end
|