Commit 9d7e5a15 authored by Mikhail Khokhlov's avatar Mikhail Khokhlov Committed by Commit Bot

sqlite: Create an sqlite_dev target for use in developer tools

We'd like to use some SQLite features currently disabled in Chrome
in a developer trace-analyzing tool called trace_processor_shell.
As discussed on the thread [1], it's undesirable to enable them
Chrome-wide.

This CL adds an "sqlite_dev" build target and third_party/sqlite/dev
include directory with a separate sqlite library that has most of the
features enabled.

[1] https://groups.google.com/a/chromium.org/g/storage-dev/c/OkwAfpYWAa0

Bug: b/150127983, b/150125501
Change-Id: If328bb737679b6d352904bcb543bc6ed1c522b90
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2082389Reviewed-by: default avatarVictor Costan <pwnall@chromium.org>
Commit-Queue: Mikhail Khokhlov <khokhlov@google.com>
Cr-Commit-Position: refs/heads/master@{#749640}
parent 7fe92480
...@@ -18,7 +18,7 @@ import("//third_party/protobuf/proto_library.gni") ...@@ -18,7 +18,7 @@ import("//third_party/protobuf/proto_library.gni")
# #
# The vast majority of the macros here are documented at # The vast majority of the macros here are documented at
# https://www.sqlite.org/compile.html # https://www.sqlite.org/compile.html
config("chromium_sqlite3_compile_options") { config("common_sqlite3_compile_options") {
defines = [ defines = [
# Skip writing transaction rollback journals on f2fs. # Skip writing transaction rollback journals on f2fs.
# f2fs tends to be used on Android, and may be used on ChromeOS. # f2fs tends to be used on Android, and may be used on ChromeOS.
...@@ -79,7 +79,7 @@ config("chromium_sqlite3_compile_options") { ...@@ -79,7 +79,7 @@ config("chromium_sqlite3_compile_options") {
"SQLITE_DEFAULT_PCACHE_INITSZ=0", "SQLITE_DEFAULT_PCACHE_INITSZ=0",
# Some defines can affect the amalgamation. Those should be added to # Some defines can affect the amalgamation. Those should be added to
# google_generate_amalgamation.sh, and the amalgamation re-generated. # scripts/generate_amalgamation.sh, and the amalgamation re-generated.
# Usually this involves disabling features which include keywords or # Usually this involves disabling features which include keywords or
# syntax, for instance SQLITE_OMIT_VIRTUALTABLE omits the virtual table # syntax, for instance SQLITE_OMIT_VIRTUALTABLE omits the virtual table
# syntax entirely. Missing an item usually results in syntax working but # syntax entirely. Missing an item usually results in syntax working but
...@@ -87,54 +87,16 @@ config("chromium_sqlite3_compile_options") { ...@@ -87,54 +87,16 @@ config("chromium_sqlite3_compile_options") {
# patched/src/parse.py # patched/src/parse.py
# patched/tool/mkkeywordhash.c # patched/tool/mkkeywordhash.c
# The flags below are recommended in the SQLite documentation, and disable # The flags below are recommended in the SQLite documentation.
# features Chrome doesn't use.
"SQLITE_LIKE_DOESNT_MATCH_BLOBS", "SQLITE_LIKE_DOESNT_MATCH_BLOBS",
"SQLITE_OMIT_DEPRECATED", "SQLITE_OMIT_DEPRECATED",
"SQLITE_OMIT_PROGRESS_CALLBACK", "SQLITE_OMIT_PROGRESS_CALLBACK",
"SQLITE_OMIT_SHARED_CACHE", "SQLITE_OMIT_SHARED_CACHE",
"SQLITE_USE_ALLOCA", "SQLITE_USE_ALLOCA",
# Chrome doesn't use the ANALYZE SQLite extension.
#
# ANALYZE [1] is non-standard, and currently performs a table scan to
# update statistics used by the query planner. Chrome uses straightforward
# database schemas which do not require the level of fine tuning provided
# by ANALYZE, and we generally cannot afford the I/O cost of the required
# table scans.
#
# [1] https://www.sqlite.org/lang_analyze.html
"SQLITE_OMIT_ANALYZE",
# Chrome initializes SQLite manually in //sql/connection.cc.
"SQLITE_OMIT_AUTOINIT",
# Chrome calls sqlite3_reset() correctly to reset prepared statements.
"SQLITE_OMIT_AUTORESET",
# Chromium does not use sqlite3_{get,free}_table().
# Chrome doesn't use sqlite3_compileoption_{used,get}().
"SQLITE_OMIT_COMPILEOPTION_DIAGS",
# Chrome doesn't ship the SQLite shell, so command auto-completion is not
# needed. Chrome developers who build the SQLite shell living at
# //third_party/sqlite:sqlite_shell for diagnostic purposes will have to
# live without auto-completion.
"SQLITE_OMIT_COMPLETE",
# Chrome does not use sqlite3_column_decltype(). # Chrome does not use sqlite3_column_decltype().
"SQLITE_OMIT_DECLTYPE", "SQLITE_OMIT_DECLTYPE",
# EXPLAIN's output is not stable across releases [1], so it should not be
# used in Chrome. Skipping the EXPLAIN machinery also results in
# non-trivial binary savings.
#
# [1] https://www.sqlite.org/lang_explain.html
"SQLITE_OMIT_EXPLAIN",
# Chrome does not use sqlite3_{get,free}_table().
"SQLITE_OMIT_GET_TABLE",
# Chrome does not use sqlite3_{enable_}load_extension(). # Chrome does not use sqlite3_{enable_}load_extension().
# Asides from giving us fairly minor code savings, this option disables code # Asides from giving us fairly minor code savings, this option disables code
# that breaks our method for renaming SQLite's exported symbols. Last, # that breaks our method for renaming SQLite's exported symbols. Last,
...@@ -142,32 +104,6 @@ config("chromium_sqlite3_compile_options") { ...@@ -142,32 +104,6 @@ config("chromium_sqlite3_compile_options") {
# reach extension loading code. # reach extension loading code.
"SQLITE_OMIT_LOAD_EXTENSION", "SQLITE_OMIT_LOAD_EXTENSION",
# Chrome already depends on malloc being very efficient, so we disable
# SQLite's arena allocator.
"SQLITE_DEFAULT_LOOKASIDE=0,0",
"SQLITE_OMIT_LOOKASIDE",
# Chrome doesn't use TCL variables.
"SQLITE_OMIT_TCL_VARIABLE",
# The REINDEX statemnt is only useful if a collation sequence's definition
# changes [1]. Chrome never defines its own collation sequences [2, 3], so
# it never needs to call REINDEX.
#
# [1] https://www.sqlite.org/lang_reindex.html
# [2] https://www.sqlite.org/datatype3.html#collating_sequences
# [3] https://www.sqlite.org/c3ref/create_collation.html
"SQLITE_OMIT_REINDEX",
# Chrome doesn't use sqlite3_{profile,trace}().
"SQLITE_OMIT_TRACE",
# Chrome doesn't use UPSERT.
"SQLITE_OMIT_UPSERT",
# Chrome doesn't use window functions in SQL.
"SQLITE_OMIT_WINDOWFUNC",
# Uses isnan() in the C99 standard library. # Uses isnan() in the C99 standard library.
"SQLITE_HAVE_ISNAN", "SQLITE_HAVE_ISNAN",
...@@ -243,6 +179,91 @@ config("chromium_sqlite3_compile_options") { ...@@ -243,6 +179,91 @@ config("chromium_sqlite3_compile_options") {
} }
} }
# These options remove SQLite features that we don't need in Chrome.
# Note that some defines affect amalgamation. Please make sure that this
# list of options is in sync with build flags for Chromium in
# scripts/generate_amalgamation.sh.
config("chromium_sqlite3_compile_options") {
configs = [ ":common_sqlite3_compile_options" ]
defines = [
# Chrome doesn't use the ANALYZE SQLite extension.
#
# ANALYZE [1] is non-standard, and currently performs a table scan to
# update statistics used by the query planner. Chrome uses straightforward
# database schemas which do not require the level of fine tuning provided
# by ANALYZE, and we generally cannot afford the I/O cost of the required
# table scans.
#
# [1] https://www.sqlite.org/lang_analyze.html
"SQLITE_OMIT_ANALYZE",
# Chrome initializes SQLite manually in //sql/connection.cc.
"SQLITE_OMIT_AUTOINIT",
# Chrome calls sqlite3_reset() correctly to reset prepared statements.
"SQLITE_OMIT_AUTORESET",
# Chromium does not use sqlite3_{get,free}_table().
# Chrome doesn't use sqlite3_compileoption_{used,get}().
"SQLITE_OMIT_COMPILEOPTION_DIAGS",
# Chrome doesn't ship the SQLite shell, so command auto-completion is not
# needed. Chrome developers who build the SQLite shell living at
# //third_party/sqlite:sqlite_shell for diagnostic purposes will have to
# live without auto-completion.
"SQLITE_OMIT_COMPLETE",
# EXPLAIN's output is not stable across releases [1], so it should not be
# used in Chrome. Skipping the EXPLAIN machinery also results in
# non-trivial binary savings.
#
# [1] https://www.sqlite.org/lang_explain.html
"SQLITE_OMIT_EXPLAIN",
# Chrome does not use sqlite3_{get,free}_table().
"SQLITE_OMIT_GET_TABLE",
# Chrome already depends on malloc being very efficient, so we disable
# SQLite's arena allocator.
"SQLITE_DEFAULT_LOOKASIDE=0,0",
"SQLITE_OMIT_LOOKASIDE",
# Chrome doesn't use TCL variables.
"SQLITE_OMIT_TCL_VARIABLE",
# The REINDEX statemnt is only useful if a collation sequence's definition
# changes [1]. Chrome never defines its own collation sequences [2, 3], so
# it never needs to call REINDEX.
#
# [1] https://www.sqlite.org/lang_reindex.html
# [2] https://www.sqlite.org/datatype3.html#collating_sequences
# [3] https://www.sqlite.org/c3ref/create_collation.html
"SQLITE_OMIT_REINDEX",
# Chrome doesn't use sqlite3_{profile,trace}().
"SQLITE_OMIT_TRACE",
# Chrome doesn't use UPSERT.
"SQLITE_OMIT_UPSERT",
# Chrome doesn't use window functions in SQL.
"SQLITE_OMIT_WINDOWFUNC",
]
}
# These options add SQLite features that we need in developer tools.
# Note that some defines affect amalgamation. Please make sure that this
# list of options is in sync with build flags for dev version in
# scripts/generate_amalgamation.sh.
config("dev_sqlite3_compile_options") {
configs = [ ":common_sqlite3_compile_options" ]
defines = [
"SQLITE_ENABLE_EXPLAIN_COMMENTS",
]
}
config("sqlite_warnings") { config("sqlite_warnings") {
cflags = [] cflags = []
if (is_clang) { if (is_clang) {
...@@ -363,6 +384,83 @@ component("chromium_sqlite3") { ...@@ -363,6 +384,83 @@ component("chromium_sqlite3") {
deps = [ "//third_party/icu" ] deps = [ "//third_party/icu" ]
} }
component("dev_sqlite3") {
visibility = [ ":*" ]
public = [ "dev/sqlite3.h" ]
sources = [
"amalgamation_dev/sqlite3.h",
"dev/sqlite3_shim.c",
]
inputs = [
# This file is #included into sqlite3_shim.c, which injects Chrome-specific
# definitions into the SQLite amalgamation code.
"amalgamation_dev/sqlite3.c",
]
cflags = []
defines = []
if (is_component_build) {
if (is_win) {
defines += [ "SQLITE_API=__declspec(dllexport)" ]
} else {
defines += [ "SQLITE_API=__attribute__((visibility(\"default\")))" ]
}
}
if (is_linux || is_android) {
defines += [
# Linux provides fdatasync(), a faster equivalent of fsync().
"fdatasync=fdatasync",
]
}
if (is_posix || is_fuchsia) {
defines += [
# Allow xSleep() call on Unix to use usleep() rather than sleep(), so it
# will have microsecond precision. Should only affect contended
# databases via the busy callback. Browser profile databases are mostly
# exclusive, but renderer databases may allow for contention.
"HAVE_USLEEP=1",
# Use pread/pwrite directly rather than emulating them.
"USE_PREAD=1",
]
}
include_dirs = [
"dev", # sqlite3.h here must override the one in amalgamation_dev/.
"amalgamation_dev",
]
configs -= [ "//build/config/compiler:chromium_code" ]
configs += [
":dev_sqlite3_compile_options",
"//build/config/compiler:no_chromium_code",
"//build/config/sanitizers:cfi_icall_generalize_pointers",
# Must be after no_chromium_code for warning flags to be ordered correctly.
":sqlite_warnings",
]
if (is_mac || is_ios) {
libs = [ "CoreFoundation.framework" ]
if (!is_ios) {
libs += [ "CoreServices.framework" ]
}
} else if (is_android) {
defines += [
"SQLITE_DEFAULT_JOURNAL_SIZE_LIMIT=1048576",
"SQLITE_DEFAULT_AUTOVACUUM=1",
]
}
deps = [ "//third_party/icu" ]
}
config("sqlite_export") { config("sqlite_export") {
if (is_component_build && is_win) { if (is_component_build && is_win) {
defines = [ "SQLITE_API=__declspec(dllimport)" ] defines = [ "SQLITE_API=__declspec(dllimport)" ]
...@@ -379,6 +477,14 @@ group("sqlite") { ...@@ -379,6 +477,14 @@ group("sqlite") {
] ]
} }
group("sqlite_dev") {
public_deps = [ ":dev_sqlite3" ]
public_configs = [
":dev_sqlite3_compile_options",
":sqlite_export",
]
}
if (is_win || is_mac || is_linux) { if (is_win || is_mac || is_linux) {
executable("sqlite_shell") { executable("sqlite_shell") {
include_dirs = [ include_dirs = [
......
...@@ -9,6 +9,7 @@ License: Public domain ...@@ -9,6 +9,7 @@ License: Public domain
2) Making changes to Chromium SQLite. 2) Making changes to Chromium SQLite.
3) Import new release of SQLite. 3) Import new release of SQLite.
4) Running SQLite's test suite within the Chromium checkout. 4) Running SQLite's test suite within the Chromium checkout.
5) Two versions of SQLite library.
--- ---
...@@ -332,3 +333,12 @@ mkdir $TMPFS ...@@ -332,3 +333,12 @@ mkdir $TMPFS
This is faster, but it is plausible that different things are being tested than This is faster, but it is plausible that different things are being tested than
real-world use. real-world use.
--------------------------------------------
5) Two versions of SQLite library.
There are two targets defined in the BUILD.gn file: sqlite and sqlite_full.
scripts/generate_amalgamation.sh generates two separate source files with
different set of build flags for them. The full version is intended for use
in developer tools only, for all other uses please depend on sqlite target.
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// This file is generated by extract_sqlite_api.py.
#ifndef THIRD_PARTY_SQLITE_AMALGAMATION_RENAME_EXPORTS_H_
#define THIRD_PARTY_SQLITE_AMALGAMATION_RENAME_EXPORTS_H_
#define sqlite3_activate_cerod chrome_sqlite3_activate_cerod // Lines 5870-5872
#define sqlite3_activate_see chrome_sqlite3_activate_see // Lines 5860-5862
#define sqlite3_aggregate_context chrome_sqlite3_aggregate_context // Line 5406
#define sqlite3_aggregate_count chrome_sqlite3_aggregate_count // Line 5181
#define sqlite3_auto_extension chrome_sqlite3_auto_extension // Line 6569
#define sqlite3_backup_finish chrome_sqlite3_backup_finish // Line 8596
#define sqlite3_backup_init chrome_sqlite3_backup_init // Lines 8589-8594
#define sqlite3_backup_pagecount chrome_sqlite3_backup_pagecount // Line 8598
#define sqlite3_backup_remaining chrome_sqlite3_backup_remaining // Line 8597
#define sqlite3_backup_step chrome_sqlite3_backup_step // Line 8595
#define sqlite3_bind_blob chrome_sqlite3_bind_blob // Line 4285
#define sqlite3_bind_blob64 chrome_sqlite3_bind_blob64 // Lines 4286-4287
#define sqlite3_bind_double chrome_sqlite3_bind_double // Line 4288
#define sqlite3_bind_int chrome_sqlite3_bind_int // Line 4289
#define sqlite3_bind_int64 chrome_sqlite3_bind_int64 // Line 4290
#define sqlite3_bind_null chrome_sqlite3_bind_null // Line 4291
#define sqlite3_bind_parameter_count \
chrome_sqlite3_bind_parameter_count // Line 4320
#define sqlite3_bind_parameter_index \
chrome_sqlite3_bind_parameter_index // Line 4366
#define sqlite3_bind_parameter_name \
chrome_sqlite3_bind_parameter_name // Line 4348
#define sqlite3_bind_pointer chrome_sqlite3_bind_pointer // Line 4297
#define sqlite3_bind_text chrome_sqlite3_bind_text // Line 4292
#define sqlite3_bind_text16 chrome_sqlite3_bind_text16 // Line 4293
#define sqlite3_bind_text64 chrome_sqlite3_bind_text64 // Lines 4294-4295
#define sqlite3_bind_value chrome_sqlite3_bind_value // Line 4296
#define sqlite3_bind_zeroblob chrome_sqlite3_bind_zeroblob // Line 4298
#define sqlite3_bind_zeroblob64 chrome_sqlite3_bind_zeroblob64 // Line 4299
#define sqlite3_blob_bytes chrome_sqlite3_blob_bytes // Line 7147
#define sqlite3_blob_close chrome_sqlite3_blob_close // Line 7131
#define sqlite3_blob_open chrome_sqlite3_blob_open // Lines 7075-7083
#define sqlite3_blob_read chrome_sqlite3_blob_read // Line 7176
#define sqlite3_blob_reopen chrome_sqlite3_blob_reopen // Line 7108
#define sqlite3_blob_write chrome_sqlite3_blob_write // Line 7218
#define sqlite3_busy_handler chrome_sqlite3_busy_handler // Line 2648
#define sqlite3_busy_timeout chrome_sqlite3_busy_timeout // Line 2671
#define sqlite3_cancel_auto_extension \
chrome_sqlite3_cancel_auto_extension // Line 6581
#define sqlite3_changes chrome_sqlite3_changes // Line 2477
#define sqlite3_clear_bindings chrome_sqlite3_clear_bindings // Line 4376
#define sqlite3_close chrome_sqlite3_close // Line 334
#define sqlite3_close_v2 chrome_sqlite3_close_v2 // Line 335
#define sqlite3_collation_needed \
chrome_sqlite3_collation_needed // Lines 5809-5813
#define sqlite3_collation_needed16 \
chrome_sqlite3_collation_needed16 // Lines 5814-5818
#define sqlite3_column_blob chrome_sqlite3_column_blob // Line 4852
#define sqlite3_column_bytes chrome_sqlite3_column_bytes // Line 4859
#define sqlite3_column_bytes16 chrome_sqlite3_column_bytes16 // Line 4860
#define sqlite3_column_count chrome_sqlite3_column_count // Line 4392
#define sqlite3_column_database_name \
chrome_sqlite3_column_database_name // Line 4466
#define sqlite3_column_database_name16 \
chrome_sqlite3_column_database_name16 // Line 4467
#define sqlite3_column_decltype chrome_sqlite3_column_decltype // Line 4503
#define sqlite3_column_decltype16 chrome_sqlite3_column_decltype16 // Line 4504
#define sqlite3_column_double chrome_sqlite3_column_double // Line 4853
#define sqlite3_column_int chrome_sqlite3_column_int // Line 4854
#define sqlite3_column_int64 chrome_sqlite3_column_int64 // Line 4855
#define sqlite3_column_name chrome_sqlite3_column_name // Line 4421
#define sqlite3_column_name16 chrome_sqlite3_column_name16 // Line 4422
#define sqlite3_column_origin_name \
chrome_sqlite3_column_origin_name // Line 4470
#define sqlite3_column_origin_name16 \
chrome_sqlite3_column_origin_name16 // Line 4471
#define sqlite3_column_table_name chrome_sqlite3_column_table_name // Line 4468
#define sqlite3_column_table_name16 \
chrome_sqlite3_column_table_name16 // Line 4469
#define sqlite3_column_text chrome_sqlite3_column_text // Line 4856
#define sqlite3_column_text16 chrome_sqlite3_column_text16 // Line 4857
#define sqlite3_column_type chrome_sqlite3_column_type // Line 4861
#define sqlite3_column_value chrome_sqlite3_column_value // Line 4858
#define sqlite3_commit_hook chrome_sqlite3_commit_hook // Line 6166
#define sqlite3_compileoption_get chrome_sqlite3_compileoption_get // Line 191
#define sqlite3_compileoption_used \
chrome_sqlite3_compileoption_used // Line 190
#define sqlite3_complete chrome_sqlite3_complete // Line 2586
#define sqlite3_complete16 chrome_sqlite3_complete16 // Line 2587
#define sqlite3_config chrome_sqlite3_config // Line 1570
#define sqlite3_context_db_handle chrome_sqlite3_context_db_handle // Line 5433
#define sqlite3_create_collation \
chrome_sqlite3_create_collation // Lines 5759-5765
#define sqlite3_create_collation16 \
chrome_sqlite3_create_collation16 // Lines 5774-5780
#define sqlite3_create_collation_v2 \
chrome_sqlite3_create_collation_v2 // Lines 5766-5773
#define sqlite3_create_function \
chrome_sqlite3_create_function // Lines 5043-5052
#define sqlite3_create_function16 \
chrome_sqlite3_create_function16 // Lines 5053-5062
#define sqlite3_create_function_v2 \
chrome_sqlite3_create_function_v2 // Lines 5063-5073
#define sqlite3_create_module chrome_sqlite3_create_module // Lines 6861-6866
#define sqlite3_create_module_v2 \
chrome_sqlite3_create_module_v2 // Lines 6867-6873
#define sqlite3_create_window_function \
chrome_sqlite3_create_window_function // Lines 5074-5085
#define sqlite3_data_count chrome_sqlite3_data_count // Line 4609
#define sqlite3_data_directory chrome_sqlite3_data_directory // Line 5987
#define sqlite3_db_cacheflush chrome_sqlite3_db_cacheflush // Line 9286
#define sqlite3_db_config chrome_sqlite3_db_config // Line 1589
#define sqlite3_db_filename chrome_sqlite3_db_filename // Line 6091
#define sqlite3_db_handle chrome_sqlite3_db_handle // Line 6059
#define sqlite3_db_mutex chrome_sqlite3_db_mutex // Line 7522
#define sqlite3_db_readonly chrome_sqlite3_db_readonly // Line 6101
#define sqlite3_db_release_memory chrome_sqlite3_db_release_memory // Line 6293
#define sqlite3_db_status chrome_sqlite3_db_status // Line 7946
#define sqlite3_declare_vtab chrome_sqlite3_declare_vtab // Line 6947
#define sqlite3_deserialize chrome_sqlite3_deserialize // Lines 9680-9687
#define sqlite3_drop_modules chrome_sqlite3_drop_modules // Lines 6887-6890
#define sqlite3_enable_load_extension \
chrome_sqlite3_enable_load_extension // Line 6531
#define sqlite3_enable_shared_cache \
chrome_sqlite3_enable_shared_cache // Line 6263
#define sqlite3_errcode chrome_sqlite3_errcode // Line 3673
#define sqlite3_errmsg chrome_sqlite3_errmsg // Line 3675
#define sqlite3_errmsg16 chrome_sqlite3_errmsg16 // Line 3676
#define sqlite3_errstr chrome_sqlite3_errstr // Line 3677
#define sqlite3_exec chrome_sqlite3_exec // Lines 406-412
#define sqlite3_expanded_sql chrome_sqlite3_expanded_sql // Line 4039
#define sqlite3_expired chrome_sqlite3_expired // Line 5182
#define sqlite3_extended_errcode chrome_sqlite3_extended_errcode // Line 3674
#define sqlite3_extended_result_codes \
chrome_sqlite3_extended_result_codes // Line 2347
#define sqlite3_file_control chrome_sqlite3_file_control // Line 7565
#define sqlite3_filename_database chrome_sqlite3_filename_database // Line 3616
#define sqlite3_filename_journal chrome_sqlite3_filename_journal // Line 3617
#define sqlite3_filename_wal chrome_sqlite3_filename_wal // Line 3618
#define sqlite3_finalize chrome_sqlite3_finalize // Line 4889
#define sqlite3_free chrome_sqlite3_free // Line 2880
#define sqlite3_free_table chrome_sqlite3_free_table // Line 2754
#define sqlite3_get_autocommit chrome_sqlite3_get_autocommit // Line 6046
#define sqlite3_get_auxdata chrome_sqlite3_get_auxdata // Line 5492
#define sqlite3_get_table chrome_sqlite3_get_table // Lines 2746-2753
#define sqlite3_global_recover chrome_sqlite3_global_recover // Line 5184
#define sqlite3_hard_heap_limit64 chrome_sqlite3_hard_heap_limit64 // Line 6360
#define sqlite3_initialize chrome_sqlite3_initialize // Line 1534
#define sqlite3_interrupt chrome_sqlite3_interrupt // Line 2551
#define sqlite3_key chrome_sqlite3_key // Lines 5828-5831
#define sqlite3_key_v2 chrome_sqlite3_key_v2 // Lines 5832-5836
#define sqlite3_keyword_check chrome_sqlite3_keyword_check // Line 7676
#define sqlite3_keyword_count chrome_sqlite3_keyword_count // Line 7674
#define sqlite3_keyword_name chrome_sqlite3_keyword_name // Line 7675
#define sqlite3_last_insert_rowid chrome_sqlite3_last_insert_rowid // Line 2409
#define sqlite3_libversion chrome_sqlite3_libversion // Line 163
#define sqlite3_libversion_number chrome_sqlite3_libversion_number // Line 165
#define sqlite3_limit chrome_sqlite3_limit // Line 3745
#define sqlite3_load_extension chrome_sqlite3_load_extension // Lines 6499-6504
#define sqlite3_log chrome_sqlite3_log // Line 8794
#define sqlite3_malloc chrome_sqlite3_malloc // Line 2876
#define sqlite3_malloc64 chrome_sqlite3_malloc64 // Line 2877
#define sqlite3_memory_alarm chrome_sqlite3_memory_alarm // Lines 5186-5187
#define sqlite3_memory_highwater chrome_sqlite3_memory_highwater // Line 2907
#define sqlite3_memory_used chrome_sqlite3_memory_used // Line 2906
#define sqlite3_mprintf chrome_sqlite3_mprintf // Line 2796
#define sqlite3_msize chrome_sqlite3_msize // Line 2881
#define sqlite3_mutex_alloc chrome_sqlite3_mutex_alloc // Line 7367
#define sqlite3_mutex_enter chrome_sqlite3_mutex_enter // Line 7369
#define sqlite3_mutex_free chrome_sqlite3_mutex_free // Line 7368
#define sqlite3_mutex_held chrome_sqlite3_mutex_held // Line 7481
#define sqlite3_mutex_leave chrome_sqlite3_mutex_leave // Line 7371
#define sqlite3_mutex_notheld chrome_sqlite3_mutex_notheld // Line 7482
#define sqlite3_mutex_try chrome_sqlite3_mutex_try // Line 7370
#define sqlite3_next_stmt chrome_sqlite3_next_stmt // Line 6117
#define sqlite3_normalized_sql chrome_sqlite3_normalized_sql // Line 4040
#define sqlite3_open chrome_sqlite3_open // Lines 3514-3517
#define sqlite3_open16 chrome_sqlite3_open16 // Lines 3518-3521
#define sqlite3_open_v2 chrome_sqlite3_open_v2 // Lines 3522-3527
#define sqlite3_os_end chrome_sqlite3_os_end // Line 1537
#define sqlite3_os_init chrome_sqlite3_os_init // Line 1536
#define sqlite3_overload_function chrome_sqlite3_overload_function // Line 6966
#define sqlite3_prepare chrome_sqlite3_prepare // Lines 3955-3961
#define sqlite3_prepare16 chrome_sqlite3_prepare16 // Lines 3977-3983
#define sqlite3_prepare16_v2 chrome_sqlite3_prepare16_v2 // Lines 3984-3990
#define sqlite3_prepare16_v3 chrome_sqlite3_prepare16_v3 // Lines 3991-3998
#define sqlite3_prepare_v2 chrome_sqlite3_prepare_v2 // Lines 3962-3968
#define sqlite3_prepare_v3 chrome_sqlite3_prepare_v3 // Lines 3969-3976
#define sqlite3_preupdate_count chrome_sqlite3_preupdate_count // Line 9385
#define sqlite3_preupdate_depth chrome_sqlite3_preupdate_depth // Line 9386
#define sqlite3_preupdate_hook chrome_sqlite3_preupdate_hook // Lines 9371-9383
#define sqlite3_preupdate_new chrome_sqlite3_preupdate_new // Line 9387
#define sqlite3_preupdate_old chrome_sqlite3_preupdate_old // Line 9384
#define sqlite3_profile chrome_sqlite3_profile // Lines 3131-3132
#define sqlite3_progress_handler chrome_sqlite3_progress_handler // Line 3259
#define sqlite3_randomness chrome_sqlite3_randomness // Line 2930
#define sqlite3_realloc chrome_sqlite3_realloc // Line 2878
#define sqlite3_realloc64 chrome_sqlite3_realloc64 // Line 2879
#define sqlite3_rekey chrome_sqlite3_rekey // Lines 5846-5849
#define sqlite3_rekey_v2 chrome_sqlite3_rekey_v2 // Lines 5850-5854
#define sqlite3_release_memory chrome_sqlite3_release_memory // Line 6279
#define sqlite3_reset chrome_sqlite3_reset // Line 4916
#define sqlite3_reset_auto_extension \
chrome_sqlite3_reset_auto_extension // Line 6589
#define sqlite3_result_blob chrome_sqlite3_result_blob // Line 5640
#define sqlite3_result_blob64 chrome_sqlite3_result_blob64 // Lines 5641-5642
#define sqlite3_result_double chrome_sqlite3_result_double // Line 5643
#define sqlite3_result_error chrome_sqlite3_result_error // Line 5644
#define sqlite3_result_error16 chrome_sqlite3_result_error16 // Line 5645
#define sqlite3_result_error_code chrome_sqlite3_result_error_code // Line 5648
#define sqlite3_result_error_nomem \
chrome_sqlite3_result_error_nomem // Line 5647
#define sqlite3_result_error_toobig \
chrome_sqlite3_result_error_toobig // Line 5646
#define sqlite3_result_int chrome_sqlite3_result_int // Line 5649
#define sqlite3_result_int64 chrome_sqlite3_result_int64 // Line 5650
#define sqlite3_result_null chrome_sqlite3_result_null // Line 5651
#define sqlite3_result_pointer chrome_sqlite3_result_pointer // Line 5659
#define sqlite3_result_subtype chrome_sqlite3_result_subtype // Line 5676
#define sqlite3_result_text chrome_sqlite3_result_text // Line 5652
#define sqlite3_result_text16 chrome_sqlite3_result_text16 // Line 5655
#define sqlite3_result_text16be chrome_sqlite3_result_text16be // Line 5657
#define sqlite3_result_text16le chrome_sqlite3_result_text16le // Line 5656
#define sqlite3_result_text64 chrome_sqlite3_result_text64 // Lines 5653-5654
#define sqlite3_result_value chrome_sqlite3_result_value // Line 5658
#define sqlite3_result_zeroblob chrome_sqlite3_result_zeroblob // Line 5660
#define sqlite3_result_zeroblob64 chrome_sqlite3_result_zeroblob64 // Line 5661
#define sqlite3_rollback_hook chrome_sqlite3_rollback_hook // Line 6167
#define sqlite3_rtree_geometry_callback \
chrome_sqlite3_rtree_geometry_callback // Lines 9767-9772
#define sqlite3_rtree_query_callback \
chrome_sqlite3_rtree_query_callback // Lines 9793-9799
#define sqlite3_serialize chrome_sqlite3_serialize // Lines 9628-9633
#define sqlite3_set_authorizer chrome_sqlite3_set_authorizer // Lines 3021-3025
#define sqlite3_set_auxdata chrome_sqlite3_set_auxdata // Line 5493
#define sqlite3_set_last_insert_rowid \
chrome_sqlite3_set_last_insert_rowid // Line 2419
#define sqlite3_shutdown chrome_sqlite3_shutdown // Line 1535
#define sqlite3_sleep chrome_sqlite3_sleep // Line 5892
#define sqlite3_snapshot_cmp chrome_sqlite3_snapshot_cmp // Lines 9562-9565
#define sqlite3_snapshot_free chrome_sqlite3_snapshot_free // Line 9535
#define sqlite3_snapshot_get chrome_sqlite3_snapshot_get // Lines 9469-9473
#define sqlite3_snapshot_open chrome_sqlite3_snapshot_open // Lines 9518-9522
#define sqlite3_snapshot_recover chrome_sqlite3_snapshot_recover // Line 9590
#define sqlite3_snprintf chrome_sqlite3_snprintf // Line 2798
#define sqlite3_soft_heap_limit chrome_sqlite3_soft_heap_limit // Line 6371
#define sqlite3_soft_heap_limit64 chrome_sqlite3_soft_heap_limit64 // Line 6359
#define sqlite3_sourceid chrome_sqlite3_sourceid // Line 164
#define sqlite3_sql chrome_sqlite3_sql // Line 4038
#define sqlite3_status chrome_sqlite3_status // Line 7836
#define sqlite3_status64 chrome_sqlite3_status64 // Lines 7837-7842
#define sqlite3_step chrome_sqlite3_step // Line 4588
#define sqlite3_stmt_busy chrome_sqlite3_stmt_busy // Line 4109
#define sqlite3_stmt_isexplain chrome_sqlite3_stmt_isexplain // Line 4088
#define sqlite3_stmt_readonly chrome_sqlite3_stmt_readonly // Line 4076
#define sqlite3_stmt_scanstatus \
chrome_sqlite3_stmt_scanstatus // Lines 9238-9243
#define sqlite3_stmt_scanstatus_reset \
chrome_sqlite3_stmt_scanstatus_reset // Line 9254
#define sqlite3_stmt_status chrome_sqlite3_stmt_status // Line 8099
#define sqlite3_str_append chrome_sqlite3_str_append // Line 7772
#define sqlite3_str_appendall chrome_sqlite3_str_appendall // Line 7773
#define sqlite3_str_appendchar chrome_sqlite3_str_appendchar // Line 7774
#define sqlite3_str_appendf chrome_sqlite3_str_appendf // Line 7770
#define sqlite3_str_errcode chrome_sqlite3_str_errcode // Line 7806
#define sqlite3_str_finish chrome_sqlite3_str_finish // Line 7736
#define sqlite3_str_length chrome_sqlite3_str_length // Line 7807
#define sqlite3_str_new chrome_sqlite3_str_new // Line 7721
#define sqlite3_str_reset chrome_sqlite3_str_reset // Line 7775
#define sqlite3_str_value chrome_sqlite3_str_value // Line 7808
#define sqlite3_str_vappendf chrome_sqlite3_str_vappendf // Line 7771
#define sqlite3_strglob chrome_sqlite3_strglob // Line 8748
#define sqlite3_stricmp chrome_sqlite3_stricmp // Line 8730
#define sqlite3_strlike chrome_sqlite3_strlike // Line 8771
#define sqlite3_strnicmp chrome_sqlite3_strnicmp // Line 8731
#define sqlite3_system_errno chrome_sqlite3_system_errno // Line 9400
#define sqlite3_table_column_metadata \
chrome_sqlite3_table_column_metadata // Lines 6443-6453
#define sqlite3_temp_directory chrome_sqlite3_temp_directory // Line 5950
#define sqlite3_test_control chrome_sqlite3_test_control // Line 7584
#define sqlite3_thread_cleanup chrome_sqlite3_thread_cleanup // Line 5185
#define sqlite3_threadsafe chrome_sqlite3_threadsafe // Line 233
#define sqlite3_total_changes chrome_sqlite3_total_changes // Line 2514
#define sqlite3_trace chrome_sqlite3_trace // Lines 3129-3130
#define sqlite3_trace_v2 chrome_sqlite3_trace_v2 // Lines 3220-3225
#define sqlite3_transfer_bindings chrome_sqlite3_transfer_bindings // Line 5183
#define sqlite3_unlock_notify chrome_sqlite3_unlock_notify // Lines 8715-8719
#define sqlite3_update_hook chrome_sqlite3_update_hook // Lines 6218-6222
#define sqlite3_uri_boolean chrome_sqlite3_uri_boolean // Line 3585
#define sqlite3_uri_int64 chrome_sqlite3_uri_int64 // Line 3586
#define sqlite3_uri_key chrome_sqlite3_uri_key // Line 3587
#define sqlite3_uri_parameter chrome_sqlite3_uri_parameter // Line 3584
#define sqlite3_user_data chrome_sqlite3_user_data // Line 5421
#define sqlite3_value_blob chrome_sqlite3_value_blob // Line 5318
#define sqlite3_value_bytes chrome_sqlite3_value_bytes // Line 5327
#define sqlite3_value_bytes16 chrome_sqlite3_value_bytes16 // Line 5328
#define sqlite3_value_double chrome_sqlite3_value_double // Line 5319
#define sqlite3_value_dup chrome_sqlite3_value_dup // Line 5360
#define sqlite3_value_free chrome_sqlite3_value_free // Line 5361
#define sqlite3_value_frombind chrome_sqlite3_value_frombind // Line 5332
#define sqlite3_value_int chrome_sqlite3_value_int // Line 5320
#define sqlite3_value_int64 chrome_sqlite3_value_int64 // Line 5321
#define sqlite3_value_nochange chrome_sqlite3_value_nochange // Line 5331
#define sqlite3_value_numeric_type \
chrome_sqlite3_value_numeric_type // Line 5330
#define sqlite3_value_pointer chrome_sqlite3_value_pointer // Line 5322
#define sqlite3_value_subtype chrome_sqlite3_value_subtype // Line 5344
#define sqlite3_value_text chrome_sqlite3_value_text // Line 5323
#define sqlite3_value_text16 chrome_sqlite3_value_text16 // Line 5324
#define sqlite3_value_text16be chrome_sqlite3_value_text16be // Line 5326
#define sqlite3_value_text16le chrome_sqlite3_value_text16le // Line 5325
#define sqlite3_value_type chrome_sqlite3_value_type // Line 5329
#define sqlite3_version chrome_sqlite3_version // Line 162
#define sqlite3_vfs_find chrome_sqlite3_vfs_find // Line 7249
#define sqlite3_vfs_register chrome_sqlite3_vfs_register // Line 7250
#define sqlite3_vfs_unregister chrome_sqlite3_vfs_unregister // Line 7251
#define sqlite3_vmprintf chrome_sqlite3_vmprintf // Line 2797
#define sqlite3_vsnprintf chrome_sqlite3_vsnprintf // Line 2799
#define sqlite3_vtab_collation chrome_sqlite3_vtab_collation // Line 9133
#define sqlite3_vtab_config chrome_sqlite3_vtab_config // Line 9021
#define sqlite3_vtab_nochange chrome_sqlite3_vtab_nochange // Line 9118
#define sqlite3_vtab_on_conflict chrome_sqlite3_vtab_on_conflict // Line 9099
#define sqlite3_wal_autocheckpoint \
chrome_sqlite3_wal_autocheckpoint // Line 8865
#define sqlite3_wal_checkpoint chrome_sqlite3_wal_checkpoint // Line 8887
#define sqlite3_wal_checkpoint_v2 \
chrome_sqlite3_wal_checkpoint_v2 // Lines 8981-8987
#define sqlite3_wal_hook chrome_sqlite3_wal_hook // Lines 8830-8834
#define sqlite3_win32_set_directory \
chrome_sqlite3_win32_set_directory // Lines 6008-6011
#define sqlite3_win32_set_directory16 \
chrome_sqlite3_win32_set_directory16 // Line 6013
#define sqlite3_win32_set_directory8 \
chrome_sqlite3_win32_set_directory8 // Line 6012
#define sqlite3changegroup_add chrome_sqlite3changegroup_add // Line 10780
#define sqlite3changegroup_add_strm \
chrome_sqlite3changegroup_add_strm // Lines 11442-11445
#define sqlite3changegroup_delete \
chrome_sqlite3changegroup_delete // Line 10817
#define sqlite3changegroup_new chrome_sqlite3changegroup_new // Line 10702
#define sqlite3changegroup_output \
chrome_sqlite3changegroup_output // Lines 10807-10811
#define sqlite3changegroup_output_strm \
chrome_sqlite3changegroup_output_strm // Lines 11446-11449
#define sqlite3changeset_apply \
chrome_sqlite3changeset_apply // Lines 10977-10991
#define sqlite3changeset_apply_strm \
chrome_sqlite3changeset_apply_strm // Lines 11375-11389
#define sqlite3changeset_apply_v2 \
chrome_sqlite3changeset_apply_v2 // Lines 10992-11008
#define sqlite3changeset_apply_v2_strm \
chrome_sqlite3changeset_apply_v2_strm // Lines 11390-11406
#define sqlite3changeset_concat \
chrome_sqlite3changeset_concat // Lines 10648-10655
#define sqlite3changeset_concat_strm \
chrome_sqlite3changeset_concat_strm // Lines 11407-11414
#define sqlite3changeset_conflict \
chrome_sqlite3changeset_conflict // Lines 10534-10538
#define sqlite3changeset_finalize \
chrome_sqlite3changeset_finalize // Line 10587
#define sqlite3changeset_fk_conflicts \
chrome_sqlite3changeset_fk_conflicts // Lines 10551-10554
#define sqlite3changeset_invert \
chrome_sqlite3changeset_invert // Lines 10617-10620
#define sqlite3changeset_invert_strm \
chrome_sqlite3changeset_invert_strm // Lines 11415-11420
#define sqlite3changeset_new chrome_sqlite3changeset_new // Lines 10506-10510
#define sqlite3changeset_next chrome_sqlite3changeset_next // Line 10378
#define sqlite3changeset_old chrome_sqlite3changeset_old // Lines 10472-10476
#define sqlite3changeset_op chrome_sqlite3changeset_op // Lines 10407-10413
#define sqlite3changeset_pk chrome_sqlite3changeset_pk // Lines 10441-10445
#define sqlite3changeset_start \
chrome_sqlite3changeset_start // Lines 10329-10333
#define sqlite3changeset_start_strm \
chrome_sqlite3changeset_start_strm // Lines 11421-11425
#define sqlite3changeset_start_v2 \
chrome_sqlite3changeset_start_v2 // Lines 10334-10339
#define sqlite3changeset_start_v2_strm \
chrome_sqlite3changeset_start_v2_strm // Lines 11426-11431
#define sqlite3rebaser_configure \
chrome_sqlite3rebaser_configure // Lines 11250-11253
#define sqlite3rebaser_create chrome_sqlite3rebaser_create // Line 11239
#define sqlite3rebaser_delete chrome_sqlite3rebaser_delete // Line 11283
#define sqlite3rebaser_rebase chrome_sqlite3rebaser_rebase // Lines 11269-11273
#define sqlite3rebaser_rebase_strm \
chrome_sqlite3rebaser_rebase_strm // Lines 11450-11456
#define sqlite3session_attach chrome_sqlite3session_attach // Lines 10036-10039
#define sqlite3session_changeset \
chrome_sqlite3session_changeset // Lines 10165-10169
#define sqlite3session_changeset_strm \
chrome_sqlite3session_changeset_strm // Lines 11432-11436
#define sqlite3session_config chrome_sqlite3session_config // Line 11491
#define sqlite3session_create chrome_sqlite3session_create // Lines 9906-9910
#define sqlite3session_delete chrome_sqlite3session_delete // Line 9925
#define sqlite3session_diff chrome_sqlite3session_diff // Lines 10228-10233
#define sqlite3session_enable chrome_sqlite3session_enable // Line 9946
#define sqlite3session_indirect chrome_sqlite3session_indirect // Line 9976
#define sqlite3session_isempty chrome_sqlite3session_isempty // Line 10286
#define sqlite3session_patchset \
chrome_sqlite3session_patchset // Lines 10265-10269
#define sqlite3session_patchset_strm \
chrome_sqlite3session_patchset_strm // Lines 11437-11441
#define sqlite3session_table_filter \
chrome_sqlite3session_table_filter // Lines 10051-10058
#endif // THIRD_PARTY_SQLITE_AMALGAMATION_RENAME_EXPORTS_H_
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
// Copyright 2020 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef THIRD_PARTY_SQLITE_DEV_SQLITE3_H_
#define THIRD_PARTY_SQLITE_DEV_SQLITE3_H_
// This is a shim header to include the right sqlite3 headers.
// Use this instead of referencing sqlite3 headers directly.
// We prefix chrome_ to SQLite's exported symbols, so that we don't clash with
// other SQLite libraries loaded by the system libraries. This only matters when
// using the component build, where our SQLite's symbols are visible to the
// dynamic library loader.
#include "third_party/sqlite/amalgamation_dev/rename_exports.h"
#include "third_party/sqlite/amalgamation_dev/sqlite3.h"
#endif // THIRD_PARTY_SQLITE_DEV_SQLITE3_H_
// Copyright 2020 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// This is a shim that injects Chrome-specific defitions into sqlite3.c
// BUILD.gn uses this instead of building the sqlite3 amalgamation directly.
// We prefix chrome_ to SQLite's exported symbols, so that we don't clash with
// other SQLite libraries loaded by the system libraries. This only matters when
// using the component build, where our SQLite's symbols are visible to the
// dynamic library loader.
#include "third_party/sqlite/amalgamation_dev/rename_exports.h"
#include "third_party/sqlite/sqlite3_shim_fixups.h"
#include "third_party/sqlite/amalgamation_dev/sqlite3.c"
...@@ -4,16 +4,19 @@ ...@@ -4,16 +4,19 @@
# Use of this source code is governed by a BSD-style license that can be # Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file. # found in the LICENSE file.
# This script generates two amalgamated sources for SQLite.
# One is for Chromium, it has some features disabled. The other one is for
# developer tools, with a fuller set of features.
# The build flag sets should be in sync with the defines in BUILD.gn,
# "chromium_sqlite3_compile_options" and "common_sqlite3_compile_options"
# configs.
set -o errexit # Stop the script on the first error. set -o errexit # Stop the script on the first error.
set -o nounset # Catch un-initialized variables. set -o nounset # Catch un-initialized variables.
cd patched cd patched
mkdir build BUILD_GN_FLAGS_COMMON="\
cd build
# The compile flags here should match the defines in BUILD.gn.
BUILD_GN_FLAGS="\
-DSQLITE_DISABLE_FTS3_UNICODE \ -DSQLITE_DISABLE_FTS3_UNICODE \
-DSQLITE_DISABLE_FTS4_DEFERRED \ -DSQLITE_DISABLE_FTS4_DEFERRED \
-DSQLITE_ENABLE_FTS3 \ -DSQLITE_ENABLE_FTS3 \
...@@ -27,47 +30,66 @@ BUILD_GN_FLAGS="\ ...@@ -27,47 +30,66 @@ BUILD_GN_FLAGS="\
-DSQLITE_HAVE_ISNAN \ -DSQLITE_HAVE_ISNAN \
-DSQLITE_MAX_WORKER_THREADS=0 \ -DSQLITE_MAX_WORKER_THREADS=0 \
-DSQLITE_MAX_MMAP_SIZE=268435456 \ -DSQLITE_MAX_MMAP_SIZE=268435456 \
-DSQLITE_OMIT_DECLTYPE \
-DSQLITE_OMIT_DEPRECATED \
-DSQLITE_OMIT_LOAD_EXTENSION \
-DSQLITE_OMIT_PROGRESS_CALLBACK \
-DSQLITE_OMIT_SHARED_CACHE \
-DSQLITE_SECURE_DELETE \
-DSQLITE_THREADSAFE=1 \
-DSQLITE_USE_ALLOCA \
"
BUILD_GN_FLAGS_CHROMIUM="\
-DSQLITE_OMIT_ANALYZE \ -DSQLITE_OMIT_ANALYZE \
-DSQLITE_OMIT_AUTOINIT \ -DSQLITE_OMIT_AUTOINIT \
-DSQLITE_OMIT_AUTORESET \ -DSQLITE_OMIT_AUTORESET \
-DSQLITE_OMIT_COMPILEOPTION_DIAGS \ -DSQLITE_OMIT_COMPILEOPTION_DIAGS \
-DSQLITE_OMIT_COMPLETE \ -DSQLITE_OMIT_COMPLETE \
-DSQLITE_OMIT_DECLTYPE \
-DSQLITE_OMIT_DEPRECATED \
-DSQLITE_OMIT_EXPLAIN \ -DSQLITE_OMIT_EXPLAIN \
-DSQLITE_OMIT_GET_TABLE \ -DSQLITE_OMIT_GET_TABLE \
-DSQLITE_OMIT_LOAD_EXTENSION \
-DSQLITE_OMIT_LOOKASIDE \ -DSQLITE_OMIT_LOOKASIDE \
-DSQLITE_OMIT_TCL_VARIABLE \ -DSQLITE_OMIT_TCL_VARIABLE \
-DSQLITE_OMIT_PROGRESS_CALLBACK \
-DSQLITE_OMIT_REINDEX \ -DSQLITE_OMIT_REINDEX \
-DSQLITE_OMIT_SHARED_CACHE \
-DSQLITE_OMIT_TRACE \ -DSQLITE_OMIT_TRACE \
-DSQLITE_OMIT_UPSERT \ -DSQLITE_OMIT_UPSERT \
-DSQLITE_OMIT_WINDOWFUNC \ -DSQLITE_OMIT_WINDOWFUNC \
-DSQLITE_SECURE_DELETE \
-DSQLITE_THREADSAFE=1 \
-DSQLITE_USE_ALLOCA \
" "
../configure \ BUILD_GN_FLAGS_DEV="\
CFLAGS="-Os $BUILD_GN_FLAGS $(icu-config --cppflags)" \ -DSQLITE_ENABLE_EXPLAIN_COMMENTS \
LDFLAGS="$(icu-config --ldflags)" \ "
--disable-load-extension \
--enable-amalgamation \ generate_amalgamation() {
--enable-threadsafe local build_flags=$1
local amalgamation_path=$2
mkdir build
cd build
../configure \
CFLAGS="-Os $build_flags $(icu-config --cppflags)" \
LDFLAGS="$(icu-config --ldflags)" \
--disable-load-extension \
--enable-amalgamation \
--enable-threadsafe
make shell.c sqlite3.h sqlite3.c
cp -f sqlite3.h sqlite3.c ../$amalgamation_path/
# shell.c must be placed in a different directory from sqlite3.h, because it
# contains an '#include "sqlite3.h"' that we want to resolve to our custom
# //third_party/sqlite/sqlite3.h, not to the sqlite3.h produced here.
mkdir -p ../$amalgamation_path/shell/
cp -f shell.c ../$amalgamation_path/shell/
make shell.c sqlite3.h sqlite3.c cd ..
cp -f sqlite3.h sqlite3.c ../../amalgamation rm -rf build
# shell.c must be placed in a different directory from sqlite3.h, because it ../scripts/extract_sqlite_api.py $amalgamation_path/sqlite3.h \
# contains an '#include "sqlite3.h"' that we want to resolve to our custom $amalgamation_path/rename_exports.h
# //third_party/sqlite/sqlite3.h, not to the sqlite3.h produced here. }
mkdir -p ../../amalgamation/shell/
cp -f shell.c ../../amalgamation/shell/
cd .. generate_amalgamation "$BUILD_GN_FLAGS_COMMON $BUILD_GN_FLAGS_CHROMIUM" ../amalgamation
rm -rf build generate_amalgamation "$BUILD_GN_FLAGS_COMMON $BUILD_GN_FLAGS_DEV" ../amalgamation_dev
../scripts/extract_sqlite_api.py ../amalgamation/sqlite3.h \
../amalgamation/rename_exports.h
...@@ -11,60 +11,6 @@ ...@@ -11,60 +11,6 @@
// dynamic library loader. // dynamic library loader.
#include "third_party/sqlite/amalgamation/rename_exports.h" #include "third_party/sqlite/amalgamation/rename_exports.h"
#if defined(SQLITE_OMIT_COMPILEOPTION_DIAGS) #include "third_party/sqlite/sqlite3_shim_fixups.h"
// When SQLITE_OMIT_COMPILEOPTION_DIAGS is defined, sqlite3.h emits macros
// instead of declarations for sqlite3_compileoption_{get,used}().
//
// In order to avoid a macro redefinition warning, we must undo the #define in
// rename_exports.h.
#if defined(sqlite3_compileoption_get)
#undef sqlite3_compileoption_get
#else
#error "This workaround is no longer needed."
#endif // !defined(sqlite3_compileoption_get)
#if defined(sqlite3_compileoption_used)
#undef sqlite3_compileoption_used
#else
#error "This workaround is no longer needed."
#endif // !defined(sqlite3_compileoption_used)
#endif // defined(SQLITE_OMIT_COMPILEOPTION_DIAGS)
// Linux-specific configuration fixups.
#if defined(__linux__)
// features.h, included below, indirectly includes sys/mman.h. The latter header
// only defines mremap if _GNU_SOURCE is defined. Depending on the order of the
// files in the amalgamation, removing the define below may result in a build
// error on Linux.
#if defined(__GNUC__) && !defined(_GNU_SOURCE)
#define _GNU_SOURCE
#endif
#include <features.h>
// SQLite wants to track malloc sizes. On OSX it uses malloc_size(), on Windows
// _msize(), elsewhere it handles it manually by enlarging the malloc and
// injecting a field. Enable malloc_usable_size() for Linux.
//
// malloc_usable_size() is not exported by the Android NDK. It is not
// implemented by uclibc.
#if !defined(__UCLIBC__) && !defined(__ANDROID__)
#define HAVE_MALLOC_H 1
#define HAVE_MALLOC_USABLE_SIZE 1
#endif
#endif // defined(__linux__)
// For unfortunately complex reasons, Chrome has release builds where
// DCHECK_IS_ON() (so we want SQLITE_DEBUG to be on) but NDEBUG is also defined.
// This causes declarations for mutex-checking functions used by SQLITE_DEBUG
// code (sqlite3_mutex_held, sqlite3_mutex_notheld) to be omitted, resulting in
// warnings.
//
// The easiest solution for now is to undefine NDEBUG when SQLITE_DEBUG is
// defined. The #undef only takes effect for the SQLite implementation (included
// below), and does not impact any dependency.
#if defined(SQLITE_DEBUG) && defined(NDEBUG)
#undef NDEBUG
#endif // defined(SQLITE_DEBUG) && defined(NDEBUG)
#include "third_party/sqlite/amalgamation/sqlite3.c" #include "third_party/sqlite/amalgamation/sqlite3.c"
// Copyright 2020 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef THIRD_PARTY_SQLITE_SQLITE3_SHIM_FIXUPS_H_
#define THIRD_PARTY_SQLITE_SQLITE3_SHIM_FIXUPS_H_
// This file contains various fixups for the amalgamated SQLite code.
// It is intended to be included in sqlite3_shim.c only.
#if defined(SQLITE_OMIT_COMPILEOPTION_DIAGS)
// When SQLITE_OMIT_COMPILEOPTION_DIAGS is defined, sqlite3.h emits macros
// instead of declarations for sqlite3_compileoption_{get,used}().
//
// In order to avoid a macro redefinition warning, we must undo the #define in
// rename_exports.h.
#if defined(sqlite3_compileoption_get)
#undef sqlite3_compileoption_get
#else
#error "This workaround is no longer needed."
#endif // !defined(sqlite3_compileoption_get)
#if defined(sqlite3_compileoption_used)
#undef sqlite3_compileoption_used
#else
#error "This workaround is no longer needed."
#endif // !defined(sqlite3_compileoption_used)
#endif // defined(SQLITE_OMIT_COMPILEOPTION_DIAGS)
// Linux-specific configuration fixups.
#if defined(__linux__)
// features.h, included below, indirectly includes sys/mman.h. The latter header
// only defines mremap if _GNU_SOURCE is defined. Depending on the order of the
// files in the amalgamation, removing the define below may result in a build
// error on Linux.
#if defined(__GNUC__) && !defined(_GNU_SOURCE)
#define _GNU_SOURCE
#endif
#include <features.h>
// SQLite wants to track malloc sizes. On OSX it uses malloc_size(), on Windows
// _msize(), elsewhere it handles it manually by enlarging the malloc and
// injecting a field. Enable malloc_usable_size() for Linux.
//
// malloc_usable_size() is not exported by the Android NDK. It is not
// implemented by uclibc.
#if !defined(__UCLIBC__) && !defined(__ANDROID__)
#define HAVE_MALLOC_H 1
#define HAVE_MALLOC_USABLE_SIZE 1
#endif
#endif // defined(__linux__)
// For unfortunately complex reasons, Chrome has release builds where
// DCHECK_IS_ON() (so we want SQLITE_DEBUG to be on) but NDEBUG is also defined.
// This causes declarations for mutex-checking functions used by SQLITE_DEBUG
// code (sqlite3_mutex_held, sqlite3_mutex_notheld) to be omitted, resulting in
// warnings.
//
// The easiest solution for now is to undefine NDEBUG when SQLITE_DEBUG is
// defined. The #undef only takes effect for the SQLite implementation (included
// below), and does not impact any dependency.
#if defined(SQLITE_DEBUG) && defined(NDEBUG)
#undef NDEBUG
#endif // defined(SQLITE_DEBUG) && defined(NDEBUG)
#endif // THIRD_PARTY_SQLITE_SQLITE3_SHIM_FIXUPS_H_
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment