summaryrefslogtreecommitdiff
path: root/lib/ffi_yajl/ext.rb
diff options
context:
space:
mode:
authorLamont Granquist <lamont@scriptkiddie.org>2015-03-24 12:17:56 -0700
committerLamont Granquist <lamont@scriptkiddie.org>2015-03-24 12:17:56 -0700
commit55f3cb72c7378336451b27ff97541c1f67f03d43 (patch)
treeb2e097410b0f840bf5e5cc48e933e8b4e8e422e1 /lib/ffi_yajl/ext.rb
parentb4ad8c022fc77736845805436136e4fc8a41b892 (diff)
downloadffi-yajl-55f3cb72c7378336451b27ff97541c1f67f03d43.tar.gz
Remove ffi gem as a hard dependency
Copies the algorithm out of FFI.map_library_name into the FFI_Yajl#map_library_name function so that when we're loading up the C extension we don't need to also slurp in the ffi gem just to run that. The ffi gem is moved to a hard dependency of only the jruby version of the gem, and its a development dependency for the other ruby VMs (so rake spec will work against the ffi library), but its an optional library to install to make the ffi library work on VMs that support C extensions (MRI, RBX).
Diffstat (limited to 'lib/ffi_yajl/ext.rb')
-rw-r--r--lib/ffi_yajl/ext.rb14
1 files changed, 3 insertions, 11 deletions
diff --git a/lib/ffi_yajl/ext.rb b/lib/ffi_yajl/ext.rb
index 5784023..bc4d410 100644
--- a/lib/ffi_yajl/ext.rb
+++ b/lib/ffi_yajl/ext.rb
@@ -2,22 +2,14 @@ require 'rubygems'
require 'ffi_yajl/encoder'
require 'ffi_yajl/parser'
-require 'ffi'
require 'libyajl2'
-require 'ffi_yajl/platform'
+require 'ffi_yajl/map_library_name'
module FFI_Yajl
- extend FFI_Yajl::Platform
+ extend FFI_Yajl::MapLibraryName
- # FIXME: DRY with ffi_yajl/ffi.rb
- # FIXME: extract map_library_name from FFI and stop requiring it at the top level
- # so that the C-library can be installed without FFI
- libname = ::FFI.map_library_name("yajl")
- # awful windows patch, but there is an open issue to entirely replace FFI.map_library_name already
- libname = "libyajl.so" if windows?
+ libname = map_library_name
libpath = File.expand_path(File.join(Libyajl2.opt_path, libname))
- libpath.gsub!(/dylib/, 'bundle')
- libpath = ::FFI.map_library_name("yajl") unless File.exist?(libpath)
#
# FFS, what exactly was so wrong with DL.dlopen that ruby had to get rid of it???