ffi 1.12.2-java → 1.13.0-java

Sign up to get free protection for your applications and to get access to all the features.
Files changed (97) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +0 -0
  3. data.tar.gz.sig +3 -3
  4. data/.appveyor.yml +30 -0
  5. data/.github/workflows/ci.yml +64 -0
  6. data/.gitignore +25 -0
  7. data/.gitmodules +4 -0
  8. data/.travis.yml +58 -0
  9. data/.yardopts +5 -0
  10. data/CHANGELOG.md +30 -0
  11. data/Gemfile +17 -0
  12. data/LICENSE.SPECS +22 -0
  13. data/Rakefile +24 -43
  14. data/ffi.gemspec +43 -0
  15. data/lib/ffi.rb +28 -0
  16. data/lib/ffi/autopointer.rb +203 -0
  17. data/lib/ffi/buffer.rb +4 -0
  18. data/lib/ffi/callback.rb +4 -0
  19. data/lib/ffi/data_converter.rb +67 -0
  20. data/lib/ffi/enum.rb +296 -0
  21. data/lib/ffi/errno.rb +43 -0
  22. data/lib/ffi/ffi.rb +46 -0
  23. data/lib/ffi/io.rb +62 -0
  24. data/lib/ffi/library.rb +592 -0
  25. data/lib/ffi/managedstruct.rb +84 -0
  26. data/lib/ffi/memorypointer.rb +1 -0
  27. data/lib/ffi/platform.rb +175 -0
  28. data/lib/ffi/platform/aarch64-freebsd/types.conf +128 -0
  29. data/lib/ffi/platform/aarch64-freebsd12/types.conf +128 -0
  30. data/lib/ffi/platform/aarch64-linux/types.conf +104 -0
  31. data/lib/ffi/platform/arm-freebsd/types.conf +152 -0
  32. data/lib/ffi/platform/arm-freebsd12/types.conf +152 -0
  33. data/lib/ffi/platform/arm-linux/types.conf +132 -0
  34. data/lib/ffi/platform/i386-cygwin/types.conf +3 -0
  35. data/lib/ffi/platform/i386-darwin/types.conf +100 -0
  36. data/lib/ffi/platform/i386-freebsd/types.conf +152 -0
  37. data/lib/ffi/platform/i386-freebsd12/types.conf +152 -0
  38. data/lib/ffi/platform/i386-gnu/types.conf +107 -0
  39. data/lib/ffi/platform/i386-linux/types.conf +103 -0
  40. data/lib/ffi/platform/i386-netbsd/types.conf +126 -0
  41. data/lib/ffi/platform/i386-openbsd/types.conf +128 -0
  42. data/lib/ffi/platform/i386-solaris/types.conf +122 -0
  43. data/lib/ffi/platform/i386-windows/types.conf +52 -0
  44. data/lib/ffi/platform/ia64-linux/types.conf +104 -0
  45. data/lib/ffi/platform/mips-linux/types.conf +102 -0
  46. data/lib/ffi/platform/mips64-linux/types.conf +104 -0
  47. data/lib/ffi/platform/mips64el-linux/types.conf +104 -0
  48. data/lib/ffi/platform/mipsel-linux/types.conf +102 -0
  49. data/lib/ffi/platform/mipsisa32r6-linux/types.conf +102 -0
  50. data/lib/ffi/platform/mipsisa32r6el-linux/types.conf +102 -0
  51. data/lib/ffi/platform/mipsisa64r6-linux/types.conf +104 -0
  52. data/lib/ffi/platform/mipsisa64r6el-linux/types.conf +104 -0
  53. data/lib/ffi/platform/powerpc-aix/types.conf +180 -0
  54. data/lib/ffi/platform/powerpc-darwin/types.conf +100 -0
  55. data/lib/ffi/platform/powerpc-linux/types.conf +130 -0
  56. data/lib/ffi/platform/powerpc-openbsd/types.conf +156 -0
  57. data/lib/ffi/platform/powerpc64-linux/types.conf +104 -0
  58. data/lib/ffi/platform/s390-linux/types.conf +102 -0
  59. data/lib/ffi/platform/s390x-linux/types.conf +102 -0
  60. data/lib/ffi/platform/sparc-linux/types.conf +102 -0
  61. data/lib/ffi/platform/sparc-solaris/types.conf +128 -0
  62. data/lib/ffi/platform/sparc64-linux/types.conf +102 -0
  63. data/lib/ffi/platform/sparcv9-openbsd/types.conf +156 -0
  64. data/lib/ffi/platform/sparcv9-solaris/types.conf +128 -0
  65. data/lib/ffi/platform/x86_64-cygwin/types.conf +3 -0
  66. data/lib/ffi/platform/x86_64-darwin/types.conf +130 -0
  67. data/lib/ffi/platform/x86_64-dragonflybsd/types.conf +148 -0
  68. data/lib/ffi/platform/x86_64-freebsd/types.conf +128 -0
  69. data/lib/ffi/platform/x86_64-freebsd12/types.conf +158 -0
  70. data/lib/ffi/platform/x86_64-linux/types.conf +132 -0
  71. data/lib/ffi/platform/x86_64-netbsd/types.conf +128 -0
  72. data/lib/ffi/platform/x86_64-openbsd/types.conf +134 -0
  73. data/lib/ffi/platform/x86_64-solaris/types.conf +122 -0
  74. data/lib/ffi/platform/x86_64-windows/types.conf +52 -0
  75. data/lib/ffi/pointer.rb +167 -0
  76. data/lib/ffi/struct.rb +316 -0
  77. data/lib/ffi/struct_by_reference.rb +72 -0
  78. data/lib/ffi/struct_layout.rb +96 -0
  79. data/lib/ffi/struct_layout_builder.rb +227 -0
  80. data/lib/ffi/tools/const_generator.rb +230 -0
  81. data/lib/ffi/tools/generator.rb +105 -0
  82. data/lib/ffi/tools/generator_task.rb +32 -0
  83. data/lib/ffi/tools/struct_generator.rb +194 -0
  84. data/lib/ffi/tools/types_generator.rb +137 -0
  85. data/lib/ffi/types.rb +194 -0
  86. data/lib/ffi/union.rb +43 -0
  87. data/lib/ffi/variadic.rb +78 -0
  88. data/lib/ffi/version.rb +3 -0
  89. data/samples/getlogin.rb +8 -0
  90. data/samples/getpid.rb +8 -0
  91. data/samples/gettimeofday.rb +18 -0
  92. data/samples/hello.rb +8 -0
  93. data/samples/inotify.rb +60 -0
  94. data/samples/pty.rb +75 -0
  95. data/samples/qsort.rb +20 -0
  96. metadata +192 -24
  97. metadata.gz.sig +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d97c965128bc43869069bde8cb5f0484c0653d5413828d138616092292610906
