module Geos::FFIGeos

Constants

FFI_LAYOUT

Public Class Methods

find_lib(lib) click to toggle source
# File lib/ffi-geos.rb, line 73
def self.find_lib(lib)
  if ENV['GEOS_LIBRARY_PATH'] && File.file?(ENV['GEOS_LIBRARY_PATH'])
    ENV['GEOS_LIBRARY_PATH']
  else
    Dir.glob(search_paths.map do |path|
      File.expand_path(File.join(path, "#{lib}.#{FFI::Platform::LIBSUFFIX}{,.?}"))
    end).first
  end
end
geos_library_path() click to toggle source
# File lib/ffi-geos.rb, line 83
def self.geos_library_path
  @geos_library_path ||=
    # On MingW the libraries have version numbers
    find_lib('{lib,}geos_c{,-?}')
end
geos_library_paths() click to toggle source

For backwards compatibility with older ffi-geos versions where this used to return an Array.

# File lib/ffi-geos.rb, line 91
def self.geos_library_paths
  [geos_library_path]
end
search_paths() click to toggle source
# File lib/ffi-geos.rb, line 56
def self.search_paths
  @search_paths ||=
    if ENV['GEOS_LIBRARY_PATH']
      [ENV['GEOS_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