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.
7 'use_system_sqlite%': 0,
8 'required_sqlite_version': '3.6.1',
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',
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
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 # Use a read-only memory map when mmap'ed I/O is enabled to prevent memory
32 # stompers from directly corrupting the database.
33 # TODO(shess): Upstream the ability to use this define.
34 'SQLITE_MMAP_READ_ONLY=1',
35 # NOTE(shess): Some defines can affect the amalgamation. Those should be
36 # added to google_generate_amalgamation.sh, and the amalgamation
37 # re-generated. Usually this involves disabling features which include
38 # keywords or syntax, for instance SQLITE_OMIT_VIRTUALTABLE omits the
39 # virtual table syntax entirely. Missing an item usually results in
40 # syntax working but execution failing. Review:
42 # src/tool/mkkeywordhash.c
47 'target_name': 'sqlite',
51 # Despite obvious warnings about not using this flag
52 # in deployment, we are turning off sync in ChromeOS
53 # and relying on the underlying journaling filesystem
54 # to do error recovery properly. It's much faster.
61 # Allow xSleep() call on Unix to use usleep() rather than sleep().
62 # Microsecond precision is better than second precision. Should
63 # only affect contended databases via the busy callback. Browser
64 # profile databases are mostly exclusive, but renderer databases may
65 # allow for contention.
69 ['OS == "linux" or OS == "android"', {
71 # Linux provides fdatasync(), a faster equivalent of fsync().
72 'fdatasync=fdatasync',
75 ['use_system_sqlite', {
77 'direct_dependent_settings': {
96 ['os_posix == 1 and OS != "mac" and OS != "ios" and OS != "android"', {
97 'direct_dependent_settings': {
99 # This next command produces no output but it it will fail
100 # (and cause GYP to fail) if we don't have a recent enough
102 '<!@(pkg-config --atleast-version=<(required_sqlite_version) sqlite3)',
104 '<!@(pkg-config --cflags sqlite3)',
109 '<!@(pkg-config --libs-only-L --libs-only-other sqlite3)',
112 '<!@(pkg-config --libs-only-l sqlite3)',
117 }, { # !use_system_sqlite
118 # "sqlite3" can cause conflicts with the system library.
119 'product_name': 'chromium_sqlite3',
120 'type': '<(component)',
122 'amalgamation/sqlite3.h',
123 'amalgamation/sqlite3.c',
126 'clang_warning_flags': [
127 # sqlite contains a few functions that are unused, at least on
128 # Windows with Chromium's sqlite patches applied
129 # (interiorCursorEOF fts3EvalDeferredPhrase
130 # fts3EvalSelectDeferred sqlite3Fts3InitHashTable
131 # sqlite3Fts3InitTok).
132 '-Wno-unused-function',
139 '../icu/icu.gyp:icui18n',
140 '../icu/icu.gyp:icuuc',
142 'direct_dependent_settings': {
148 'msvs_disabled_warnings': [
152 ['OS == "win" and component == "shared_library"', {
153 'defines': ['SQLITE_API=__declspec(dllexport)'],
154 'direct_dependent_settings': {
155 'defines': ['SQLITE_API=__declspec(dllimport)'],
158 ['OS != "win" and component == "shared_library"', {
159 'defines': ['SQLITE_API=__attribute__((visibility("default")))'],
168 ['OS == "mac" or OS == "ios"', {
171 '$(SDKROOT)/System/Library/Frameworks/CoreFoundation.framework',
172 '$(SDKROOT)/System/Library/Frameworks/CoreServices.framework',
176 ['OS == "android"', {
178 'SQLITE_DEFAULT_JOURNAL_SIZE_LIMIT=1048576',
179 'SQLITE_DEFAULT_AUTOVACUUM=1',
180 'SQLITE_TEMP_STORE=3',
181 'SQLITE_ENABLE_FTS3_BACKWARDS',
182 'SQLITE_DEFAULT_FILE_FORMAT=4',
185 ['os_posix == 1 and OS != "mac" and OS != "android"', {
187 # SQLite doesn't believe in compiler warnings,
188 # preferring testing.
189 # http://www.sqlite.org/faq.html#q17
190 '-Wno-int-to-pointer-cast',
191 '-Wno-pointer-to-int-cast',
198 # Disable LTO due to ELF section name out of range
200 '../../build/android/disable_gcc_lto.gypi',
205 ['os_posix == 1 and OS != "mac" and OS != "ios" and OS != "android" and not use_system_sqlite', {
208 'target_name': 'sqlite_shell',
209 'type': 'executable',
211 '../icu/icu.gyp:icuuc',
216 'src/src/shell_icu_linux.c',
217 # Include a dummy c++ file to force linking of libstdc++.
226 'target_name': 'sqlite_regexp',
227 'type': 'static_library',
229 '../icu/icu.gyp:icui18n',
230 '../icu/icu.gyp:icuuc',
233 # Necessary to statically compile the extension.