1// 2// 3// Build the library 4// 5// 6 7package { 8 default_applicable_licenses: ["external_sqlite_dist_license"], 9} 10 11// Added automatically by a large-scale-change that took the approach of 12// 'apply every license found to every target'. While this makes sure we respect 13// every license restriction, it may not be entirely correct. 14// 15// e.g. GPL in an MIT project might only apply to the contrib/ directory. 16// 17// Please consider splitting the single license below into multiple licenses, 18// taking care not to lose any license_kind information, and overriding the 19// default license using the 'licenses: [...]' property on targets as needed. 20// 21// For unused files, consider creating a 'fileGroup' with "//visibility:private" 22// to attach the license to, and including a comment whether the files may be 23// used in the current project. 24// See: http://go/android-license-faq 25license { 26 name: "external_sqlite_dist_license", 27 visibility: [":__subpackages__"], 28 license_kinds: [ 29 "legacy_permissive", 30 "legacy_unencumbered", 31 ], 32 license_text: [ 33 "NOTICE", 34 ], 35} 36 37cc_defaults { 38 name: "sqlite-minimal-defaults", 39 host_supported: true, 40 41 // static analysis is too slow on these huge files. 42 tidy_checks: [ 43 "-clang-analyzer-*", 44 ], 45 46 // NOTE the following flags, 47 // SQLITE_TEMP_STORE=3 causes all TEMP files to go into RAM. and thats the behavior we want 48 // SQLITE_ENABLE_FTS3 enables usage of FTS3 - NOT FTS1 or 2. 49 // SQLITE_DEFAULT_AUTOVACUUM=1 causes the databases to be subject to auto-vacuum 50 cflags: [ 51 "-DNDEBUG=1", 52 "-DHAVE_USLEEP=1", 53 "-DSQLITE_HAVE_ISNAN", 54 "-DSQLITE_DEFAULT_JOURNAL_SIZE_LIMIT=1048576", 55 "-DSQLITE_THREADSAFE=2", 56 "-DSQLITE_TEMP_STORE=3", 57 "-DSQLITE_POWERSAFE_OVERWRITE=1", 58 "-DSQLITE_DEFAULT_FILE_FORMAT=4", 59 "-DSQLITE_DEFAULT_AUTOVACUUM=1", 60 "-DSQLITE_ENABLE_MEMORY_MANAGEMENT=1", 61 "-DSQLITE_ENABLE_FTS3", 62 "-DSQLITE_ENABLE_FTS3_BACKWARDS", 63 "-DSQLITE_ENABLE_FTS4", 64 "-DSQLITE_OMIT_BUILTIN_TEST", 65 "-DSQLITE_OMIT_COMPILEOPTION_DIAGS", 66 "-DSQLITE_OMIT_LOAD_EXTENSION", 67 "-DSQLITE_DEFAULT_FILE_PERMISSIONS=0600", 68 "-DSQLITE_SECURE_DELETE", 69 "-DSQLITE_ENABLE_BATCH_ATOMIC_WRITE", 70 "-DBIONIC_IOCTL_NO_SIGNEDNESS_OVERLOAD", 71 "-DSQLITE_DEFAULT_LEGACY_ALTER_TABLE", 72 "-Wno-unused-parameter", 73 "-Werror", 74 75 // Default value causes sqlite3_open_v2 to return error if DB is missing. 76 "-ftrivial-auto-var-init=pattern", 77 ], 78 79 target: { 80 linux_glibc: { 81 cflags: ["-DHAVE_POSIX_FALLOCATE=1"], 82 }, 83 }, 84} 85 86cc_defaults { 87 name: "sqlite-defaults", 88 defaults: ["sqlite-minimal-defaults"], 89 target: { 90 android: { 91 cflags: [ 92 "-DUSE_PREAD64", 93 "-Dfdatasync=fdatasync", 94 "-DHAVE_MALLOC_H=1", 95 "-DHAVE_MALLOC_USABLE_SIZE", 96 "-DSQLITE_ENABLE_DBSTAT_VTAB", 97 ], 98 }, 99 }, 100} 101 102cc_library { 103 name: "libsqlite", 104 defaults: ["sqlite-defaults"], 105 vendor_available: true, 106 native_bridge_supported: true, 107 vndk: { 108 enabled: true, 109 }, 110 111 srcs: ["sqlite3.c"], 112 113 target: { 114 android: { 115 shared_libs: [ 116 "libdl", 117 "liblog", 118 "libandroidicu", 119 ], 120 cflags: ["-DSQLITE_ENABLE_ICU"], 121 122 // include android specific methods 123 whole_static_libs: ["libsqlite3_android"], 124 }, 125 host: { 126 static_libs: [ 127 "liblog", 128 ], 129 }, 130 not_windows: { 131 shared_libs: [ 132 "libicui18n", 133 "libicuuc", 134 ], 135 136 // include android specific methods 137 whole_static_libs: ["libsqlite3_android"], 138 }, 139 windows: { 140 enabled: true, 141 }, 142 vendor: { 143 cflags: ["-USQLITE_ENABLE_ICU"], 144 exclude_shared_libs: ["libandroidicu"], 145 exclude_static_libs: ["libsqlite3_android"], 146 }, 147 }, 148 149 export_include_dirs: ["."], 150} 151 152// This static library is variant of libsqlite built without the ICU extension. 153// The library is supposed to be used in environments where the ICU extension 154// is not needed and the dependency to ICU (which is as large as 60+ MB) is not 155// desirable, like microdroid. 156cc_library_static { 157 name: "libsqlite_static_noicu", 158 defaults: ["sqlite-defaults"], 159 srcs: ["sqlite3.c"], 160 whole_static_libs: ["libsqlite3_android_noicu"], 161 // Not define SQLITE_ENABLE_ICU 162} 163 164// 165// 166// Build the device command line tool sqlite3 167// 168// 169 170cc_binary { 171 name: "sqlite3", 172 defaults: ["sqlite-defaults"], 173 174 srcs: ["shell.c"], 175 176 target: { 177 android: { 178 shared_libs: [ 179 "libsqlite", 180 "libandroidicu", 181 "liblog", 182 "libutils", 183 ], 184 }, 185 host: { 186 cflags: ["-DNO_ANDROID_FUNCS=1"], 187 static_libs: [ 188 "libsqlite", 189 // sqlite3MemsysAlarm uses LOG() 190 "liblog", 191 ], 192 }, 193 194 windows: { 195 enabled: true, 196 }, 197 }, 198} 199 200// Build a minimal version of sqlite3 without any android specific 201// features against the NDK. This is used by libcore's JDBC related 202// unit tests. 203cc_library_static { 204 name: "libsqlite_static_minimal", 205 defaults: ["sqlite-minimal-defaults"], 206 srcs: ["sqlite3.c"], 207 sdk_version: "23", 208 export_include_dirs: ["."], 209} 210