-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathextconf.rb
More file actions
86 lines (77 loc) · 2.97 KB
/
extconf.rb
File metadata and controls
86 lines (77 loc) · 2.97 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
require 'mkmf'
require 'rbconfig'
# used by the ext:build_win-1.x.x tasks, really no one else but jeremy should be
# using this hack
$ruby = ARGV.shift if ARGV[0]
# make available table and column meta data api
$CFLAGS += " -DSQLITE_ENABLE_BYTECODE_VTAB=1"
$CFLAGS += " -DSQLITE_ENABLE_COLUMN_METADATA=1"
$CFLAGS += " -DSQLITE_ENABLE_DBSTAT_VTAB=1"
$CFLAGS += " -DSQLITE_ENABLE_DBPAGE_VTAB=1"
$CFLAGS += " -DSQLITE_ENABLE_EXPLAIN_COMMENTS=1"
$CFLAGS += " -DSQLITE_ENABLE_FTS3=1"
$CFLAGS += " -DSQLITE_ENABLE_FTS3_PARENTHESIS=1"
$CFLAGS += " -DSQLITE_ENABLE_FTS4=1"
$CFLAGS += " -DSQLITE_ENABLE_FTS5=1"
$CFLAGS += " -DSQLITE_ENABLE_GEOPOLY=1"
$CFLAGS += " -DSQLITE_ENABLE_MATH_FUNCTIONS=1"
$CFLAGS += " -DSQLITE_ENABLE_MEMORY_MANAGEMENT=1"
$CFLAGS += " -DSQLITE_ENABLE_NORMALIZE=1"
$CFLAGS += " -DSQLITE_ENABLE_NULL_TRIM=1"
$CFLAGS += " -DSQLITE_ENABLE_PREUPDATE_HOOK=1"
$CFLAGS ++ " -DSQLITE_EANBLE_QPSG=1"
$CFLAGS += " -DSQLITE_ENABLE_RBU=1"
$CFLAGS += " -DSQLITE_ENABLE_RTREE=1"
$CFLAGS += " -DSQLITE_ENABLE_SESSION=1"
# https://github.com/libsql/libsql/issues/144
# $CFLAGS += " -DSQLITE_ENABLE_SNAPSHOT=1"
$CFLAGS += " -DSQLITE_ENABLE_STMTVTAB=1"
$CFLAGS += " -DSQLITE_ENABLE_STAT4=1"
$CFLAGS += " -DSQLITE_ENABLE_UNLOCK_NOTIFY=1"
$CFLAGS += " -DSQLITE_ENABLE_SOUNDEX=1"
$CFLAGS += " -DSQLITE_USE_ALLOCA=1"
$CFLAGS += " -DSQLITE_OMIT_DEPRECATED=1"
# we compile sqlite the same way that the installation of ruby is compiled.
if RbConfig::MAKEFILE_CONFIG['configure_args'].include?( "--enable-pthread" ) then
$CFLAGS += " -DSQLITE_THREADSAFE=1"
else
$CFLAGS += " -DSQLITE_THREADSAFE=0"
end
# remove the -g flags if it exists
%w[ -ggdb\\d* -g\\d* ].each do |debug|
$CFLAGS = $CFLAGS.gsub(/\s#{debug}\b/,'')
RbConfig::MAKEFILE_CONFIG['debugflags'] = RbConfig::MAKEFILE_CONFIG['debugflags'].gsub(/\s#{debug}\b/,'') if RbConfig::MAKEFILE_CONFIG['debugflags']
end
ignoreable_warnings = %w[ write-strings ]
ignore_by_compiler = {
"clang" => %w[
empty-body
declaration-after-statement
incompatible-pointer-types-discards-qualifiers
shorten-64-to-32
sign-compare
unused-const-variable
unused-variable
unused-but-set-variable
undef
],
"gcc" => %w[
declaration-after-statement
implicit-function-declaration
unused-variable
unused-but-set-variable
maybe-uninitialized
old-style-definition
undef
]
}
if extras = ignore_by_compiler[RbConfig::MAKEFILE_CONFIG["CC"]] then
ignoreable_warnings.concat(extras)
end
ignoreable_warnings.each do |warning|
$CFLAGS = $CFLAGS.gsub(/-W#{warning}/,'')
RbConfig::MAKEFILE_CONFIG['warnflags'] = RbConfig::MAKEFILE_CONFIG['warnflags'].gsub(/-W#{warning}/,'') if RbConfig::MAKEFILE_CONFIG['warnflags']
$CFLAGS += " -Wno-#{warning}"
end
subdir = RUBY_VERSION.sub(/\.\d$/,'')
create_makefile("libsql/#{subdir}/libsql_ext")