blob: e668ae9c3bf228348717bf349391b2663f9981a3 [file] [log] [blame]
From e6a52a13daabf722ed5bee436af214babae113c1 Mon Sep 17 00:00:00 2001
From: Scott Hess <shess@chromium.org>
Date: Fri, 16 Jan 2015 10:24:30 -0800
Subject: [PATCH 01/10] [test] SQLite tests compiling on Linux.
---
third_party/sqlite/src/Makefile.linux-gcc | 41 ++++++++++++++++++++++---------
third_party/sqlite/src/main.mk | 2 +-
2 files changed, 30 insertions(+), 13 deletions(-)
diff --git a/third_party/sqlite/src/Makefile.linux-gcc b/third_party/sqlite/src/Makefile.linux-gcc
index b838b844a312..62d029430803 100644
--- a/third_party/sqlite/src/Makefile.linux-gcc
+++ b/third_party/sqlite/src/Makefile.linux-gcc
@@ -14,7 +14,7 @@
#### The toplevel directory of the source tree. This is the directory
# that contains this "Makefile.in" and the "configure.in" script.
#
-TOP = ../sqlite
+TOP = ..
#### C Compiler and options for use in building executables that
# will run on the platform that is doing the build.
@@ -32,19 +32,19 @@ USLEEP = -DHAVE_USLEEP=1
# multi-threaded program, then define the following macro
# appropriately:
#
-#THREADSAFE = -DTHREADSAFE=1
-THREADSAFE = -DTHREADSAFE=0
+THREADSAFE = -DTHREADSAFE=1
+#THREADSAFE = -DTHREADSAFE=0
#### Specify any extra linker options needed to make the library
# thread safe
#
-#THREADLIB = -lpthread
-THREADLIB =
+THREADLIB = -lpthread
+#THREADLIB =
#### Specify any extra libraries needed to access required functions.
#
#TLIBS = -lrt # fdatasync on Solaris 8
-TLIBS =
+TLIBS = -ldl
#### Leave SQLITE_DEBUG undefined for maximum speed. Use SQLITE_DEBUG=1
# to check for memory leaks. Use SQLITE_DEBUG=2 to print a log of all
@@ -58,7 +58,24 @@ TLIBS =
#OPTS = -DSQLITE_DEBUG=1
#OPTS =
OPTS = -DNDEBUG=1
-OPTS += -DHAVE_FDATASYNC=1
+#OPTS += -DHAVE_FDATASYNC=1
+
+# These flags match those for SQLITE_CFLAGS in config.mk.
+
+OPTS += -DSQLITE_DEFAULT_FILE_PERMISSIONS=0600
+OPTS += -DHAVE_USLEEP=1
+
+# Additional SQLite tests.
+OPTS += -DSQLITE_MEMDEBUG=1
+
+# Don't include these ones, they break the SQLite tests.
+# -DSQLITE_OMIT_ATTACH=1 \
+# -DSQLITE_OMIT_LOAD_EXTENSION=1 \
+# -DSQLITE_OMIT_VACUUM=1 \
+# -DSQLITE_TRANSACTION_DEFAULT_IMMEDIATE=1 \
+
+# TODO(shess) I can't see why I need this setting.
+OPTS += -DOS_UNIX=1
#### The suffix to add to executable files. ".exe" for windows.
# Nothing for unix.
@@ -70,7 +87,7 @@ EXE =
# will run on the target platform. This is usually the same
# as BCC, unless you are cross-compiling.
#
-TCC = gcc -O6
+TCC = gcc -Os
#TCC = gcc -g -O0 -Wall
#TCC = gcc -g -O0 -Wall -fprofile-arcs -ftest-coverage
#TCC = /opt/mingw/bin/i386-mingw32-gcc -O6
@@ -91,16 +108,16 @@ SHPREFIX = lib
#### Extra compiler options needed for programs that use the TCL library.
#
-#TCL_FLAGS =
+TCL_FLAGS = -I/usr/include/tcl8.6
#TCL_FLAGS = -DSTATIC_BUILD=1
-TCL_FLAGS = -I/home/drh/tcltk/8.5linux
+#TCL_FLAGS = -I/home/drh/tcltk/8.5linux
#TCL_FLAGS = -I/home/drh/tcltk/8.5win -DSTATIC_BUILD=1
#TCL_FLAGS = -I/home/drh/tcltk/8.3hpux
#### Linker options needed to link against the TCL library.
#
-#LIBTCL = -ltcl -lm -ldl
-LIBTCL = /home/drh/tcltk/8.5linux/libtcl8.5g.a -lm -ldl
+LIBTCL = -ltcl8.6 -lm -ldl
+#LIBTCL = /home/drh/tcltk/8.5linux/libtcl8.5g.a -lm -ldl
#LIBTCL = /home/drh/tcltk/8.5win/libtcl85s.a -lmsvcrt
#LIBTCL = /home/drh/tcltk/8.3hpux/libtcl8.3.a -ldld -lm -lc
diff --git a/third_party/sqlite/src/main.mk b/third_party/sqlite/src/main.mk
index d45f8b8a4daf..be694f0d5586 100644
--- a/third_party/sqlite/src/main.mk
+++ b/third_party/sqlite/src/main.mk
@@ -784,7 +784,7 @@ sqlite3_analyzer.c: sqlite3.c $(TOP)/src/tclsqlite.c $(TOP)/tool/spaceanal.tcl $
tclsh $(TOP)/tool/mkccode.tcl $(TOP)/tool/sqlite3_analyzer.c.in >sqlite3_analyzer.c
sqlite3_analyzer$(EXE): sqlite3_analyzer.c
- $(TCCX) $(TCL_FLAGS) sqlite3_analyzer.c -o $@ $(LIBTCL) $(THREADLIB)
+ $(TCCX) $(TCL_FLAGS) sqlite3_analyzer.c -o $@ $(LIBTCL) $(TLIBS) $(THREADLIB)
dbdump$(EXE): $(TOP)/ext/misc/dbdump.c sqlite3.o
$(TCCX) -DDBDUMP_STANDALONE -o dbdump$(EXE) \
--
2.14.0