Commit graph

315 commits

Author SHA1 Message Date
Sutou Kouhei
ae7b53546c [ruby/fiddle] Add TYPE_CONST_STRING and SIZEOF_CONST_STRING for "const char *"
Add rb_fiddle_ prefix to conversion functions.h to keep backward
compatibility but value_to_generic() isn't safe for TYPE_CONST_STRING
and not String src. Use rb_fiddle_value_to_generic() instead.

0ffcaa39e5
2020-11-18 09:05:13 +09:00
卜部昌平
490010084e sed -i '/rmodule.h/d' 2020-08-27 16:42:06 +09:00
卜部昌平
756403d775 sed -i '/r_cast.h/d' 2020-08-27 15:03:36 +09:00
卜部昌平
0da2a3f1fc sed -i '\,2/extern.h,d' 2020-08-27 14:07:49 +09:00
Hiroshi SHIBATA
8fb02b7a97
Update the license for the default gems to dual licenses 2020-08-18 20:26:39 +09:00
Nobuyoshi Nakada
48fb6299c6
[ruby/fiddle] support for very old libffi
Define `Fiddle::TYPE_VARIADIC` only when `ffi_prep_cif_var` is
available, otherwise skip the test for it.
2020-06-28 10:40:31 +09:00
Nobuyoshi Nakada
c405a8d37a
[ruby/fiddle] try bundled libffi by default
If no installed libffi found, use bundled libffi unless explicitly
`--disable-bundled-libffi` option is given.
2020-06-28 01:03:21 +09:00
Sutou Kouhei
f2bcdc7283
[ruby/fiddle] Support MSWIN (#43)
f16e7ff6e0
2020-06-27 23:54:09 +09:00
Sutou Kouhei
6429b6d973
[ruby/fiddle] Add missing include
4ca61efcd7
2020-06-27 23:54:08 +09:00
Sutou Kouhei
ae18220f99
[ruby/fiddle] Add support for variadic arguments
GitHub: fix GH-39

Reported by kojix2. Thanks!!!

6c4cb904dc
2020-06-27 23:54:08 +09:00
Sutou Kouhei
9f740acaf9
[ruby/fiddle] Use meaningful variable name
2cac24b7c8
2020-06-27 23:54:08 +09:00
Sutou Kouhei
50fbd00e76
[ruby/fiddle] Use "do { } while (0)" to ensure requiring ";"
2155ae5979
2020-06-27 23:54:08 +09:00
Nobuyoshi Nakada
4949df498a
[ruby/fiddle] Fixed typos
a09e66adf4
6cab9b45d6
ab72b19bed
2020-06-26 17:05:27 +09:00
Nobuyoshi Nakada
6dbc3a2871
autoconf may not be available 2020-05-27 23:46:55 +09:00
Nobuyoshi Nakada
135c6a4b99
fiddle: need to update configure after updating config tools 2020-05-27 00:30:59 +09:00
Nobuyoshi Nakada
5917fe2303
_GNU_SOURCE is needed for mkostemp on Cygwin 2020-05-26 19:17:47 +09:00
Yusuke Endoh
f27e0d90c8 ext/fiddle/fiddle.gemspec: avoid require lib/fiddle/version.rb
It loads `ext/fiddle/lib/fiddle/version.rb`, which causes constant
redefinition warning:

20200523T153003Z.log.html.gz
```
[ 6317/20193] TestDefaultGems#test_validate_gemspec/home/chkbuild/chkbuild/tmp/build/20200523T153003Z/ruby/ext/fiddle/lib/fiddle/version.rb:2: warning: already initialized constant Fiddle::VERSION
/home/chkbuild/chkbuild/tmp/build/20200523T153003Z/ruby/.ext/common/fiddle/version.rb:2: warning: previous definition of VERSION was here
 = 0.16 s
```

This changeset read the version by manual parsing hack which is also
used in stringio and zlib.
2020-05-24 04:01:20 +09:00
Chris Seaton
3015a7aae7 [ruby/fiddle] Improve documentation on how to correctly free memory and free memory in tests (#33)
e59cfd708a
2020-05-23 14:34:07 +09:00
Sutou Kouhei
24b615e82e [ruby/fiddle] Export Fiddle::VERSION
1b93a2d9db
2020-05-23 14:29:16 +09:00
Sutou Kouhei
74a4558c14 [ruby/fiddle] Update file list
b04cb92d7b
2020-05-23 14:29:16 +09:00
Sutou Kouhei
d5c0018a9a [ruby/fiddle] Fix a typo
445ca6b501
2020-05-23 14:29:16 +09:00
Sutou Kouhei
a0dcdd64c5 [ruby/fiddle] Bump version
f8fb7c4823
2020-05-23 14:29:16 +09:00
Sutou Kouhei
13f64333ea [ruby/fiddle] Add Fiddle::VERSION
9dcf64c096
2020-05-23 14:29:16 +09:00
Sutou Kouhei
5fb7ca33e6 [ruby/fiddle] Add missing spec.extensions
2ce36b1fdc
2020-05-23 14:29:16 +09:00
sinisterchipmunk
77cc13943c [ruby/fiddle] Fix assignment to array within struct (#26)
* Allow access to a struct's underlying memory with `struct[offset, length]`.

24083690a6
2020-05-23 14:29:16 +09:00
sinisterchipmunk
4a835621ce [ruby/fiddle] Make array access override compatible with base class (#25)
* Allow access to a struct's underlying memory with `struct[offset, length]`.

* Make accessing a struct's underlying memory more convenient.

* refactor memory access unit tests for improved clarity


c082c81bb5
2020-05-23 14:29:16 +09:00
sinisterchipmunk
aa1d3c7d2c [ruby/fiddle] Initialize memory to 0 when calling Fiddle.malloc(). (#24)
8414239ca3
2020-05-23 14:29:16 +09:00
Yusuke Endoh
b68dab8667 ext/fiddle/extconf.rb: Fix the condition of libffi <= 3.1
ver is [3, 1, 0] which is not less then or equal to [3, 1]
2020-05-13 10:57:14 +09:00
Yusuke Endoh
9cfa811b0f Do not try ffi_closure_alloc if libffi is <= 3.1
Maybe due to e1855100e4, CentOS, RHEL, and
Fedora CIs have started failing with SEGV.  Try to avoid
ffi_closure_alloc on those environments.

20200512T183004Z.fail.html.gz
20200512T183004Z.fail.html.gz
20200512T183003Z.fail.html.gz
2020-05-13 08:42:48 +09:00
Yusuke Endoh
e1855100e4 ext/fiddle/extconf.rb: check if ffi_closure_alloc is available
to define HAVE_FFI_CLOSURE_ALLOC.
The macro is used in closure.c, so have_func check is needed.

If pkg-config is not installed, extconf.rb fails to detect the version
of libffi, and does not add "-DUSE_FFI_CLOSURE_ALLOC=1" even when system
libffi version is >= 3.2.

If USE_FFI_CLOSURE_ALLOC is not defined, closure.c attempts to check if
HAVE_FFI_CLOSURE_ALLOC is defined or not, but have_func was removed with
528a3a1797, so the macro is always not
defined.

This resulted in this deprecation warning:

20200512T123003Z.log.html.gz
```
compiling closure.c
closure.c: In function 'initialize':
closure.c:265:5: warning: 'ffi_prep_closure' is deprecated: use ffi_prep_closure_loc instead [-Wdeprecated-declarations]
  265 |     result = ffi_prep_closure(pcl, cif, callback, (void *)self);
      |     ^~~~~~
In file included from ./fiddle.h:42,
                 from closure.c:1:
/usr/include/x86_64-linux-gnu/ffi.h:334:1: note: declared here
  334 | ffi_prep_closure (ffi_closure*,
      | ^~~~~~~~~~~~~~~~
```
2020-05-13 01:17:30 +09:00
Nobuyoshi Nakada
317fdd6df2 fiddle: share the same config tools 2020-05-12 15:57:47 +09:00
Nobuyoshi Nakada
d1748484e8 extlibs.rb: added variable references
Reduce duplicate parts such as package name and version numbers.
2020-05-12 15:57:47 +09:00
卜部昌平
9e41a75255 sed -i 's|ruby/impl|ruby/internal|'
To fix build failures.
2020-05-11 09:24:08 +09:00
卜部昌平
d7f4d732c1 sed -i s|ruby/3|ruby/impl|g
This shall fix compile errors.
2020-05-11 09:24:08 +09:00
卜部昌平
9e6e39c351
Merge pull request #2991 from shyouhei/ruby.h
Split ruby.h
2020-04-08 13:28:13 +09:00
Nobuyoshi Nakada
318be1cb2f
Show libffi version only if set 2020-03-21 16:38:29 +09:00
Jeremy Evans
040cfc89b9 Do not set USE_FFI_CLOSURE_ALLOC=1 in fiddle on OpenBSD
On OpenBSD, USE_FFI_CLOSURE_ALLOC was always set to 0 previously. In
633a1f15d8, the code was modified in a
way that it ended up being set to 1 on OpenBSD.  However, that results
in SIGABRT when running make test-all, inside ffi_closure_free.
Setting USE_FFI_CLOSURE_ALLOC back to 0 fixes the issue.
2020-03-08 17:47:48 -07:00
Hiroshi SHIBATA
47a1872cd8
Use osuosl instead of GitHub releases
Because the package provided by GitHub releases is different from sourceware.
2020-03-07 20:45:09 +09:00
Hiroshi SHIBATA
8602216746
Switch to download libffi source package to github releases from sourceware.org 2020-03-07 19:57:28 +09:00
Nobuyoshi Nakada
e4a9e926f0
Fixed a typo 2020-03-05 13:31:25 +09:00
Nobuyoshi Nakada
261569d4aa
[ruby/fiddle] always use ffi_closure_alloc on Windows 2020-03-05 11:31:08 +09:00
Nobuyoshi Nakada
528a3a1797
[ruby/fiddle] use ffi_closure_alloc only with 3.2 or later 2020-03-04 23:19:35 +09:00
Nobuyoshi Nakada
95f387f61a
[ruby/fiddle] ffi_closure_free is available in the bundled libffi 2020-03-04 18:41:47 +09:00
Nobuyoshi Nakada
633a1f15d8
[ruby/fiddle] Use ffi_closure_free if available 2020-03-04 18:14:18 +09:00
Yusuke Endoh
d732bc51bd Revert "Revert "Revert "[ruby/fiddle] Use ffi_closure_free by default. (#20)"""
This reverts commit 87f6154bb4.

It turned out that the change fails to build on macOS

20200304T074503Z.fail.html.gz
```
+ make 'TESTS=--hide-skip -v fiddle' RUBYOPT=-w test-all
dyld: lazy symbol binding failed: Symbol not found: _ffi_closure_alloc
  Referenced from: /Users/hsbt/Documents/cb/tmp/build/20200304T074503Z/ruby/.ext/x86_64-darwin18/fiddle.bundle
  Expected in: flat namespace

dyld: Symbol not found: _ffi_closure_alloc
  Referenced from: /Users/hsbt/Documents/cb/tmp/build/20200304T074503Z/ruby/.ext/x86_64-darwin18/fiddle.bundle
  Expected in: flat namespace

make: *** [yes-test-all] Abort trap: 6
```
2020-03-04 17:28:21 +09:00
Yusuke Endoh
87f6154bb4 Revert "Revert "[ruby/fiddle] Use ffi_closure_free by default. (#20)""
This reverts commit efd641ffab.

This changeset seems to be needed to suppress a warning on Ubuntu 20.04
20200304T033004Z.log.html.gz
```
closure.c:264:5: warning: 'ffi_prep_closure' is deprecated: use ffi_prep_closure_loc instead [-Wdeprecated-declarations]
  264 |     result = ffi_prep_closure(pcl, cif, callback, (void *)self);
      |     ^~~~~~
```

I guess there was a reason why the commit was reverted (maybe some CIs
failed?), so try it again.
2020-03-04 15:46:26 +09:00
Kazuhiro NISHIYAMA
c90fc55a1f Drop executable bit of *.{yml,h,mk.tmpl} 2020-01-22 16:04:38 +09:00
Nobuyoshi Nakada
e1b2341488
Update dependencies 2019-11-18 23:16:22 +09:00
Hiroshi SHIBATA
efd641ffab Revert "[ruby/fiddle] Use ffi_closure_free by default. (#20)"
This reverts commit ce6caade7c.
2019-10-24 20:58:32 +09:00
Jeremy Evans
b809784817 [ruby/fiddle] Remove taint support (#21)
Ruby 2.7 deprecates taint and it no longer has an effect.
The lack of taint support should not cause a problem in
previous Ruby versions.
18d6fb6915
2019-10-24 19:34:49 +09:00