| OLD | NEW |
| (Empty) |
| 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | |
| 2 # Use of this source code is governed by a BSD-style license that can be | |
| 3 # found in the LICENSE file. | |
| 4 | |
| 5 { | |
| 6 'variables': { | |
| 7 'use_system_sqlite%': 0, | |
| 8 'required_sqlite_version': '3.6.1', | |
| 9 }, | |
| 10 'target_defaults': { | |
| 11 'defines': [ | |
| 12 'SQLITE_ENABLE_FTS3', | |
| 13 # New unicode61 tokenizer with built-in tables. | |
| 14 'SQLITE_DISABLE_FTS3_UNICODE', | |
| 15 # Chromium currently does not enable fts4, disable extra code. | |
| 16 'SQLITE_DISABLE_FTS4_DEFERRED', | |
| 17 'SQLITE_ENABLE_ICU', | |
| 18 'SQLITE_ENABLE_MEMORY_MANAGEMENT', | |
| 19 'SQLITE_SECURE_DELETE', | |
| 20 # Custom flag to tweak pcache pools. | |
| 21 # TODO(shess): This shouldn't use faux-SQLite naming. | |
| 22 'SQLITE_SEPARATE_CACHE_POOLS', | |
| 23 # TODO(shess): SQLite adds mutexes to protect structures which cross | |
| 24 # threads. In theory Chromium should be able to turn this off for a | |
| 25 # slight speed boost. | |
| 26 'THREADSAFE', | |
| 27 # SQLite can spawn threads to sort in parallel if configured | |
| 28 # appropriately. Chromium doesn't configure SQLite for that, and would | |
| 29 # prefer to control distribution to worker threads. | |
| 30 'SQLITE_MAX_WORKER_THREADS=0', | |
| 31 # Allow 256MB mmap footprint per connection. Should not be too open-ended | |
| 32 # as that could cause memory fragmentation. 50MB encompasses the 99th | |
| 33 # percentile of Chrome databases in the wild. | |
| 34 # TODO(shess): A 64-bit-specific value could be 1G or more. | |
| 35 # TODO(shess): Figure out if exceeding this is costly. | |
| 36 'SQLITE_MAX_MMAP_SIZE=268435456', | |
| 37 # Use a read-only memory map when mmap'ed I/O is enabled to prevent memory | |
| 38 # stompers from directly corrupting the database. | |
| 39 # TODO(shess): Upstream the ability to use this define. | |
| 40 'SQLITE_MMAP_READ_ONLY=1', | |
| 41 # By default SQLite pre-allocates 100 pages of pcache data, which will not | |
| 42 # be released until the handle is closed. This is contrary to Chromium's | |
| 43 # memory-usage goals. | |
| 44 'SQLITE_DEFAULT_PCACHE_INITSZ=0', | |
| 45 # NOTE(shess): Some defines can affect the amalgamation. Those should be | |
| 46 # added to google_generate_amalgamation.sh, and the amalgamation | |
| 47 # re-generated. Usually this involves disabling features which include | |
| 48 # keywords or syntax, for instance SQLITE_OMIT_VIRTUALTABLE omits the | |
| 49 # virtual table syntax entirely. Missing an item usually results in | |
| 50 # syntax working but execution failing. Review: | |
| 51 # src/src/parse.py | |
| 52 # src/tool/mkkeywordhash.c | |
| 53 ], | |
| 54 }, | |
| 55 'targets': [ | |
| 56 { | |
| 57 'target_name': 'sqlite', | |
| 58 'conditions': [ | |
| 59 ['use_system_sqlite', { | |
| 60 'type': 'none', | |
| 61 'direct_dependent_settings': { | |
| 62 'defines': [ | |
| 63 'USE_SYSTEM_SQLITE', | |
| 64 ], | |
| 65 }, | |
| 66 | |
| 67 'conditions': [ | |
| 68 ['OS == "ios"', { | |
| 69 'dependencies': [ | |
| 70 'sqlite_recover', | |
| 71 'sqlite_regexp', | |
| 72 ], | |
| 73 'link_settings': { | |
| 74 'xcode_settings': { | |
| 75 'OTHER_LDFLAGS': [ | |
| 76 '-lsqlite3', | |
| 77 ], | |
| 78 }, | |
| 79 }, | |
| 80 }], | |
| 81 ['os_posix == 1 and OS != "mac" and OS != "ios" and OS != "android"'
, { | |
| 82 'direct_dependent_settings': { | |
| 83 'cflags': [ | |
| 84 # This next command produces no output but it it will fail | |
| 85 # (and cause GYP to fail) if we don't have a recent enough | |
| 86 # version of sqlite. | |
| 87 '<!@(pkg-config --atleast-version=<(required_sqlite_version) s
qlite3)', | |
| 88 | |
| 89 '<!@(pkg-config --cflags sqlite3)', | |
| 90 ], | |
| 91 }, | |
| 92 'link_settings': { | |
| 93 'ldflags': [ | |
| 94 '<!@(pkg-config --libs-only-L --libs-only-other sqlite3)', | |
| 95 ], | |
| 96 'libraries': [ | |
| 97 '<!@(pkg-config --libs-only-l sqlite3)', | |
| 98 ], | |
| 99 }, | |
| 100 }], | |
| 101 ], | |
| 102 }, { # !use_system_sqlite | |
| 103 # "sqlite3" can cause conflicts with the system library. | |
| 104 'product_name': 'chromium_sqlite3', | |
| 105 'type': '<(component)', | |
| 106 'sources': [ | |
| 107 'amalgamation/config.h', | |
| 108 'amalgamation/sqlite3.h', | |
| 109 'amalgamation/sqlite3.c', | |
| 110 'src/src/recover_varint.c', | |
| 111 'src/src/recover.c', | |
| 112 'src/src/recover.h', | |
| 113 ], | |
| 114 'variables': { | |
| 115 'clang_warning_flags': [ | |
| 116 # sqlite contains a few functions that are unused, at least on | |
| 117 # Windows with Chromium's sqlite patches applied | |
| 118 # (interiorCursorEOF fts3EvalDeferredPhrase | |
| 119 # fts3EvalSelectDeferred sqlite3Fts3InitHashTable | |
| 120 # sqlite3Fts3InitTok). | |
| 121 '-Wno-unused-function', | |
| 122 ], | |
| 123 }, | |
| 124 'include_dirs': [ | |
| 125 'amalgamation', | |
| 126 ], | |
| 127 'dependencies': [ | |
| 128 '../icu/icu.gyp:icui18n', | |
| 129 '../icu/icu.gyp:icuuc', | |
| 130 ], | |
| 131 'msvs_disabled_warnings': [ | |
| 132 4244, 4267, | |
| 133 ], | |
| 134 'conditions': [ | |
| 135 ['OS == "win" and component == "shared_library"', { | |
| 136 'defines': ['SQLITE_API=__declspec(dllexport)'], | |
| 137 'direct_dependent_settings': { | |
| 138 'defines': ['SQLITE_API=__declspec(dllimport)'], | |
| 139 }, | |
| 140 }], | |
| 141 ['OS != "win" and component == "shared_library"', { | |
| 142 'defines': ['SQLITE_API=__attribute__((visibility("default")))'], | |
| 143 }], | |
| 144 ['os_posix == 1', { | |
| 145 'defines': [ | |
| 146 # Allow xSleep() call on Unix to use usleep() rather than | |
| 147 # sleep(). Microsecond precision is better than second | |
| 148 # precision. Should only affect contended databases via the | |
| 149 # busy callback. Browser profile databases are mostly | |
| 150 # exclusive, but renderer databases may allow for contention. | |
| 151 'HAVE_USLEEP=1', | |
| 152 # Use pread/pwrite directly rather than emulating them. | |
| 153 'USE_PREAD=1', | |
| 154 ], | |
| 155 }], | |
| 156 # Pull in config.h on Linux. This allows use of preprocessor macros | |
| 157 # which are not available to the build config. | |
| 158 ['OS == "linux"', { | |
| 159 'defines': [ | |
| 160 '_HAVE_SQLITE_CONFIG_H', | |
| 161 ], | |
| 162 }], | |
| 163 ['OS == "linux" or OS == "android"', { | |
| 164 'defines': [ | |
| 165 # Linux provides fdatasync(), a faster equivalent of fsync(). | |
| 166 'fdatasync=fdatasync', | |
| 167 ], | |
| 168 }], | |
| 169 ['OS=="linux"', { | |
| 170 'link_settings': { | |
| 171 'libraries': [ | |
| 172 '-ldl', | |
| 173 ], | |
| 174 }, | |
| 175 }], | |
| 176 ['OS == "mac" or OS == "ios"', { | |
| 177 'link_settings': { | |
| 178 'libraries': [ | |
| 179 '$(SDKROOT)/System/Library/Frameworks/CoreFoundation.framework
', | |
| 180 '$(SDKROOT)/System/Library/Frameworks/CoreServices.framework', | |
| 181 ], | |
| 182 }, | |
| 183 }], | |
| 184 ['OS == "android"', { | |
| 185 'defines': [ | |
| 186 'SQLITE_DEFAULT_JOURNAL_SIZE_LIMIT=1048576', | |
| 187 'SQLITE_DEFAULT_AUTOVACUUM=1', | |
| 188 'SQLITE_TEMP_STORE=3', | |
| 189 'SQLITE_ENABLE_FTS3_BACKWARDS', | |
| 190 'SQLITE_DEFAULT_FILE_FORMAT=4', | |
| 191 ], | |
| 192 }], | |
| 193 ['os_posix == 1 and OS != "mac" and OS != "android"', { | |
| 194 'cflags': [ | |
| 195 # SQLite doesn't believe in compiler warnings, | |
| 196 # preferring testing. | |
| 197 # http://www.sqlite.org/faq.html#q17 | |
| 198 '-Wno-int-to-pointer-cast', | |
| 199 '-Wno-pointer-to-int-cast', | |
| 200 ], | |
| 201 }], | |
| 202 ], | |
| 203 }], | |
| 204 ], | |
| 205 'includes': [ | |
| 206 # Disable LTO due to ELF section name out of range | |
| 207 # crbug.com/422251 | |
| 208 '../../build/android/disable_gcc_lto.gypi', | |
| 209 ], | |
| 210 }, | |
| 211 ], | |
| 212 'conditions': [ | |
| 213 ['os_posix == 1 and OS != "mac" and OS != "ios" and OS != "android" and not
use_system_sqlite', { | |
| 214 'targets': [ | |
| 215 { | |
| 216 'target_name': 'sqlite_shell', | |
| 217 'type': 'executable', | |
| 218 'dependencies': [ | |
| 219 '../icu/icu.gyp:icuuc', | |
| 220 'sqlite', | |
| 221 ], | |
| 222 # So shell.c can find the correct sqlite3.h. | |
| 223 'include_dirs': [ | |
| 224 'amalgamation', | |
| 225 ], | |
| 226 'sources': [ | |
| 227 'src/src/shell.c', | |
| 228 'src/src/shell_icu_linux.c', | |
| 229 # Include a dummy c++ file to force linking of libstdc++. | |
| 230 'build_as_cpp.cc', | |
| 231 ], | |
| 232 }, | |
| 233 ], | |
| 234 },], | |
| 235 ['OS == "ios"', { | |
| 236 'targets': [ | |
| 237 { | |
| 238 # Virtual table used by sql::Recovery to recover corrupt | |
| 239 # databases, for use with USE_SYSTEM_SQLITE. | |
| 240 'target_name': 'sqlite_recover', | |
| 241 'type': 'static_library', | |
| 242 'sources': [ | |
| 243 # TODO(shess): Move out of the SQLite source tree, perhaps to ext/. | |
| 244 'src/src/recover_varint.c', | |
| 245 'src/src/recover.c', | |
| 246 'src/src/recover.h', | |
| 247 ], | |
| 248 }, | |
| 249 { | |
| 250 'target_name': 'sqlite_regexp', | |
| 251 'type': 'static_library', | |
| 252 'dependencies': [ | |
| 253 '../icu/icu.gyp:icui18n', | |
| 254 '../icu/icu.gyp:icuuc', | |
| 255 ], | |
| 256 'defines': [ | |
| 257 # Necessary to statically compile the extension. | |
| 258 'SQLITE_CORE', | |
| 259 ], | |
| 260 'sources': [ | |
| 261 'src/ext/icu/icu.c', | |
| 262 ], | |
| 263 'variables': { | |
| 264 'clang_warning_flags_unset': [ | |
| 265 # icu.c uses assert(!"foo") instead of assert(false && "foo") | |
| 266 '-Wstring-conversion', | |
| 267 ], | |
| 268 }, | |
| 269 }, | |
| 270 ], | |
| 271 }], | |
| 272 ], | |
| 273 } | |
| OLD | NEW |