Top Level Namespace

Defined Under Namespace

Modules: DuckDB

Constant Summary collapse

DUCKDB_REQUIRED_VERSION =
'0.9.0'

Instance Method Summary collapse

Instance Method Details

#check_duckdb_header(header, version) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'ext/duckdb/extconf.rb', line 7

def check_duckdb_header(header, version)
  found = find_header(
    header,
    '/opt/homebrew/include',
    '/opt/homebrew/opt/duckdb/include',
    '/opt/local/include'
  )
  return if found

  msg = "#{header} is not found. Install #{header} of duckdb >= #{version}."
  print_message(msg)
  raise msg
end

#check_duckdb_library(library, func, version) ⇒ Object



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'ext/duckdb/extconf.rb', line 21

def check_duckdb_library(library, func, version)
  found = find_library(
    library,
    func,
    '/opt/homebrew/lib',
    '/opt/homebrew/opt/duckdb/lib',
    '/opt/local/lib'
  )
  have_func(func, 'duckdb.h')
  return if found

  library_name = duckdb_library_name(library)
  msg = "#{library_name} is not found. Install #{library_name} of duckdb >= #{version}."
  print_message(msg)
  raise msg
end

#duckdb_library_name(library) ⇒ Object



38
39
40
# File 'ext/duckdb/extconf.rb', line 38

def duckdb_library_name(library)
  "lib#{library}.(so|dylib|dll)"
end


42
43
44
45
46
47
48
49
50
# File 'ext/duckdb/extconf.rb', line 42

def print_message(msg)
  print <<~END_OF_MESSAGE

    #{'*' * 80}
    #{msg}
    #{'*' * 80}

  END_OF_MESSAGE
end