summaryrefslogtreecommitdiffstats
path: root/third_party
diff options
context:
space:
mode:
authorshess <shess@chromium.org>2015-09-01 16:48:02 -0700
committerCommit bot <commit-bot@chromium.org>2015-09-01 23:48:42 +0000
commit490badf7240616d0be64b4a49f1039477c1306c0 (patch)
treee3a8a23056af3b974ded42888e3661c1b3b5aeef /third_party
parentb39d7d421eac62bf70fde0d15bd15fe6f6bcbe75 (diff)
downloadchromium_src-490badf7240616d0be64b4a49f1039477c1306c0.zip
chromium_src-490badf7240616d0be64b4a49f1039477c1306c0.tar.gz
chromium_src-490badf7240616d0be64b4a49f1039477c1306c0.tar.bz2
[sqlite] Respect the gyp and gn component switch.
SQLITE_API is the existing mechanism SQLite provides, and is used in preference to inventing a new SQLITE_EXPORT symbol (like sql/sql_export.h and other examples). CoreServices.framework is necessary on OSX because of the Time Machine patch. Rename library to prevent accidental override of system libsqlite3.dylib on OSX. [Relanding https://codereview.chromium.org/1306863006/ with sql/ changes removed] BUG=489444, 526208 Review URL: https://codereview.chromium.org/1304373009 Cr-Commit-Position: refs/heads/master@{#346789}
Diffstat (limited to 'third_party')
-rw-r--r--third_party/sqlite/BUILD.gn32
-rw-r--r--third_party/sqlite/sqlite.gyp15
2 files changed, 42 insertions, 5 deletions
diff --git a/third_party/sqlite/BUILD.gn b/third_party/sqlite/BUILD.gn
index 92d0d88..af6381c 100644
--- a/third_party/sqlite/BUILD.gn
+++ b/third_party/sqlite/BUILD.gn
@@ -10,11 +10,16 @@ declare_args() {
}
if (!use_system_sqlite) {
+ # TODO(shess): This cannot possibly be the right thing to do. AFAICT it is
+ # only necessary so that WebDatabase can #include <sqlite3.h>.
config("sqlite_config") {
include_dirs = [ "." ]
}
- source_set("sqlite") {
+ # "sqlite3" can cause conflicts with the system library.
+ component("chromium_sqlite3") {
+ visibility = [ ":*" ]
+
sources = [
"amalgamation/sqlite3.c",
"amalgamation/sqlite3.h",
@@ -31,6 +36,13 @@ if (!use_system_sqlite) {
"SQLITE_SEPARATE_CACHE_POOLS",
"THREADSAFE",
]
+ if (is_component_build) {
+ if (is_win) {
+ defines += [ "SQLITE_API=__declspec(dllexport)" ]
+ } else {
+ defines += [ "SQLITE_API=__attribute__((visibility(\"default\")))" ]
+ }
+ }
if (is_chromeos) {
defines += [
# Despite obvious warnings about not using this flag in deployment, we
@@ -84,7 +96,10 @@ if (!use_system_sqlite) {
if (is_linux) {
libs = [ "dl" ]
} else if (is_mac || is_ios) {
- libs = [ "CoreFoundation.framework" ]
+ libs = [
+ "CoreFoundation.framework",
+ "CoreServices.framework",
+ ]
} else if (is_android) {
defines += [
"SQLITE_DEFAULT_JOURNAL_SIZE_LIMIT=1048576",
@@ -98,8 +113,19 @@ if (!use_system_sqlite) {
deps = [
"//third_party/icu",
]
+ }
- public_configs = [ ":sqlite_config" ]
+ config("sqlite_export") {
+ if (is_component_build && is_win) {
+ defines = [ "SQLITE_API=__declspec(dllimport)" ]
+ }
+ }
+
+ # This is used to allow the SQLITE_API definition to be different when
+ # building sqlite3.c than it is when clients include sqlite3.h.
+ group("sqlite") {
+ public_deps = [ ":chromium_sqlite3" ]
+ public_configs = [ ":sqlite_export", ":sqlite_config" ]
}
if (is_linux) {
diff --git a/third_party/sqlite/sqlite.gyp b/third_party/sqlite/sqlite.gyp
index 61bfd9d..4fabe5e 100644
--- a/third_party/sqlite/sqlite.gyp
+++ b/third_party/sqlite/sqlite.gyp
@@ -115,8 +115,9 @@
}],
],
}, { # !use_system_sqlite
- 'product_name': 'sqlite3',
- 'type': 'static_library',
+ # "sqlite3" can cause conflicts with the system library.
+ 'product_name': 'chromium_sqlite3',
+ 'type': '<(component)',
'sources': [
'amalgamation/sqlite3.h',
'amalgamation/sqlite3.c',
@@ -148,6 +149,15 @@
4244, 4267,
],
'conditions': [
+ ['OS == "win" and component == "shared_library"', {
+ 'defines': ['SQLITE_API=__declspec(dllexport)'],
+ 'direct_dependent_settings': {
+ 'defines': ['SQLITE_API=__declspec(dllimport)'],
+ },
+ }],
+ ['OS != "win" and component == "shared_library"', {
+ 'defines': ['SQLITE_API=__attribute__((visibility("default")))'],
+ }],
['OS=="linux"', {
'link_settings': {
'libraries': [
@@ -159,6 +169,7 @@
'link_settings': {
'libraries': [
'$(SDKROOT)/System/Library/Frameworks/CoreFoundation.framework',
+ '$(SDKROOT)/System/Library/Frameworks/CoreServices.framework',
],
},
}],