Module: Confium::Lib
- Extended by:
- FFI::Library
- Defined in:
- lib/confium/lib.rb
Constant Summary collapse
- FFI_LAYOUT =
{ cfm_create: [ %i[pointer], :uint32 ], cfm_destroy: [ %i[pointer], :uint32 ], cfm_plugin_load: [ %i[pointer string string pointer pointer], :uint32 ], cfm_hash_create: [ %i[pointer pointer pointer pointer pointer pointer], :uint32 ], cfm_hash_output_size: [ %i[pointer pointer], :uint32 ], cfm_hash_block_size: [ %i[pointer pointer], :uint32 ], cfm_hash_update: [ %i[pointer pointer uint32], :uint32 ], cfm_hash_reset: [ %i[pointer], :uint32 ], cfm_hash_clone: [ %i[pointer pointer], :uint32 ], cfm_hash_finalize: [ %i[pointer pointer uint32], :uint32 ], cfm_hash_destroy: [ %i[pointer], :void ], }.freeze
Class Method Summary collapse
Class Method Details
.confium_library_path ⇒ Object
36 37 38 39 40 |
# File 'lib/confium/lib.rb', line 36 def self.confium_library_path @confium_library_path ||= \ # On MingW the libraries have version numbers find_lib('{lib,}confium{,-?}') end |
.find_lib(lib) ⇒ Object
26 27 28 29 30 31 32 33 34 |
# File 'lib/confium/lib.rb', line 26 def self.find_lib(lib) if ENV['CONFIUM_LIBRARY_PATH'] && File.file?(ENV['CONFIUM_LIBRARY_PATH']) ENV['CONFIUM_LIBRARY_PATH'] else Dir.glob(search_paths.map do |path| File.(File.join(path, "#{lib}.#{FFI::Platform::LIBSUFFIX}{,.?}")) end).first end end |
.search_paths ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/confium/lib.rb', line 9 def self.search_paths @search_paths ||= \ if ENV['CONFIUM_LIBRARY_PATH'] [ENV['CONFIUM_LIBRARY_PATH']] elsif FFI::Platform::IS_WINDOWS ENV['PATH'].split(File::PATH_SEPARATOR) else [ '/usr/local/{lib64,lib}', '/opt/local/{lib64,lib}', '/usr/{lib64,lib}', '/opt/homebrew/lib', '/usr/lib/{x86_64,i386,aarch64}-linux-gnu' ] end end |