// // // Build the library // // package { default_applicable_licenses: ["external_sqlite_dist_license"], } // Added automatically by a large-scale-change that took the approach of // 'apply every license found to every target'. While this makes sure we respect // every license restriction, it may not be entirely correct. // // e.g. GPL in an MIT project might only apply to the contrib/ directory. // // Please consider splitting the single license below into multiple licenses, // taking care not to lose any license_kind information, and overriding the // default license using the 'licenses: [...]' property on targets as needed. // // For unused files, consider creating a 'fileGroup' with "//visibility:private" // to attach the license to, and including a comment whether the files may be // used in the current project. // See: http://go/android-license-faq license { name: "external_sqlite_dist_license", visibility: [":__subpackages__"], license_kinds: [ "legacy_permissive", "legacy_unencumbered", ], license_text: [ "NOTICE", ], } cc_defaults { name: "sqlite-minimal-defaults", host_supported: true, // static analysis is too slow on these huge files. tidy_checks: [ "-clang-analyzer-*", ], // NOTE the following flags, // SQLITE_TEMP_STORE=3 causes all TEMP files to go into RAM. and thats the behavior we want // SQLITE_ENABLE_FTS3 enables usage of FTS3 - NOT FTS1 or 2. // SQLITE_DEFAULT_AUTOVACUUM=1 causes the databases to be subject to auto-vacuum cflags: [ "-DNDEBUG=1", "-DHAVE_USLEEP=1", "-DSQLITE_HAVE_ISNAN", "-DSQLITE_DEFAULT_JOURNAL_SIZE_LIMIT=1048576", "-DSQLITE_THREADSAFE=2", "-DSQLITE_TEMP_STORE=3", "-DSQLITE_POWERSAFE_OVERWRITE=1", "-DSQLITE_DEFAULT_FILE_FORMAT=4", "-DSQLITE_DEFAULT_AUTOVACUUM=1", "-DSQLITE_ENABLE_MEMORY_MANAGEMENT=1", "-DSQLITE_ENABLE_FTS3", "-DSQLITE_ENABLE_FTS3_BACKWARDS", "-DSQLITE_ENABLE_FTS4", "-DSQLITE_OMIT_BUILTIN_TEST", "-DSQLITE_OMIT_COMPILEOPTION_DIAGS", "-DSQLITE_OMIT_LOAD_EXTENSION", "-DSQLITE_DEFAULT_FILE_PERMISSIONS=0600", "-DSQLITE_SECURE_DELETE", "-DSQLITE_ENABLE_BATCH_ATOMIC_WRITE", "-DBIONIC_IOCTL_NO_SIGNEDNESS_OVERLOAD", "-DSQLITE_DEFAULT_LEGACY_ALTER_TABLE", "-DSQLITE_ALLOW_ROWID_IN_VIEW", "-DSQLITE_ENABLE_BYTECODE_VTAB", "-Wno-unused-parameter", "-Werror", // Default value causes sqlite3_open_v2 to return error if DB is missing. "-ftrivial-auto-var-init=pattern", ], target: { linux_glibc: { cflags: ["-DHAVE_POSIX_FALLOCATE=1"], }, }, } cc_defaults { name: "sqlite-defaults", defaults: ["sqlite-minimal-defaults"], target: { android: { cflags: [ "-DUSE_PREAD64", "-Dfdatasync=fdatasync", "-DHAVE_MALLOC_H=1", "-DSQLITE_ENABLE_DBSTAT_VTAB", ], }, }, cflags: [ "-U_FORTIFY_SOURCE", "-D_FORTIFY_SOURCE=3", ], } soong_config_module_type { name: "release_package_libsqlite3_library_defaults_config", module_type: "cc_defaults", config_namespace: "libsqlite3", value_variables: ["release_package_libsqlite3"], properties: [ "export_include_dirs", "srcs", ], } // Construct the correct source and includes for sqlite libraries, // based on the build flag. release_package_libsqlite3_library_defaults_config { name: "release_package_libsqlite3_library_defaults", soong_config_variables: { release_package_libsqlite3: { export_include_dirs: ["sqlite-autoconf-%s"], srcs: ["sqlite-autoconf-%s/sqlite3.c"], conditions_default: { export_include_dirs: ["sqlite-default"], srcs: ["sqlite-default/sqlite3.c"], }, }, }, } cc_defaults { name: "libsqlite_defaults", defaults: [ "sqlite-defaults", "release_package_libsqlite3_library_defaults", ], } cc_library { name: "libsqlite", defaults: [ "sqlite-defaults", "release_package_libsqlite3_library_defaults", ], product_available: true, vendor_available: true, native_bridge_supported: true, target: { android: { shared_libs: [ "libdl", "liblog", "libandroidicu", ], cflags: ["-DSQLITE_ENABLE_ICU"], // include android specific methods whole_static_libs: ["libsqlite3_android"], }, host: { static_libs: [ "liblog", ], shared_libs: [ "libicui18n", "libicuuc", ], cflags: ["-DSQLITE_ENABLE_ICU"], // include android specific methods whole_static_libs: ["libsqlite3_android"], }, windows: { enabled: true, }, product: { cflags: ["-USQLITE_ENABLE_ICU"], exclude_shared_libs: ["libandroidicu"], exclude_static_libs: ["libsqlite3_android"], }, vendor: { cflags: ["-USQLITE_ENABLE_ICU"], exclude_shared_libs: ["libandroidicu"], exclude_static_libs: ["libsqlite3_android"], }, }, apex_available: [ "//apex_available:platform", "com.android.virt", "com.sdv.*", ], afdo: true, // libsqlite is a single gigantic C file, no need to run LTO. lto: { never: true, }, } // This static library is variant of libsqlite built without the ICU extension. // The library is supposed to be used in environments where the ICU extension // is not needed and the dependency to ICU (which is as large as 60+ MB) is not // desirable, like microdroid. cc_library_static { name: "libsqlite_static_noicu", defaults: [ "sqlite-defaults", "release_package_libsqlite3_library_defaults", ], whole_static_libs: ["libsqlite3_android_noicu"], // Not define SQLITE_ENABLE_ICU apex_available: [ "//apex_available:platform", "com.android.os.statsd", "test_com.android.os.statsd", ], min_sdk_version: "apex_inherit", host_supported: true, } // Build a minimal version of sqlite3 without any android specific // features against the NDK. This is used by libcore's JDBC related // unit tests. cc_library_static { name: "libsqlite_static_minimal", defaults: [ "sqlite-minimal-defaults", "release_package_libsqlite3_library_defaults", ], sdk_version: "23", } soong_config_module_type { name: "release_package_libsqlite3_library_percentile_config", module_type: "cc_library_static", config_namespace: "libsqlite3", value_variables: ["release_package_libsqlite3"], properties: [ "export_include_dirs", ], } release_package_libsqlite3_library_percentile_config { name: "sqlite_ext_percentile", soong_config_variables: { release_package_libsqlite3: { export_include_dirs: ["sqlite-autoconf-%s"], conditions_default: { export_include_dirs: ["sqlite-default"], }, }, }, srcs: [ "ext/misc/percentile.c", ], defaults: ["sqlite-defaults"], host_supported: true, } // // // Build the device command line tool sqlite3 // // soong_config_module_type { name: "release_package_libsqlite3_library_shell_config", module_type: "cc_binary", config_namespace: "libsqlite3", value_variables: ["release_package_libsqlite3"], properties: [ "srcs", ], } // Construct the correct source and includes for sqlite libraries, // based on the build flag. release_package_libsqlite3_library_shell_config { name: "sqlite3", soong_config_variables: { release_package_libsqlite3: { srcs: ["sqlite-autoconf-%s/shell.c"], conditions_default: { srcs: ["sqlite-default/shell.c"], }, }, }, defaults: ["sqlite-defaults"], target: { android: { shared_libs: [ "libsqlite", "libandroidicu", "liblog", "libutils", ], }, host: { cflags: ["-DNO_ANDROID_FUNCS=1"], static_libs: [ "libsqlite", // sqlite3MemsysAlarm uses LOG() "liblog", "libicui18n", "libicuuc", "libicuuc_stubdata", ], }, windows: { enabled: true, }, }, }