ffi 1.10.0
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 +7 -0
- data/.gitignore +22 -0
- data/.gitmodules +3 -0
- data/.travis.yml +43 -0
- data/.yardopts +5 -0
- data/CHANGELOG.md +98 -0
- data/COPYING +49 -0
- data/Gemfile +15 -0
- data/LICENSE +24 -0
- data/LICENSE.SPECS +22 -0
- data/README.md +112 -0
- data/Rakefile +268 -0
- data/appveyor.yml +22 -0
- data/ext/ffi_c/AbstractMemory.c +1109 -0
- data/ext/ffi_c/AbstractMemory.h +175 -0
- data/ext/ffi_c/ArrayType.c +162 -0
- data/ext/ffi_c/ArrayType.h +59 -0
- data/ext/ffi_c/Buffer.c +365 -0
- data/ext/ffi_c/Call.c +520 -0
- data/ext/ffi_c/Call.h +110 -0
- data/ext/ffi_c/ClosurePool.c +283 -0
- data/ext/ffi_c/ClosurePool.h +57 -0
- data/ext/ffi_c/DataConverter.c +91 -0
- data/ext/ffi_c/DynamicLibrary.c +339 -0
- data/ext/ffi_c/DynamicLibrary.h +98 -0
- data/ext/ffi_c/Function.c +1001 -0
- data/ext/ffi_c/Function.h +87 -0
- data/ext/ffi_c/FunctionInfo.c +271 -0
- data/ext/ffi_c/LastError.c +229 -0
- data/ext/ffi_c/LastError.h +47 -0
- data/ext/ffi_c/LongDouble.c +63 -0
- data/ext/ffi_c/LongDouble.h +51 -0
- data/ext/ffi_c/MappedType.c +168 -0
- data/ext/ffi_c/MappedType.h +59 -0
- data/ext/ffi_c/MemoryPointer.c +197 -0
- data/ext/ffi_c/MemoryPointer.h +53 -0
- data/ext/ffi_c/MethodHandle.c +358 -0
- data/ext/ffi_c/MethodHandle.h +55 -0
- data/ext/ffi_c/Platform.c +129 -0
- data/ext/ffi_c/Platform.h +45 -0
- data/ext/ffi_c/Pointer.c +508 -0
- data/ext/ffi_c/Pointer.h +63 -0
- data/ext/ffi_c/Struct.c +829 -0
- data/ext/ffi_c/Struct.h +106 -0
- data/ext/ffi_c/StructByReference.c +190 -0
- data/ext/ffi_c/StructByReference.h +50 -0
- data/ext/ffi_c/StructByValue.c +150 -0
- data/ext/ffi_c/StructByValue.h +55 -0
- data/ext/ffi_c/StructLayout.c +698 -0
- data/ext/ffi_c/Thread.c +353 -0
- data/ext/ffi_c/Thread.h +95 -0
- data/ext/ffi_c/Type.c +397 -0
- data/ext/ffi_c/Type.h +62 -0
- data/ext/ffi_c/Types.c +139 -0
- data/ext/ffi_c/Types.h +89 -0
- data/ext/ffi_c/Variadic.c +304 -0
- data/ext/ffi_c/compat.h +78 -0
- data/ext/ffi_c/extconf.rb +72 -0
- data/ext/ffi_c/ffi.c +98 -0
- data/ext/ffi_c/libffi.bsd.mk +40 -0
- data/ext/ffi_c/libffi.darwin.mk +105 -0
- data/ext/ffi_c/libffi.gnu.mk +32 -0
- data/ext/ffi_c/libffi.mk +18 -0
- data/ext/ffi_c/libffi.vc.mk +26 -0
- data/ext/ffi_c/libffi.vc64.mk +26 -0
- data/ext/ffi_c/libffi/.appveyor.yml +50 -0
- data/ext/ffi_c/libffi/.github/issue_template.md +10 -0
- data/ext/ffi_c/libffi/.gitignore +38 -0
- data/ext/ffi_c/libffi/.travis.yml +34 -0
- data/ext/ffi_c/libffi/.travis/ar-lib +270 -0
- data/ext/ffi_c/libffi/.travis/build.sh +34 -0
- data/ext/ffi_c/libffi/.travis/compile +351 -0
- data/ext/ffi_c/libffi/.travis/install.sh +22 -0
- data/ext/ffi_c/libffi/.travis/moxie-sim.exp +60 -0
- data/ext/ffi_c/libffi/.travis/site.exp +18 -0
- data/ext/ffi_c/libffi/ChangeLog.libffi +584 -0
- data/ext/ffi_c/libffi/ChangeLog.libffi-3.1 +6000 -0
- data/ext/ffi_c/libffi/ChangeLog.libgcj +40 -0
- data/ext/ffi_c/libffi/ChangeLog.v1 +764 -0
- data/ext/ffi_c/libffi/LICENSE +21 -0
- data/ext/ffi_c/libffi/LICENSE-BUILDTOOLS +352 -0
- data/ext/ffi_c/libffi/Makefile.am +166 -0
- data/ext/ffi_c/libffi/README.md +461 -0
- data/ext/ffi_c/libffi/acinclude.m4 +479 -0
- data/ext/ffi_c/libffi/autogen.sh +2 -0
- data/ext/ffi_c/libffi/config.guess +1466 -0
- data/ext/ffi_c/libffi/config.sub +1836 -0
- data/ext/ffi_c/libffi/configure.ac +390 -0
- data/ext/ffi_c/libffi/configure.host +289 -0
- data/ext/ffi_c/libffi/generate-darwin-source-and-headers.py +203 -0
- data/ext/ffi_c/libffi/include/Makefile.am +9 -0
- data/ext/ffi_c/libffi/include/ffi.h.in +511 -0
- data/ext/ffi_c/libffi/include/ffi_cfi.h +55 -0
- data/ext/ffi_c/libffi/include/ffi_common.h +149 -0
- data/ext/ffi_c/libffi/libffi.map.in +80 -0
- data/ext/ffi_c/libffi/libffi.pc.in +11 -0
- data/ext/ffi_c/libffi/libffi.xcodeproj/project.pbxproj +1043 -0
- data/ext/ffi_c/libffi/libtool-version +29 -0
- data/ext/ffi_c/libffi/m4/asmcfi.m4 +13 -0
- data/ext/ffi_c/libffi/m4/ax_append_flag.m4 +71 -0
- data/ext/ffi_c/libffi/m4/ax_cc_maxopt.m4 +194 -0
- data/ext/ffi_c/libffi/m4/ax_cflags_warn_all.m4 +122 -0
- data/ext/ffi_c/libffi/m4/ax_check_compile_flag.m4 +74 -0
- data/ext/ffi_c/libffi/m4/ax_compiler_vendor.m4 +87 -0
- data/ext/ffi_c/libffi/m4/ax_configure_args.m4 +70 -0
- data/ext/ffi_c/libffi/m4/ax_enable_builddir.m4 +302 -0
- data/ext/ffi_c/libffi/m4/ax_gcc_archflag.m4 +263 -0
- data/ext/ffi_c/libffi/m4/ax_gcc_x86_cpuid.m4 +89 -0
- data/ext/ffi_c/libffi/m4/ax_require_defined.m4 +37 -0
- data/ext/ffi_c/libffi/man/Makefile.am +8 -0
- data/ext/ffi_c/libffi/man/ffi.3 +41 -0
- data/ext/ffi_c/libffi/man/ffi_call.3 +103 -0
- data/ext/ffi_c/libffi/man/ffi_prep_cif.3 +68 -0
- data/ext/ffi_c/libffi/man/ffi_prep_cif_var.3 +73 -0
- data/ext/ffi_c/libffi/msvcc.sh +328 -0
- data/ext/ffi_c/libffi/src/aarch64/ffi.c +941 -0
- data/ext/ffi_c/libffi/src/aarch64/ffitarget.h +81 -0
- data/ext/ffi_c/libffi/src/aarch64/internal.h +67 -0
- data/ext/ffi_c/libffi/src/aarch64/sysv.S +438 -0
- data/ext/ffi_c/libffi/src/alpha/ffi.c +521 -0
- data/ext/ffi_c/libffi/src/alpha/ffitarget.h +57 -0
- data/ext/ffi_c/libffi/src/alpha/internal.h +23 -0
- data/ext/ffi_c/libffi/src/alpha/osf.S +282 -0
- data/ext/ffi_c/libffi/src/arc/arcompact.S +135 -0
- data/ext/ffi_c/libffi/src/arc/ffi.c +266 -0
- data/ext/ffi_c/libffi/src/arc/ffitarget.h +53 -0
- data/ext/ffi_c/libffi/src/arm/ffi.c +819 -0
- data/ext/ffi_c/libffi/src/arm/ffitarget.h +82 -0
- data/ext/ffi_c/libffi/src/arm/internal.h +7 -0
- data/ext/ffi_c/libffi/src/arm/sysv.S +383 -0
- data/ext/ffi_c/libffi/src/avr32/ffi.c +423 -0
- data/ext/ffi_c/libffi/src/avr32/ffitarget.h +55 -0
- data/ext/ffi_c/libffi/src/avr32/sysv.S +208 -0
- data/ext/ffi_c/libffi/src/bfin/ffi.c +196 -0
- data/ext/ffi_c/libffi/src/bfin/ffitarget.h +43 -0
- data/ext/ffi_c/libffi/src/bfin/sysv.S +179 -0
- data/ext/ffi_c/libffi/src/closures.c +966 -0
- data/ext/ffi_c/libffi/src/cris/ffi.c +386 -0
- data/ext/ffi_c/libffi/src/cris/ffitarget.h +56 -0
- data/ext/ffi_c/libffi/src/cris/sysv.S +215 -0
- data/ext/ffi_c/libffi/src/debug.c +64 -0
- data/ext/ffi_c/libffi/src/dlmalloc.c +5166 -0
- data/ext/ffi_c/libffi/src/frv/eabi.S +128 -0
- data/ext/ffi_c/libffi/src/frv/ffi.c +292 -0
- data/ext/ffi_c/libffi/src/frv/ffitarget.h +62 -0
- data/ext/ffi_c/libffi/src/ia64/ffi.c +604 -0
- data/ext/ffi_c/libffi/src/ia64/ffitarget.h +56 -0
- data/ext/ffi_c/libffi/src/ia64/ia64_flags.h +40 -0
- data/ext/ffi_c/libffi/src/ia64/unix.S +567 -0
- data/ext/ffi_c/libffi/src/java_raw_api.c +374 -0
- data/ext/ffi_c/libffi/src/m32r/ffi.c +232 -0
- data/ext/ffi_c/libffi/src/m32r/ffitarget.h +53 -0
- data/ext/ffi_c/libffi/src/m32r/sysv.S +121 -0
- data/ext/ffi_c/libffi/src/m68k/ffi.c +362 -0
- data/ext/ffi_c/libffi/src/m68k/ffitarget.h +54 -0
- data/ext/ffi_c/libffi/src/m68k/sysv.S +357 -0
- data/ext/ffi_c/libffi/src/m88k/ffi.c +400 -0
- data/ext/ffi_c/libffi/src/m88k/ffitarget.h +49 -0
- data/ext/ffi_c/libffi/src/m88k/obsd.S +209 -0
- data/ext/ffi_c/libffi/src/metag/ffi.c +330 -0
- data/ext/ffi_c/libffi/src/metag/ffitarget.h +53 -0
- data/ext/ffi_c/libffi/src/metag/sysv.S +311 -0
- data/ext/ffi_c/libffi/src/microblaze/ffi.c +321 -0
- data/ext/ffi_c/libffi/src/microblaze/ffitarget.h +53 -0
- data/ext/ffi_c/libffi/src/microblaze/sysv.S +302 -0
- data/ext/ffi_c/libffi/src/mips/ffi.c +1130 -0
- data/ext/ffi_c/libffi/src/mips/ffitarget.h +244 -0
- data/ext/ffi_c/libffi/src/mips/n32.S +663 -0
- data/ext/ffi_c/libffi/src/mips/o32.S +502 -0
- data/ext/ffi_c/libffi/src/moxie/eabi.S +101 -0
- data/ext/ffi_c/libffi/src/moxie/ffi.c +285 -0
- data/ext/ffi_c/libffi/src/moxie/ffitarget.h +52 -0
- data/ext/ffi_c/libffi/src/nios2/ffi.c +304 -0
- data/ext/ffi_c/libffi/src/nios2/ffitarget.h +52 -0
- data/ext/ffi_c/libffi/src/nios2/sysv.S +136 -0
- data/ext/ffi_c/libffi/src/or1k/ffi.c +328 -0
- data/ext/ffi_c/libffi/src/or1k/ffitarget.h +58 -0
- data/ext/ffi_c/libffi/src/or1k/sysv.S +107 -0
- data/ext/ffi_c/libffi/src/pa/ffi.c +719 -0
- data/ext/ffi_c/libffi/src/pa/ffitarget.h +85 -0
- data/ext/ffi_c/libffi/src/pa/hpux32.S +368 -0
- data/ext/ffi_c/libffi/src/pa/linux.S +357 -0
- data/ext/ffi_c/libffi/src/powerpc/aix.S +566 -0
- data/ext/ffi_c/libffi/src/powerpc/aix_closure.S +694 -0
- data/ext/ffi_c/libffi/src/powerpc/asm.h +125 -0
- data/ext/ffi_c/libffi/src/powerpc/darwin.S +378 -0
- data/ext/ffi_c/libffi/src/powerpc/darwin_closure.S +571 -0
- data/ext/ffi_c/libffi/src/powerpc/ffi.c +173 -0
- data/ext/ffi_c/libffi/src/powerpc/ffi_darwin.c +1440 -0
- data/ext/ffi_c/libffi/src/powerpc/ffi_linux64.c +974 -0
- data/ext/ffi_c/libffi/src/powerpc/ffi_powerpc.h +94 -0
- data/ext/ffi_c/libffi/src/powerpc/ffi_sysv.c +923 -0
- data/ext/ffi_c/libffi/src/powerpc/ffitarget.h +198 -0
- data/ext/ffi_c/libffi/src/powerpc/linux64.S +228 -0
- data/ext/ffi_c/libffi/src/powerpc/linux64_closure.S +488 -0
- data/ext/ffi_c/libffi/src/powerpc/ppc_closure.S +397 -0
- data/ext/ffi_c/libffi/src/powerpc/sysv.S +175 -0
- data/ext/ffi_c/libffi/src/prep_cif.c +261 -0
- data/ext/ffi_c/libffi/src/raw_api.c +267 -0
- data/ext/ffi_c/libffi/src/riscv/ffi.c +445 -0
- data/ext/ffi_c/libffi/src/riscv/ffitarget.h +68 -0
- data/ext/ffi_c/libffi/src/riscv/sysv.S +214 -0
- data/ext/ffi_c/libffi/src/s390/ffi.c +756 -0
- data/ext/ffi_c/libffi/src/s390/ffitarget.h +70 -0
- data/ext/ffi_c/libffi/src/s390/internal.h +11 -0
- data/ext/ffi_c/libffi/src/s390/sysv.S +325 -0
- data/ext/ffi_c/libffi/src/sh/ffi.c +717 -0
- data/ext/ffi_c/libffi/src/sh/ffitarget.h +54 -0
- data/ext/ffi_c/libffi/src/sh/sysv.S +850 -0
- data/ext/ffi_c/libffi/src/sh64/ffi.c +469 -0
- data/ext/ffi_c/libffi/src/sh64/ffitarget.h +58 -0
- data/ext/ffi_c/libffi/src/sh64/sysv.S +539 -0
- data/ext/ffi_c/libffi/src/sparc/ffi.c +468 -0
- data/ext/ffi_c/libffi/src/sparc/ffi64.c +608 -0
- data/ext/ffi_c/libffi/src/sparc/ffitarget.h +81 -0
- data/ext/ffi_c/libffi/src/sparc/internal.h +26 -0
- data/ext/ffi_c/libffi/src/sparc/v8.S +443 -0
- data/ext/ffi_c/libffi/src/sparc/v9.S +440 -0
- data/ext/ffi_c/libffi/src/tile/ffi.c +355 -0
- data/ext/ffi_c/libffi/src/tile/ffitarget.h +65 -0
- data/ext/ffi_c/libffi/src/tile/tile.S +360 -0
- data/ext/ffi_c/libffi/src/types.c +108 -0
- data/ext/ffi_c/libffi/src/vax/elfbsd.S +195 -0
- data/ext/ffi_c/libffi/src/vax/ffi.c +276 -0
- data/ext/ffi_c/libffi/src/vax/ffitarget.h +49 -0
- data/ext/ffi_c/libffi/src/x86/asmnames.h +30 -0
- data/ext/ffi_c/libffi/src/x86/ffi.c +753 -0
- data/ext/ffi_c/libffi/src/x86/ffi64.c +884 -0
- data/ext/ffi_c/libffi/src/x86/ffitarget.h +147 -0
- data/ext/ffi_c/libffi/src/x86/ffiw64.c +308 -0
- data/ext/ffi_c/libffi/src/x86/internal.h +29 -0
- data/ext/ffi_c/libffi/src/x86/internal64.h +22 -0
- data/ext/ffi_c/libffi/src/x86/sysv.S +1043 -0
- data/ext/ffi_c/libffi/src/x86/unix64.S +525 -0
- data/ext/ffi_c/libffi/src/x86/win64.S +232 -0
- data/ext/ffi_c/libffi/src/x86/win64_intel.S +237 -0
- data/ext/ffi_c/libffi/src/xtensa/ffi.c +298 -0
- data/ext/ffi_c/libffi/src/xtensa/ffitarget.h +53 -0
- data/ext/ffi_c/libffi/src/xtensa/sysv.S +258 -0
- data/ext/ffi_c/libffi/stamp-h.in +1 -0
- data/ext/ffi_c/libffi/testsuite/Makefile.am +117 -0
- data/ext/ffi_c/libffi/testsuite/config/default.exp +1 -0
- data/ext/ffi_c/libffi/testsuite/lib/libffi.exp +636 -0
- data/ext/ffi_c/libffi/testsuite/lib/target-libpath.exp +283 -0
- data/ext/ffi_c/libffi/testsuite/lib/wrapper.exp +45 -0
- data/ext/ffi_c/libffi/testsuite/libffi.bhaible/Makefile +28 -0
- data/ext/ffi_c/libffi/testsuite/libffi.bhaible/README +78 -0
- data/ext/ffi_c/libffi/testsuite/libffi.bhaible/alignof.h +50 -0
- data/ext/ffi_c/libffi/testsuite/libffi.bhaible/bhaible.exp +58 -0
- data/ext/ffi_c/libffi/testsuite/libffi.bhaible/test-call.c +1745 -0
- data/ext/ffi_c/libffi/testsuite/libffi.bhaible/test-callback.c +2885 -0
- data/ext/ffi_c/libffi/testsuite/libffi.bhaible/testcases.c +743 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/align_mixed.c +46 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/align_stdcall.c +46 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/call.exp +43 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/closure_fn0.c +89 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/closure_fn1.c +81 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/closure_fn2.c +81 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/closure_fn3.c +82 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/closure_fn4.c +89 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/closure_fn5.c +92 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/closure_fn6.c +90 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/closure_loc_fn0.c +95 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/closure_simple.c +55 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_12byte.c +94 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_16byte.c +95 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_18byte.c +96 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_19byte.c +102 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_1_1byte.c +89 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_20byte.c +91 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_20byte1.c +93 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_24byte.c +113 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_2byte.c +90 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_3_1byte.c +95 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_3byte1.c +90 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_3byte2.c +90 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_3float.c +95 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_4_1byte.c +98 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_4byte.c +90 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_5_1_byte.c +109 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_5byte.c +98 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_64byte.c +124 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_6_1_byte.c +113 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_6byte.c +99 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_7_1_byte.c +117 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_7byte.c +97 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_8byte.c +88 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_9byte1.c +90 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_9byte2.c +91 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_align_double.c +93 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_align_float.c +91 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_align_longdouble.c +92 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_align_longdouble_split.c +132 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_align_longdouble_split2.c +115 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_align_pointer.c +95 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_align_sint16.c +91 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_align_sint32.c +91 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_align_sint64.c +92 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_align_uint16.c +91 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_align_uint32.c +91 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_align_uint64.c +93 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_dbls_struct.c +66 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_double.c +43 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_double_va.c +61 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_float.c +42 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_longdouble.c +105 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_longdouble_va.c +61 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_many_mixed_args.c +70 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_many_mixed_float_double.c +55 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_multi_schar.c +74 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_multi_sshort.c +74 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_multi_sshortchar.c +86 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_multi_uchar.c +91 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_multi_ushort.c +74 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_multi_ushortchar.c +86 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_pointer.c +74 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_pointer_stack.c +142 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_schar.c +44 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_sint.c +42 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_sshort.c +42 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_struct_va1.c +114 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_uchar.c +42 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_uchar_va.c +44 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_uint.c +43 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_uint_va.c +45 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_ulong_va.c +45 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_ulonglong.c +47 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_ushort.c +43 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/cls_ushort_va.c +44 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/err_bad_abi.c +36 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/err_bad_typedef.c +26 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/ffitest.h +138 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/float.c +59 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/float1.c +60 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/float2.c +60 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/float3.c +74 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/float4.c +62 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/float_va.c +107 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/huge_struct.c +341 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/many.c +59 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/many2.c +57 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/many_double.c +70 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/many_mixed.c +78 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/negint.c +52 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/nested_struct.c +152 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/nested_struct1.c +161 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/nested_struct10.c +134 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/nested_struct11.c +121 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/nested_struct2.c +110 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/nested_struct3.c +111 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/nested_struct4.c +111 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/nested_struct5.c +112 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/nested_struct6.c +131 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/nested_struct7.c +111 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/nested_struct8.c +131 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/nested_struct9.c +131 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/offsets.c +46 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/pr1172638.c +127 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/problem1.c +90 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/promotion.c +59 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/pyobjc-tc.c +114 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/return_dbl.c +36 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/return_dbl1.c +43 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/return_dbl2.c +42 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/return_fl.c +35 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/return_fl1.c +36 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/return_fl2.c +49 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/return_fl3.c +42 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/return_ldl.c +34 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/return_ll.c +41 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/return_ll1.c +43 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/return_sc.c +36 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/return_sl.c +38 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/return_uc.c +38 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/return_ul.c +38 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/stret_large.c +145 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/stret_large2.c +148 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/stret_medium.c +124 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/stret_medium2.c +125 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/strlen.c +44 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/strlen2.c +49 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/strlen3.c +49 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/strlen4.c +55 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/struct1.c +67 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/struct10.c +57 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/struct2.c +67 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/struct3.c +60 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/struct4.c +64 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/struct5.c +66 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/struct6.c +64 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/struct7.c +74 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/struct8.c +81 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/struct9.c +68 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/testclosure.c +70 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/uninitialized.c +61 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/unwindtest.cc +117 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/unwindtest_ffi_call.cc +54 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/va_1.c +196 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/va_struct1.c +121 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/va_struct2.c +123 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/va_struct3.c +125 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_align_complex.inc +91 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_align_complex_double.c +10 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_align_complex_float.c +10 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_align_complex_longdouble.c +10 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_complex.inc +42 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_complex_double.c +10 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_complex_float.c +10 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_complex_longdouble.c +10 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_complex_struct.inc +71 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_complex_struct_double.c +10 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_complex_struct_float.c +10 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_complex_struct_longdouble.c +10 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_complex_va.inc +80 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_complex_va_double.c +10 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_complex_va_float.c +16 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/cls_complex_va_longdouble.c +10 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/complex.exp +36 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/complex.inc +51 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/complex_defs_double.inc +7 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/complex_defs_float.inc +7 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/complex_defs_longdouble.inc +7 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/complex_double.c +10 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/complex_float.c +10 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/complex_int.c +86 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/complex_longdouble.c +10 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/ffitest.h +1 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/many_complex.inc +78 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/many_complex_double.c +10 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/many_complex_float.c +10 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/many_complex_longdouble.c +10 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex.inc +37 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex1.inc +41 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex1_double.c +10 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex1_float.c +10 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex1_longdouble.c +10 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex2.inc +44 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex2_double.c +10 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex2_float.c +10 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex2_longdouble.c +10 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex_double.c +10 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex_float.c +10 -0
- data/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex_longdouble.c +10 -0
- data/ext/ffi_c/libffi/testsuite/libffi.go/aa-direct.c +34 -0
- data/ext/ffi_c/libffi/testsuite/libffi.go/closure1.c +28 -0
- data/ext/ffi_c/libffi/testsuite/libffi.go/ffitest.h +1 -0
- data/ext/ffi_c/libffi/testsuite/libffi.go/go.exp +36 -0
- data/ext/ffi_c/libffi/testsuite/libffi.go/static-chain.h +19 -0
- data/ext/ffi_c/rbffi.h +57 -0
- data/ext/ffi_c/rbffi_endian.h +59 -0
- data/ext/ffi_c/win32/stdbool.h +8 -0
- data/ext/ffi_c/win32/stdint.h +201 -0
- data/ffi.gemspec +36 -0
- data/lib/ffi.rb +20 -0
- data/lib/ffi/autopointer.rb +203 -0
- data/lib/ffi/buffer.rb +4 -0
- data/lib/ffi/callback.rb +4 -0
- data/lib/ffi/enum.rb +296 -0
- data/lib/ffi/errno.rb +43 -0
- data/lib/ffi/ffi.rb +44 -0
- data/lib/ffi/io.rb +62 -0
- data/lib/ffi/library.rb +588 -0
- data/lib/ffi/managedstruct.rb +84 -0
- data/lib/ffi/memorypointer.rb +1 -0
- data/lib/ffi/platform.rb +170 -0
- data/lib/ffi/platform/aarch64-freebsd/types.conf +128 -0
- data/lib/ffi/platform/aarch64-freebsd12/types.conf +128 -0
- data/lib/ffi/platform/aarch64-linux/types.conf +104 -0
- data/lib/ffi/platform/arm-freebsd/types.conf +152 -0
- data/lib/ffi/platform/arm-freebsd12/types.conf +152 -0
- data/lib/ffi/platform/arm-linux/types.conf +104 -0
- data/lib/ffi/platform/i386-cygwin/types.conf +3 -0
- data/lib/ffi/platform/i386-darwin/types.conf +100 -0
- data/lib/ffi/platform/i386-freebsd/types.conf +152 -0
- data/lib/ffi/platform/i386-freebsd12/types.conf +152 -0
- data/lib/ffi/platform/i386-gnu/types.conf +107 -0
- data/lib/ffi/platform/i386-linux/types.conf +103 -0
- data/lib/ffi/platform/i386-netbsd/types.conf +126 -0
- data/lib/ffi/platform/i386-openbsd/types.conf +128 -0
- data/lib/ffi/platform/i386-solaris/types.conf +122 -0
- data/lib/ffi/platform/i386-windows/types.conf +105 -0
- data/lib/ffi/platform/ia64-linux/types.conf +104 -0
- data/lib/ffi/platform/mips-linux/types.conf +102 -0
- data/lib/ffi/platform/mips64-linux/types.conf +104 -0
- data/lib/ffi/platform/mips64el-linux/types.conf +104 -0
- data/lib/ffi/platform/mipsel-linux/types.conf +102 -0
- data/lib/ffi/platform/mipsisa32r6-linux/types.conf +102 -0
- data/lib/ffi/platform/mipsisa32r6el-linux/types.conf +102 -0
- data/lib/ffi/platform/mipsisa64r6-linux/types.conf +104 -0
- data/lib/ffi/platform/mipsisa64r6el-linux/types.conf +104 -0
- data/lib/ffi/platform/powerpc-aix/types.conf +180 -0
- data/lib/ffi/platform/powerpc-darwin/types.conf +100 -0
- data/lib/ffi/platform/powerpc-linux/types.conf +100 -0
- data/lib/ffi/platform/powerpc64-linux/types.conf +104 -0
- data/lib/ffi/platform/s390-linux/types.conf +102 -0
- data/lib/ffi/platform/s390x-linux/types.conf +102 -0
- data/lib/ffi/platform/sparc-linux/types.conf +102 -0
- data/lib/ffi/platform/sparc-solaris/types.conf +128 -0
- data/lib/ffi/platform/sparc64-linux/types.conf +102 -0
- data/lib/ffi/platform/sparcv9-solaris/types.conf +128 -0
- data/lib/ffi/platform/x86_64-cygwin/types.conf +3 -0
- data/lib/ffi/platform/x86_64-darwin/types.conf +126 -0
- data/lib/ffi/platform/x86_64-freebsd/types.conf +128 -0
- data/lib/ffi/platform/x86_64-freebsd12/types.conf +128 -0
- data/lib/ffi/platform/x86_64-linux/types.conf +102 -0
- data/lib/ffi/platform/x86_64-netbsd/types.conf +128 -0
- data/lib/ffi/platform/x86_64-openbsd/types.conf +134 -0
- data/lib/ffi/platform/x86_64-solaris/types.conf +122 -0
- data/lib/ffi/platform/x86_64-windows/types.conf +120 -0
- data/lib/ffi/pointer.rb +160 -0
- data/lib/ffi/struct.rb +371 -0
- data/lib/ffi/struct_layout_builder.rb +227 -0
- data/lib/ffi/tools/const_generator.rb +229 -0
- data/lib/ffi/tools/generator.rb +60 -0
- data/lib/ffi/tools/generator_task.rb +36 -0
- data/lib/ffi/tools/struct_generator.rb +194 -0
- data/lib/ffi/tools/types_generator.rb +134 -0
- data/lib/ffi/types.rb +194 -0
- data/lib/ffi/union.rb +43 -0
- data/lib/ffi/variadic.rb +78 -0
- data/lib/ffi/version.rb +3 -0
- data/samples/getlogin.rb +8 -0
- data/samples/getpid.rb +8 -0
- data/samples/gettimeofday.rb +18 -0
- data/samples/hello.rb +7 -0
- data/samples/inotify.rb +60 -0
- data/samples/pty.rb +76 -0
- data/samples/qsort.rb +21 -0
- data/samples/sample_helper.rb +6 -0
- metadata +658 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 108ea9d730d92bf5994912324af1cd21b23256c575d0344a7884990d8307baa7
|
|
4
|
+
data.tar.gz: be60f268828396e8b67d1329ac95b136f4f03a229d37f95f73d35dcd1fb8908c
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: eed04778f789f4216f78466bc8fb3f30efa96f3da66720fe3fcce1f5eba01213387c20fe0eb1bcd73146931cefdc68133a3d6a1723b921e1ce00adb58e8e6440
|
|
7
|
+
data.tar.gz: 8c8c96560189bce8d0a95513872028692b89d181ed8ba68752085cbcac2cf957bde9b00c6666946646849acea167b300c28727fd9669098cfb83514fbcf29474
|
data/.gitignore
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
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
|
data/.gitmodules
ADDED
data/.travis.yml
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
dist: trusty
|
|
2
|
+
sudo: false
|
|
3
|
+
group: beta
|
|
4
|
+
language: ruby
|
|
5
|
+
before_install:
|
|
6
|
+
- gem install bundler
|
|
7
|
+
script:
|
|
8
|
+
- bundle exec rake compile || bundle exec rake compile
|
|
9
|
+
- bundle exec rake test
|
|
10
|
+
os:
|
|
11
|
+
- linux
|
|
12
|
+
- osx
|
|
13
|
+
rvm:
|
|
14
|
+
- 2.3.8
|
|
15
|
+
- 2.4.5
|
|
16
|
+
- 2.5.3
|
|
17
|
+
- 2.6.0
|
|
18
|
+
- ruby-head
|
|
19
|
+
- system
|
|
20
|
+
env:
|
|
21
|
+
- CC=gcc
|
|
22
|
+
- CC=clang
|
|
23
|
+
matrix:
|
|
24
|
+
allow_failures:
|
|
25
|
+
- rvm: system
|
|
26
|
+
- os: osx
|
|
27
|
+
rvm: ruby-head
|
|
28
|
+
exclude: # ruby 2.4.2 needs build with xcode9 or later on osx
|
|
29
|
+
- os: osx
|
|
30
|
+
rvm: 2.4.2
|
|
31
|
+
include:
|
|
32
|
+
- os: osx
|
|
33
|
+
osx_image: xcode9.1
|
|
34
|
+
rvm: 2.4.2
|
|
35
|
+
env:
|
|
36
|
+
- CC=gcc
|
|
37
|
+
- os: osx
|
|
38
|
+
osx_image: xcode9.1
|
|
39
|
+
rvm: 2.4.2
|
|
40
|
+
env:
|
|
41
|
+
- CC=clang
|
|
42
|
+
after_failure:
|
|
43
|
+
- "find build -name mkmf.log | xargs cat"
|
data/.yardopts
ADDED
data/CHANGELOG.md
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
1.10.0 / 2019-01-06
|
|
2
|
+
-------------------
|
|
3
|
+
|
|
4
|
+
Added:
|
|
5
|
+
* Add /opt/local/lib/ to ffi's fallback library search path. #638
|
|
6
|
+
* Add binary gem support for ruby-2.6 on Windows
|
|
7
|
+
* Add FreeBSD on AArch64 and ARM support. #644
|
|
8
|
+
* Add FFI::LastError.winapi_error on Windows native or Cygwin. #633
|
|
9
|
+
|
|
10
|
+
Changed:
|
|
11
|
+
* Update to rake-compiler-dock-0.7.0
|
|
12
|
+
* Use 64-bit inodes on FreeBSD >= 12. #644
|
|
13
|
+
* Switch time_t and suseconds_t types to long on FreeBSD. #627
|
|
14
|
+
* Make register_t long_long on 64-bit FreeBSD. #644
|
|
15
|
+
* Fix Pointer#write_array_of_type #637
|
|
16
|
+
|
|
17
|
+
Removed:
|
|
18
|
+
* Drop binary gem support for ruby-2.0 and 2.1 on Windows
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
1.9.25 / 2018-06-03
|
|
22
|
+
-------------------
|
|
23
|
+
|
|
24
|
+
Changed:
|
|
25
|
+
* Revert closures via libffi.
|
|
26
|
+
This re-adds ClosurePool and fixes compat with SELinux enabled systems. #621
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
1.9.24 / 2018-06-02
|
|
30
|
+
-------------------
|
|
31
|
+
|
|
32
|
+
Security Note:
|
|
33
|
+
|
|
34
|
+
This update addresses vulnerability CVE-2018-1000201: DLL loading issue which can be hijacked on Windows OS, when a Symbol is used as DLL name instead of a String. Found by Matthew Bush.
|
|
35
|
+
|
|
36
|
+
Added:
|
|
37
|
+
* Added a CHANGELOG file
|
|
38
|
+
* Add mips64(eb) support, and mips r6 support. (#601)
|
|
39
|
+
|
|
40
|
+
Changed:
|
|
41
|
+
* Update libffi to latest changes on master.
|
|
42
|
+
* Don't search in hardcoded /usr paths on Windows.
|
|
43
|
+
* Don't treat Symbol args different to Strings in ffi_lib.
|
|
44
|
+
* Make sure size_t is defined in Thread.c. Fixes #609
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
1.9.23 / 2018-02-25
|
|
48
|
+
-------------------
|
|
49
|
+
|
|
50
|
+
Changed:
|
|
51
|
+
* Fix unnecessary rebuild of configure in darwin multi arch. Fixes #605
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
1.9.22 / 2018-02-22
|
|
55
|
+
-------------------
|
|
56
|
+
|
|
57
|
+
Changed:
|
|
58
|
+
* Update libffi to latest changes on master.
|
|
59
|
+
* Update detection of system libffi to match new requirements. Fixes #617
|
|
60
|
+
* Prefer bundled libffi over system libffi on Mac OS.
|
|
61
|
+
* Do closures via libffi. This removes ClosurePool and fixes compat with PaX. #540
|
|
62
|
+
* Use a more deterministic gem packaging.
|
|
63
|
+
* Fix unnecessary update of autoconf files at gem install.
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
1.9.21 / 2018-02-06
|
|
67
|
+
-------------------
|
|
68
|
+
|
|
69
|
+
Added:
|
|
70
|
+
* Ruby-2.5 support by Windows binary gems. Fixes #598
|
|
71
|
+
* Add missing win64 types.
|
|
72
|
+
* Added support for Bitmask. (#573)
|
|
73
|
+
* Add support for MSYS2 (#572) and Sparc64 Linux. (#574)
|
|
74
|
+
|
|
75
|
+
Changed:
|
|
76
|
+
* Fix read_string to not throw an error on length 0.
|
|
77
|
+
* Don't use absolute paths for sh and env. Fixes usage on Adroid #528
|
|
78
|
+
* Use Ruby implementation for `which` for better compat with Windows. Fixes #315
|
|
79
|
+
* Fix compatibility with PPC64LE platform. (#577)
|
|
80
|
+
* Normalize sparc64 to sparcv9. (#575)
|
|
81
|
+
|
|
82
|
+
Removed:
|
|
83
|
+
* Drop Ruby 1.8.7 support (#480)
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
1.9.18 / 2017-03-03
|
|
87
|
+
-------------------
|
|
88
|
+
|
|
89
|
+
Added:
|
|
90
|
+
* Add compatibility with Ruby-2.4.
|
|
91
|
+
|
|
92
|
+
Changed:
|
|
93
|
+
* Add missing shlwapi.h include to fix Windows build.
|
|
94
|
+
* Avoid undefined behaviour of LoadLibrary() on Windows. #553
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
1.9.17 / 2017-01-13
|
|
98
|
+
-------------------
|
data/COPYING
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
Copyright (c) 2008-2013, Ruby FFI project contributors
|
|
2
|
+
All rights reserved.
|
|
3
|
+
|
|
4
|
+
Redistribution and use in source and binary forms, with or without
|
|
5
|
+
modification, are permitted provided that the following conditions are met:
|
|
6
|
+
* Redistributions of source code must retain the above copyright
|
|
7
|
+
notice, this list of conditions and the following disclaimer.
|
|
8
|
+
* Redistributions in binary form must reproduce the above copyright
|
|
9
|
+
notice, this list of conditions and the following disclaimer in the
|
|
10
|
+
documentation and/or other materials provided with the distribution.
|
|
11
|
+
* Neither the name of the Ruby FFI project nor the
|
|
12
|
+
names of its contributors may be used to endorse or promote products
|
|
13
|
+
derived from this software without specific prior written permission.
|
|
14
|
+
|
|
15
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
16
|
+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
17
|
+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
18
|
+
DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
|
|
19
|
+
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
|
20
|
+
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
21
|
+
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
|
22
|
+
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
23
|
+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
24
|
+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
25
|
+
|
|
26
|
+
libffi, used by this project, is licensed under the MIT license:
|
|
27
|
+
|
|
28
|
+
libffi - Copyright (c) 1996-2011 Anthony Green, Red Hat, Inc and others.
|
|
29
|
+
See source files for details.
|
|
30
|
+
|
|
31
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
32
|
+
a copy of this software and associated documentation files (the
|
|
33
|
+
``Software''), to deal in the Software without restriction, including
|
|
34
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
35
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
36
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
37
|
+
the following conditions:
|
|
38
|
+
|
|
39
|
+
The above copyright notice and this permission notice shall be
|
|
40
|
+
included in all copies or substantial portions of the Software.
|
|
41
|
+
|
|
42
|
+
THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND,
|
|
43
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
44
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
45
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
|
46
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
47
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
48
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
49
|
+
|
data/Gemfile
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
source 'https://rubygems.org'
|
|
2
|
+
|
|
3
|
+
group :development do
|
|
4
|
+
gem 'rake', '~> 10.1'
|
|
5
|
+
gem 'rake-compiler', '~> 1.0.3'
|
|
6
|
+
gem 'rake-compiler-dock', '~> 0.7.0'
|
|
7
|
+
gem 'rspec', '~> 3.0'
|
|
8
|
+
gem 'rubygems-tasks', '~> 0.2.4', :require => 'rubygems/tasks'
|
|
9
|
+
gem "rubysl", "~> 2.0", :platforms => 'rbx'
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
group :doc do
|
|
13
|
+
gem 'kramdown'
|
|
14
|
+
gem 'yard', '~> 0.9'
|
|
15
|
+
end
|
data/LICENSE
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
Copyright (c) 2008-2016, Ruby FFI project contributors
|
|
2
|
+
All rights reserved.
|
|
3
|
+
|
|
4
|
+
Redistribution and use in source and binary forms, with or without
|
|
5
|
+
modification, are permitted provided that the following conditions are met:
|
|
6
|
+
* Redistributions of source code must retain the above copyright
|
|
7
|
+
notice, this list of conditions and the following disclaimer.
|
|
8
|
+
* Redistributions in binary form must reproduce the above copyright
|
|
9
|
+
notice, this list of conditions and the following disclaimer in the
|
|
10
|
+
documentation and/or other materials provided with the distribution.
|
|
11
|
+
* Neither the name of the Ruby FFI project nor the
|
|
12
|
+
names of its contributors may be used to endorse or promote products
|
|
13
|
+
derived from this software without specific prior written permission.
|
|
14
|
+
|
|
15
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
16
|
+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
17
|
+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
18
|
+
DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
|
|
19
|
+
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
|
20
|
+
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
21
|
+
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
|
22
|
+
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
23
|
+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
24
|
+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
data/LICENSE.SPECS
ADDED
|
@@ -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/README.md
ADDED
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
# ruby-ffi https://wiki.github.com/ffi/ffi [](https://travis-ci.org/ffi/ffi) [](https://ci.appveyor.com/project/larskanis/ffi-aofqa/branch/master)
|
|
2
|
+
|
|
3
|
+
## Description
|
|
4
|
+
|
|
5
|
+
Ruby-FFI is a ruby extension for programmatically loading dynamic
|
|
6
|
+
libraries, binding functions within them, and calling those functions
|
|
7
|
+
from Ruby code. Moreover, a Ruby-FFI extension works without changes
|
|
8
|
+
on Ruby and JRuby. [Discover why you should write your next extension
|
|
9
|
+
using Ruby-FFI](https://wiki.github.com/ffi/ffi/why-use-ffi).
|
|
10
|
+
|
|
11
|
+
## Features/problems
|
|
12
|
+
|
|
13
|
+
* Intuitive DSL
|
|
14
|
+
* Supports all C native types
|
|
15
|
+
* C structs (also nested), enums and global variables
|
|
16
|
+
* Callbacks from C to ruby
|
|
17
|
+
* Automatic garbage collection of native memory
|
|
18
|
+
|
|
19
|
+
## Synopsis
|
|
20
|
+
|
|
21
|
+
```ruby
|
|
22
|
+
require 'ffi'
|
|
23
|
+
|
|
24
|
+
module MyLib
|
|
25
|
+
extend FFI::Library
|
|
26
|
+
ffi_lib 'c'
|
|
27
|
+
attach_function :puts, [ :string ], :int
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
MyLib.puts 'Hello, World using libc!'
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
For less minimalistic and more sane examples you may look at:
|
|
34
|
+
|
|
35
|
+
* the samples/ folder
|
|
36
|
+
* the examples on the [wiki](https://wiki.github.com/ffi/ffi)
|
|
37
|
+
* the projects using FFI listed on this page (https://wiki.github.com/ffi/ffi/projects-using-ffi)
|
|
38
|
+
|
|
39
|
+
## Requirements
|
|
40
|
+
|
|
41
|
+
You need a sane building environment in order to compile the extension.
|
|
42
|
+
At a minimum, you will need:
|
|
43
|
+
* A C compiler (e.g. Xcode on OSX, gcc on everything else)
|
|
44
|
+
* libffi development library - this is commonly in the libffi-dev or libffi-devel
|
|
45
|
+
|
|
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.
|
|
47
|
+
|
|
48
|
+
## Installation
|
|
49
|
+
|
|
50
|
+
From rubygems:
|
|
51
|
+
|
|
52
|
+
[sudo] gem install ffi
|
|
53
|
+
|
|
54
|
+
or from the git repository on github:
|
|
55
|
+
|
|
56
|
+
git clone git://github.com/ffi/ffi.git
|
|
57
|
+
git submodule update --init --recursive
|
|
58
|
+
cd ffi
|
|
59
|
+
rake install
|
|
60
|
+
|
|
61
|
+
## License
|
|
62
|
+
|
|
63
|
+
The ffi library is covered by the BSD license, also see the LICENSE file.
|
|
64
|
+
The specs are shared with Rubyspec and are licensed by the same license
|
|
65
|
+
as Rubyspec, see the LICENSE.SPECS file.
|
|
66
|
+
|
|
67
|
+
## Credits
|
|
68
|
+
|
|
69
|
+
The following people have submitted code, bug reports, or otherwise contributed to the success of this project:
|
|
70
|
+
|
|
71
|
+
* Alban Peignier <alban.peignier@free.fr>
|
|
72
|
+
* Aman Gupta <aman@tmm1.net>
|
|
73
|
+
* Andrea Fazzi <andrea.fazzi@alcacoop.it>
|
|
74
|
+
* Andreas Niederl <rico32@gmx.net>
|
|
75
|
+
* Andrew Cholakian <andrew@andrewvc.com>
|
|
76
|
+
* Antonio Terceiro <terceiro@softwarelivre.org>
|
|
77
|
+
* Brian Candler <B.Candler@pobox.com>
|
|
78
|
+
* Brian D. Burns <burns180@gmail.com>
|
|
79
|
+
* Bryan Kearney <bkearney@redhat.com>
|
|
80
|
+
* Charlie Savage <cfis@zerista.com>
|
|
81
|
+
* Chikanaga Tomoyuki <nagachika00@gmail.com>
|
|
82
|
+
* Hongli Lai <hongli@phusion.nl>
|
|
83
|
+
* Ian MacLeod <ian@nevir.net>
|
|
84
|
+
* Jake Douglas <jake@shiftedlabs.com>
|
|
85
|
+
* Jean-Dominique Morani <jdmorani@mac.com>
|
|
86
|
+
* Jeremy Hinegardner <jeremy@hinegardner.org>
|
|
87
|
+
* Jesús García Sáez <blaxter@gmail.com>
|
|
88
|
+
* Joe Khoobyar <joe@ankhcraft.com>
|
|
89
|
+
* Jurij Smakov <jurij@wooyd.org>
|
|
90
|
+
* KISHIMOTO, Makoto <ksmakoto@dd.iij4u.or.jp>
|
|
91
|
+
* Kim Burgestrand <kim@burgestrand.se>
|
|
92
|
+
* Lars Kanis <kanis@comcard.de>
|
|
93
|
+
* Luc Heinrich <luc@honk-honk.com>
|
|
94
|
+
* Luis Lavena <luislavena@gmail.com>
|
|
95
|
+
* Matijs van Zuijlen <matijs@matijs.net>
|
|
96
|
+
* Matthew King <automatthew@gmail.com>
|
|
97
|
+
* Mike Dalessio <mike.dalessio@gmail.com>
|
|
98
|
+
* NARUSE, Yui <naruse@airemix.jp>
|
|
99
|
+
* Park Heesob <phasis@gmail.com>
|
|
100
|
+
* Shin Yee <shinyee@speedgocomputing.com>
|
|
101
|
+
* Stephen Bannasch <stephen.bannasch@gmail.com>
|
|
102
|
+
* Suraj N. Kurapati <sunaku@gmail.com>
|
|
103
|
+
* Sylvain Daubert <sylvain.daubert@laposte.net>
|
|
104
|
+
* Victor Costan
|
|
105
|
+
* beoran@gmail.com
|
|
106
|
+
* ctide <christide@christide.com>
|
|
107
|
+
* emboss <Martin.Bosslet@googlemail.com>
|
|
108
|
+
* hobophobe <unusualtears@gmail.com>
|
|
109
|
+
* meh <meh@paranoici.org>
|
|
110
|
+
* postmodern <postmodern.mod3@gmail.com>
|
|
111
|
+
* wycats@gmail.com <wycats@gmail.com>
|
|
112
|
+
* Wayne Meissner <wmeissner@gmail.com>
|
data/Rakefile
ADDED
|
@@ -0,0 +1,268 @@
|
|
|
1
|
+
require 'rubygems/tasks'
|
|
2
|
+
require 'rbconfig'
|
|
3
|
+
require 'rake/clean'
|
|
4
|
+
require File.expand_path("./lib/ffi/version")
|
|
5
|
+
|
|
6
|
+
USE_RAKE_COMPILER = (RUBY_PLATFORM =~ /java/) ? false : true
|
|
7
|
+
if USE_RAKE_COMPILER
|
|
8
|
+
require 'rake/extensiontask'
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
require 'date'
|
|
12
|
+
require 'fileutils'
|
|
13
|
+
require 'rbconfig'
|
|
14
|
+
require 'rspec/core/rake_task'
|
|
15
|
+
require 'rubygems/package_task'
|
|
16
|
+
|
|
17
|
+
LIBEXT = case RbConfig::CONFIG['host_os'].downcase
|
|
18
|
+
when /darwin/
|
|
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
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
GMAKE = which('gmake').nil? ? 'make' : 'gmake'
|
|
80
|
+
|
|
81
|
+
LIBTEST = "build/libtest.#{LIBEXT}"
|
|
82
|
+
BUILD_DIR = "build"
|
|
83
|
+
BUILD_EXT_DIR = File.join(BUILD_DIR, "#{RbConfig::CONFIG['arch']}", 'ffi_c', RUBY_VERSION)
|
|
84
|
+
|
|
85
|
+
def gem_spec
|
|
86
|
+
@gem_spec ||= Gem::Specification.load('ffi.gemspec')
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
TEST_DEPS = [ LIBTEST ]
|
|
90
|
+
if RUBY_PLATFORM == "java"
|
|
91
|
+
RSpec::Core::RakeTask.new(:spec) do |config|
|
|
92
|
+
config.rspec_opts = YAML.load_file 'spec/spec.opts'
|
|
93
|
+
end
|
|
94
|
+
else
|
|
95
|
+
RSpec::Core::RakeTask.new(:spec => :compile) do |config|
|
|
96
|
+
config.rspec_opts = YAML.load_file 'spec/spec.opts'
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
TEST_DEPS.unshift :compile
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
desc "Build all packages"
|
|
103
|
+
task :package => %w[ gem:java gem:windows ]
|
|
104
|
+
|
|
105
|
+
CLOBBER.include 'lib/ffi/types.conf'
|
|
106
|
+
CLOBBER.include 'pkg'
|
|
107
|
+
CLOBBER.include 'log'
|
|
108
|
+
|
|
109
|
+
CLEAN.include 'build'
|
|
110
|
+
CLEAN.include 'conftest.dSYM'
|
|
111
|
+
CLEAN.include 'spec/ffi/fixtures/libtest.{dylib,so,dll}'
|
|
112
|
+
CLEAN.include 'spec/ffi/fixtures/*.o'
|
|
113
|
+
CLEAN.include "pkg/ffi-*-{mingw32,java}"
|
|
114
|
+
CLEAN.include 'lib/1.*'
|
|
115
|
+
CLEAN.include 'lib/2.*'
|
|
116
|
+
CLEAN.include 'bin'
|
|
117
|
+
|
|
118
|
+
task :distclean => :clobber
|
|
119
|
+
|
|
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
|
+
desc "Test the extension"
|
|
130
|
+
task :test => [ :spec ]
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
namespace :bench do
|
|
134
|
+
ITER = ENV['ITER'] ? ENV['ITER'].to_i : 100000
|
|
135
|
+
bench_libs = "-Ilib -I#{BUILD_DIR}" unless RUBY_PLATFORM == "java"
|
|
136
|
+
bench_files = Dir["bench/bench_*.rb"].reject { |f| f == "bench_helper.rb" }
|
|
137
|
+
bench_files.each do |bench|
|
|
138
|
+
task File.basename(bench, ".rb")[6..-1] => TEST_DEPS do
|
|
139
|
+
sh %{#{Gem.ruby} #{bench_libs} #{bench} #{ITER}}
|
|
140
|
+
end
|
|
141
|
+
end
|
|
142
|
+
task :all => TEST_DEPS do
|
|
143
|
+
bench_files.each do |bench|
|
|
144
|
+
sh %{#{Gem.ruby} #{bench_libs} #{bench}}
|
|
145
|
+
end
|
|
146
|
+
end
|
|
147
|
+
end
|
|
148
|
+
|
|
149
|
+
task 'spec:run' => TEST_DEPS
|
|
150
|
+
task 'spec:specdoc' => TEST_DEPS
|
|
151
|
+
|
|
152
|
+
task :default => :spec
|
|
153
|
+
|
|
154
|
+
namespace 'java' do
|
|
155
|
+
|
|
156
|
+
java_gem_spec = Gem::Specification.new do |s|
|
|
157
|
+
s.name = gem_spec.name
|
|
158
|
+
s.version = gem_spec.version
|
|
159
|
+
s.author = gem_spec.author
|
|
160
|
+
s.email = gem_spec.email
|
|
161
|
+
s.homepage = gem_spec.homepage
|
|
162
|
+
s.summary = gem_spec.summary
|
|
163
|
+
s.description = gem_spec.description
|
|
164
|
+
s.files = %w(LICENSE COPYING README.md CHANGELOG.md Rakefile)
|
|
165
|
+
s.license = gem_spec.license
|
|
166
|
+
s.platform = 'java'
|
|
167
|
+
end
|
|
168
|
+
|
|
169
|
+
Gem::PackageTask.new(java_gem_spec) do |pkg|
|
|
170
|
+
pkg.need_zip = true
|
|
171
|
+
pkg.need_tar = true
|
|
172
|
+
pkg.package_dir = 'pkg'
|
|
173
|
+
end
|
|
174
|
+
end
|
|
175
|
+
|
|
176
|
+
task 'gem:java' => 'java:gem'
|
|
177
|
+
|
|
178
|
+
|
|
179
|
+
if USE_RAKE_COMPILER
|
|
180
|
+
Rake::ExtensionTask.new('ffi_c', gem_spec) do |ext|
|
|
181
|
+
ext.name = 'ffi_c' # indicate the name of the extension.
|
|
182
|
+
# ext.lib_dir = BUILD_DIR # put binaries into this folder.
|
|
183
|
+
ext.tmp_dir = BUILD_DIR # temporary folder used during compilation.
|
|
184
|
+
ext.cross_compile = true # enable cross compilation (requires cross compile toolchain)
|
|
185
|
+
ext.cross_platform = %w[i386-mingw32 x64-mingw32] # forces the Windows platform instead of the default one
|
|
186
|
+
ext.cross_compiling do |spec|
|
|
187
|
+
spec.files.reject! { |path| File.fnmatch?('ext/*', path) }
|
|
188
|
+
end
|
|
189
|
+
end
|
|
190
|
+
|
|
191
|
+
# To reduce the gem file size strip mingw32 dlls before packaging
|
|
192
|
+
ENV['RUBY_CC_VERSION'].to_s.split(':').each do |ruby_version|
|
|
193
|
+
task "build/i386-mingw32/stage/lib/#{ruby_version[/^\d+\.\d+/]}/ffi_c.so" do |t|
|
|
194
|
+
sh "i686-w64-mingw32-strip -S build/i386-mingw32/stage/lib/#{ruby_version[/^\d+\.\d+/]}/ffi_c.so"
|
|
195
|
+
end
|
|
196
|
+
|
|
197
|
+
task "build/x64-mingw32/stage/lib/#{ruby_version[/^\d+\.\d+/]}/ffi_c.so" do |t|
|
|
198
|
+
sh "x86_64-w64-mingw32-strip -S build/x64-mingw32/stage/lib/#{ruby_version[/^\d+\.\d+/]}/ffi_c.so"
|
|
199
|
+
end
|
|
200
|
+
end
|
|
201
|
+
end
|
|
202
|
+
|
|
203
|
+
desc "build a windows gem without all the ceremony"
|
|
204
|
+
task "gem:windows" do
|
|
205
|
+
require "rake_compiler_dock"
|
|
206
|
+
sh "bundle package"
|
|
207
|
+
RakeCompilerDock.sh "sudo apt-get update && sudo apt-get install -y libltdl-dev && bundle --local && rake cross native gem MAKE='nice make -j`nproc`'"
|
|
208
|
+
end
|
|
209
|
+
|
|
210
|
+
directory "ext/ffi_c/libffi"
|
|
211
|
+
file "ext/ffi_c/libffi/autogen.sh" => "ext/ffi_c/libffi" do
|
|
212
|
+
warn "Downloading libffi ..."
|
|
213
|
+
sh "git submodule update --init --recursive"
|
|
214
|
+
end
|
|
215
|
+
|
|
216
|
+
LIBFFI_GIT_FILES = `git --git-dir ext/ffi_c/libffi/.git ls-files -z`.split("\x0")
|
|
217
|
+
|
|
218
|
+
# Generate files in gemspec but not in libffi's git repo by running autogen.sh
|
|
219
|
+
gem_spec.files.select do |f|
|
|
220
|
+
f =~ /ext\/ffi_c\/libffi\/(.*)/ && !LIBFFI_GIT_FILES.include?($1)
|
|
221
|
+
end.each do |f|
|
|
222
|
+
file f => "ext/ffi_c/libffi/autogen.sh" do
|
|
223
|
+
chdir "ext/ffi_c/libffi" do
|
|
224
|
+
sh "sh ./autogen.sh"
|
|
225
|
+
end
|
|
226
|
+
touch f
|
|
227
|
+
if gem_spec.files != Gem::Specification.load('./ffi.gemspec').files
|
|
228
|
+
warn "gemspec files have changed -> Please restart rake!"
|
|
229
|
+
exit 1
|
|
230
|
+
end
|
|
231
|
+
end
|
|
232
|
+
end
|
|
233
|
+
|
|
234
|
+
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), 'lib')
|
|
235
|
+
require 'ffi/platform'
|
|
236
|
+
types_conf = File.expand_path(File.join(FFI::Platform::CONF_DIR, 'types.conf'))
|
|
237
|
+
logfile = File.join(File.dirname(__FILE__), 'types_log')
|
|
238
|
+
|
|
239
|
+
file types_conf => File.join("lib", "ffi", "version.rb") do |task|
|
|
240
|
+
require 'fileutils'
|
|
241
|
+
require 'ffi/tools/types_generator'
|
|
242
|
+
options = {}
|
|
243
|
+
FileUtils.mkdir_p(File.dirname(task.name), { :mode => 0755 })
|
|
244
|
+
File.open(task.name, File::CREAT|File::TRUNC|File::RDWR, 0644) do |f|
|
|
245
|
+
f.puts FFI::TypesGenerator.generate(options)
|
|
246
|
+
end
|
|
247
|
+
File.open(logfile, 'w') do |log|
|
|
248
|
+
log.puts(types_conf)
|
|
249
|
+
end
|
|
250
|
+
end
|
|
251
|
+
|
|
252
|
+
task :types_conf => types_conf do
|
|
253
|
+
end
|
|
254
|
+
|
|
255
|
+
Gem::Tasks.new do |t|
|
|
256
|
+
t.scm.tag.format = '%s'
|
|
257
|
+
end
|
|
258
|
+
|
|
259
|
+
begin
|
|
260
|
+
require 'yard'
|
|
261
|
+
|
|
262
|
+
namespace :doc do
|
|
263
|
+
YARD::Rake::YardocTask.new do |yard|
|
|
264
|
+
end
|
|
265
|
+
end
|
|
266
|
+
rescue LoadError
|
|
267
|
+
warn "[warn] YARD unavailable"
|
|
268
|
+
end
|