• Victor Costan's avatar
    sqlite: Clean up build. · c2e79a34
    Victor Costan authored
    This CL includes the following inter-dependent changes.
    
    1) Use SQLITE_DEFAULT_LOOKASIDE instead of a sqlite_db_config() call.
    2) Use SQLITE_OMIT_COMPILEOPTION_DIAGS. This is needed to avoid a
        compilation error after the previous change.
    3) Rework the way Chome-specific defines are injected into the SQLite
        amalgamation. This is needed to get the code linking after the
        previous change, and is explained in detail below.
    4) Replace Chromium -> Chrome in SQLite's BUILD.gn file. While the
        project's name is Chromium, the codebase refers to the resulting
        product as Chrome. This is not strongly related to the above, but
        is bundled to avoid merge conflicts.
    
    Chrome's SQLite version is first generated using the standard
    amalgamation process [1]. Then we inject a set of macros [2] adding a
    prefix to every symbol exported by SQLite. This is currently done by
    taking advantage of the fact that a standard build of SQLite #includes
    a "config.h" header if the _HAVE_SQLITE_CONFIG_H macro is defined.
    
    Our current approach relies on the fact that the amalgamation generation
    script simply happens to list ctime.c as the first file in the
    amalgamation [3]. When the file's content is ignored by defining the
    SQLITE_OMIT_COMPILEOPTION_DIAGS macro, the assumption does not hold
    anymore.
    
    This CL replaces the _HAVE_SQLITE_CONFIG_H macro with an approach
    guaranteed to surive changes in SQLite's amalgamation process. Instead
    of building amalgamation/sqlite3.c directly, this CL introduces a
    sqlite3_shim.c which sets up the Chrome-specific compilation
    environment, including our rename macros, and then #includes
    amalgamation/sqlite3.c.
    
    [1] https://www.sqlite.org/amalgamation.html
    [2] https://cs.chromium.org/chromium/src/third_party/sqlite/amalgamation/rename_exports.h
    [3] https://cs.chromium.org/chromium/src/third_party/sqlite/src/tool/mksqlite3c.tcl?q=ctime.c
    
    Change-Id: Ib4ccea5f9c025114e7d2ebf0305687ed21bf68b7
    Reviewed-on: https://chromium-review.googlesource.com/1146155
    Commit-Queue: Victor Costan <pwnall@chromium.org>
    Reviewed-by: default avatarChris Mumford <cmumford@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#577423}
    c2e79a34
sqlite3_shim.c 1.54 KB