1 // 2 // 3 // Build the library 4 // 5 // 6 7 cc_defaults { 8 name: "sqlite-minimal-defaults", 9 host_supported: true, 10 11 // static analysis is too slow on these huge files. 12 tidy_checks: [ 13 "-clang-analyzer-*", 14 ], 15 16 // NOTE the following flags, 17 // SQLITE_TEMP_STORE=3 causes all TEMP files to go into RAM. and thats the behavior we want 18 // SQLITE_ENABLE_FTS3 enables usage of FTS3 - NOT FTS1 or 2. 19 // SQLITE_DEFAULT_AUTOVACUUM=1 causes the databases to be subject to auto-vacuum 20 cflags: [ 21 "-DNDEBUG=1", 22 "-DHAVE_USLEEP=1", 23 "-DSQLITE_HAVE_ISNAN", 24 "-DSQLITE_DEFAULT_JOURNAL_SIZE_LIMIT=1048576", 25 "-DSQLITE_THREADSAFE=2", 26 "-DSQLITE_TEMP_STORE=3", 27 "-DSQLITE_POWERSAFE_OVERWRITE=1", 28 "-DSQLITE_DEFAULT_FILE_FORMAT=4", 29 "-DSQLITE_DEFAULT_AUTOVACUUM=1", 30 "-DSQLITE_ENABLE_MEMORY_MANAGEMENT=1", 31 "-DSQLITE_ENABLE_FTS3", 32 "-DSQLITE_ENABLE_FTS3_BACKWARDS", 33 "-DSQLITE_ENABLE_FTS4", 34 "-DSQLITE_OMIT_BUILTIN_TEST", 35 "-DSQLITE_OMIT_COMPILEOPTION_DIAGS", 36 "-DSQLITE_OMIT_LOAD_EXTENSION", 37 "-DSQLITE_DEFAULT_FILE_PERMISSIONS=0600", 38 "-DSQLITE_SECURE_DELETE", 39 "-DSQLITE_ENABLE_BATCH_ATOMIC_WRITE", 40 "-Wno-unused-parameter", 41 "-Werror", 42 ], 43 44 target: { 45 linux: { 46 cflags: ["-DHAVE_POSIX_FALLOCATE=1"], 47 }, 48 }, 49 } 50 51 cc_defaults { 52 name: "sqlite-defaults", 53 defaults: ["sqlite-minimal-defaults"], 54 target: { 55 android: { 56 cflags: [ 57 "-DUSE_PREAD64", 58 "-Dfdatasync=fdatasync", 59 "-DHAVE_MALLOC_H=1", 60 "-DHAVE_MALLOC_USABLE_SIZE", 61 ], 62 }, 63 }, 64 } 65 66 cc_library { 67 name: "libsqlite", 68 defaults: ["sqlite-defaults"], 69 vendor_available: true, 70 vndk: { 71 enabled: true, 72 }, 73 74 srcs: ["sqlite3.c"], 75 76 target: { 77 android: { 78 shared_libs: [ 79 "libdl", 80 "liblog", 81 "libutils", 82 "libicuuc", 83 "libicui18n", 84 ], 85 cflags: ["-DSQLITE_ENABLE_ICU"], 86 87 // include android specific methods 88 whole_static_libs: ["libsqlite3_android"], 89 }, 90 host: { 91 static_libs: [ 92 "liblog", 93 "libutils", 94 ], 95 }, 96 not_windows: { 97 shared_libs: [ 98 "libicuuc", 99 "libicui18n", 100 ], 101 102 // include android specific methods 103 whole_static_libs: ["libsqlite3_android"], 104 }, 105 windows: { 106 enabled: true, 107 }, 108 vendor: { 109 cflags: ["-USQLITE_ENABLE_ICU"], 110 exclude_shared_libs: ["libicuuc", "libicui18n"], 111 }, 112 }, 113 114 export_include_dirs: ["."], 115 } 116 117 // 118 // 119 // Build the device command line tool sqlite3 120 // 121 // 122 123 cc_binary { 124 name: "sqlite3", 125 defaults: ["sqlite-defaults"], 126 127 srcs: ["shell.c"], 128 129 tags: ["debug"], 130 131 target: { 132 android: { 133 shared_libs: [ 134 "libsqlite", 135 "libicuuc", 136 "libicui18n", 137 "liblog", 138 "libutils", 139 ], 140 static_libs: [ 141 "libicuandroid_utils", 142 ], 143 }, 144 host: { 145 cflags: ["-DNO_ANDROID_FUNCS=1"], 146 static_libs: [ 147 "libsqlite", 148 // sqlite3MemsysAlarm uses LOG() 149 "liblog", 150 ], 151 }, 152 not_windows: { 153 host_ldlibs: [ 154 "-lpthread", 155 "-ldl", 156 ], 157 }, 158 159 windows: { 160 enabled: true, 161 }, 162 }, 163 } 164 165 // Build a minimal version of sqlite3 without any android specific 166 // features against the NDK. This is used by libcore's JDBC related 167 // unit tests. 168 cc_library_static { 169 name: "libsqlite_static_minimal", 170 defaults: ["sqlite-minimal-defaults"], 171 srcs: ["sqlite3.c"], 172 sdk_version: "23", 173 export_include_dirs: ["."], 174 } 175