4
- data.tar.gz: d0f9fd8a5d388d35d39a135fa27f6098c7b6fc1daec909c00cc1f5e81fd3c941
3
+ metadata.gz: ec8ecb80cae5f286604be6b88b490b62751f16d79a0d7599c3c4d64055499527
4
+ data.tar.gz: 2289c7a3973e96d5012adf74d001291760dc22099e5059aad3f56dd1fc07fc51
5
5
  SHA512:
6
- metadata.gz: cf9777eef5340b46d3cef2f411c8a3c79c1a16ba85a91b5db3d3c042aafa09b14a2fd41b76aace5950bcf3ec574ae220e227fbc951c61ab846758b14e4731c39
7
- data.tar.gz: 189feebb9b9b503af06c5e20801d2340c043e82aa7273bfe079e4f41ed62c436b8efb9e15ca61dfc2a698fcb9eec74d4893367c281d4a240ae32e7d95afedba9
6
+ metadata.gz: 79b30f43958c9b843683bdd422bd88550d4e7bab1b9db0788a94aec9a2123d0b4f4420e009268ad58e05d3074198abc2c761e5ba6395c289305147733f055f30
7
+ data.tar.gz: ce89998224c5d340d7deb7322ff1bfdec33b9fc2ead4672b23a25eb0cccc990d829ae83fb90c15a11af2ee3c3150463ef92a7493edc2c65ed8a46c0a31e1c005
Binary file
data.tar.gz.sig CHANGED
@@ -1,3 +1,3 @@
1
- uX����ɦ����a=^`�+ݹO���E֋@��:ή]@�+��Q��{���אĭQ;����F��?����m�
2
- ��!s��6�/Ӝ�`�WQ>
3
- }~Ȁn!�`/1�����x�nἇ*�N��7E������p��v��p\�`�
1
+ ����ǜ!2�&4�:�a�$;n�4�;@�m�Fj�~��C1c�]�R��8s%�7ny�M�\m���2e���B��&>(��v ��7�vs��L�ݙ��m�[�x
2
+ ���>��в�U�Q���\\g]؇I�1�!�{nȆ#��O�X��t��g����KL�!Ř�֥�1Pt�V��q���(�5en:�ǧ��a޼��{Z�&l�����/5���/�ݴ�GR"���s��}�\j��p^
3
+  �~z������ޙ�9
@@ -0,0 +1,30 @@
1
+ install:
2
+ - SET PATH=C:\Ruby%RUBYVER%\bin;%PATH%
3
+ - SET RAKEOPT=-rdevkit
4
+ - ps: |
5
+ if ($env:RUBYVER -like "*head*") {
6
+ $(new-object net.webclient).DownloadFile("https://github.com/oneclick/rubyinstaller2/releases/download/rubyinstaller-head/rubyinstaller-$env:RUBYVER.exe", "$pwd/ruby-setup.exe")
7
+ cmd /c ruby-setup.exe /verysilent /dir=C:/Ruby$env:RUBYVER
8
+ }
9
+ - ridk version
10
+ - gem --version
11
+ - gem install bundler --quiet --no-document
12
+ - bundle install
13
+ # Update to libffi-3.3 since Appveyor version fails on LongDouble specs
14
+ - ridk exec pacman --sync --refresh --needed --noconfirm mingw-w64-x86_64-libffi mingw-w64-i686-libffi
15
+ build: off
16
+ build_script:
17
+ - bundle exec rake libffi compile -- %EXTCONFOPTS% || bundle exec rake compile -- %EXTCONFOPTS%
18
+ test_script:
19
+ - bundle exec rake test
20
+ - bundle exec rake types_conf && git --no-pager diff
21
+ environment:
22
+ matrix:
23
+ - RUBYVER: "head-x64"
24
+ EXTCONFOPTS: "--disable-system-libffi"
25
+ - RUBYVER: 24
26
+ EXTCONFOPTS: "--disable-system-libffi"
27
+ - RUBYVER: 25-x64
28
+ EXTCONFOPTS: "--enable-system-libffi"
29
+ - RUBYVER: 26
30
+ EXTCONFOPTS: "--enable-system-libffi"
@@ -0,0 +1,64 @@
1
+ name: CI
2
+ on: [push, pull_request]
3
+ jobs:
4
+ system-libffi:
5
+ # Run on latest MRI with explicit selection of system or builtin libffi
6
+ strategy:
7
+ fail-fast: false
8
+ matrix:
9
+ os: [ ubuntu, macos, windows ]
10
+ extconfopts: [ --disable-system-libffi, --enable-system-libffi ]
11
+ runs-on: ${{ matrix.os }}-latest
12
+ steps:
13
+ - uses: actions/checkout@v2
14
+ - uses: ruby/setup-ruby@v1
15
+ with:
16
+ ruby-version: 2.7
17
+
18
+ - run: brew install automake libffi pkg-config
19
+ if: matrix.os == 'macos'
20
+ - run: ridk exec pacman --sync --refresh --needed --noconfirm mingw-w64-x86_64-libffi
21
+ if: matrix.os == 'windows' && matrix.extconfopts == '--enable-system-libffi'
22
+
23
+ - run: bundle install
24
+ - run: bundle exec rake libffi
25
+ - run: bundle exec rake compile -- ${{ matrix.extconfopts }}
26
+ env:
27
+ # work around misconfiguration of libffi on MacOS with homebrew
28
+ PKG_CONFIG_PATH: ${{ env.PKG_CONFIG_PATH }}:/usr/local/opt/libffi/lib/pkgconfig
29
+ - run: bundle exec rake test
30
+ - run: bundle exec rake types_conf && git --no-pager diff
31
+
32
+ specs:
33
+ # Run all specs on all ruby implementations
34
+ # Use automatic libffi selection on MRI
35
+ strategy:
36
+ fail-fast: false
37
+ matrix:
38
+ os: [ ubuntu, macos, windows ]
39
+ ruby: [ 2.3, 2.4, 2.5, 2.6, 2.7, ruby-head, truffleruby-head ]
40
+ exclude:
41
+ - os: windows
42
+ ruby: truffleruby-head
43
+ - os: windows
44
+ ruby: 2.3 # compilation fails
45
+ runs-on: ${{ matrix.os }}-latest
46
+ steps:
47
+ - uses: actions/checkout@v2
48
+ - uses: ruby/setup-ruby@v1
49
+ with:
50
+ ruby-version: ${{ matrix.ruby }}
51
+
52
+ - run: brew install automake
53
+ if: matrix.os == 'macos'
54
+
55
+ - run: bundle install
56
+ - run: bundle exec rake libffi
57
+ - run: bundle exec rake compile
58
+
59
+ - run: bundle exec rake test
60
+
61
+ - run: bundle exec rake bench:all
62
+ if: matrix.ruby != 'truffleruby-head'
63
+ env:
64
+ ITER: 10
@@ -0,0 +1,25 @@
1
+ doc/
2
+ bin/
3
+ .yardoc
4
+ *.orig
5
+ nbproject/private
6
+ pkg
7
+ *.orig
8
+ *.rej
9
+ *.patch
10
+ *.diff
11
+ build
12
+ *.so
13
+ *.[oa]
14
+ core
15
+ lib/ffi/types.conf
16
+ lib/ffi_c.bundle
17
+ lib/ffi_c.so
18
+ vendor
19
+ .bundle
20
+ Gemfile.lock
21
+ types_log
22
+ *.gem
23
+ embed-test.log
24
+ spec/ffi/embed-test/ext/Makefile
25
+ spec/ffi/embed-test/ext/embed_test.bundle
@@ -0,0 +1,4 @@
1
+ [submodule "ext/ffi_c/libffi"]
2
+ path = ext/ffi_c/libffi
3
+ url = https://github.com/libffi/libffi.git
4
+ branch = master
@@ -0,0 +1,58 @@
1
+ dist: trusty
2
+ group: beta
3
+ language: ruby
4
+ git:
5
+ submodules: false
6
+
7
+ script:
8
+ - bundle exec rake libffi
9
+ - bundle exec rake compile
10
+ - bundle exec rake test
11
+ - |
12
+ if [[ $(ruby -v) != *truffleruby* ]]; then
13
+ ITER=10 bundle exec rake bench:all
14
+ fi
15
+ - bundle exec rake types_conf && git --no-pager diff
16
+ os:
17
+ - linux
18
+ - osx
19
+ rvm:
20
+ - 2.3.8
21
+ - 2.4.6
22
+ - 2.5.5
23
+ - 2.6.5
24
+ - 2.7.0
25
+ - ruby-head
26
+ - truffleruby-head
27
+
28
+ env:
29
+ - CC=gcc
30
+ - CC=clang
31
+ matrix:
32
+ allow_failures:
33
+ - os: osx
34
+ rvm: ruby-head
35
+ - os: osx
36
+ rvm: 2.3.8
37
+ - os: linux
38
+ rvm: ruby-head
39
+ include:
40
+ - name: powerpc
41
+ language: generic
42
+ before_install: |
43
+ docker run --rm --privileged multiarch/qemu-user-static:register --reset &&
44
+ docker build --rm -t ffi-powerpc -f spec/env/Dockerfile.powerpc .
45
+ script: |
46
+ docker run --rm -t -v `pwd`:/ffi ffi-powerpc
47
+ - name: armhf
48
+ language: generic
49
+ before_install: |
50
+ docker run --rm --privileged multiarch/qemu-user-static:register --reset &&
51
+ docker build --rm -t ffi-armhf -f spec/env/Dockerfile.armhf .
52
+ script: |
53
+ docker run --rm -t -v `pwd`:/ffi ffi-armhf
54
+ exclude:
55
+ - os: osx
56
+ rvm: truffleruby-head
57
+ after_failure:
58
+ - "find build -name mkmf.log | xargs cat"
@@ -0,0 +1,5 @@
1
+ --title "Ruby FFI"
2
+ --charset UTF-8
3
+ --private
4
+ lib/**/*.rb
5
+ ext/**/*.c
@@ -1,3 +1,33 @@
1
+ 1.13.0 / 2020-06-01
2
+ -------------------
3
+
4
+ Added:
5
+ * Add TruffleRuby support. Almost all specs are running on TruffleRuby and succeed. #768
6
+ * Add ruby source files to the java gem. This allows to ship the Ruby library code per platform java gem and add it as a default gem to JRuby. #763
7
+ * Add FFI::Platform::LONG_DOUBLE_SIZE
8
+ * Add bounds checks for writing to an inline char[] . #756
9
+ * Add long double as callback return value. #771
10
+ * Update type definitions and add types from stdint.h and stddef.h on i386-windows, x86_64-windows, x86_64-darwin, x86_64-linux, arm-linux, powerpc-linux. #749
11
+ * Add new type definitions for powerpc-openbsd and sparcv9-openbsd. #775, #778
12
+
13
+ Changed:
14
+ * Raise required ruby version to >= 2.3.
15
+ * Lots of cleanups and improvements in library, specs and benchmarks.
16
+ * Fix a lot of compiler warnings at the C-extension
17
+ * Fix several install issues on MacOS:
18
+ * Look for libffi in SDK paths, since recent versions of macOS removed it from `/usr/include` . #757
19
+ * Fix error `ld: library not found for -lgcc_s.10.4`
20
+ * Don't built for i386 architecture as it is deprecated
21
+ * Several fixes for MSVC build on Windows. #779
22
+ * Use `ucrtbase.dll` as default C library on Windows instead of old `msvcrt.dll`. #779
23
+ * Update builtin libffi to fix a Powerpc issue with parameters of type long
24
+ * Allow unmodified sourcing of (the ruby code of) this gem in JRuby and TruffleRuby as a default gem. #747
25
+ * Improve check to detect if a module has a #find_type method suitable for FFI. This fixes compatibility with stdlib `mkmf` . #776
26
+
27
+ Removed:
28
+ * Reject callback with `:string` return type at definition, because it didn't work so far and is not save to use. #751, #782
29
+
30
+
1
31
  1.12.2 / 2020-02-01
2
32
  -------------------
3
33
 
data/Gemfile ADDED
@@ -0,0 +1,17 @@
1
+ source 'https://rubygems.org'
2
+
3
+ group :development do
4
+ gem 'rake', '~> 13.0'
5
+ gem 'rake-compiler', '~> 1.0.3'
6
+ gem 'rake-compiler-dock', '~> 1.0'
7
+ gem 'rspec', '~> 3.0'
8
+ # irb is a dependency of rubygems-tasks 0.2.5.
9
+ # irb versions > 1.1.1 depend on reline,
10
+ # which sometimes causes 'bundle install' to fail on Ruby <= 2.4: https://github.com/rubygems/rubygems/issues/3463
11
+ gem 'rubygems-tasks', '>= 0.2', '< 0.2.5', :require => 'rubygems/tasks'
12
+ end
13
+
14
+ group :doc do
15
+ gem 'kramdown'
16
+ gem 'yard', '~> 0.9'
17
+ end
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2008-2012 Ruby-FFI contributors
2
+
3
+ Permission is hereby granted, free of charge, to any person
4
+ obtaining a copy of this software and associated documentation
5
+ files (the "Software"), to deal in the Software without
6
+ restriction, including without limitation the rights to use,
7
+ copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ copies of the Software, and to permit persons to whom the
9
+ Software is furnished to do so, subject to the following
10
+ conditions:
11
+
12
+ The above copyright notice and this permission notice shall be
13
+ included in all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
17
+ OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
19
+ HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
20
+ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22
+ OTHER DEALINGS IN THE SOFTWARE.
data/Rakefile CHANGED
@@ -1,7 +1,7 @@
1
1
  require 'rubygems/tasks'
2
2
  require 'rbconfig'
3
3
  require 'rake/clean'
4
- require File.expand_path("./lib/ffi/version")
4
+ require_relative "lib/ffi/version"
5
5
 
6
6
  require 'date'
7
7
  require 'fileutils'
@@ -9,10 +9,6 @@ require 'rbconfig'
9
9
  require 'rspec/core/rake_task'
10
10
  require 'rubygems/package_task'
11
11
 
12
- def java?
13
- /java/ === RUBY_PLATFORM
14
- end
15
-
16
12
  BUILD_DIR = "build"
17
13
  BUILD_EXT_DIR = File.join(BUILD_DIR, "#{RbConfig::CONFIG['arch']}", 'ffi_c', RUBY_VERSION)
18
14
 
@@ -20,17 +16,8 @@ def gem_spec
20
16
  @gem_spec ||= Gem::Specification.load('ffi.gemspec')
21
17
  end
22
18
 
23
- TEST_DEPS = []
24
- if RUBY_PLATFORM == "java"
25
- RSpec::Core::RakeTask.new(:spec) do |config|
26
- config.rspec_opts = YAML.load_file 'spec/spec.opts'
27
- end
28
- else
29
- RSpec::Core::RakeTask.new(:spec => :compile) do |config|
30
- config.rspec_opts = YAML.load_file 'spec/spec.opts'
31
- end
32
-
33
- TEST_DEPS.unshift :compile
19
+ RSpec::Core::RakeTask.new(:spec => :compile) do |config|
20
+ config.rspec_opts = YAML.load_file 'spec/spec.opts'
34
21
  end
35
22
 
36
23
  desc "Build all packages"
@@ -58,37 +45,29 @@ task :test => [ :spec ]
58
45
 
59
46
  namespace :bench do
60
47
  ITER = ENV['ITER'] ? ENV['ITER'].to_i : 100000
61
- bench_libs = "-Ilib" unless RUBY_PLATFORM == "java"
62
- bench_files = Dir["bench/bench_*.rb"].reject { |f| f == "bench/bench_helper.rb" }
48
+ bench_files = Dir["bench/bench_*.rb"].sort.reject { |f| f == "bench/bench_helper.rb" }
63
49
  bench_files.each do |bench|
64
- task File.basename(bench, ".rb")[6..-1] => TEST_DEPS do
65
- sh %{#{Gem.ruby} #{bench_libs} #{bench} #{ITER}}
50
+ task File.basename(bench, ".rb")[6..-1] => :compile do
51
+ sh %{#{Gem.ruby} #{bench} #{ITER}}
66
52
  end
67
53
  end
68
- task :all => TEST_DEPS do
54
+ task :all => :compile do
69
55
  bench_files.each do |bench|
70
- sh %{#{Gem.ruby} #{bench_libs} #{bench}}
56
+ sh %{#{Gem.ruby} #{bench}}
71
57
  end
72
58
  end
73
59
  end
74
60
 
75
- task 'spec:run' => TEST_DEPS
76
- task 'spec:specdoc' => TEST_DEPS
61
+ task 'spec:run' => :compile
62
+ task 'spec:specdoc' => :compile
77
63
 
78
64
  task :default => :spec
79
65
 
80
66
  namespace 'java' do
81
67
 
82
- java_gem_spec = Gem::Specification.new do |s|
83
- s.name = gem_spec.name
84
- s.version = gem_spec.version
85
- s.author = gem_spec.author
86
- s.email = gem_spec.email
87
- s.homepage = gem_spec.homepage
88
- s.summary = gem_spec.summary
89
- s.description = gem_spec.description
90
- s.files = %w(LICENSE COPYING README.md CHANGELOG.md Rakefile)
91
- s.license = gem_spec.license
68
+ java_gem_spec = gem_spec.dup.tap do |s|
69
+ s.files.reject! { |f| File.fnmatch?("ext/*", f) }
70
+ s.extensions = []
92
71
  s.platform = 'java'
93
72
  end
94
73
 
@@ -101,7 +80,7 @@ end
101
80
 
102
81
  task 'gem:java' => 'java:gem'
103
82
 
104
- unless java?
83
+ if RUBY_ENGINE == 'ruby' || RUBY_ENGINE == 'rbx'
105
84
  require 'rake/extensiontask'
106
85
  Rake::ExtensionTask.new('ffi_c', gem_spec) do |ext|
107
86
  ext.name = 'ffi_c' # indicate the name of the extension.
@@ -124,13 +103,17 @@ unless java?
124
103
  sh "x86_64-w64-mingw32-strip -S build/x64-mingw32/stage/lib/#{ruby_version[/^\d+\.\d+/]}/ffi_c.so"
125
104
  end
126
105
  end
106
+ else
107
+ task :compile do
108
+ STDERR.puts "Nothing to compile on #{RUBY_ENGINE}"
109
+ end
127
110
  end
128
111
 
129
112
  desc "build a windows gem without all the ceremony"
130
113
  task "gem:windows" do
131
114
  require "rake_compiler_dock"
132
115
  sh "bundle package"
133
- RakeCompilerDock.sh "sudo apt-get update && sudo apt-get install -y libltdl-dev && bundle --local && rake cross native gem MAKE='nice make -j`nproc`'"
116
+ RakeCompilerDock.sh "sudo apt-get update && sudo apt-get install -y libltdl-dev && bundle --local && rake cross native gem MAKE='nice make -j`nproc`' RUBY_CC_VERSION=${RUBY_CC_VERSION/:2.2.2/}"
134
117
  end
135
118
 
136
119
  directory "ext/ffi_c/libffi"
@@ -158,16 +141,15 @@ end.each do |f|
158
141
  end
159
142
  end
160
143
 
161
- $LOAD_PATH.unshift File.join(File.dirname(__FILE__), 'lib')
162
- require 'ffi/platform'
144
+ require_relative "lib/ffi/platform"
163
145
  types_conf = File.expand_path(File.join(FFI::Platform::CONF_DIR, 'types.conf'))
164
146
  logfile = File.join(File.dirname(__FILE__), 'types_log')
165
147
 
166
- file types_conf => File.join("lib", "ffi", "version.rb") do |task|
148
+ task types_conf do |task|
167
149
  require 'fileutils'
168
- require 'ffi/tools/types_generator'
150
+ require_relative "lib/ffi/tools/types_generator"
169
151
  options = {}
170
- FileUtils.mkdir_p(File.dirname(task.name), { :mode => 0755 })
152
+ FileUtils.mkdir_p(File.dirname(task.name), mode: 0755 )
171
153
  File.open(task.name, File::CREAT|File::TRUNC|File::RDWR, 0644) do |f|
172
154
  f.puts FFI::TypesGenerator.generate(options)
173
155
  end
@@ -177,8 +159,7 @@ file types_conf => File.join("lib", "ffi", "version.rb") do |task|
177
159
  end
178
160
 
179
161
  desc "Create or update type information for platform #{FFI::Platform::NAME}"
180
- task :types_conf => types_conf do
181
- end
162
+ task :types_conf => types_conf
182
163
 
183
164
  Gem::Tasks.new do |t|
184
165
  t.scm.tag.format = '%s'
@@ -0,0 +1,43 @@
1
+ require File.expand_path("../lib/#{File.basename(__FILE__, '.gemspec')}/version", __FILE__)
2
+
3
+ Gem::Specification.new do |s|
4
+ s.name = 'ffi'
5
+ s.version = FFI::VERSION
6
+ s.author = 'Wayne Meissner'
7
+ s.email = 'wmeissner@gmail.com'
8
+ s.homepage = 'https://github.com/ffi/ffi/wiki'
9
+ s.summary = 'Ruby FFI'
10
+ s.description = 'Ruby FFI library'
11
+ if s.respond_to?(:metadata)
12
+ s.metadata['bug_tracker_uri'] = 'https://github.com/ffi/ffi/issues'
13
+ s.metadata['changelog_uri'] = 'https://github.com/ffi/ffi/blob/master/CHANGELOG.md'
14
+ s.metadata['documentation_uri'] = 'https://github.com/ffi/ffi/wiki'
15
+ s.metadata['wiki_uri'] = 'https://github.com/ffi/ffi/wiki'
16
+ s.metadata['source_code_uri'] = 'https://github.com/ffi/ffi/'
17
+ s.metadata['mailing_list_uri'] = 'http://groups.google.com/group/ruby-ffi'
18
+ end
19
+ s.files = `git ls-files -z`.split("\x0").reject do |f|
20
+ f =~ /^(bench|gen|libtest|nbproject|spec)/
21
+ end
22
+
23
+ # Add libffi git files
24
+ lfs = `git --git-dir ext/ffi_c/libffi/.git ls-files -z`.split("\x0")
25
+ # Add autoconf generated files of libffi
26
+ lfs += %w[ configure config.guess config.sub install-sh ltmain.sh missing fficonfig.h.in ]
27
+ # Add automake generated files of libffi
28
+ lfs += `git --git-dir ext/ffi_c/libffi/.git ls-files -z *.am */*.am`.gsub(".am\0", ".in\0").split("\x0")
29
+ s.files += lfs.map do |f|
30
+ File.join("ext/ffi_c/libffi", f)
31
+ end
32
+
33
+ s.extensions << 'ext/ffi_c/extconf.rb'
34
+ s.rdoc_options = %w[--exclude=ext/ffi_c/.*\.o$ --exclude=ffi_c\.(bundle|so)$]
35
+ s.license = 'BSD-3-Clause'
36
+ s.require_paths << 'ext/ffi_c'
37
+ s.required_ruby_version = '>= 2.3'
38
+ s.add_development_dependency 'rake', '~> 13.0'
39
+ s.add_development_dependency 'rake-compiler', '~> 1.0'
40
+ s.add_development_dependency 'rake-compiler-dock', '~> 1.0'
41
+ s.add_development_dependency 'rspec', '~> 2.14.1'
42
+ s.add_development_dependency 'rubygems-tasks', "~> 0.2.4"
43
+ end