Disable flaky WebNavigationApiTest.Failures on Windows.
[chromium-blink-merge.git] / third_party / sqlite / sqlite.gyp
blob21245dbae0b915233f0e6403f756d12b4967c52a
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.
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       # TODO(shess): Figure out why this is here.  Nobody references it
28       # directly.
29       '_HAS_EXCEPTIONS=0',
30       # NOTE(shess): Some defines can affect the amalgamation.  Those should be
31       # added to google_generate_amalgamation.sh, and the amalgamation
32       # re-generated.  Usually this involves disabling features which include
33       # keywords or syntax, for instance SQLITE_OMIT_VIRTUALTABLE omits the
34       # virtual table syntax entirely.  Missing an item usually results in
35       # syntax working but execution failing.  Review:
36       #   src/src/parse.py
37       #   src/tool/mkkeywordhash.c
38     ],
39   },
40   'targets': [
41     {
42       'target_name': 'sqlite',
43       'conditions': [
44         [ 'chromeos==1' , {
45             'defines': [
46                 # Despite obvious warnings about not using this flag
47                 # in deployment, we are turning off sync in ChromeOS
48                 # and relying on the underlying journaling filesystem
49                 # to do error recovery properly.  It's much faster.
50                 'SQLITE_NO_SYNC',
51                 ],
52           },
53         ],
54         ['os_posix == 1', {
55           'defines': [
56             # Allow xSleep() call on Unix to use usleep() rather than sleep().
57             # Microsecond precision is better than second precision.  Should
58             # only affect contended databases via the busy callback.  Browser
59             # profile databases are mostly exclusive, but renderer databases may
60             # allow for contention.
61             'HAVE_USLEEP=1',
62           ],
63         }],
64         ['OS == "linux" or OS == "android"', {
65           'defines': [
66             # Linux provides fdatasync(), a faster equivalent of fsync().
67             'fdatasync=fdatasync',
68           ],
69         }],
70         ['use_system_sqlite', {
71           'type': 'none',
72           'direct_dependent_settings': {
73             'defines': [
74               'USE_SYSTEM_SQLITE',
75             ],
76           },
78           'conditions': [
79             ['OS == "ios"', {
80               'dependencies': [
81                 'sqlite_regexp',
82               ],
83               'link_settings': {
84                 'libraries': [
85                   '$(SDKROOT)/usr/lib/libsqlite3.dylib',
86                 ],
87               },
88             }],
89             ['os_posix == 1 and OS != "mac" and OS != "ios" and OS != "android"', {
90               'direct_dependent_settings': {
91                 'cflags': [
92                   # This next command produces no output but it it will fail
93                   # (and cause GYP to fail) if we don't have a recent enough
94                   # version of sqlite.
95                   '<!@(pkg-config --atleast-version=<(required_sqlite_version) sqlite3)',
97                   '<!@(pkg-config --cflags sqlite3)',
98                 ],
99               },
100               'link_settings': {
101                 'ldflags': [
102                   '<!@(pkg-config --libs-only-L --libs-only-other sqlite3)',
103                 ],
104                 'libraries': [
105                   '<!@(pkg-config --libs-only-l sqlite3)',
106                 ],
107               },
108             }],
109           ],
110         }, { # !use_system_sqlite
111           'product_name': 'sqlite3',
112           'type': 'static_library',
113           'sources': [
114             'amalgamation/sqlite3.h',
115             'amalgamation/sqlite3.c',
116           ],
117           'include_dirs': [
118             'amalgamation',
119           ],
120           'dependencies': [
121             '../icu/icu.gyp:icui18n',
122             '../icu/icu.gyp:icuuc',
123           ],
124           'direct_dependent_settings': {
125             'include_dirs': [
126               '.',
127               '../..',
128             ],
129           },
130           'msvs_disabled_warnings': [
131             4018, 4244, 4267,
132           ],
133           'conditions': [
134             ['OS=="linux"', {
135               'link_settings': {
136                 'libraries': [
137                   '-ldl',
138                 ],
139               },
140             }],
141             ['OS == "mac" or OS == "ios"', {
142               'link_settings': {
143                 'libraries': [
144                   '$(SDKROOT)/System/Library/Frameworks/CoreFoundation.framework',
145                 ],
146               },
147             }],
148             ['OS == "android"', {
149               'defines': [
150                 'SQLITE_DEFAULT_JOURNAL_SIZE_LIMIT=1048576',
151                 'SQLITE_DEFAULT_AUTOVACUUM=1',
152                 'SQLITE_TEMP_STORE=3',
153                 'SQLITE_ENABLE_FTS3_BACKWARDS',
154                 'SQLITE_DEFAULT_FILE_FORMAT=4',
155               ],
156             }],
157             ['os_posix == 1 and OS != "mac" and OS != "android"', {
158               'cflags': [
159                 # SQLite doesn't believe in compiler warnings,
160                 # preferring testing.
161                 #   http://www.sqlite.org/faq.html#q17
162                 '-Wno-int-to-pointer-cast',
163                 '-Wno-pointer-to-int-cast',
164               ],
165             }],
166           ],
167         }],
168       ],
169       'includes': [
170         # Disable LTO due to ELF section name out of range
171         # crbug.com/422251
172         '../../build/android/disable_lto.gypi',
173       ],
174     },
175   ],
176   'conditions': [
177     ['os_posix == 1 and OS != "mac" and OS != "ios" and OS != "android" and not use_system_sqlite', {
178       'targets': [
179         {
180           'target_name': 'sqlite_shell',
181           'type': 'executable',
182           'dependencies': [
183             '../icu/icu.gyp:icuuc',
184             'sqlite',
185           ],
186           'sources': [
187             'src/src/shell.c',
188             'src/src/shell_icu_linux.c',
189             # Include a dummy c++ file to force linking of libstdc++.
190             'build_as_cpp.cc',
191           ],
192         },
193       ],
194     },],
195     ['OS == "ios"', {
196       'targets': [
197         {
198           'target_name': 'sqlite_regexp',
199           'type': 'static_library',
200           'dependencies': [
201             '../icu/icu.gyp:icui18n',
202             '../icu/icu.gyp:icuuc',
203           ],
204           'defines': [
205             # Necessary to statically compile the extension.
206             'SQLITE_CORE',
207           ],
208           'sources': [
209             'src/ext/icu/icu.c',
210           ],
211         },
212       ],
213     }],
214   ],