summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortc@google.com <tc@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-16 22:37:01 +0000
committertc@google.com <tc@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-16 22:37:01 +0000
commit9995e1749a3eabca54973b07b5cb0e9ea6bcd025 (patch)
tree0d8febf62d9c07279d1bef941e71c4dd12f7a42c
parent8332b73bf73730995157c96c881c712d58fba7fa (diff)
downloadchromium_src-9995e1749a3eabca54973b07b5cb0e9ea6bcd025.zip
chromium_src-9995e1749a3eabca54973b07b5cb0e9ea6bcd025.tar.gz
chromium_src-9995e1749a3eabca54973b07b5cb0e9ea6bcd025.tar.bz2
Build the sqlite shell via scons on linux so we can debug the
full text indexed sqlite files. Review URL: http://codereview.chromium.org/42250 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@11789 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--third_party/sqlite/README.chromium4
-rw-r--r--third_party/sqlite/SConscript172
-rw-r--r--third_party/sqlite/sqlite.vcproj2
-rwxr-xr-xthird_party/sqlite/src/shell_icu_linux.c26
-rwxr-xr-xthird_party/sqlite/src/shell_icu_win.c (renamed from third_party/sqlite/src/shell_icu.c)0
5 files changed, 46 insertions, 158 deletions
diff --git a/third_party/sqlite/README.chromium b/third_party/sqlite/README.chromium
index 93cfdc2..509f313 100644
--- a/third_party/sqlite/README.chromium
+++ b/third_party/sqlite/README.chromium
@@ -95,8 +95,8 @@ Changes from Chrome:
figure out what really ought to happen here (perhaps this file is new and
hasn't been tested to verify it works right). Update: Seems this is an
issue we get because we're using fts2 instead of fts3.
- - shell_icu.c is a Chrome-specific file used to load our ICU data. shell.c
- has been modifed to call into shell_icu.c.
+ - shell_icu_win.c and shell_icu_linux.c are Chrome-specific files used to load
+ our ICU data. shell.c has been modifed to call into these files.
- fts2_icu.c has a critical bug. U8_NEXT is used over a UTF-16 string. It's
rep$ by U16_NEXT (jungshik)
- Added a new function sqlite3Preload we use to prime the database cache. It
diff --git a/third_party/sqlite/SConscript b/third_party/sqlite/SConscript
index 615989d..633c5dd 100644
--- a/third_party/sqlite/SConscript
+++ b/third_party/sqlite/SConscript
@@ -4,8 +4,7 @@
Import('env')
-env = env.Clone(
-)
+env = env.Clone()
env.Prepend(
CPPPATH = [
@@ -30,19 +29,6 @@ env.Append(
],
)
-if env.Bit('windows'):
- env.Append(
- CCFLAGS = [
- '/TC',
-
- '/wd4800',
- '/wd4244',
- '/wd4018',
- '/wd4146',
- '/wd4996',
- ],
- )
-
input_files = ChromeFileList([
'src/alter.c',
'src/analyze.c',
@@ -89,14 +75,12 @@ input_files = ChromeFileList([
'src/mutex.c',
'src/mutex.h',
'src/mutex_unix.c',
- 'src/mutex_w32.c',
'preprocessed/opcodes.c',
'preprocessed/opcodes.h',
'src/os.c',
'src/os.h',
'src/os_common.h',
'src/os_unix.c',
- 'src/os_win.c',
'src/pager.c',
'src/pager.h',
'preprocessed/parse.c',
@@ -106,8 +90,6 @@ input_files = ChromeFileList([
'src/printf.c',
'src/random.c',
'src/select.c',
- 'src/shell.c',
- 'src/shell_icu.c',
'preprocessed/sqlite3.h',
'src/sqlite3ext.h',
'src/sqliteInt.h',
@@ -132,142 +114,22 @@ input_files = ChromeFileList([
'src/where.c',
])
-if not env.Bit('windows'):
- input_files.Remove(
- 'src/mutex_w32.c',
- 'src/os_win.c',
- 'src/shell.c',
- 'src/shell_icu.c',
- )
-
-if not env.Bit('linux'):
- input_files.Remove(
- 'src/mutex_unix.c',
- 'src/os_unix.c',
- )
-
-env.ChromeLibrary('sqlite', input_files)
-
-p = env.ChromeMSVSProject('sqlite.vcproj',
- dest=('$CHROME_SRC_DIR/third_party/' +
- 'sqlite/sqlite.vcproj'),
- dependencies = [
- '$ICU38_DIR/build/icu.vcproj',
- ],
- guid='{6EAD4A4B-2BBC-4974-8E45-BB5C16CC2AC9}',
- keyword='Win32Proj',
- # TODO(sgk): when we can intuit the hierarchy
- # from the built targets.
- #buildtargets=TODO,
- files=input_files,
- relative_path_prefix='./')
+sqlite_lib = env.ChromeLibrary('sqlite', input_files)
+# Build a stand alone sqlite shell so we can inspect the sqlite files.
+env_shell = env.Clone()
-p.AddConfig('Debug|Win32',
- InheritedPropertySheets=[
- '$(SolutionDir)../build/common.vsprops',
- '$(SolutionDir)../build/debug.vsprops',
- './sqlite.vsprops',
- '$(SolutionDir)../build/external_code.vsprops',
- '$(SolutionDir)../third_party/icu38/build/using_icu.vsprops',
- ],
- ConfigurationType='4',
- tools=[
- 'VCPreBuildEventTool',
- 'VCCustomBuildTool',
- 'VCXMLDataGeneratorTool',
- 'VCWebServiceProxyGeneratorTool',
- 'VCMIDLTool',
- MSVSTool('VCCLCompilerTool',
- AdditionalIncludeDirectories='"$(SolutionDir)..\\third_party\\sqlite\\src";"$(SolutionDir)..\\third_party\\sqlite\\preprocessed"'),
- 'VCManagedResourceCompilerTool',
- 'VCResourceCompilerTool',
- 'VCPreLinkEventTool',
- 'VCLibrarianTool',
- 'VCALinkTool',
- 'VCXDCMakeTool',
- 'VCBscMakeTool',
- 'VCFxCopTool',
- 'VCPostBuildEventTool',
- ])
-
-p.AddConfig('Release|Win32',
- InheritedPropertySheets=[
- '$(SolutionDir)../build/common.vsprops',
- '$(SolutionDir)../build/release.vsprops',
- './sqlite.vsprops',
- '$(SolutionDir)../build/external_code.vsprops',
- '$(SolutionDir)../third_party/icu38/build/using_icu.vsprops',
- ],
- ConfigurationType='4',
- tools=[
- 'VCPreBuildEventTool',
- 'VCCustomBuildTool',
- 'VCXMLDataGeneratorTool',
- 'VCWebServiceProxyGeneratorTool',
- 'VCMIDLTool',
- MSVSTool('VCCLCompilerTool',
- AdditionalIncludeDirectories=[
- '"$(SolutionDir)../third_party/sqlite/src"',
- '"$(SolutionDir)../third_party/sqlite/preprocessed"',
- ]),
- 'VCManagedResourceCompilerTool',
- 'VCResourceCompilerTool',
- 'VCPreLinkEventTool',
- 'VCLibrarianTool',
- 'VCALinkTool',
- 'VCXDCMakeTool',
- 'VCBscMakeTool',
- 'VCFxCopTool',
- 'VCPostBuildEventTool',
- ])
-
-p.AddConfig('Shell|Win32',
- InheritedPropertySheets=[
- '$(SolutionDir)../build/common.vsprops',
- './sqlite.vsprops',
- '$(SolutionDir)../build/release.vsprops',
- '$(SolutionDir)../build/external_code.vsprops',
- '$(SolutionDir)../third_party/icu38/build/using_icu.vsprops',
- ],
- ConfigurationType='1',
- tools=[
- 'VCPreBuildEventTool',
- 'VCCustomBuildTool',
- 'VCXMLDataGeneratorTool',
- 'VCWebServiceProxyGeneratorTool',
- 'VCMIDLTool',
- MSVSTool('VCCLCompilerTool',
- AdditionalIncludeDirectories=[
- '"$(SolutionDir)../third_party/sqlite/src"',
- '"$(SolutionDir)../third_party/sqlite/preprocessed"',
- ]),
- 'VCManagedResourceCompilerTool',
- 'VCResourceCompilerTool',
- 'VCPreLinkEventTool',
- 'VCLinkerTool',
- 'VCALinkTool',
- 'VCManifestTool',
- 'VCXDCMakeTool',
- 'VCBscMakeTool',
- 'VCFxCopTool',
- 'VCAppVerifierTool',
- 'VCWebDeploymentTool',
- 'VCPostBuildEventTool',
- ])
-
-p.AddFileConfig('./src/shell.c',
- 'Debug|Win32',
- ExcludedFromBuild='true',
- tools=[
- 'VCCLCompilerTool',
- ])
-
-p.AddFileConfig('./src/shell.c',
- 'Release|Win32',
- ExcludedFromBuild='true',
- tools=[
- 'VCCLCompilerTool',
- ])
+shell_input_files = [
+ 'src/shell.c',
+ 'src/shell_icu_linux.c',
+]
+
+env_shell.Append(
+ LIBS = [
+ 'icu',
+ 'sqlite',
+ 'stdc++',
+ ]
+)
-# TODO(tc): There should be a target to build the stand alone sqlite shell.
+env_shell.ChromeProgram('sqlite_shell', shell_input_files)
diff --git a/third_party/sqlite/sqlite.vcproj b/third_party/sqlite/sqlite.vcproj
index 8cb3551..421880c 100644
--- a/third_party/sqlite/sqlite.vcproj
+++ b/third_party/sqlite/sqlite.vcproj
@@ -445,7 +445,7 @@
</FileConfiguration>
</File>
<File
- RelativePath=".\src\shell_icu.c"
+ RelativePath=".\src\shell_icu_win.c"
>
</File>
<File
diff --git a/third_party/sqlite/src/shell_icu_linux.c b/third_party/sqlite/src/shell_icu_linux.c
new file mode 100755
index 0000000..8194db5
--- /dev/null
+++ b/third_party/sqlite/src/shell_icu_linux.c
@@ -0,0 +1,26 @@
+/* Copyright 2007 Google Inc. All Rights Reserved.
+**/
+
+#include <limits.h>
+#include <unistd.h>
+#include "unicode/udata.h"
+
+/*
+** This function attempts to load the ICU data tables from a data file.
+** Returns 0 on failure, nonzero on success.
+** This a hack job of icu_utils.cc:Initialize(). It's Chrome-specific code.
+*/
+int sqlite_shell_init_icu() {
+ char bin_dir[PATH_MAX + 1];
+ int bin_dir_size = readlink("/proc/self/exe", bin_dir, PATH_MAX);
+ if (bin_dir_size < 0 || bin_dir_size > PATH_MAX)
+ return 0;
+ bin_dir[bin_dir_size] = 0;;
+
+ u_setDataDirectory(bin_dir);
+ // Only look for the packaged data file;
+ // the default behavior is to look for individual files.
+ UErrorCode err = U_ZERO_ERROR;
+ udata_setFileAccess(UDATA_ONLY_PACKAGES, &err);
+ return err == U_ZERO_ERROR;
+}
diff --git a/third_party/sqlite/src/shell_icu.c b/third_party/sqlite/src/shell_icu_win.c
index d68cf8f..d68cf8f 100755
--- a/third_party/sqlite/src/shell_icu.c
+++ b/third_party/sqlite/src/shell_icu_win.c