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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
| //
| //
| // Build the library
| //
| //
|
| cc_defaults {
| name: "sqlite-minimal-defaults",
| host_supported: true,
|
| // static analysis is too slow on these huge files.
| tidy_checks: [
| "-clang-analyzer-*",
| ],
|
| // NOTE the following flags,
| // SQLITE_TEMP_STORE=3 causes all TEMP files to go into RAM. and thats the behavior we want
| // SQLITE_ENABLE_FTS3 enables usage of FTS3 - NOT FTS1 or 2.
| // SQLITE_DEFAULT_AUTOVACUUM=1 causes the databases to be subject to auto-vacuum
| cflags: [
| "-DNDEBUG=1",
| "-DHAVE_USLEEP=1",
| "-DSQLITE_HAVE_ISNAN",
| "-DSQLITE_DEFAULT_JOURNAL_SIZE_LIMIT=1048576",
| "-DSQLITE_THREADSAFE=2",
| "-DSQLITE_TEMP_STORE=3",
| "-DSQLITE_POWERSAFE_OVERWRITE=1",
| "-DSQLITE_DEFAULT_FILE_FORMAT=4",
| "-DSQLITE_DEFAULT_AUTOVACUUM=1",
| "-DSQLITE_ENABLE_MEMORY_MANAGEMENT=1",
| "-DSQLITE_ENABLE_FTS3",
| "-DSQLITE_ENABLE_FTS3_BACKWARDS",
| "-DSQLITE_ENABLE_FTS4",
| "-DSQLITE_OMIT_BUILTIN_TEST",
| "-DSQLITE_OMIT_COMPILEOPTION_DIAGS",
| "-DSQLITE_OMIT_LOAD_EXTENSION",
| "-DSQLITE_DEFAULT_FILE_PERMISSIONS=0600",
| "-DSQLITE_SECURE_DELETE",
| "-DSQLITE_ENABLE_BATCH_ATOMIC_WRITE",
| "-DBIONIC_IOCTL_NO_SIGNEDNESS_OVERLOAD",
| "-Wno-unused-parameter",
| "-Werror",
| ],
|
| target: {
| linux_glibc: {
| cflags: ["-DHAVE_POSIX_FALLOCATE=1"],
| },
| },
| }
|
| cc_defaults {
| name: "sqlite-defaults",
| defaults: ["sqlite-minimal-defaults"],
| target: {
| android: {
| cflags: [
| "-DUSE_PREAD64",
| "-Dfdatasync=fdatasync",
| "-DHAVE_MALLOC_H=1",
| "-DHAVE_MALLOC_USABLE_SIZE",
| ],
| },
| },
| }
|
| cc_library {
| name: "libsqlite",
| defaults: ["sqlite-defaults"],
| vendor_available: true,
| vndk: {
| enabled: true,
| },
|
| srcs: ["sqlite3.c"],
|
| target: {
| android: {
| shared_libs: [
| "libdl",
| "liblog",
| "libutils",
| "libandroidicu",
| ],
| cflags: ["-DSQLITE_ENABLE_ICU"],
|
| // include android specific methods
| whole_static_libs: ["libsqlite3_android"],
| },
| host: {
| static_libs: [
| "liblog",
| "libutils",
| ],
| },
| not_windows: {
| shared_libs: [
| "libandroidicu",
| ],
|
| // include android specific methods
| whole_static_libs: ["libsqlite3_android"],
| },
| windows: {
| enabled: true,
| },
| vendor: {
| cflags: ["-USQLITE_ENABLE_ICU"],
| exclude_shared_libs: ["libandroidicu"],
| },
| },
|
| export_include_dirs: ["."],
| }
|
| //
| //
| // Build the device command line tool sqlite3
| //
| //
|
| cc_binary {
| name: "sqlite3",
| defaults: ["sqlite-defaults"],
|
| srcs: ["shell.c"],
|
| target: {
| android: {
| shared_libs: [
| "libsqlite",
| "libandroidicu",
| "liblog",
| "libutils",
| ],
| },
| host: {
| cflags: ["-DNO_ANDROID_FUNCS=1"],
| static_libs: [
| "libsqlite",
| // sqlite3MemsysAlarm uses LOG()
| "liblog",
| ],
| },
|
| windows: {
| enabled: true,
| },
| },
| }
|
| // Build a minimal version of sqlite3 without any android specific
| // features against the NDK. This is used by libcore's JDBC related
| // unit tests.
| cc_library_static {
| name: "libsqlite_static_minimal",
| defaults: ["sqlite-minimal-defaults"],
| srcs: ["sqlite3.c"],
| sdk_version: "23",
| export_include_dirs: ["."],
| }
|
|