ffi 1.10.0-java → 1.11.0-java
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +21 -0
- data/README.md +20 -17
- data/Rakefile +10 -83
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 53cb37b116a115c656991318196df9fa94fb4ea92dc25a869c21bb5eca449626
|
4
|
+
data.tar.gz: cd66bf2677b4090a9944e09f5998c3842ef39e21be0bf66c9eb28d489dafedf3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 36bd6efdbefc05eb9a13553c9257716c7efb81ce809f582b81f82972211e77899cf8954a532daab8d0f2b41938a8a6bba290d59e0cbccb924e2ec93a54898605
|
7
|
+
data.tar.gz: 54a107b39d0bd4e9d2b3bfcebf7768b1416a894ef4e667f762b86bbf740fb7ae0f35729c901bb49dc2b50c3e466a06c9b00ab0bd85a67ba0d1750df48b708405
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,24 @@
|
|
1
|
+
1.11.0 / 2019-05-17
|
2
|
+
-------------------
|
3
|
+
|
4
|
+
Added:
|
5
|
+
* Add proper documentation to FFI::Generator and ::Task
|
6
|
+
* Add gemspec metadata. #696, #698
|
7
|
+
|
8
|
+
Changed:
|
9
|
+
* Add ability to disable or force system libffi. #669
|
10
|
+
Use like `gem inst ffi -- --enable-system-libffi` .
|
11
|
+
* Move FFI::Platform::CPU from C to Ruby. #663
|
12
|
+
* Fix stdcall on Win32. #649, #669
|
13
|
+
* Move FFI::StructByReference to Ruby. #681
|
14
|
+
* Fix FFI::Pointer#read_string(0) to return a binary String. #692
|
15
|
+
* Fix load paths for FFI::Generator::Task
|
16
|
+
|
17
|
+
Removed:
|
18
|
+
* Remove ruby-1.8 and 1.9 compatibility code. #683
|
19
|
+
* Remove unused spec files. #684
|
20
|
+
|
21
|
+
|
1
22
|
1.10.0 / 2019-01-06
|
2
23
|
-------------------
|
3
24
|
|
data/README.md
CHANGED
@@ -1,19 +1,19 @@
|
|
1
|
-
#
|
1
|
+
# Ruby-FFI https://github.com/ffi/ffi/wiki [![Build Status](https://travis-ci.org/ffi/ffi.svg?branch=master)](https://travis-ci.org/ffi/ffi) [![Build status Windows](https://ci.appveyor.com/api/projects/status/r8wxn1sd4s794gg1/branch/master?svg=true)](https://ci.appveyor.com/project/larskanis/ffi-aofqa/branch/master)
|
2
2
|
|
3
3
|
## Description
|
4
4
|
|
5
|
-
Ruby-FFI is a
|
5
|
+
Ruby-FFI is a gem for programmatically loading dynamically-linked native
|
6
6
|
libraries, binding functions within them, and calling those functions
|
7
7
|
from Ruby code. Moreover, a Ruby-FFI extension works without changes
|
8
|
-
on
|
9
|
-
using Ruby-FFI](https://
|
8
|
+
on CRuby (MRI), JRuby, Rubinius and TruffleRuby. [Discover why you should write your next extension
|
9
|
+
using Ruby-FFI](https://github.com/ffi/ffi/wiki/why-use-ffi).
|
10
10
|
|
11
|
-
## Features
|
11
|
+
## Features
|
12
12
|
|
13
13
|
* Intuitive DSL
|
14
14
|
* Supports all C native types
|
15
15
|
* C structs (also nested), enums and global variables
|
16
|
-
* Callbacks from C to
|
16
|
+
* Callbacks from C to Ruby
|
17
17
|
* Automatic garbage collection of native memory
|
18
18
|
|
19
19
|
## Synopsis
|
@@ -30,20 +30,23 @@ end
|
|
30
30
|
MyLib.puts 'Hello, World using libc!'
|
31
31
|
```
|
32
32
|
|
33
|
-
For less minimalistic and more
|
33
|
+
For less minimalistic and more examples you may look at:
|
34
34
|
|
35
|
-
* the samples
|
36
|
-
* the examples on the [wiki](https://
|
37
|
-
* the projects using FFI listed on
|
35
|
+
* the `samples/` folder
|
36
|
+
* the examples on the [wiki](https://github.com/ffi/ffi/wiki)
|
37
|
+
* the projects using FFI listed on the wiki: https://github.com/ffi/ffi/wiki/projects-using-ffi
|
38
38
|
|
39
39
|
## Requirements
|
40
40
|
|
41
|
-
|
42
|
-
|
43
|
-
*
|
44
|
-
* libffi development library - this is commonly in the libffi-dev or libffi-devel
|
41
|
+
When installing the gem on CRuby (MRI) or Rubinius, you will need:
|
42
|
+
* A C compiler (e.g., Xcode on macOS, `gcc` or `clang` on everything else)
|
43
|
+
* The `libffi` library and development headers - this is commonly in the `libffi-dev` or `libffi-devel` packages
|
45
44
|
|
46
|
-
On Linux systems running with [PaX](https://en.wikipedia.org/wiki/PaX) (Gentoo, Alpine, etc.) FFI may trigger `mprotect` errors. You may need to disable [mprotect](https://en.wikibooks.org/wiki/Grsecurity/Appendix/Grsecurity_and_PaX_Configuration_Options#Restrict_mprotect.28.29) for ruby (`paxctl -m [/path/to/ruby]`) for the time being until a solution is found.
|
45
|
+
On Linux systems running with [PaX](https://en.wikipedia.org/wiki/PaX) (Gentoo, Alpine, etc.), FFI may trigger `mprotect` errors. You may need to disable [mprotect](https://en.wikibooks.org/wiki/Grsecurity/Appendix/Grsecurity_and_PaX_Configuration_Options#Restrict_mprotect.28.29) for ruby (`paxctl -m [/path/to/ruby]`) for the time being until a solution is found.
|
46
|
+
|
47
|
+
On FreeBSD systems pkgconf must be installed for the gem to be able to compile using clang. Install either via packages `pkg install pkgconf` or from ports via `devel/pkgconf`.
|
48
|
+
|
49
|
+
On JRuby and TruffleRuby, there are no requirements to install the FFI gem, and `require 'ffi'` works even without installing the gem (i.e., the gem is preinstalled on these implementations).
|
47
50
|
|
48
51
|
## Installation
|
49
52
|
|
@@ -61,8 +64,7 @@ or from the git repository on github:
|
|
61
64
|
## License
|
62
65
|
|
63
66
|
The ffi library is covered by the BSD license, also see the LICENSE file.
|
64
|
-
The specs are
|
65
|
-
as Rubyspec, see the LICENSE.SPECS file.
|
67
|
+
The specs are covered by the same license as [ruby/spec](https://github.com/ruby/spec), the MIT license.
|
66
68
|
|
67
69
|
## Credits
|
68
70
|
|
@@ -74,6 +76,7 @@ The following people have submitted code, bug reports, or otherwise contributed
|
|
74
76
|
* Andreas Niederl <rico32@gmx.net>
|
75
77
|
* Andrew Cholakian <andrew@andrewvc.com>
|
76
78
|
* Antonio Terceiro <terceiro@softwarelivre.org>
|
79
|
+
* Benoit Daloze <eregontp@gmail.com>
|
77
80
|
* Brian Candler <B.Candler@pobox.com>
|
78
81
|
* Brian D. Burns <burns180@gmail.com>
|
79
82
|
* Bryan Kearney <bkearney@redhat.com>
|
data/Rakefile
CHANGED
@@ -3,82 +3,16 @@ require 'rbconfig'
|
|
3
3
|
require 'rake/clean'
|
4
4
|
require File.expand_path("./lib/ffi/version")
|
5
5
|
|
6
|
-
USE_RAKE_COMPILER = (RUBY_PLATFORM =~ /java/) ? false : true
|
7
|
-
if USE_RAKE_COMPILER
|
8
|
-
require 'rake/extensiontask'
|
9
|
-
end
|
10
|
-
|
11
6
|
require 'date'
|
12
7
|
require 'fileutils'
|
13
8
|
require 'rbconfig'
|
14
9
|
require 'rspec/core/rake_task'
|
15
10
|
require 'rubygems/package_task'
|
16
11
|
|
17
|
-
|
18
|
-
|
19
|
-
"dylib"
|
20
|
-
when /mswin|mingw/
|
21
|
-
"dll"
|
22
|
-
else
|
23
|
-
RbConfig::CONFIG['DLEXT']
|
24
|
-
end
|
25
|
-
|
26
|
-
CPU = case RbConfig::CONFIG['host_cpu'].downcase
|
27
|
-
when /i[3456]86/
|
28
|
-
# Darwin always reports i686, even when running in 64bit mode
|
29
|
-
if RbConfig::CONFIG['host_os'] =~ /darwin/ && 0xfee1deadbeef.is_a?(Fixnum)
|
30
|
-
"x86_64"
|
31
|
-
else
|
32
|
-
"i386"
|
33
|
-
end
|
34
|
-
|
35
|
-
when /amd64|x86_64/
|
36
|
-
"x86_64"
|
37
|
-
|
38
|
-
when /ppc64|powerpc64/
|
39
|
-
"powerpc64"
|
40
|
-
|
41
|
-
when /ppc|powerpc/
|
42
|
-
"powerpc"
|
43
|
-
|
44
|
-
when /^arm/
|
45
|
-
"arm"
|
46
|
-
|
47
|
-
else
|
48
|
-
RbConfig::CONFIG['host_cpu']
|
49
|
-
end
|
50
|
-
|
51
|
-
OS = case RbConfig::CONFIG['host_os'].downcase
|
52
|
-
when /linux/
|
53
|
-
"linux"
|
54
|
-
when /darwin/
|
55
|
-
"darwin"
|
56
|
-
when /freebsd/
|
57
|
-
"freebsd"
|
58
|
-
when /openbsd/
|
59
|
-
"openbsd"
|
60
|
-
when /sunos|solaris/
|
61
|
-
"solaris"
|
62
|
-
when /mswin|mingw/
|
63
|
-
"win32"
|
64
|
-
else
|
65
|
-
RbConfig::CONFIG['host_os'].downcase
|
66
|
-
end
|
67
|
-
|
68
|
-
def which(name)
|
69
|
-
exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']
|
70
|
-
ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|
|
71
|
-
exts.each do |ext|
|
72
|
-
app = File.join(path, name+ext)
|
73
|
-
return app if File.executable? app
|
74
|
-
end
|
75
|
-
end
|
76
|
-
nil
|
12
|
+
def java?
|
13
|
+
/java/ === RUBY_PLATFORM
|
77
14
|
end
|
78
15
|
|
79
|
-
GMAKE = which('gmake').nil? ? 'make' : 'gmake'
|
80
|
-
|
81
|
-
LIBTEST = "build/libtest.#{LIBEXT}"
|
82
16
|
BUILD_DIR = "build"
|
83
17
|
BUILD_EXT_DIR = File.join(BUILD_DIR, "#{RbConfig::CONFIG['arch']}", 'ffi_c', RUBY_VERSION)
|
84
18
|
|
@@ -86,7 +20,7 @@ def gem_spec
|
|
86
20
|
@gem_spec ||= Gem::Specification.load('ffi.gemspec')
|
87
21
|
end
|
88
22
|
|
89
|
-
TEST_DEPS = [
|
23
|
+
TEST_DEPS = []
|
90
24
|
if RUBY_PLATFORM == "java"
|
91
25
|
RSpec::Core::RakeTask.new(:spec) do |config|
|
92
26
|
config.rspec_opts = YAML.load_file 'spec/spec.opts'
|
@@ -110,30 +44,22 @@ CLEAN.include 'build'
|
|
110
44
|
CLEAN.include 'conftest.dSYM'
|
111
45
|
CLEAN.include 'spec/ffi/fixtures/libtest.{dylib,so,dll}'
|
112
46
|
CLEAN.include 'spec/ffi/fixtures/*.o'
|
47
|
+
CLEAN.include 'spec/ffi/embed-test/ext/*.{o,def}'
|
48
|
+
CLEAN.include 'spec/ffi/embed-test/ext/Makefile'
|
113
49
|
CLEAN.include "pkg/ffi-*-{mingw32,java}"
|
114
50
|
CLEAN.include 'lib/1.*'
|
115
51
|
CLEAN.include 'lib/2.*'
|
116
|
-
CLEAN.include 'bin'
|
117
52
|
|
118
53
|
task :distclean => :clobber
|
119
54
|
|
120
|
-
desc "Build the native test lib"
|
121
|
-
file "build/libtest.#{LIBEXT}" => FileList['libtest/**/*.[ch]'] do
|
122
|
-
sh %{#{GMAKE} -f libtest/GNUmakefile CPU=#{CPU} OS=#{OS} }
|
123
|
-
end
|
124
|
-
|
125
|
-
|
126
|
-
desc "Build test helper lib"
|
127
|
-
task :libtest => "build/libtest.#{LIBEXT}"
|
128
|
-
|
129
55
|
desc "Test the extension"
|
130
56
|
task :test => [ :spec ]
|
131
57
|
|
132
58
|
|
133
59
|
namespace :bench do
|
134
60
|
ITER = ENV['ITER'] ? ENV['ITER'].to_i : 100000
|
135
|
-
bench_libs = "-Ilib
|
136
|
-
bench_files = Dir["bench/bench_*.rb"].reject { |f| f == "bench_helper.rb" }
|
61
|
+
bench_libs = "-Ilib" unless RUBY_PLATFORM == "java"
|
62
|
+
bench_files = Dir["bench/bench_*.rb"].reject { |f| f == "bench/bench_helper.rb" }
|
137
63
|
bench_files.each do |bench|
|
138
64
|
task File.basename(bench, ".rb")[6..-1] => TEST_DEPS do
|
139
65
|
sh %{#{Gem.ruby} #{bench_libs} #{bench} #{ITER}}
|
@@ -175,8 +101,8 @@ end
|
|
175
101
|
|
176
102
|
task 'gem:java' => 'java:gem'
|
177
103
|
|
178
|
-
|
179
|
-
|
104
|
+
unless java?
|
105
|
+
require 'rake/extensiontask'
|
180
106
|
Rake::ExtensionTask.new('ffi_c', gem_spec) do |ext|
|
181
107
|
ext.name = 'ffi_c' # indicate the name of the extension.
|
182
108
|
# ext.lib_dir = BUILD_DIR # put binaries into this folder.
|
@@ -212,6 +138,7 @@ file "ext/ffi_c/libffi/autogen.sh" => "ext/ffi_c/libffi" do
|
|
212
138
|
warn "Downloading libffi ..."
|
213
139
|
sh "git submodule update --init --recursive"
|
214
140
|
end
|
141
|
+
task :libffi => "ext/ffi_c/libffi/autogen.sh"
|
215
142
|
|
216
143
|
LIBFFI_GIT_FILES = `git --git-dir ext/ffi_c/libffi/.git ls-files -z`.split("\x0")
|
217
144
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ffi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.11.0
|
5
5
|
platform: java
|
6
6
|
authors:
|
7
7
|
- Wayne Meissner
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-05-17 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Ruby FFI library
|
14
14
|
email: wmeissner@gmail.com
|
@@ -40,7 +40,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
40
40
|
- !ruby/object:Gem::Version
|
41
41
|
version: '0'
|
42
42
|
requirements: []
|
43
|
-
rubygems_version: 3.0.
|
43
|
+
rubygems_version: 3.0.3
|
44
44
|
signing_key:
|
45
45
|
specification_version: 4
|
46
46
|
summary: Ruby FFI
|