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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7478a6ca7d9844364e8f2f4eab4ccd0c4fa0e5f8faa18079e5f69b2112a7d62c
4
- data.tar.gz: 4a2636e7e4e1c524308d482c324386b515c6c84f5d6495f40bd96e5f9dd36aa2
3
+ metadata.gz: 04b1fd43d494fe843d181656a69cdad812ceac3ae747b7b11a572200efd433f1
4
+ data.tar.gz: 67284fbe786486e12a7e4d6b19198bc00b399cf6877ff27c3e8ad13e285c2035
5
5
  SHA512:
6
- metadata.gz: 4ea2a2a6ca08fde681e33f5fad9a2154f5e8191128ea69cab2313100fa2e445396494e896c7ba507b372840d3b873e0850e4fa590893b2128dccfe1d7571c49b
7
- data.tar.gz: b691234fd30347f6bb6366943835351c29f4d74cf33edbb5f10db5f4c4d89fb568949953433ff31baea9818b2abd9445092e4c341ebae732575623b8492808aa
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', '< 3'
7
- gem 'fiddle', platforms: %i[mri windows] # necessary on ruby-3.5+
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.9.0'
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 >= "2.6" && %w[ ruby truffleruby ].include?(RUBY_ENGINE)
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 --all"
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("~>2.5", "~>3.0")}
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 "lib/ffi/tools/types_generator"
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
@@ -0,0 +1,8 @@
1
+ target :lib do
2
+ signature "sig"
3
+
4
+ check "lib"
5
+
6
+ # ignore whole of lib, to just validate RBS in sig
7
+ ignore "lib"
8
+ end
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
- s.add_development_dependency 'rake', '~> 13.0'
39
- s.add_development_dependency 'rake-compiler', '~> 1.1'
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
@@ -89,6 +89,12 @@ module FFI
89
89
  self
90
90
  end
91
91
 
92
+ def dup
93
+ raise RuntimeError, "cannot duplicate FFI::AutoPointer"
94
+ end
95
+
96
+ alias clone dup
97
+
92
98
  # @return [nil]
93
99
  # Free the pointer.
94
100
  def free
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 <<-code, __FILE__, __LINE__
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 <<-code, __FILE__, __LINE__
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 methods or variables can be attached and no further enums or typedefs can be created in this module afterwards.
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
@@ -44,7 +44,7 @@ module FFI
44
44
  end
45
45
 
46
46
  # Always get {FFI::Type}::POINTER.
47
- def native_type
47
+ def native_type(_type = nil)
48
48
  FFI::Type::POINTER
49
49
  end
50
50
 
data/lib/ffi/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module FFI
2
- VERSION = '1.17.2'
2
+ VERSION = '1.17.3'
3
3
  end
@@ -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.take
19
+ end.value
@@ -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.take
34
+ end.value
27
35
 
28
36
  puts "After ractor termination #{p.get_array_of_int32(0, 3).join(', ')}"
@@ -12,7 +12,7 @@ module FFI
12
12
  def release: (Pointer ptr) -> void
13
13
  end
14
14
 
15
- def initialize: (Pointer pointer, Method | ^(self) -> void | Releaser::_Proc[self] callable) -> self
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,8 @@
1
+ module FFI
2
+ module LastError
3
+ def self?.error: () -> Integer
4
+ def self?.error=: (Integer) -> Integer
5
+ def self?.winapi_error: () -> Integer?
6
+ def self?.winapi_error=: (Integer? error) -> void
7
+ end
8
+ end
@@ -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, instance, untyped
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, instance, untyped
25
+ Pointer, ManagedStruct[AutoPointer, untyped], untyped
26
26
  ]
27
27
  def self.layout: (*layout | Integer) -> StructLayout
28
28
  | (Hash[Symbol, layout]) -> StructLayout
@@ -5,7 +5,7 @@ module FFI
5
5
 
6
6
  def initialize: (S struct_class) -> void
7
7
  def from_native: (P value, untyped ctx) -> S
8
- def native_type: () -> Type::Builtin
8
+ def native_type: (?ffi_auto_type? type) -> Type
9
9
  def to_native: (S? value, untyped ctx) -> P
10
10
  end
11
11
  end
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) -> nil
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.2
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
- MIIEBDCCAmygAwIBAgIBAzANBgkqhkiG9w0BAQsFADAoMSYwJAYDVQQDDB1sYXJz
13
- L0RDPWdyZWl6LXJlaW5zZG9yZi9EQz1kZTAeFw0yNDEyMjkxOTU2NTZaFw0yNTEy
14
- MjkxOTU2NTZaMCgxJjAkBgNVBAMMHWxhcnMvREM9Z3JlaXotcmVpbnNkb3JmL0RD
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
- 7EfMFzANBgkqhkiG9w0BAQsFAAOCAYEAoZZWzNV2XXaoSmvyamSSN+Wt/Ia+DNrU
26
- 2pc3kMEqykH6l1WiVPszr6HavQ//2I2UcSRSS5AGDdiSXcfyFmHtMBdtJHhTPcn7
27
- 4DLliB0szpvwG+ltGD8PI8eWkLaTQeFzs+0QCTavgKV+Zw56Q0J5zZvHHUMrLkUD
28
- qhwKjdTdkrRTn9Sqi0BrIRRZGTUDdrt8qoWm35aES5arKZzytgrRD/kXfFW2LCg0
29
- FzgTKibR4/3g8ph94kQLg/D2SMlVPkQ3ECi036mZxDC2n8V6u3rDkG5923wmrRZB
30
- J6cqz475Q8HYORQCB68OPzkWMfC7mBo3vpSsIqRoNs1FE4FJu4FGwZG8fBSrDC4H
31
- bZe+GtyS3e2SMjgT65zp35gLO9I7MquzYN9P6V2u1iBpTycchk5z9R1ghxzZSBT8
32
- DrkJ9tVlPQtJB0LqT0tvBap4upnwT1xYq721b5dwH6AF4Pi6iz/dc5vnq1/MH8bV
33
- 8VbbBzzeE7MsvgkP3sHlLmY8PtuyViJ8
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: 2025-04-15 00:00:00.000000000 Z
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: 3.6.2
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
-
@@ -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