Module: Kreuzberg::SetupLibPath

Defined in:
lib/kreuzberg/setup_lib_path.rb

Class Method Summary collapse

Class Method Details

.configureObject



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/kreuzberg/setup_lib_path.rb', line 10

def configure
  lib_dir = File.expand_path('..', __dir__ || '.')
  host_os = RbConfig::CONFIG['host_os']

  case host_os
  when /darwin/
    prepend_env('DYLD_LIBRARY_PATH', lib_dir)
    prepend_env('DYLD_FALLBACK_LIBRARY_PATH', "#{lib_dir}:/usr/local/lib:/usr/lib")
    fix_macos_install_name(lib_dir)
  when /linux/
    prepend_env('LD_LIBRARY_PATH', lib_dir)
  when /mswin|mingw|cygwin/
    # Windows uses PATH to locate DLLs
    prepend_env('PATH', lib_dir, separator: ';')
    # Also check common locations for PDFium on Windows
    setup_windows_library_paths(lib_dir)
  end
end