Top Level Namespace

Defined Under Namespace

Modules: DuckDB

Constant Summary collapse

DUCKDB_REQUIRED_VERSION =
'0.10.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
# 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

  raise_not_found_library(library, version)
end

#duckdb_library_name(library) ⇒ Object



42
43
44
# File 'ext/duckdb/extconf.rb', line 42

def duckdb_library_name(library)
  "lib#{library}.#{RbConfig::CONFIG['DLEXT']}"
end


46
47
48
49
50
51
52
53
54
# File 'ext/duckdb/extconf.rb', line 46

def print_message(msg)
  print <<~END_OF_MESSAGE

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

  END_OF_MESSAGE
end

#raise_not_found_library(library, version) ⇒ Object



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

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