db/sqlite3/src/moz.build
author Marco Bonardo <mbonardo@mozilla.com>
Thu, 03 Nov 2016 21:04:00 +0100
changeset 363972 059f143b789492d36df1cf20ba6385e16572e139
parent 363938 4c050d33b8424ef92cf6cfe6befb135dd18b80be
child 364054 60046427323744b6384ef3ee14ec82feeb33d932
permissions -rw-r--r--
Bug 1313309 - Remove getColumnDecltype and compile with SQLITE_OMIT_DECLTYPE. r=asuth MozReview-Commit-ID: 2QR8P7ylg9m

# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
# vim: set filetype=python:
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
NO_VISIBILITY_FLAGS = True

EXPORTS += [
    'sqlite3.h',
]

# We allow warnings for third-party code that can be updated from upstream.
ALLOW_COMPILER_WARNINGS = True

if CONFIG['MOZ_FOLD_LIBS']:
    # When folding libraries, sqlite is actually in the nss library.
    FINAL_LIBRARY = 'nss'
else:
    # The final library is in config/external/sqlite
    FINAL_LIBRARY = 'sqlite'

SOURCES += [
    'sqlite3.c',
]

# -DSQLITE_SECURE_DELETE=1 will cause SQLITE to 0-fill delete data so we
# don't have to vacuum to make sure the data is not visible in the file.
# -DSQLITE_ENABLE_FTS3=1 enables the full-text index module.
# -DSQLITE_CORE=1 statically links that module into the SQLite library.
# -DSQLITE_DEFAULT_PAGE_SIZE=32768 and SQLITE_MAX_DEFAULT_PAGE_SIZE=32768
# increases the page size from 1k, see bug 416330.  It must be kept in sync with
# the value of PREF_TS_PAGESIZE_DEFAULT in mozStorageService.cpp.  The value can
# be overridden on a per-platform basis through the use of the PREF_TS_PAGESIZE
# hidden preference.  If that preference is missing or invalid then this value
# will be used.
# -DSQLITE_MAX_SCHEMA_RETRY increases the times SQLite may try to reparse
# statements when the schema changes. This is important when supporting lots of
# concurrent connections, especially when they use shared cache.
# Note: Be sure to update the configure.in checks when these change!
for var in ('SQLITE_SECURE_DELETE', 'SQLITE_THREADSAFE', 'SQLITE_CORE',
            'SQLITE_ENABLE_FTS3', 'SQLITE_ENABLE_UNLOCK_NOTIFY',
            'SQLITE_ENABLE_DBSTAT_VTAB'):
    DEFINES[var] = 1

DEFINES['SQLITE_DEFAULT_PAGE_SIZE'] = 32768
DEFINES['SQLITE_MAX_DEFAULT_PAGE_SIZE'] = 32768
DEFINES['SQLITE_MAX_SCHEMA_RETRY'] = 25

# -DSQLITE_WIN32_GETVERSIONEX=0 avoids using deprecated functions.
# SQLite will just assume we are running on NT kinds of Windows. That's fine
# because we don't support Win9x.
# -DSQLITE_ALLOW_URI_AUTHORITY=1 enables uri authorities. See bug 879133.
if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows':
    DEFINES['SQLITE_WIN32_GETVERSIONEX'] = 0
    DEFINES['SQLITE_ALLOW_URI_AUTHORITY'] = 1

# -DSQLITE_ENABLE_LOCKING_STYLE=1 to help with AFP folders
if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa':
    DEFINES['SQLITE_ENABLE_LOCKING_STYLE'] = 1

# sqlite defaults this to on on __APPLE_ but it breaks on newer iOS SDKs
if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'uikit':
    DEFINES['SQLITE_ENABLE_LOCKING_STYLE'] = 0

# Thunderbird needs the 2-argument version of fts3_tokenizer()
if CONFIG['MOZ_THUNDERBIRD'] or CONFIG['MOZ_SUITE']:
    DEFINES['SQLITE_ENABLE_FTS3_TOKENIZER'] = 1

# Turn on SQLite's assertions in debug builds.
if CONFIG['MOZ_DEBUG']:
    DEFINES['SQLITE_DEBUG'] = 1

if CONFIG['OS_TARGET'] == 'Android':
    # default to user readable only to fit Android security model
    DEFINES['SQLITE_DEFAULT_FILE_PERMISSIONS'] = '0600'

# Force using malloc_usable_size when building with jemalloc because _msize
# causes assertions on Win64. See bug 719579.
if CONFIG['OS_ARCH'] == 'WINNT' and CONFIG['MOZ_MEMORY']:
    DEFINES['HAVE_MALLOC_USABLE_SIZE'] = True
    DEFINES['SQLITE_WITHOUT_MSIZE'] = True

# Omit unused functions to save some library footprint.
DEFINES['SQLITE_OMIT_DEPRECATED'] = True
DEFINES['SQLITE_OMIT_BUILTIN_TEST'] = True
DEFINES['SQLITE_OMIT_DECLTYPE'] = True

# Suppress warnings in third-party code.
if CONFIG['GNU_CC']:
    CFLAGS += [
        '-Wno-sign-compare',
        '-Wno-type-limits',
    ]