1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

[ruby/fiddle] use ffi_closure_alloc only with 3.2 or later

This commit is contained in:
Nobuyoshi Nakada 2020-03-04 23:13:45 +09:00
parent 5bb80b76b0
commit 528a3a1797
No known key found for this signature in database
GPG key ID: 4BC7D6DF58D8DF60

View file

@ -114,8 +114,9 @@ end
if ver if ver
ver = ver.gsub(/-rc\d+/, '') # If ver contains rc version, just ignored. ver = ver.gsub(/-rc\d+/, '') # If ver contains rc version, just ignored.
ver = (ver.split('.') + [0,0])[0,3] ver = (ver.split('.').map(&:to_i) + [0,0])[0,3]
$defs.push(%{-DRUBY_LIBFFI_MODVERSION=#{ '%d%03d%03d' % ver }}) $defs.push(%{-DRUBY_LIBFFI_MODVERSION=#{ '%d%03d%03d' % ver }})
$defs << "-DUSE_FFI_CLOSURE_ALLOC=1" if (ver <=> [3, 2]) >= 0
end end
have_header 'sys/mman.h' have_header 'sys/mman.h'
@ -153,9 +154,6 @@ end
if libffi if libffi
$LOCAL_LIBS.prepend("./#{libffi.a} ").strip! # to exts.mk $LOCAL_LIBS.prepend("./#{libffi.a} ").strip! # to exts.mk
$INCFLAGS.gsub!(/-I#{libffi.dir}/, '-I$(LIBFFI_DIR)') $INCFLAGS.gsub!(/-I#{libffi.dir}/, '-I$(LIBFFI_DIR)')
$defs << "-DUSE_FFI_CLOSURE_ALLOC=1"
else
have_func('ffi_closure_alloc', ffi_header)
end end
$INCFLAGS << " -I$(top_srcdir)" $INCFLAGS << " -I$(top_srcdir)"
create_makefile 'fiddle' do |conf| create_makefile 'fiddle' do |conf|