Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 9983442f0d |
+16
-10
@@ -30,12 +30,14 @@ The public domain source files usually contain a header comment
|
||||
similar to the following to make it clear that the software is
|
||||
public domain.
|
||||
|
||||
> The author disclaims copyright to this source code. In place of
|
||||
> a legal notice, here is a blessing:
|
||||
>
|
||||
> * May you do good and not evil.
|
||||
> * May you find forgiveness for yourself and forgive others.
|
||||
> * May you share freely, never taking more than you give.
|
||||
> ~~~
|
||||
The author disclaims copyright to this source code. In place of
|
||||
a legal notice, here is a blessing:
|
||||
|
||||
* May you do good and not evil.
|
||||
* May you find forgiveness for yourself and forgive others.
|
||||
* May you share freely, never taking more than you give.
|
||||
~~~
|
||||
|
||||
Almost every file you find in this source repository will be
|
||||
public domain. But there are a small number of exceptions:
|
||||
@@ -47,7 +49,9 @@ This repository contains a (relatively) small amount of non-public-domain
|
||||
code used to help implement the configuration and build logic. In other
|
||||
words, there are some non-public-domain files used to implement:
|
||||
|
||||
> ./configure && make
|
||||
> ~~~
|
||||
./configure && make
|
||||
~~~
|
||||
|
||||
In all cases, the non-public-domain files included with this
|
||||
repository have generous BSD-style licenses. So anyone is free to
|
||||
@@ -65,7 +69,7 @@ third-party build scripts in order to compile SQLite.
|
||||
Non-public-domain code included in this respository includes:
|
||||
|
||||
* The ["autosetup"](http://msteveb.github.io/autosetup/) configuration
|
||||
system that is contained (mostly) in the autosetup/ directory, but also
|
||||
system that is contained (mostly) the autosetup/ directory, but also
|
||||
includes the "./configure" script at the top-level of this archive.
|
||||
Autosetup has a separate BSD-style license. See the
|
||||
[autosetup/LICENSE](http://msteveb.github.io/autosetup/license/)
|
||||
@@ -75,11 +79,13 @@ Non-public-domain code included in this respository includes:
|
||||
software found in the legacy autoconf/ directory and its
|
||||
subdirectories.
|
||||
|
||||
The following unix shell command can be run from the top-level
|
||||
The following unix shell command is can be run from the top-level
|
||||
of this source repository in order to remove all non-public-domain
|
||||
code:
|
||||
|
||||
> rm -rf configure autosetup autoconf
|
||||
> ~~~
|
||||
rm -rf configure autosetup autoconf
|
||||
~~~
|
||||
|
||||
If you unpack this source repository and then run the command above, what
|
||||
is left will be 100% public domain.
|
||||
|
||||
+27
-20
@@ -11,6 +11,17 @@
|
||||
#
|
||||
all:
|
||||
########################################################################
|
||||
#
|
||||
# Known TODOs/FIXMEs/TOIMPROVEs for the autosetup port, in no
|
||||
# particular order...
|
||||
#
|
||||
# - TEA pieces.
|
||||
#
|
||||
# - Replace the autotools-specific distribution deliverable(s).
|
||||
#
|
||||
# - Confirm whether cross-compilation works and patch it
|
||||
# appropriately.
|
||||
#
|
||||
# Maintenance reminders:
|
||||
#
|
||||
# - This makefile should remain as POSIX-make-compatible as possible:
|
||||
@@ -111,13 +122,10 @@ LDFLAGS.rt = @LDFLAGS_RT@
|
||||
CFLAGS.icu = @CFLAGS_ICU@
|
||||
LDFLAGS.libsqlite3.soname = @LDFLAGS_LIBSQLITE3_SONAME@
|
||||
# soname: see https://sqlite.org/src/forumpost/5a3b44f510df8ded
|
||||
LDFLAGS.libsqlite3.os-specific = \
|
||||
@LDFLAGS_MAC_CVERSION@ @LDFLAGS_MAC_INSTALL_NAME@ @LDFLAGS_OUT_IMPLIB@
|
||||
LDFLAGS.libsqlite3.os-specific = @LDFLAGS_MAC_CVERSION@ @LDFLAGS_OUT_IMPLIB@
|
||||
# os-specific: see
|
||||
# - https://sqlite.org/forum/forumpost/9dfd5b8fd525a5d7
|
||||
# - https://sqlite.org/forum/forumpost/0c7fc097b2
|
||||
# - https://sqlite.org/forum/forumpost/5651662b8875ec0a
|
||||
|
||||
libsqlite3.DLL.basename = @SQLITE_DLL_BASENAME@
|
||||
# DLL.basename: see https://sqlite.org/forum/forumpost/828fdfe904
|
||||
libsqlite3.out.implib = @SQLITE_OUT_IMPLIB@
|
||||
@@ -130,6 +138,15 @@ libsqlite3.DLL.install-rules = @SQLITE_DLL_INSTALL_RULES@
|
||||
# -fsanitize flags for the fuzzcheck-asap app
|
||||
CFLAGS.fuzzcheck-asan.fsanitize = @CFLAGS_ASAN_FSANITIZE@
|
||||
|
||||
#
|
||||
# Define -D_HAVE_SQLITE_CONFIG_H so that the code knows it
|
||||
# can include the generated sqlite_cfg.h.
|
||||
#
|
||||
# main.mk will fill out T.cc.sqlite with additional flags common to
|
||||
# all builds.
|
||||
#
|
||||
T.cc.sqlite.extras = -D_HAVE_SQLITE_CONFIG_H -DBUILD_sqlite
|
||||
|
||||
#
|
||||
# Intended to either be empty or be set to -g -DSQLITE_DEBUG=1.
|
||||
#
|
||||
@@ -202,13 +219,6 @@ TCL_CONFIG_SH = @TCL_CONFIG_SH@
|
||||
#TCL_STUB_LIB_SPEC = @TCL_STUB_LIB_SPEC@
|
||||
#TCL_EXEC_PREFIX = @TCL_EXEC_PREFIX@
|
||||
#TCL_VERSION = @TCL_VERSION@
|
||||
TCL_MAJOR_VERSION = @TCL_MAJOR_VERSION@
|
||||
# ^^^ main.mk optionally uses this for determining the Tcl extension's
|
||||
# DLL name.
|
||||
TCL_EXT_DLL_BASENAME = @TCL_EXT_DLL_BASENAME@
|
||||
# ^^^ base name of the Tcl extension DLL. It varies by platform and
|
||||
# Tcl version.
|
||||
|
||||
#
|
||||
# $(TCLLIBDIR) = where to install the tcl plugin. If this is empty, it
|
||||
# is calculated at make-time by the targets which need it but we
|
||||
@@ -239,8 +249,8 @@ TSTRNNR_OPTS = @TSTRNNR_OPTS@
|
||||
CFLAGS.gcov1 = -DSQLITE_COVERAGE_TEST=1 -fprofile-arcs -ftest-coverage
|
||||
LDFLAGS.gcov1 = -lgcov
|
||||
USE_GCOV = @USE_GCOV@
|
||||
T.compile.gcov = $(CFLAGS.gcov$(USE_GCOV))
|
||||
T.link.gcov = $(LDFLAGS.gcov$(USE_GCOV))
|
||||
T.compile.extras = $(CFLAGS.gcov$(USE_GCOV))
|
||||
T.link.extras = $(LDFLAGS.gcov$(USE_GCOV))
|
||||
|
||||
#
|
||||
# Vars with the AS_ prefix are specifically related to AutoSetup.
|
||||
@@ -253,15 +263,11 @@ AS_AUTO_DEF = $(TOP)/auto.def
|
||||
# invoked with to produce this makefile.
|
||||
#
|
||||
AS_AUTORECONFIG = @SQLITE_AUTORECONFIG@
|
||||
.PHONY: config reconfigure
|
||||
config reconfigure:
|
||||
$(AS_AUTORECONFIG)
|
||||
|
||||
USE_AMALGAMATION ?= @USE_AMALGAMATION@
|
||||
LINK_TOOLS_DYNAMICALLY ?= @LINK_TOOLS_DYNAMICALLY@
|
||||
AMALGAMATION_GEN_FLAGS ?= --linemacros=@AMALGAMATION_LINE_MACROS@
|
||||
EXTRA_SRC ?= @AMALGAMATION_EXTRA_SRC@
|
||||
STATIC_TCLSQLITE3 = @STATIC_TCLSQLITE3@
|
||||
STATIC_CLI_SHELL = @STATIC_CLI_SHELL@
|
||||
|
||||
#
|
||||
# CFLAGS for sqlite3$(T.exe)
|
||||
@@ -313,8 +319,9 @@ fiddle: sqlite3.c shell.c
|
||||
./custom.rws: ./tool/custom.txt
|
||||
@echo 'Updating custom dictionary from tool/custom.txt'
|
||||
aspell --lang=en create master ./custom.rws < ./tool/custom.txt
|
||||
# Note that jimsh does not work here:
|
||||
# https://github.com/msteveb/jimtcl/issues/319
|
||||
misspell: ./custom.rws has_tclsh84
|
||||
# $(JIMSH) does not work with spellsift.tcl
|
||||
$(TCLSH_CMD) ./tool/spellsift.tcl ./src/*.c ./src/*.h ./src/*.in
|
||||
|
||||
#
|
||||
@@ -331,7 +338,7 @@ distclean: distclean-autosetup
|
||||
|
||||
#
|
||||
# tool/version-info: a utility for emitting sqlite3 version info
|
||||
# in various forms. It's used by ext/wasm/.
|
||||
# in various forms.
|
||||
#
|
||||
version-info$(T.exe): $(TOP)/tool/version-info.c Makefile sqlite3.h
|
||||
$(T.link) $(ST_OPT) -o $@ $(TOP)/tool/version-info.c
|
||||
|
||||
+155
-237
@@ -11,8 +11,6 @@
|
||||
TOP = .
|
||||
|
||||
# <<mark>>
|
||||
# ^^^^^^^^-- content between mark and /mark omitted from autoconf/Makefile.msc
|
||||
#
|
||||
# Set this non-0 to create and use the SQLite amalgamation file.
|
||||
#
|
||||
!IFNDEF USE_AMALGAMATION
|
||||
@@ -103,6 +101,13 @@ NO_WARN = $(NO_WARN) -wd4210 -wd4232 -wd4244 -wd4305 -wd4306 -wd4702 -wd4706
|
||||
!ENDIF
|
||||
!ENDIF
|
||||
|
||||
# Set this non-0 to use the library paths and other options necessary for
|
||||
# Windows Phone 8.1.
|
||||
#
|
||||
!IFNDEF USE_WP81_OPTS
|
||||
USE_WP81_OPTS = 0
|
||||
!ENDIF
|
||||
|
||||
# Set this non-0 to split the SQLite amalgamation file into chunks to
|
||||
# be used for debugging with Visual Studio.
|
||||
#
|
||||
@@ -111,8 +116,14 @@ SPLIT_AMALGAMATION = 0
|
||||
!ENDIF
|
||||
|
||||
# <<mark>>
|
||||
# ^^^^^^^^-- content between mark and /mark omitted from autoconf/Makefile.msc
|
||||
# Set this non-0 to have this makefile assume the Tcl shell executable
|
||||
# (tclsh*.exe) is available in the PATH. By default, this is disabled
|
||||
# for compatibility with older build environments. This setting only
|
||||
# applies if TCLSH_CMD is not set manually.
|
||||
#
|
||||
!IFNDEF USE_TCLSH_IN_PATH
|
||||
USE_TCLSH_IN_PATH = 0
|
||||
!ENDIF
|
||||
|
||||
# Set this non-0 to use zlib, possibly compiling it from source code.
|
||||
#
|
||||
@@ -175,6 +186,14 @@ USE_NATIVE_LIBPATHS = 0
|
||||
USE_RC = 1
|
||||
!ENDIF
|
||||
|
||||
# Set this non-0 to compile binaries suitable for the WinRT environment.
|
||||
# This setting does not apply to any binaries that require Tcl to operate
|
||||
# properly (i.e. the text fixture, etc).
|
||||
#
|
||||
!IFNDEF FOR_WINRT
|
||||
FOR_WINRT = 0
|
||||
!ENDIF
|
||||
|
||||
# Set this non-0 to compile binaries suitable for the UWP environment.
|
||||
# This setting does not apply to any binaries that require Tcl to operate
|
||||
# properly (i.e. the text fixture, etc).
|
||||
@@ -190,8 +209,6 @@ FOR_WIN10 = 0
|
||||
!ENDIF
|
||||
|
||||
# <<mark>>
|
||||
# ^^^^^^^^-- content between mark and /mark omitted from autoconf/Makefile.msc
|
||||
#
|
||||
# Set this non-0 to skip attempting to look for and/or link with the Tcl
|
||||
# runtime library.
|
||||
#
|
||||
@@ -248,8 +265,6 @@ DEBUG = 0
|
||||
!ENDIF
|
||||
|
||||
# <<mark>>
|
||||
# ^^^^^^^^-- content between mark and /mark omitted from autoconf/Makefile.msc
|
||||
#
|
||||
# By default, use --linemacros=1 argument to the mksqlite3c.tcl tool, which
|
||||
# is used to build the amalgamation. This can be turned off to ease debug
|
||||
# of the amalgamation away from the source tree.
|
||||
@@ -345,8 +360,6 @@ SQLITE3EXEPDB = /pdb:sqlite3sh.pdb
|
||||
!ENDIF
|
||||
|
||||
# <<mark>>
|
||||
# ^^^^^^^^-- content between mark and /mark omitted from autoconf/Makefile.msc
|
||||
#
|
||||
# These are the names of the customized Tcl header files used by various parts
|
||||
# of this makefile when the stdcall calling convention is in use. It is not
|
||||
# used for any other purpose.
|
||||
@@ -392,7 +405,6 @@ OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_STMTVTAB=1
|
||||
OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_DBPAGE_VTAB=1
|
||||
OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_DBSTAT_VTAB=1
|
||||
OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_BYTECODE_VTAB=1
|
||||
OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_CARRAY=1
|
||||
!ENDIF
|
||||
OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_COLUMN_METADATA=1
|
||||
!ENDIF
|
||||
@@ -415,7 +427,6 @@ OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_PREUPDATE_HOOK=1
|
||||
|
||||
# Always enable math functions on Windows
|
||||
OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_MATH_FUNCTIONS
|
||||
OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_PERCENTILE
|
||||
|
||||
# Should the rbu extension be enabled? If so, add compilation options
|
||||
# to enable it.
|
||||
@@ -628,24 +639,16 @@ RCC = $(RC) -DSQLITE_OS_WIN=1 -I. -I$(TOP) -I$(TOP)\src $(RCOPTS) $(RCCOPTS)
|
||||
!IF "$(PLATFORM)"=="x86"
|
||||
CORE_CCONV_OPTS = -Gz -guard:cf -DSQLITE_CDECL=__cdecl -DSQLITE_APICALL=__stdcall -DSQLITE_CALLBACK=__stdcall -DSQLITE_SYSAPI=__stdcall
|
||||
SHELL_CCONV_OPTS = -Gz -guard:cf -DSQLITE_CDECL=__cdecl -DSQLITE_APICALL=__stdcall -DSQLITE_CALLBACK=__stdcall -DSQLITE_SYSAPI=__stdcall
|
||||
|
||||
# <<mark>>
|
||||
# ^^^^^^^^-- content between mark and /mark omitted from autoconf/Makefile.msc
|
||||
#
|
||||
TEST_CCONV_OPTS = -Gz -guard:cf -DSQLITE_CDECL=__cdecl -DSQLITE_APICALL=__stdcall -DSQLITE_CALLBACK=__stdcall -DSQLITE_SYSAPI=__stdcall -DINCLUDE_SQLITE_TCL_H=1 -DSQLITE_TCLAPI=__cdecl
|
||||
# <</mark>>
|
||||
|
||||
!ELSE
|
||||
!IFNDEF PLATFORM
|
||||
CORE_CCONV_OPTS = -Gz -guard:cf -DSQLITE_CDECL=__cdecl -DSQLITE_APICALL=__stdcall -DSQLITE_CALLBACK=__stdcall -DSQLITE_SYSAPI=__stdcall
|
||||
SHELL_CCONV_OPTS = -Gz -guard:cf -DSQLITE_CDECL=__cdecl -DSQLITE_APICALL=__stdcall -DSQLITE_CALLBACK=__stdcall -DSQLITE_SYSAPI=__stdcall
|
||||
|
||||
# <<mark>>
|
||||
# ^^^^^^^^-- content between mark and /mark omitted from autoconf/Makefile.msc
|
||||
#
|
||||
TEST_CCONV_OPTS = -Gz -guard:cf -DSQLITE_CDECL=__cdecl -DSQLITE_APICALL=__stdcall -DSQLITE_CALLBACK=__stdcall -DSQLITE_SYSAPI=__stdcall -DINCLUDE_SQLITE_TCL_H=1 -DSQLITE_TCLAPI=__cdecl
|
||||
# <</mark>>
|
||||
|
||||
!ELSE
|
||||
CORE_CCONV_OPTS =
|
||||
SHELL_CCONV_OPTS =
|
||||
@@ -772,6 +775,18 @@ SHELL_LINK_OPTS = $(SHELL_CORE_LIB)
|
||||
TCC = $(TCC) -FAcs
|
||||
!ENDIF
|
||||
|
||||
# When compiling the library for use in the WinRT environment,
|
||||
# the following compile-time options must be used as well to
|
||||
# disable use of Win32 APIs that are not available and to enable
|
||||
# use of Win32 APIs that are specific to Windows 8 and/or WinRT.
|
||||
#
|
||||
!IF $(FOR_WINRT)!=0
|
||||
TCC = $(TCC) -DSQLITE_OS_WINRT=1
|
||||
RCC = $(RCC) -DSQLITE_OS_WINRT=1
|
||||
TCC = $(TCC) -DWINAPI_FAMILY=WINAPI_FAMILY_APP
|
||||
RCC = $(RCC) -DWINAPI_FAMILY=WINAPI_FAMILY_APP
|
||||
!ENDIF
|
||||
|
||||
# C compiler options for the Windows 10 platform (needs MSVC 2015).
|
||||
#
|
||||
!IF $(FOR_WIN10)!=0
|
||||
@@ -784,31 +799,25 @@ BCC = $(BCC) /d2guard4 -D_ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE
|
||||
# USE_CRT_DLL option is set to force dynamically linking to the
|
||||
# MSVC runtime library.
|
||||
#
|
||||
!IF $(USE_CRT_DLL)!=0
|
||||
!IF $(FOR_WINRT)!=0 || $(USE_CRT_DLL)!=0
|
||||
!IF $(DEBUG)>1
|
||||
TCC = $(TCC) -MDd
|
||||
BCC = $(BCC) -MDd
|
||||
ZLIBCFLAGS = -nologo -MDd -W3 -O2 -Oy- -Zi
|
||||
!ELSE
|
||||
TCC = $(TCC) -MD
|
||||
BCC = $(BCC) -MD
|
||||
ZLIBCFLAGS = -nologo -MD -W3 -O2 -Oy- -Zi
|
||||
!ENDIF
|
||||
!ELSE
|
||||
!IF $(DEBUG)>1
|
||||
TCC = $(TCC) -MTd
|
||||
BCC = $(BCC) -MTd
|
||||
ZLIBCFLAGS = -nologo -MTd -W3 -O2 -Oy- -Zi
|
||||
!ELSE
|
||||
TCC = $(TCC) -MT
|
||||
BCC = $(BCC) -MT
|
||||
ZLIBCFLAGS = -nologo -MT -W3 -O2 -Oy- -Zi
|
||||
!ENDIF
|
||||
!ENDIF
|
||||
|
||||
# <<mark>>
|
||||
# ^^^^^^^^-- content between mark and /mark omitted from autoconf/Makefile.msc
|
||||
#
|
||||
# The mksqlite3c.tcl and mksqlite3h.tcl scripts will pull in
|
||||
# any extension header files by default. For non-amalgamation
|
||||
# builds, we need to make sure the compiler can find these.
|
||||
@@ -859,13 +868,23 @@ MKSQLITE3H_ARGS =
|
||||
!ENDIF
|
||||
# <</mark>>
|
||||
|
||||
# Define -DNDEBUG to compile without debugging (i.e., for production usage)
|
||||
# Omitting the define will cause extra debugging code to be inserted and
|
||||
# includes extra comments when "EXPLAIN stmt" is used.
|
||||
#
|
||||
!IF $(DEBUG)==0
|
||||
TCC = $(TCC) -DNDEBUG
|
||||
BCC = $(BCC) -DNDEBUG
|
||||
RCC = $(RCC) -DNDEBUG
|
||||
!ENDIF
|
||||
|
||||
!IF $(DEBUG)>0 || $(API_ARMOR)!=0 || $(FOR_WIN10)!=0
|
||||
TCC = $(TCC) -DSQLITE_ENABLE_API_ARMOR=1
|
||||
RCC = $(RCC) -DSQLITE_ENABLE_API_ARMOR=1
|
||||
!ENDIF
|
||||
|
||||
!IF $(DEBUG)>2
|
||||
TCC = $(TCC) -DSQLITE_DEBUG=1 -DSQLITE_USE_W32_FOR_CONSOLE_IO
|
||||
TCC = $(TCC) -DSQLITE_DEBUG=1
|
||||
RCC = $(RCC) -DSQLITE_DEBUG=1
|
||||
!IF $(DYNAMIC_SHELL)==0
|
||||
TCC = $(TCC) -DSQLITE_ENABLE_WHERETRACE -DSQLITE_ENABLE_SELECTTRACE
|
||||
@@ -924,8 +943,6 @@ TCC = $(TCC) /fsanitize=address
|
||||
!ENDIF
|
||||
|
||||
# <<mark>>
|
||||
# ^^^^^^^^-- content between mark and /mark omitted from autoconf/Makefile.msc
|
||||
#
|
||||
# The locations of the Tcl header and library files. Also, the library that
|
||||
# non-stubs enabled programs using Tcl must link against. These variables
|
||||
# (TCLINCDIR, TCLLIBDIR, and LIBTCL) may be overridden via the environment
|
||||
@@ -1165,8 +1182,6 @@ BCC = $(BCC) -Zi
|
||||
!ENDIF
|
||||
|
||||
# <<mark>>
|
||||
# ^^^^^^^^-- content between mark and /mark omitted from autoconf/Makefile.msc
|
||||
#
|
||||
# If zlib support is enabled, add the compiler options for it.
|
||||
#
|
||||
!IF $(USE_ZLIB)!=0
|
||||
@@ -1219,6 +1234,56 @@ LTLINKOPTS = /NOLOGO
|
||||
LTLIBOPTS = /NOLOGO
|
||||
!ENDIF
|
||||
|
||||
# When compiling for use in the WinRT environment, the following
|
||||
# linker option must be used to mark the executable as runnable
|
||||
# only in the context of an application container.
|
||||
#
|
||||
!IF $(FOR_WINRT)!=0
|
||||
LTLINKOPTS = $(LTLINKOPTS) /APPCONTAINER
|
||||
!IF "$(VISUALSTUDIOVERSION)"=="12.0" || "$(VISUALSTUDIOVERSION)"=="14.0"
|
||||
!IFNDEF STORELIBPATH
|
||||
!IF "$(PLATFORM)"=="x86"
|
||||
STORELIBPATH = $(CRTLIBPATH)\store
|
||||
!ELSEIF "$(PLATFORM)"=="x64"
|
||||
STORELIBPATH = $(CRTLIBPATH)\store\amd64
|
||||
!ELSEIF "$(PLATFORM)"=="ARM"
|
||||
STORELIBPATH = $(CRTLIBPATH)\store\arm
|
||||
!ELSE
|
||||
STORELIBPATH = $(CRTLIBPATH)\store
|
||||
!ENDIF
|
||||
!ENDIF
|
||||
STORELIBPATH = $(STORELIBPATH:\\=\)
|
||||
LTLINKOPTS = $(LTLINKOPTS) "/LIBPATH:$(STORELIBPATH)"
|
||||
!ENDIF
|
||||
!ENDIF
|
||||
|
||||
# When compiling for Windows Phone 8.1, an extra library path is
|
||||
# required.
|
||||
#
|
||||
!IF $(USE_WP81_OPTS)!=0
|
||||
!IFNDEF WP81LIBPATH
|
||||
!IF "$(PLATFORM)"=="x86"
|
||||
WP81LIBPATH = $(PROGRAMFILES_X86)\Windows Phone Kits\8.1\lib\x86
|
||||
!ELSEIF "$(PLATFORM)"=="ARM"
|
||||
WP81LIBPATH = $(PROGRAMFILES_X86)\Windows Phone Kits\8.1\lib\ARM
|
||||
!ELSE
|
||||
WP81LIBPATH = $(PROGRAMFILES_X86)\Windows Phone Kits\8.1\lib\x86
|
||||
!ENDIF
|
||||
!ENDIF
|
||||
!ENDIF
|
||||
|
||||
# When compiling for Windows Phone 8.1, some extra linker options
|
||||
# are also required.
|
||||
#
|
||||
!IF $(USE_WP81_OPTS)!=0
|
||||
!IFDEF WP81LIBPATH
|
||||
LTLINKOPTS = $(LTLINKOPTS) "/LIBPATH:$(WP81LIBPATH)"
|
||||
!ENDIF
|
||||
LTLINKOPTS = $(LTLINKOPTS) /DYNAMICBASE
|
||||
LTLINKOPTS = $(LTLINKOPTS) WindowsPhoneCore.lib RuntimeObject.lib PhoneAppModelHost.lib
|
||||
LTLINKOPTS = $(LTLINKOPTS) /NODEFAULTLIB:kernel32.lib /NODEFAULTLIB:ole32.lib
|
||||
!ENDIF
|
||||
|
||||
# When compiling for UWP or the Windows 10 platform, some extra linker
|
||||
# options are also required.
|
||||
#
|
||||
@@ -1242,14 +1307,12 @@ LTLINKOPTS = $(LTLINKOPTS) /NODEFAULTLIB:libucrt.lib /DEFAULTLIB:ucrt.lib
|
||||
# If either debugging or symbols are enabled, enable PDBs.
|
||||
#
|
||||
!IF $(DEBUG)>1 || $(SYMBOLS)!=0
|
||||
LDFLAGS = /NODEFAULTLIB:msvcrt /DEBUG $(LDOPTS)
|
||||
LDFLAGS = /DEBUG $(LDOPTS)
|
||||
!ELSE
|
||||
LDFLAGS = /NODEFAULTLIB:msvcrt $(LDOPTS)
|
||||
LDFLAGS = $(LDOPTS)
|
||||
!ENDIF
|
||||
|
||||
# <<mark>>
|
||||
# ^^^^^^^^-- content between mark and /mark omitted from autoconf/Makefile.msc
|
||||
#
|
||||
# Start with the Tcl related linker options.
|
||||
#
|
||||
!IF $(NO_TCL)==0
|
||||
@@ -1276,13 +1339,11 @@ LTLIBS = $(LTLIBS) $(LIBICU)
|
||||
###############################################################################
|
||||
|
||||
# <<mark>>
|
||||
# ^^^^^^^^-- content between mark and /mark omitted from autoconf/Makefile.msc
|
||||
#
|
||||
# Object files for the SQLite library (non-amalgamation).
|
||||
#
|
||||
LIBOBJS0 = vdbe.lo parse.lo alter.lo analyze.lo attach.lo auth.lo \
|
||||
backup.lo bitvec.lo btmutex.lo btree.lo build.lo \
|
||||
callback.lo carray.lo complete.lo ctime.lo \
|
||||
callback.lo complete.lo ctime.lo \
|
||||
date.lo dbpage.lo dbstat.lo delete.lo \
|
||||
expr.lo fault.lo fkey.lo \
|
||||
fts3.lo fts3_aux.lo fts3_expr.lo fts3_hash.lo fts3_icu.lo \
|
||||
@@ -1344,7 +1405,6 @@ SRC00 = \
|
||||
$(TOP)\src\btree.c \
|
||||
$(TOP)\src\build.c \
|
||||
$(TOP)\src\callback.c \
|
||||
$(TOP)\src\carray.c \
|
||||
$(TOP)\src\complete.c \
|
||||
ctime.c \
|
||||
$(TOP)\src\date.c \
|
||||
@@ -1396,7 +1456,7 @@ SRC01 = \
|
||||
$(TOP)\src\status.c \
|
||||
$(TOP)\src\table.c \
|
||||
$(TOP)\src\threads.c \
|
||||
tclsqlite-ex.c \
|
||||
$(TOP)\src\tclsqlite.c \
|
||||
$(TOP)\src\tokenize.c \
|
||||
$(TOP)\src\treeview.c \
|
||||
$(TOP)\src\trigger.c \
|
||||
@@ -1563,6 +1623,7 @@ TESTSRC = \
|
||||
$(TOP)\src\test_thread.c \
|
||||
$(TOP)\src\test_vdbecov.c \
|
||||
$(TOP)\src\test_vfs.c \
|
||||
$(TOP)\src\test_windirent.c \
|
||||
$(TOP)\src\test_window.c \
|
||||
$(TOP)\src\test_wsd.c \
|
||||
$(TOP)\ext\fts3\fts3_term.c \
|
||||
@@ -1578,6 +1639,7 @@ TESTEXT = \
|
||||
$(TOP)\ext\misc\amatch.c \
|
||||
$(TOP)\ext\misc\appendvfs.c \
|
||||
$(TOP)\ext\misc\basexx.c \
|
||||
$(TOP)\ext\misc\carray.c \
|
||||
$(TOP)\ext\misc\cksumvfs.c \
|
||||
$(TOP)\ext\misc\closure.c \
|
||||
$(TOP)\ext\misc\csv.c \
|
||||
@@ -1593,6 +1655,7 @@ TESTEXT = \
|
||||
$(TOP)\ext\misc\mmapwarm.c \
|
||||
$(TOP)\ext\misc\nextchar.c \
|
||||
$(TOP)\ext\misc\normalize.c \
|
||||
$(TOP)\ext\misc\percentile.c \
|
||||
$(TOP)\ext\misc\prefixes.c \
|
||||
$(TOP)\ext\misc\qpvtab.c \
|
||||
$(TOP)\ext\misc\randomjson.c \
|
||||
@@ -1704,10 +1767,8 @@ SHELL_COMPILE_OPTS = $(SHELL_COMPILE_OPTS) -DSQLITE_DQS=0
|
||||
SHELL_COMPILE_OPTS = $(SHELL_COMPILE_OPTS) -DSQLITE_ENABLE_FTS4=1
|
||||
SHELL_COMPILE_OPTS = $(SHELL_COMPILE_OPTS) -DSQLITE_ENABLE_EXPLAIN_COMMENTS=1
|
||||
SHELL_COMPILE_OPTS = $(SHELL_COMPILE_OPTS) -DSQLITE_ENABLE_OFFSET_SQL_FUNC=1
|
||||
SHELL_COMPILE_OPTS = $(SHELL_COMPILE_OPTS) -DSQLITE_ENABLE_PERCENTILE=1
|
||||
SHELL_COMPILE_OPTS = $(SHELL_COMPILE_OPTS) -DSQLITE_ENABLE_UNKNOWN_SQL_FUNCTION=1
|
||||
SHELL_COMPILE_OPTS = $(SHELL_COMPILE_OPTS) -DSQLITE_ENABLE_STMT_SCANSTATUS=1
|
||||
SHELL_COMPILE_OPTS = $(SHELL_COMPILE_OPTS) -DSQLITE_ENABLE_BYTECODE_VTAB=1
|
||||
SHELL_COMPILE_OPTS = $(SHELL_COMPILE_OPTS) -DSQLITE_STRICT_SUBTYPE=1
|
||||
!ENDIF
|
||||
|
||||
@@ -1720,7 +1781,6 @@ FUZZCHECK_OPTS = $(FUZZCHECK_OPTS) -I$(TOP)\test -I$(TOP)\ext\recover
|
||||
FUZZCHECK_OPTS = $(FUZZCHECK_OPTS) -DSQLITE_ENABLE_MEMSYS5
|
||||
FUZZCHECK_OPTS = $(FUZZCHECK_OPTS) -DSQLITE_OSS_FUZZ
|
||||
FUZZCHECK_OPTS = $(FUZZCHECK_OPTS) -DSQLITE_ENABLE_BYTECODE_VTAB
|
||||
FUZZCHECK_OPTS = $(FUZZCHECK_OPTS) -DSQLITE_ENABLE_CARRAY
|
||||
FUZZCHECK_OPTS = $(FUZZCHECK_OPTS) -DSQLITE_ENABLE_DBPAGE_VTAB
|
||||
FUZZCHECK_OPTS = $(FUZZCHECK_OPTS) -DSQLITE_ENABLE_DBSTAT_VTAB
|
||||
FUZZCHECK_OPTS = $(FUZZCHECK_OPTS) -DSQLITE_ENABLE_BYTECODE_VTAB
|
||||
@@ -1734,7 +1794,6 @@ FUZZCHECK_OPTS = $(FUZZCHECK_OPTS) -DSQLITE_ENABLE_MATH_FUNCTIONS
|
||||
FUZZCHECK_OPTS = $(FUZZCHECK_OPTS) -DSQLITE_ENABLE_MEMSYS5
|
||||
FUZZCHECK_OPTS = $(FUZZCHECK_OPTS) -DSQLITE_ENABLE_NORMALIZE
|
||||
FUZZCHECK_OPTS = $(FUZZCHECK_OPTS) -DSQLITE_ENABLE_OFFSET_SQL_FUNC
|
||||
FUZZCHECK_OPTS = $(FUZZCHECK_OPTS) -DSQLITE_ENABLE_PERCENTILE
|
||||
FUZZCHECK_OPTS = $(FUZZCHECK_OPTS) -DSQLITE_ENABLE_PREUPDATE_HOOK
|
||||
FUZZCHECK_OPTS = $(FUZZCHECK_OPTS) -DSQLITE_ENABLE_RTREE
|
||||
FUZZCHECK_OPTS = $(FUZZCHECK_OPTS) -DSQLITE_ENABLE_SESSION
|
||||
@@ -1765,6 +1824,7 @@ FUZZCHECK_SRC = $(FUZZCHECK_SRC) $(TOP)\test\fuzzinvariants.c
|
||||
FUZZCHECK_SRC = $(FUZZCHECK_SRC) $(TOP)\test\vt02.c
|
||||
FUZZCHECK_SRC = $(FUZZCHECK_SRC) $(TOP)\ext\recover\dbdata.c
|
||||
FUZZCHECK_SRC = $(FUZZCHECK_SRC) $(TOP)\ext\recover\sqlite3recover.c
|
||||
FUZZCHECK_SRC = $(FUZZCHECK_SRC) $(TOP)\ext\misc\percentile.c
|
||||
FUZZCHECK_SRC = $(FUZZCHECK_SRC) $(TOP)\ext\misc\randomjson.c
|
||||
|
||||
OSSSHELL_SRC = $(TOP)\test\ossshell.c $(TOP)\test\ossfuzz.c
|
||||
@@ -1866,8 +1926,8 @@ $(SQLITE3EXE): shell.c $(SHELL_CORE_DEP) $(LIBRESOBJS) $(SHELL_CORE_SRC) $(SQLIT
|
||||
/link $(SQLITE3EXEPDB) $(LDFLAGS) $(LTLINKOPTS) $(SHELL_LINK_OPTS) $(LTLIBPATHS) $(LIBRESOBJS) $(LIBREADLINE) $(LTLIBS) $(TLIBS)
|
||||
|
||||
# <<mark>>
|
||||
sqldiff.exe: $(TOP)\tool\sqldiff.c $(TOP)\ext\misc\sqlite3_stdio.h $(TOP)\ext\misc\sqlite3_stdio.c $(SQLITE3C) $(SQLITE3H) $(LIBRESOBJS) $(TOP)\tool\winmain.c
|
||||
$(LTLINK) $(NO_WARN) -I$(TOP)\ext\misc $(TOP)\tool\sqldiff.c $(TOP)\ext\misc\sqlite3_stdio.c $(TOP)\tool\winmain.c $(SQLITE3C) /link $(LDFLAGS) $(LTLINKOPTS) $(LIBRESOBJS)
|
||||
sqldiff.exe: $(TOP)\tool\sqldiff.c $(TOP)\ext\misc\sqlite3_stdio.h $(TOP)\ext\misc\sqlite3_stdio.c $(SQLITE3C) $(SQLITE3H) $(LIBRESOBJS)
|
||||
$(LTLINK) $(NO_WARN) -I$(TOP)\ext\misc $(TOP)\tool\sqldiff.c $(TOP)\ext\misc\sqlite3_stdio.c $(SQLITE3C) /link $(LDFLAGS) $(LTLINKOPTS) $(LIBRESOBJS)
|
||||
|
||||
dbhash.exe: $(TOP)\tool\dbhash.c $(SQLITE3C) $(SQLITE3H)
|
||||
$(LTLINK) $(NO_WARN) $(TOP)\tool\dbhash.c $(SQLITE3C) /link $(LDFLAGS) $(LTLINKOPTS)
|
||||
@@ -1912,6 +1972,10 @@ fuzzcheck.exe: $(FUZZCHECK_SRC) $(SQLITE3C) $(SQLITE3H)
|
||||
fuzzcheck-asan.exe: $(FUZZCHECK_SRC) $(SQLITE3C) $(SQLITE3H)
|
||||
$(LTLINK) $(NO_WARN) /fsanitize=address $(FUZZCHECK_OPTS) $(FUZZCHECK_SRC) $(SQLITE3C) /link $(LDFLAGS) $(LTLINKOPTS)
|
||||
|
||||
run-fuzzcheck: fuzzcheck.exe fuzzcheck-asan.exe
|
||||
fuzzcheck --spinner $(FUZZDB)
|
||||
fuzzcheck-asan --spinner $(FUZZDB)
|
||||
|
||||
ossshell.exe: $(OSSSHELL_SRC) $(SQLITE3C) $(SQLITE3H)
|
||||
$(LTLINK) $(NO_WARN) $(FUZZCHECK_OPTS) $(OSSSHELL_SRC) $(SQLITE3C) /link $(LDFLAGS) $(LTLINKOPTS)
|
||||
|
||||
@@ -1957,18 +2021,8 @@ sqlite3.c: .target_source sqlite3ext.h sqlite3session.h $(MKSQLITE3C_TOOL) src-v
|
||||
|
||||
sqlite3-all.c: sqlite3.c $(TOP)\tool\split-sqlite3c.tcl $(JIM_TCLSH)
|
||||
$(JIM_TCLSH) $(TOP)\tool\split-sqlite3c.tcl
|
||||
|
||||
TCLSQLITEEX = \
|
||||
$(TOP)\ext\qrf\qrf.h \
|
||||
$(TOP)\ext\qrf\qrf.c \
|
||||
$(TOP)\src\tclsqlite.c
|
||||
|
||||
tclsqlite-ex.c: $(TCLSQLITEEX) $(TOP)\tool\mkcombo.tcl $(JIM_TCLSH)
|
||||
$(JIM_TCLSH) $(TOP)\tool\mkcombo.tcl $(TCLSQLITEEX) -o $@
|
||||
# <</mark>>
|
||||
|
||||
tclsqlite-ex.c:
|
||||
|
||||
# Rule to build the amalgamation
|
||||
#
|
||||
sqlite3.lo: $(SQLITE3C)
|
||||
@@ -2052,9 +2106,6 @@ build.lo: $(TOP)\src\build.c $(HDR)
|
||||
callback.lo: $(TOP)\src\callback.c $(HDR)
|
||||
$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\callback.c
|
||||
|
||||
carray.lo: $(TOP)\src\carray.c $(HDR)
|
||||
$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\carray.c
|
||||
|
||||
complete.lo: $(TOP)\src\complete.c $(HDR)
|
||||
$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\complete.c
|
||||
|
||||
@@ -2268,11 +2319,11 @@ whereexpr.lo: $(TOP)\src\whereexpr.c $(HDR)
|
||||
window.lo: $(TOP)\src\window.c $(HDR)
|
||||
$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\window.c
|
||||
|
||||
tclsqlite.lo: tclsqlite-ex.c $(HDR) $(SQLITE_TCL_DEP)
|
||||
$(LTCOMPILE) $(NO_WARN) -DUSE_TCL_STUBS=1 -DBUILD_sqlite -I$(TCLINCDIR) -c tclsqlite-ex.c /OUT:tclsqlite.lo
|
||||
tclsqlite.lo: $(TOP)\src\tclsqlite.c $(HDR) $(SQLITE_TCL_DEP)
|
||||
$(LTCOMPILE) $(NO_WARN) -DUSE_TCL_STUBS=1 -DBUILD_sqlite -I$(TCLINCDIR) -c $(TOP)\src\tclsqlite.c
|
||||
|
||||
tclsqlite-shell.lo: tclsqlite-ex.c $(HDR) $(SQLITE_TCL_DEP)
|
||||
$(LTCOMPILE) $(NO_WARN) -DTCLSH -DBUILD_sqlite -I$(TCLINCDIR) -c tclsqlite-ex.c
|
||||
tclsqlite-shell.lo: $(TOP)\src\tclsqlite.c $(HDR) $(SQLITE_TCL_DEP)
|
||||
$(LTCOMPILE) $(NO_WARN) -DTCLSH -DBUILD_sqlite -I$(TCLINCDIR) -c $(TOP)\src\tclsqlite.c
|
||||
|
||||
tclsqlite3.exe: tclsqlite-shell.lo $(SQLITE3C) $(SQLITE3H) $(LIBRESOBJS)
|
||||
$(LTLINK) $(SQLITE3C) /link $(LDFLAGS) $(LTLINKOPTS) $(TCLLIBPATHS) $(LTLIBPATHS) /OUT:$@ tclsqlite-shell.lo $(LIBRESOBJS) $(TCLLIBS) $(LTLIBS) $(TLIBS)
|
||||
@@ -2325,8 +2376,6 @@ keywordhash.h: $(TOP)\tool\mkkeywordhash.c mkkeywordhash.exe
|
||||
# Source and header files that shell.c depends on
|
||||
SHELL_DEP = \
|
||||
$(TOP)\src\shell.c.in \
|
||||
$(TOP)\ext\qrf\qrf.c \
|
||||
$(TOP)\ext\qrf\qrf.h \
|
||||
$(TOP)\ext\expert\sqlite3expert.c \
|
||||
$(TOP)\ext\expert\sqlite3expert.h \
|
||||
$(TOP)\ext\intck\sqlite3intck.c \
|
||||
@@ -2340,6 +2389,7 @@ SHELL_DEP = \
|
||||
$(TOP)\ext\misc\ieee754.c \
|
||||
$(TOP)\ext\misc\memtrace.c \
|
||||
$(TOP)\ext\misc\pcachetrace.c \
|
||||
$(TOP)\ext\misc\percentile.c \
|
||||
$(TOP)\ext\misc\regexp.c \
|
||||
$(TOP)\ext\misc\series.c \
|
||||
$(TOP)\ext\misc\sha1.c \
|
||||
@@ -2349,11 +2399,12 @@ SHELL_DEP = \
|
||||
$(TOP)\ext\misc\sqlite3_stdio.h \
|
||||
$(TOP)\ext\misc\uint.c \
|
||||
$(TOP)\ext\misc\vfstrace.c \
|
||||
$(TOP)\ext\misc\windirent.h \
|
||||
$(TOP)\ext\misc\zipfile.c \
|
||||
$(TOP)\ext\recover\dbdata.c \
|
||||
$(TOP)\ext\recover\sqlite3recover.c \
|
||||
$(TOP)\ext\recover\sqlite3recover.h
|
||||
$(TOP)\ext\recover\sqlite3recover.h \
|
||||
$(TOP)\src\test_windirent.c \
|
||||
$(TOP)\src\test_windirent.h
|
||||
|
||||
# If use of zlib is enabled, add the "zipfile.c" source file.
|
||||
#
|
||||
@@ -2366,7 +2417,7 @@ shell.c: $(SHELL_DEP) $(TOP)\tool\mkshellc.tcl $(JIM_TCLSH)
|
||||
$(JIM_TCLSH) $(TOP)\tool\mkshellc.tcl shell.c
|
||||
|
||||
zlib:
|
||||
pushd $(ZLIBDIR) && $(MAKE) /f win32\Makefile.msc clean $(ZLIBLIB) CFLAGS="$(ZLIBCFLAGS)" && popd
|
||||
pushd $(ZLIBDIR) && $(MAKE) /f win32\Makefile.msc clean $(ZLIBLIB) && popd
|
||||
|
||||
# Rules to build the extension objects.
|
||||
#
|
||||
@@ -2440,6 +2491,24 @@ FTS5_SRC = \
|
||||
$(TOP)\ext\fts5\fts5_varint.c \
|
||||
$(TOP)\ext\fts5\fts5_vocab.c
|
||||
|
||||
LSM1_SRC = \
|
||||
$(TOP)\ext\lsm1\lsm.h \
|
||||
$(TOP)\ext\lsm1\lsmInt.h \
|
||||
$(TOP)\ext\lsm1\lsm_ckpt.c \
|
||||
$(TOP)\ext\lsm1\lsm_file.c \
|
||||
$(TOP)\ext\lsm1\lsm_log.c \
|
||||
$(TOP)\ext\lsm1\lsm_main.c \
|
||||
$(TOP)\ext\lsm1\lsm_mem.c \
|
||||
$(TOP)\ext\lsm1\lsm_mutex.c \
|
||||
$(TOP)\ext\lsm1\lsm_shared.c \
|
||||
$(TOP)\ext\lsm1\lsm_sorted.c \
|
||||
$(TOP)\ext\lsm1\lsm_str.c \
|
||||
$(TOP)\ext\lsm1\lsm_tree.c \
|
||||
$(TOP)\ext\lsm1\lsm_unix.c \
|
||||
$(TOP)\ext\lsm1\lsm_varint.c \
|
||||
$(TOP)\ext\lsm1\lsm_vtab.c \
|
||||
$(TOP)\ext\lsm1\lsm_win32.c
|
||||
|
||||
fts5parse.c: $(TOP)\ext\fts5\fts5parse.y lemon.exe
|
||||
copy /Y $(TOP)\ext\fts5\fts5parse.y .
|
||||
copy /B fts5parse.y +,,
|
||||
@@ -2453,6 +2522,11 @@ fts5.c: $(FTS5_SRC) $(JIM_TCLSH)
|
||||
copy /Y $(TOP)\ext\fts5\fts5.h .
|
||||
copy /B fts5.h +,,
|
||||
|
||||
lsm1.c: $(LSM1_SRC) $(JIM_TCLSH)
|
||||
$(JIM_TCLSH) $(TOP)\ext\lsm1\tool\mklsm1c.tcl
|
||||
copy /Y $(TOP)\ext\lsm1\lsm.h .
|
||||
copy /B lsm.h +,,
|
||||
|
||||
fts5.lo: fts5.c $(HDR) $(EXTHDR)
|
||||
$(LTCOMPILE) $(CORE_COMPILE_OPTS) $(NO_WARN) -DSQLITE_CORE -c fts5.c
|
||||
|
||||
@@ -2480,8 +2554,6 @@ TESTFIXTURE_FLAGS = $(TESTFIXTURE_FLAGS) -DSQLITE_DEFAULT_PAGE_SIZE=1024
|
||||
TESTFIXTURE_FLAGS = $(TESTFIXTURE_FLAGS) -DSQLITE_ENABLE_STMTVTAB=1
|
||||
TESTFIXTURE_FLAGS = $(TESTFIXTURE_FLAGS) -DSQLITE_ENABLE_DBPAGE_VTAB=1
|
||||
TESTFIXTURE_FLAGS = $(TESTFIXTURE_FLAGS) -DSQLITE_ENABLE_BYTECODE_VTAB=1
|
||||
TESTFIXTURE_FLAGS = $(TESTFIXTURE_FLAGS) -DSQLITE_ENABLE_CARRAY=1
|
||||
TESTFIXTURE_FLAGS = $(TESTFIXTURE_FLAGS) -DSQLITE_ENABLE_PERCENTILE=1
|
||||
TESTFIXTURE_FLAGS = $(TESTFIXTURE_FLAGS) -DSQLITE_CKSUMVFS_STATIC=1
|
||||
TESTFIXTURE_FLAGS = $(TESTFIXTURE_FLAGS) $(TEST_CCONV_OPTS)
|
||||
TESTFIXTURE_FLAGS = $(TESTFIXTURE_FLAGS) -DSQLITE_STATIC_RANDOMJSON
|
||||
@@ -2490,9 +2562,9 @@ TESTFIXTURE_FLAGS = $(TESTFIXTURE_FLAGS) -DSQLITE_STRICT_SUBTYPE=1
|
||||
TESTFIXTURE_SRC0 = $(TESTEXT) $(TESTSRC2)
|
||||
TESTFIXTURE_SRC1 = $(TESTEXT) $(SQLITE3C)
|
||||
!IF $(USE_AMALGAMATION)==0
|
||||
TESTFIXTURE_SRC = $(TESTSRC) tclsqlite-ex.c $(TESTFIXTURE_SRC0)
|
||||
TESTFIXTURE_SRC = $(TESTSRC) $(TOP)\src\tclsqlite.c $(TESTFIXTURE_SRC0)
|
||||
!ELSE
|
||||
TESTFIXTURE_SRC = $(TESTSRC) tclsqlite-ex.c $(TESTFIXTURE_SRC1)
|
||||
TESTFIXTURE_SRC = $(TESTSRC) $(TOP)\src\tclsqlite.c $(TESTFIXTURE_SRC1)
|
||||
!ENDIF
|
||||
|
||||
!IF $(USE_STDCALL)!=0 || $(FOR_WIN10)!=0
|
||||
@@ -2517,7 +2589,7 @@ sqlite_tcl.h:
|
||||
|
||||
testfixture.exe: $(TESTFIXTURE_SRC) $(TESTFIXTURE_DEP) $(SQLITE3H) $(LIBRESOBJS) $(HDR) $(SQLITE_TCL_DEP)
|
||||
$(LTLINK) -DSQLITE_NO_SYNC=1 $(TESTFIXTURE_FLAGS) \
|
||||
-DBUILD_sqlite -I$(TCLINCDIR) -I$(TOP)\ext\misc \
|
||||
-DBUILD_sqlite -I$(TCLINCDIR) \
|
||||
$(TESTFIXTURE_SRC) \
|
||||
/link $(LDFLAGS) $(LTLINKOPTS) $(TCLLIBPATHS) $(LTLIBPATHS) $(LIBRESOBJS) $(TCLLIBS) $(LTLIBS) $(TLIBS)
|
||||
|
||||
@@ -2530,12 +2602,9 @@ extensiontest: testfixture.exe testloadext.dll
|
||||
@set PATH=$(LIBTCLPATH);$(PATH)
|
||||
.\testfixture.exe $(TOP)\test\loadext.test $(TESTOPTS)
|
||||
|
||||
tool-zip: testfixture.exe sqlite3.exe sqldiff.exe sqlite3_analyzer.exe sqlite3_rsync.exe sqlite3.dll $(TOP)\tool\mktoolzip.tcl
|
||||
tool-zip: testfixture.exe sqlite3.exe sqldiff.exe sqlite3_analyzer.exe sqlite3_rsync.exe $(TOP)\tool\mktoolzip.tcl
|
||||
.\testfixture.exe $(TOP)\tool\mktoolzip.tcl
|
||||
|
||||
snapshot-zip: testfixture.exe sqlite3.exe sqldiff.exe sqlite3_analyzer.exe sqlite3_rsync.exe sqlite3.dll $(TOP)\tool\mktoolzip.tcl
|
||||
.\testfixture.exe $(TOP)\tool\mktoolzip.tcl --snapshot
|
||||
|
||||
coretestprogs: testfixture.exe sqlite3.exe
|
||||
|
||||
testprogs: $(TESTPROGS) srcck1.exe fuzzcheck.exe sessionfuzz.exe
|
||||
@@ -2601,22 +2670,6 @@ devtest: srctree-check sourcetest
|
||||
mdevtest:
|
||||
$(TCLSH_CMD) $(TOP)\test\testrunner.tcl mdevtest
|
||||
|
||||
# Rerun test cases that failed on the previous testrunner invocation
|
||||
#
|
||||
retest:
|
||||
$(TCLSH_CMD) $(TOP)\test\testrunner.tcl retest
|
||||
|
||||
# Show all errors from the most reason testrunner invocation
|
||||
#
|
||||
errors:
|
||||
$(TCLSH_CMD) $(TOP)\test\testrunner.tcl errors
|
||||
|
||||
# Show the status of the current testrunner invocation,
|
||||
# updated every couple of seconds
|
||||
#
|
||||
status:
|
||||
$(TCLSH_CMD) $(TOP)\test\testrunner.tcl status -d 2
|
||||
|
||||
# Validate that various generated files in the source tree
|
||||
# are up-to-date.
|
||||
#
|
||||
@@ -2625,14 +2678,7 @@ srctree-check: $(TOP)\tool\srctree-check.tcl
|
||||
|
||||
# Testing for a release
|
||||
#
|
||||
releasetest: verify-source
|
||||
$(TCLSH_CMD) $(TOP)\test\testrunner.tcl release
|
||||
|
||||
# xdevtest is like releasetest, except that it skips the
|
||||
# dependency on verify-source so that xdevtest can be run from
|
||||
# a modified source tree.
|
||||
#
|
||||
xdevtest:
|
||||
releasetest:
|
||||
$(TCLSH_CMD) $(TOP)\test\testrunner.tcl release
|
||||
|
||||
|
||||
@@ -2640,17 +2686,17 @@ smoketest: $(TESTPROGS)
|
||||
@set PATH=$(LIBTCLPATH);$(PATH)
|
||||
.\testfixture.exe $(TOP)\test\main.test $(TESTOPTS)
|
||||
|
||||
shelltest:
|
||||
$(TCLSH_CMD) $(TOP)\test\testrunner.tcl release shell
|
||||
shelltest: $(TESTPROGS)
|
||||
.\testfixture.exe $(TOP)\test\permutations.test shell
|
||||
|
||||
sqlite3_analyzer.c: $(SQLITE3C) $(SQLITE3H) tclsqlite-ex.c $(TOP)\tool\spaceanal.tcl $(TOP)\tool\mkccode.tcl $(TOP)\tool\sqlite3_analyzer.c.in $(TOP)\ext\misc\sqlite3_stdio.h $(TOP)\ext\misc\sqlite3_stdio.c $(SQLITE_TCL_DEP)
|
||||
sqlite3_analyzer.c: $(SQLITE3C) $(SQLITE3H) $(TOP)\src\tclsqlite.c $(TOP)\tool\spaceanal.tcl $(TOP)\tool\mkccode.tcl $(TOP)\tool\sqlite3_analyzer.c.in $(TOP)\ext\misc\sqlite3_stdio.h $(TOP)\ext\misc\sqlite3_stdio.c $(SQLITE_TCL_DEP)
|
||||
$(TCLSH_CMD) $(TOP)\tool\mkccode.tcl -DINCLUDE_SQLITE3_C $(TOP)\tool\sqlite3_analyzer.c.in > $@
|
||||
|
||||
sqlite3_analyzer.exe: sqlite3_analyzer.c $(LIBRESOBJS)
|
||||
$(LTLINK) $(NO_WARN) -DBUILD_sqlite -I$(TCLINCDIR) sqlite3_analyzer.c \
|
||||
/link $(LDFLAGS) $(LTLINKOPTS) $(TCLLIBPATHS) $(LTLIBPATHS) $(LIBRESOBJS) $(TCLLIBS) $(LTLIBS) $(TLIBS)
|
||||
|
||||
sqltclsh.c: sqlite3.c tclsqlite-ex.c $(TOP)\tool\sqltclsh.tcl $(TOP)\ext\misc\appendvfs.c $(TOP)\tool\mkccode.tcl $(TOP)\tool\sqltclsh.c.in
|
||||
sqltclsh.c: sqlite3.c $(TOP)\src\tclsqlite.c $(TOP)\tool\sqltclsh.tcl $(TOP)\ext\misc\appendvfs.c $(TOP)\tool\mkccode.tcl $(TOP)\tool\sqltclsh.c.in
|
||||
$(TCLSH_CMD) $(TOP)\tool\mkccode.tcl $(TOP)\tool\sqltclsh.c.in >sqltclsh.c
|
||||
|
||||
sqltclsh.exe: sqltclsh.c $(SHELL_CORE_DEP) $(LIBRESOBJS)
|
||||
@@ -2663,7 +2709,7 @@ sqlite3_expert.exe: $(SQLITE3C) $(TOP)\ext\expert\sqlite3expert.h $(TOP)\ext\exp
|
||||
CHECKER_DEPS =\
|
||||
$(TOP)\tool\mkccode.tcl \
|
||||
sqlite3.c \
|
||||
tclsqlite-ex.c \
|
||||
$(TOP)\src\tclsqlite.c \
|
||||
$(TOP)\ext\repair\sqlite3_checker.tcl \
|
||||
$(TOP)\ext\repair\checkindex.c \
|
||||
$(TOP)\ext\repair\checkfreelist.c \
|
||||
@@ -2709,9 +2755,6 @@ showwal.exe: $(TOP)\tool\showwal.c $(SQLITE3C) $(SQLITE3H)
|
||||
showshm.exe: $(TOP)\tool\showshm.c
|
||||
$(LTLINK) $(NO_WARN) $(TOP)\tool\showshm.c /link $(LDFLAGS) $(LTLINKOPTS)
|
||||
|
||||
showtmlog.exe: $(TOP)\tool\showtmlog.c
|
||||
$(LTLINK) $(NO_WARN) $(TOP)\tool\showtmlog.c /link $(LDFLAGS) $(LTLINKOPTS)
|
||||
|
||||
index_usage.exe: $(TOP)\tool\index_usage.c $(SQLITE3C) $(SQLITE3H)
|
||||
$(LTLINK) $(NO_WARN) -DSQLITE_THREADSAFE=0 -DSQLITE_OMIT_LOAD_EXTENSION \
|
||||
$(TOP)\tool\index_usage.c $(SQLITE3C) /link $(LDFLAGS) $(LTLINKOPTS)
|
||||
@@ -2780,134 +2823,8 @@ tcl-env:
|
||||
@echo JIM_TCLSH = $(JIM_TCLSH)
|
||||
@echo VISUALSTUDIOVERSION = $(VISUALSTUDIOVERSION)
|
||||
|
||||
env:
|
||||
@echo ALL_TCL_TARGETS = $(ALL_TCL_TARGETS)
|
||||
@echo API_ARMOR = $(API_ARMOR)
|
||||
@echo ASAN = $(ASAN)
|
||||
@echo BCC = $(BCC)
|
||||
@echo BUILD_ZLIB = $(BUILD_ZLIB)
|
||||
@echo CC = $(CC)
|
||||
@echo CCOPTS = $(CCOPTS)
|
||||
@echo CHECKER_DEPS = $(CHECKER_DEPS)
|
||||
@echo CORE_CCONV_OPTS = $(CORE_CCONV_OPTS)
|
||||
@echo CORE_COMPILE_OPTS = $(CORE_COMPILE_OPTS)
|
||||
@echo CORE_LINK_DEP = $(CORE_LINK_DEP)
|
||||
@echo CORE_LINK_OPTS = $(CORE_LINK_OPTS)
|
||||
@echo CRTLIBPATH = $(CRTLIBPATH)
|
||||
@echo CSC = $(CSC)
|
||||
@echo DBFUZZ_COMPILE_OPTS = $(DBFUZZ_COMPILE_OPTS)
|
||||
@echo DEBUG = $(DEBUG)
|
||||
@echo DYNAMIC_SHELL = $(DYNAMIC_SHELL)
|
||||
@echo EXT_FEATURE_FLAGS = $(EXT_FEATURE_FLAGS)
|
||||
@echo EXTHDR = $(EXTHDR)
|
||||
@echo EXTRA_SRC = $(EXTRA_SRC)
|
||||
@echo FOR_UWP = $(FOR_UWP)
|
||||
@echo FUZZCHECK_OPTS = $(FUZZCHECK_OPTS)
|
||||
@echo FUZZCHECK_SRC = $(FUZZCHECK_SRC)
|
||||
@echo FUZZDATA = $(FUZZDATA)
|
||||
@echo FUZZERSHELL_COMPILE_OPTS = $(FUZZERSHELL_COMPILE_OPTS)
|
||||
@echo HDR = $(HDR)
|
||||
@echo ICUDIR = $(ICUDIR)
|
||||
@echo ICUINCDIR = $(ICUINCDIR)
|
||||
@echo ICULIBDIR = $(ICULIBDIR)
|
||||
@echo JIM_TCLSH = $(JIM_TCLSH)
|
||||
@echo KV_COMPILE_OPTS = $(KV_COMPILE_OPTS)
|
||||
@echo LDFLAGS = $(LDFLAGS)
|
||||
@echo LD = $(LD)
|
||||
@echo LIBICU = $(LIBICU)
|
||||
@echo LIBOBJ = $(LIBOBJ)
|
||||
@echo LIBREADLINE = $(LIBREADLINE)
|
||||
@echo LIBRESOBJS = $(LIBRESOBJS)
|
||||
@echo LIBTCLPATH = $(LIBTCLPATH)
|
||||
@echo LIBTCLSTUB = $(LIBTCLSTUB)
|
||||
@echo LIBTCL = $(LIBTCL)
|
||||
@echo LTCOMPILE = $(LTCOMPILE)
|
||||
@echo LTLIB = $(LTLIB)
|
||||
@echo LTLIBOPTS = $(LTLIBOPTS)
|
||||
@echo LTLIBPATHS = $(LTLIBPATHS)
|
||||
@echo LTLIBS = $(LTLIBS)
|
||||
@echo LTLINK = $(LTLINK)
|
||||
@echo LTLINKOPTS = $(LTLINKOPTS)
|
||||
@echo LTRCOMPILE = $(LTRCOMPILE)
|
||||
@echo MEMDEBUG = $(MEMDEBUG)
|
||||
@echo MINIMAL_AMALGAMATION = $(MINIMAL_AMALGAMATION)
|
||||
@echo MPTESTER_COMPILE_OPTS = $(MPTESTER_COMPILE_OPTS)
|
||||
@echo NCC = $(NCC)
|
||||
@echo NCRTLIBPATH = $(NCRTLIBPATH)
|
||||
@echo NLTLIBPATHS = $(NLTLIBPATHS)
|
||||
@echo NO_LINEMACROS = $(NO_LINEMACROS)
|
||||
@echo NO_TCL = $(NO_TCL)
|
||||
@echo NO_WARN = $(NO_WARN)
|
||||
@echo NSDKLIBPATH = $(NSDKLIBPATH)
|
||||
@echo NUCRTLIBPATH = $(NUCRTLIBPATH)
|
||||
@echo OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS)
|
||||
@echo OPTIMIZATIONS = $(OPTIMIZATIONS)
|
||||
@echo OSSSHELL_SRC = $(OSSSHELL_SRC)
|
||||
@echo OSTRACE = $(OSTRACE)
|
||||
@echo RBU = $(RBU)
|
||||
@echo RCC = $(RCC)
|
||||
@echo RC = $(RC)
|
||||
@echo READLINE_FLAGS = $(READLINE_FLAGS)
|
||||
@echo REQ_FEATURE_FLAGS = $(REQ_FEATURE_FLAGS)
|
||||
@echo RSYNC_OPT = $(RSYNC_OPT)
|
||||
@echo RSYNC_SRC = $(RSYNC_SRC)
|
||||
@echo SESSION = $(SESSION)
|
||||
@echo SETLK_TIMEOUT = $(SETLK_TIMEOUT)
|
||||
@echo SHELL_CCONV_OPTS = $(SHELL_CCONV_OPTS)
|
||||
@echo SHELL_COMPILE_OPTS = $(SHELL_COMPILE_OPTS)
|
||||
@echo SHELL_CORE_DEP = $(SHELL_CORE_DEP)
|
||||
@echo SHELL_CORE_LIB = $(SHELL_CORE_LIB)
|
||||
@echo SHELL_CORE_SRC = $(SHELL_CORE_SRC)
|
||||
@echo SHELL_DEP = $(SHELL_DEP)
|
||||
@echo SHELL_LINK_OPTS = $(SHELL_LINK_OPTS)
|
||||
@echo SPLIT_AMALGAMATION = $(SPLIT_AMALGAMATION)
|
||||
@echo SQLITETCLDECLSH = $(SQLITETCLDECLSH)
|
||||
@echo SQLITE_TCL_DEP = $(SQLITE_TCL_DEP)
|
||||
@echo SQLITETCLH = $(SQLITETCLH)
|
||||
@echo SRC = $(SRC)
|
||||
@echo STATICALLY_LINK_TCL = $(STATICALLY_LINK_TCL)
|
||||
@echo ST_COMPILE_OPTS = $(ST_COMPILE_OPTS)
|
||||
@echo STORELIBPATH = $(STORELIBPATH)
|
||||
@echo SYMBOLS = $(SYMBOLS)
|
||||
@echo TCC = $(TCC)
|
||||
@echo TCLDIR = $(TCLDIR)
|
||||
@echo TCLINCDIR = $(TCLINCDIR)
|
||||
@echo TCLLIBDIR = $(TCLLIBDIR)
|
||||
@echo TCLLIBPATHS = $(TCLLIBPATHS)
|
||||
@echo TCLLIBS = $(TCLLIBS)
|
||||
@echo TCLSH_CMD = $(TCLSH_CMD)
|
||||
@echo TCLSQLITEEX = $(TCLSQLITEEX)
|
||||
@echo TCLSUFFIX = $(TCLSUFFIX)
|
||||
@echo TCLVERSION = $(TCLVERSION)
|
||||
@echo TEST_CCONV_OPTS = $(TEST_CCONV_OPTS)
|
||||
@echo TESTEXT = $(TESTEXT)
|
||||
@echo TESTFIXTURE_DEP = $(TESTFIXTURE_DEP)
|
||||
@echo TESTFIXTURE_FLAGS = $(TESTFIXTURE_FLAGS)
|
||||
@echo TESTFIXTURE_SRC = $(TESTFIXTURE_SRC)
|
||||
@echo TESTOPTS = $(TESTOPTS)
|
||||
@echo TESTPROGS = $(TESTPROGS)
|
||||
@echo TESTSRC = $(TESTSRC)
|
||||
@echo TLIBS = $(TLIBS)
|
||||
@echo TOP = $(TOP)
|
||||
@echo UCRTLIBPATH = $(UCRTLIBPATH)
|
||||
@echo USE_AMALGAMATION = $(USE_AMALGAMATION)
|
||||
@echo USE_CRT_DLL = $(USE_CRT_DLL)
|
||||
@echo USE_FATAL_WARN = $(USE_FATAL_WARN)
|
||||
@echo USE_FULLWARN = $(USE_FULLWARN)
|
||||
@echo USE_ICU = $(USE_ICU)
|
||||
@echo USE_LISTINGS = $(USE_LISTINGS)
|
||||
@echo USE_NATIVE_LIBPATHS = $(USE_NATIVE_LIBPATHS)
|
||||
@echo USE_RC = $(USE_RC)
|
||||
@echo USE_RUNTIME_CHECKS = $(USE_RUNTIME_CHECKS)
|
||||
@echo USE_SEH = $(USE_SEH)
|
||||
@echo USE_STDCALL = $(USE_STDCALL)
|
||||
@echo USE_ZLIB = $(USE_ZLIB)
|
||||
@echo XCOMPILE = $(XCOMPILE)
|
||||
@echo ZLIBCFLAGS = $(ZLIBCFLAGS)
|
||||
@echo ZLIBDIR = $(ZLIBDIR)
|
||||
@echo ZLIBINCDIR = $(ZLIBINCDIR)
|
||||
@echo ZLIBLIBDIR = $(ZLIBLIBDIR)
|
||||
@echo ZLIBLIB = $(ZLIBLIB)
|
||||
LSMDIR=$(TOP)\ext\lsm1
|
||||
!INCLUDE $(LSMDIR)\Makefile.msc
|
||||
|
||||
moreclean: clean
|
||||
del /Q $(SQLITE3C) $(SQLITE3H) 2>NUL
|
||||
@@ -2950,6 +2867,7 @@ clean:
|
||||
del /Q kvtest.exe ossshell.exe scrub.exe 2>NUL
|
||||
del /Q showshm.exe sqlite3_checker.* sqlite3_expert.exe 2>NUL
|
||||
del /Q fts5.* fts5parse.* 2>NUL
|
||||
del /Q lsm.h lsm1.c 2>NUL
|
||||
del /q src-verify.exe 2>NUL
|
||||
del /q jimsh.exe jimsh0.exe 2>NUL
|
||||
# <</mark>>
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
<h1 align="center">SQLite Source Repository</h1>
|
||||
|
||||
This repository contains the complete source code for the
|
||||
[SQLite database engine](https://sqlite.org/) going back
|
||||
to 2000-05-29. The tree includes many tests and some
|
||||
documentation, though additional tests and most documentation
|
||||
are managed separately.
|
||||
[SQLite database engine](https://sqlite.org/), including
|
||||
many test scripts. However, other test scripts
|
||||
and most of the documentation are managed separately.
|
||||
|
||||
See the [on-line documentation](https://sqlite.org/) for more information
|
||||
about what SQLite is and how it works from a user's perspective. This
|
||||
@@ -54,32 +53,39 @@ then no longer be fully in the public domain.
|
||||
|
||||
## Obtaining The SQLite Source Code
|
||||
|
||||
Source code tarballs or ZIP archives are available at:
|
||||
If you do not want to use Fossil, you can download tarballs or ZIP
|
||||
archives or [SQLite archives](https://sqlite.org/cli.html#sqlar) as follows:
|
||||
|
||||
* [Latest trunk check-in](https://sqlite.org/src/rchvdwnld/trunk).
|
||||
* Latest trunk check-in as
|
||||
[Tarball](https://www.sqlite.org/src/tarball/sqlite.tar.gz),
|
||||
[ZIP-archive](https://www.sqlite.org/src/zip/sqlite.zip), or
|
||||
[SQLite-archive](https://www.sqlite.org/src/sqlar/sqlite.sqlar).
|
||||
|
||||
* [Latest release](https://sqlite.org/src/rchvdwnld/release)
|
||||
* Latest release as
|
||||
[Tarball](https://www.sqlite.org/src/tarball/sqlite.tar.gz?r=release),
|
||||
[ZIP-archive](https://www.sqlite.org/src/zip/sqlite.zip?r=release), or
|
||||
[SQLite-archive](https://www.sqlite.org/src/sqlar/sqlite.sqlar?r=release).
|
||||
|
||||
* For other check-ins, browse the
|
||||
[project timeline](https://sqlite.org/src/timeline?y=ci) and
|
||||
click on the check-in hash of the check-in you want to download.
|
||||
On the resulting "info" page, click one of the options to the
|
||||
right of the "**Downloads:**" label in the "**Overview**" section
|
||||
near the top.
|
||||
* For other check-ins, substitute an appropriate branch name or
|
||||
tag or hash prefix in place of "release" in the URLs of the previous
|
||||
bullet. Or browse the [timeline](https://www.sqlite.org/src/timeline)
|
||||
to locate the check-in desired, click on its information page link,
|
||||
then click on the "Tarball" or "ZIP Archive" links on the information
|
||||
page.
|
||||
|
||||
To access sources directly using [Fossil](https://fossil-scm.org/home),
|
||||
first install Fossil version 2.0 or later.
|
||||
Source tarballs and precompiled binaries for Fossil are available at
|
||||
Source tarballs and precompiled binaries available at
|
||||
<https://fossil-scm.org/home/uv/download.html>. Fossil is
|
||||
a stand-alone program. To install, simply download or build the single
|
||||
executable file and put that file someplace on your $PATH or %PATH%.
|
||||
executable file and put that file someplace on your $PATH.
|
||||
Then run commands like this:
|
||||
|
||||
mkdir -p ~/sqlite
|
||||
cd ~/sqlite
|
||||
fossil open https://sqlite.org/src
|
||||
|
||||
The initial "fossil open" command will take two or three minutes. Afterwards,
|
||||
The "fossil open" command will take two or three minutes. Afterwards,
|
||||
you can do fast, bandwidth-efficient updates to the whatever versions
|
||||
of SQLite you like. Some examples:
|
||||
|
||||
@@ -100,16 +106,16 @@ script found at the root of the source tree. Then run "make".
|
||||
|
||||
For example:
|
||||
|
||||
apt install gcc make tcl-dev ;# Install the necessary build tools
|
||||
apt install gcc make tcl-dev ;# Make sure you have all the necessary build tools
|
||||
tar xzf sqlite.tar.gz ;# Unpack the source tree into "sqlite"
|
||||
mkdir bld ;# Build happens in a sibling directory
|
||||
mkdir bld ;# Build will occur in a sibling directory
|
||||
cd bld ;# Change to the build directory
|
||||
../sqlite/configure ;# Run the configure script
|
||||
make sqlite3 ;# The "sqlite3" command-line tool
|
||||
make sqlite3.c ;# The "amalgamation" source file
|
||||
make sqldiff ;# The "sqldiff" command-line tool
|
||||
#### Targets below require tcl-dev ####
|
||||
make tclextension-install ;# Install the SQLite TCL extension
|
||||
make sqlite3 ;# Builds the "sqlite3" command-line tool
|
||||
make sqlite3.c ;# Build the "amalgamation" source file
|
||||
make sqldiff ;# Builds the "sqldiff" command-line tool
|
||||
# Makefile targets below this point require tcl-dev
|
||||
make tclextension-install ;# Build and install the SQLite TCL extension
|
||||
make devtest ;# Run development tests
|
||||
make releasetest ;# Run full release tests
|
||||
make sqlite3_analyzer ;# Builds the "sqlite3_analyzer" tool
|
||||
@@ -117,15 +123,14 @@ For example:
|
||||
See the makefile for additional targets. For debugging builds, the
|
||||
core developers typically run "configure" with options like this:
|
||||
|
||||
../sqlite/configure --all --debug CFLAGS='-O0 -g'
|
||||
../sqlite/configure --enable-all --enable-debug CFLAGS='-O0 -g'
|
||||
|
||||
For release builds, the core developers usually do:
|
||||
|
||||
../sqlite/configure --all
|
||||
../sqlite/configure --enable-all
|
||||
|
||||
Core deliverables (sqlite3.c, sqlite3) can be built without a TCL, but
|
||||
many makefile targets require a "tclsh" TCL interpreter version 8.6
|
||||
or later. The "tclextension-install" target and the test targets that follow
|
||||
Almost all makefile targets require a "tclsh" TCL interpreter version 8.6 or
|
||||
later. The "tclextension-install" target and the test targets that follow
|
||||
all require TCL development libraries too. ("apt install tcl-dev"). It is
|
||||
helpful, but is not required, to install the SQLite TCL extension (the
|
||||
"tclextension-install" target) prior to running tests. The "releasetest"
|
||||
@@ -135,20 +140,19 @@ On "make" command-lines, one can add "OPTIONS=..." to specify additional
|
||||
compile-time options over and above those set by ./configure. For example,
|
||||
to compile with the SQLITE_OMIT_DEPRECATED compile-time option, one could say:
|
||||
|
||||
./configure --all
|
||||
./configure --enable-all
|
||||
make OPTIONS=-DSQLITE_OMIT_DEPRECATED sqlite3
|
||||
|
||||
The configure script uses [autosetup](https://msteveb.github.io/autosetup/).
|
||||
If the configure script does not work out for you, there is a generic
|
||||
makefile named "Makefile.linux-gcc" in the top directory of the source tree
|
||||
that you can copy and edit to suit your needs. Comments on the generic
|
||||
makefile show what changes are needed.
|
||||
The configure script uses autoconf 2.61 and libtool. If the configure
|
||||
script does not work out for you, there is a generic makefile named
|
||||
"Makefile.linux-gcc" in the top directory of the source tree that you
|
||||
can copy and edit to suit your needs. Comments on the generic makefile
|
||||
show what changes are needed.
|
||||
|
||||
## Compiling for Windows Using MSVC
|
||||
|
||||
On Windows, everything can be compiled with MSVC.
|
||||
You will also need a working installation of TCL if you want to run tests,
|
||||
though TCL is not required if you just want to build SQLite itself.
|
||||
You will also need a working installation of TCL.
|
||||
See the [compile-for-windows.md](doc/compile-for-windows.md) document for
|
||||
additional information about how to install MSVC and TCL and configure your
|
||||
build environment.
|
||||
@@ -158,25 +162,24 @@ TCL library, using a command like this:
|
||||
|
||||
set TCLDIR=c:\Tcl
|
||||
|
||||
SQLite itself does not contain any TCL code, but it does use TCL to run
|
||||
tests. You may need to install TCL development libraries in order to
|
||||
successfully complete some makefile targets. It is helpful, but is not
|
||||
required, to install the SQLite TCL extension (the "tclextension-install"
|
||||
target) prior to running tests.
|
||||
SQLite uses "tclsh.exe" as part of the build process, and so that
|
||||
program will need to be somewhere on your %PATH%. SQLite itself
|
||||
does not contain any TCL code, but it does use TCL to help with the
|
||||
build process and to run tests. You may need to install TCL development
|
||||
libraries in order to successfully complete some makefile targets.
|
||||
It is helpful, but is not required, to install the SQLite TCL extension
|
||||
(the "tclextension-install" target) prior to running tests.
|
||||
|
||||
The source tree contains a "make.bat" file that allows the same "make"
|
||||
commands of Unix to work on Windows. In the following, you can substitute
|
||||
"nmake /f Makefile.msc" in place of "make", if you prefer to avoid this BAT
|
||||
file:
|
||||
Build using Makefile.msc. Example:
|
||||
|
||||
make sqlite3.exe
|
||||
make sqlite3.c
|
||||
make sqldiff.exe
|
||||
#### Targets below require TCL development libraries ####
|
||||
make tclextension-install
|
||||
make devtest
|
||||
make releasetest
|
||||
make sqlite3_analyzer.exe
|
||||
nmake /f Makefile.msc sqlite3.exe
|
||||
nmake /f Makefile.msc sqlite3.c
|
||||
nmake /f Makefile.msc sqldiff.exe
|
||||
# Makefile targets below this point require TCL development libraries
|
||||
nmake /f Makefile.msc tclextension-install
|
||||
nmake /f Makefile.msc devtest
|
||||
nmake /f Makefile.msc releasetest
|
||||
nmake /f Makefile.msc sqlite3_analyzer.exe
|
||||
|
||||
There are many other makefile targets. See comments in Makefile.msc for
|
||||
details.
|
||||
@@ -184,7 +187,7 @@ details.
|
||||
As with the unix Makefile, the OPTIONS=... argument can be passed on the nmake
|
||||
command-line to enable new compile-time options. For example:
|
||||
|
||||
make OPTIONS=-DSQLITE_OMIT_DEPRECATED sqlite3.exe
|
||||
nmake /f Makefile.msc OPTIONS=-DSQLITE_OMIT_DEPRECATED sqlite3.exe
|
||||
|
||||
## Source Tree Map
|
||||
|
||||
@@ -197,7 +200,8 @@ command-line to enable new compile-time options. For example:
|
||||
* **test/** - This directory and its subdirectories contains code used
|
||||
for testing. Files that end in "`.test`" are TCL scripts that run
|
||||
tests using an augmented TCL interpreter named "testfixture". Use
|
||||
a command like "`make testfixture`" to build that
|
||||
a command like "`make testfixture`" (unix) or
|
||||
"`nmake /f Makefile.msc testfixture.exe`" (windows) to build that
|
||||
augmented TCL interpreter, then run individual tests using commands like
|
||||
"`testfixture test/main.test`". This test/ subdirectory also contains
|
||||
additional C code modules and scripts for other kinds of testing.
|
||||
@@ -304,14 +308,14 @@ individual source file exceeds 32K lines in length.
|
||||
## How It All Fits Together
|
||||
|
||||
SQLite is modular in design.
|
||||
See the [architectural description](https://sqlite.org/arch.html)
|
||||
See the [architectural description](https://www.sqlite.org/arch.html)
|
||||
for details. Other documents that are useful in
|
||||
helping to understand how SQLite works include the
|
||||
[file format](https://sqlite.org/fileformat2.html) description,
|
||||
the [virtual machine](https://sqlite.org/opcode.html) that runs
|
||||
[file format](https://www.sqlite.org/fileformat2.html) description,
|
||||
the [virtual machine](https://www.sqlite.org/opcode.html) that runs
|
||||
prepared statements, the description of
|
||||
[how transactions work](https://sqlite.org/atomiccommit.html), and
|
||||
the [overview of the query planner](https://sqlite.org/optoverview.html).
|
||||
[how transactions work](https://www.sqlite.org/atomiccommit.html), and
|
||||
the [overview of the query planner](https://www.sqlite.org/optoverview.html).
|
||||
|
||||
Decades of effort have gone into optimizing SQLite, both
|
||||
for small size and high performance. And optimizations tend to result in
|
||||
@@ -379,11 +383,10 @@ implementation. It will not be the easiest library in the world to hack.
|
||||
(and some other test programs too) is built and run when you type
|
||||
"make test".
|
||||
|
||||
* **VERSION**, **manifest**, **manifest.tags**, and **manifest.uuid** -
|
||||
These files define the current SQLite version number. The "VERSION" file
|
||||
is human generated, but the "manifest", "manifest.tags", and
|
||||
"manifest.uuid" files are automatically generated by the
|
||||
[Fossil version control system](https://fossil-scm.org/).
|
||||
* **VERSION**, **manifest**, and **manifest.uuid** - These files define
|
||||
the current SQLite version number. The "VERSION" file is human generated,
|
||||
but the "manifest" and "manifest.uuid" files are automatically generated
|
||||
by the [Fossil version control system](https://fossil-scm.org/).
|
||||
|
||||
There are many other source files. Each has a succinct header comment that
|
||||
describes its purpose and role within the larger system.
|
||||
@@ -409,6 +412,10 @@ makefile:
|
||||
|
||||
> make verify-source
|
||||
|
||||
Or on windows:
|
||||
|
||||
> nmake /f Makefile.msc verify-source
|
||||
|
||||
Using the makefile to verify source integrity is good for detecting
|
||||
accidental changes to the source tree, but malicious changes could be
|
||||
hidden by also modifying the makefiles.
|
||||
|
||||
@@ -12,11 +12,6 @@
|
||||
#
|
||||
# JimTCL: https://jim.tcl.tk
|
||||
#
|
||||
# Code-diver notes: APIs names starting with "sqlite-" are specific to
|
||||
# this project and can be found in autosetup/sqlite-config.tcl. Names
|
||||
# starting with "proj-" are project-agnostic and found in
|
||||
# autosetup/proj.tcl.
|
||||
#
|
||||
use sqlite-config
|
||||
sqlite-configure canonical {
|
||||
proj-if-opt-truthy dev {
|
||||
@@ -31,7 +26,7 @@ sqlite-configure canonical {
|
||||
# [proj-get-env] and we want this to supercede that.
|
||||
sqlite-munge-cflags; # straighten out -DSQLITE_ENABLE/OMIT flags
|
||||
}
|
||||
sqlite-handle-debug ;# must come after --dev flag check
|
||||
sqlite-handle-debug
|
||||
sqlite-check-common-bins ;# must come before [sqlite-handle-wasi-sdk]
|
||||
sqlite-handle-wasi-sdk ;# must run relatively early, as it changes the environment
|
||||
sqlite-check-common-system-deps
|
||||
@@ -59,11 +54,4 @@ sqlite-configure canonical {
|
||||
sqlite-handle-tcl
|
||||
sqlite-handle-emsdk
|
||||
|
||||
proj-if-opt-truthy static-shells {
|
||||
proj-opt-set static-tclsqlite3 1
|
||||
proj-opt-set static-cli-shell 1
|
||||
}
|
||||
proj-define-for-opt static-tclsqlite3 STATIC_TCLSQLITE3 "Statically link tclsqlite3?"
|
||||
proj-define-for-opt static-cli-shell STATIC_CLI_SHELL "Statically link CLI shell?"
|
||||
|
||||
}; # sqlite-configure
|
||||
}
|
||||
|
||||
+9
-22
@@ -125,8 +125,10 @@ OPT_FEATURE_FLAGS = @OPT_FEATURE_FLAGS@
|
||||
|
||||
LDFLAGS.libsqlite3.soname = @LDFLAGS_LIBSQLITE3_SONAME@
|
||||
# soname: see https://sqlite.org/src/forumpost/5a3b44f510df8ded
|
||||
LDFLAGS.libsqlite3.os-specific = \
|
||||
@LDFLAGS_MAC_CVERSION@ @LDFLAGS_MAC_INSTALL_NAME@ @LDFLAGS_OUT_IMPLIB@
|
||||
LDFLAGS.libsqlite3.os-specific = @LDFLAGS_MAC_CVERSION@ @LDFLAGS_OUT_IMPLIB@
|
||||
# os-specific: see
|
||||
# - https://sqlite.org/forum/forumpost/9dfd5b8fd525a5d7
|
||||
# - https://sqlite.org/forum/forumpost/0c7fc097b2
|
||||
|
||||
LDFLAGS.libsqlite3 = \
|
||||
$(LDFLAGS.rpath) $(LDFLAGS.pthread) \
|
||||
@@ -222,33 +224,17 @@ install: install-lib
|
||||
# Flags to link the shell app either directly against sqlite3.c
|
||||
# (ENABLE_STATIC_SHELL==1) or libsqlite3.so (ENABLE_STATIC_SHELL==0).
|
||||
#
|
||||
# Maintenance reminder: placement of $(LDFLAGS) is more relevant for
|
||||
# some platforms than others:
|
||||
# https://sqlite.org/forum/forumpost/d80ecdaddd
|
||||
ENABLE_STATIC_SHELL = @ENABLE_STATIC_SHELL@
|
||||
sqlite3-shell-link-flags.1 = $(TOP)/sqlite3.c $(LDFLAGS) $(LDFLAGS.libsqlite3)
|
||||
sqlite3-shell-link-flags.0 = $(LDFLAGS) -L. -lsqlite3 $(LDFLAGS.zlib) $(LDFLAGS.math)
|
||||
sqlite3-shell-link-flags.1 = $(TOP)/sqlite3.c $(LDFLAGS.libsqlite3)
|
||||
sqlite3-shell-link-flags.0 = -L. -lsqlite3 $(LDFLAGS.zlib)
|
||||
sqlite3-shell-deps.1 = $(TOP)/sqlite3.c
|
||||
sqlite3-shell-deps.0 = $(libsqlite3.DLL)
|
||||
#
|
||||
# STATIC_CLI_SHELL = 1 to statically link sqlite3$(T.exe), else
|
||||
# 0. Requires static versions of all requisite libraries. Primarily
|
||||
# intended for use with static-friendly environments like Alpine
|
||||
# Linux.
|
||||
#
|
||||
STATIC_CLI_SHELL = @STATIC_CLI_SHELL@
|
||||
#
|
||||
# sqlite3-shell-static.flags.N = N is $(STATIC_CLI_SHELL)
|
||||
#
|
||||
sqlite3-shell-static.flags.1 = -static
|
||||
sqlite3-shell-static.flags.0 =
|
||||
sqlite3$(T.exe): $(TOP)/shell.c $(sqlite3-shell-deps.$(ENABLE_STATIC_SHELL))
|
||||
$(CC) -o $@ \
|
||||
$(TOP)/shell.c $(sqlite3-shell-link-flags.$(ENABLE_STATIC_SHELL)) \
|
||||
$(sqlite3-shell-static.flags.$(STATIC_CLI_SHELL)) \
|
||||
-I. $(OPT_FEATURE_FLAGS) $(SHELL_OPT) \
|
||||
$(CFLAGS) $(CFLAGS.readline) $(CFLAGS.icu) \
|
||||
$(LDFLAGS.readline)
|
||||
$(LDFLAGS) $(LDFLAGS.readline)
|
||||
|
||||
sqlite3$(T.exe)-1:
|
||||
sqlite3$(T.exe)-0: sqlite3$(T.exe)
|
||||
@@ -282,7 +268,7 @@ DIST_FILES := \
|
||||
README.txt VERSION \
|
||||
auto.def autosetup configure tea \
|
||||
sqlite3.h sqlite3.c shell.c sqlite3ext.h \
|
||||
Makefile.in Makefile.msc Makefile.fallback make.bat \
|
||||
Makefile.in Makefile.msc Makefile.fallback \
|
||||
sqlite3.rc sqlite3rc.h Replace.cs \
|
||||
sqlite3.pc.in sqlite3.1
|
||||
|
||||
@@ -296,6 +282,7 @@ dist:
|
||||
rm -fr $(dist_name)
|
||||
mkdir -p $(dist_name)
|
||||
cp -rp $(DIST_FILES) $(dist_name)/.
|
||||
rm -f $(dist_name)/tea/configure.ac.in
|
||||
tar czf $(dist_tarball) $(dist_name)
|
||||
rm -fr $(dist_name)
|
||||
ls -l $(dist_tarball)
|
||||
|
||||
+91
-18
@@ -101,6 +101,13 @@ NO_WARN = $(NO_WARN) -wd4210 -wd4232 -wd4244 -wd4305 -wd4306 -wd4702 -wd4706
|
||||
!ENDIF
|
||||
!ENDIF
|
||||
|
||||
# Set this non-0 to use the library paths and other options necessary for
|
||||
# Windows Phone 8.1.
|
||||
#
|
||||
!IFNDEF USE_WP81_OPTS
|
||||
USE_WP81_OPTS = 0
|
||||
!ENDIF
|
||||
|
||||
# Set this non-0 to split the SQLite amalgamation file into chunks to
|
||||
# be used for debugging with Visual Studio.
|
||||
#
|
||||
@@ -149,6 +156,14 @@ USE_NATIVE_LIBPATHS = 0
|
||||
USE_RC = 1
|
||||
!ENDIF
|
||||
|
||||
# Set this non-0 to compile binaries suitable for the WinRT environment.
|
||||
# This setting does not apply to any binaries that require Tcl to operate
|
||||
# properly (i.e. the text fixture, etc).
|
||||
#
|
||||
!IFNDEF FOR_WINRT
|
||||
FOR_WINRT = 0
|
||||
!ENDIF
|
||||
|
||||
# Set this non-0 to compile binaries suitable for the UWP environment.
|
||||
# This setting does not apply to any binaries that require Tcl to operate
|
||||
# properly (i.e. the text fixture, etc).
|
||||
@@ -312,7 +327,6 @@ OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_STMTVTAB=1
|
||||
OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_DBPAGE_VTAB=1
|
||||
OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_DBSTAT_VTAB=1
|
||||
OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_BYTECODE_VTAB=1
|
||||
OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_CARRAY=1
|
||||
!ENDIF
|
||||
OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_COLUMN_METADATA=1
|
||||
!ENDIF
|
||||
@@ -335,7 +349,6 @@ OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_PREUPDATE_HOOK=1
|
||||
|
||||
# Always enable math functions on Windows
|
||||
OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_MATH_FUNCTIONS
|
||||
OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_PERCENTILE
|
||||
|
||||
# Should the rbu extension be enabled? If so, add compilation options
|
||||
# to enable it.
|
||||
@@ -548,14 +561,10 @@ RCC = $(RC) -DSQLITE_OS_WIN=1 -I. -I$(TOP) $(RCOPTS) $(RCCOPTS)
|
||||
!IF "$(PLATFORM)"=="x86"
|
||||
CORE_CCONV_OPTS = -Gz -guard:cf -DSQLITE_CDECL=__cdecl -DSQLITE_APICALL=__stdcall -DSQLITE_CALLBACK=__stdcall -DSQLITE_SYSAPI=__stdcall
|
||||
SHELL_CCONV_OPTS = -Gz -guard:cf -DSQLITE_CDECL=__cdecl -DSQLITE_APICALL=__stdcall -DSQLITE_CALLBACK=__stdcall -DSQLITE_SYSAPI=__stdcall
|
||||
|
||||
|
||||
!ELSE
|
||||
!IFNDEF PLATFORM
|
||||
CORE_CCONV_OPTS = -Gz -guard:cf -DSQLITE_CDECL=__cdecl -DSQLITE_APICALL=__stdcall -DSQLITE_CALLBACK=__stdcall -DSQLITE_SYSAPI=__stdcall
|
||||
SHELL_CCONV_OPTS = -Gz -guard:cf -DSQLITE_CDECL=__cdecl -DSQLITE_APICALL=__stdcall -DSQLITE_CALLBACK=__stdcall -DSQLITE_SYSAPI=__stdcall
|
||||
|
||||
|
||||
!ELSE
|
||||
CORE_CCONV_OPTS =
|
||||
SHELL_CCONV_OPTS =
|
||||
@@ -656,6 +665,18 @@ SHELL_LINK_OPTS = $(SHELL_CORE_LIB)
|
||||
TCC = $(TCC) -FAcs
|
||||
!ENDIF
|
||||
|
||||
# When compiling the library for use in the WinRT environment,
|
||||
# the following compile-time options must be used as well to
|
||||
# disable use of Win32 APIs that are not available and to enable
|
||||
# use of Win32 APIs that are specific to Windows 8 and/or WinRT.
|
||||
#
|
||||
!IF $(FOR_WINRT)!=0
|
||||
TCC = $(TCC) -DSQLITE_OS_WINRT=1
|
||||
RCC = $(RCC) -DSQLITE_OS_WINRT=1
|
||||
TCC = $(TCC) -DWINAPI_FAMILY=WINAPI_FAMILY_APP
|
||||
RCC = $(RCC) -DWINAPI_FAMILY=WINAPI_FAMILY_APP
|
||||
!ENDIF
|
||||
|
||||
# C compiler options for the Windows 10 platform (needs MSVC 2015).
|
||||
#
|
||||
!IF $(FOR_WIN10)!=0
|
||||
@@ -668,36 +689,42 @@ BCC = $(BCC) /d2guard4 -D_ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE
|
||||
# USE_CRT_DLL option is set to force dynamically linking to the
|
||||
# MSVC runtime library.
|
||||
#
|
||||
!IF $(USE_CRT_DLL)!=0
|
||||
!IF $(FOR_WINRT)!=0 || $(USE_CRT_DLL)!=0
|
||||
!IF $(DEBUG)>1
|
||||
TCC = $(TCC) -MDd
|
||||
BCC = $(BCC) -MDd
|
||||
ZLIBCFLAGS = -nologo -MDd -W3 -O2 -Oy- -Zi
|
||||
!ELSE
|
||||
TCC = $(TCC) -MD
|
||||
BCC = $(BCC) -MD
|
||||
ZLIBCFLAGS = -nologo -MD -W3 -O2 -Oy- -Zi
|
||||
!ENDIF
|
||||
!ELSE
|
||||
!IF $(DEBUG)>1
|
||||
TCC = $(TCC) -MTd
|
||||
BCC = $(BCC) -MTd
|
||||
ZLIBCFLAGS = -nologo -MTd -W3 -O2 -Oy- -Zi
|
||||
!ELSE
|
||||
TCC = $(TCC) -MT
|
||||
BCC = $(BCC) -MT
|
||||
ZLIBCFLAGS = -nologo -MT -W3 -O2 -Oy- -Zi
|
||||
!ENDIF
|
||||
!ENDIF
|
||||
|
||||
|
||||
# Define -DNDEBUG to compile without debugging (i.e., for production usage)
|
||||
# Omitting the define will cause extra debugging code to be inserted and
|
||||
# includes extra comments when "EXPLAIN stmt" is used.
|
||||
#
|
||||
!IF $(DEBUG)==0
|
||||
TCC = $(TCC) -DNDEBUG
|
||||
BCC = $(BCC) -DNDEBUG
|
||||
RCC = $(RCC) -DNDEBUG
|
||||
!ENDIF
|
||||
|
||||
!IF $(DEBUG)>0 || $(API_ARMOR)!=0 || $(FOR_WIN10)!=0
|
||||
TCC = $(TCC) -DSQLITE_ENABLE_API_ARMOR=1
|
||||
RCC = $(RCC) -DSQLITE_ENABLE_API_ARMOR=1
|
||||
!ENDIF
|
||||
|
||||
!IF $(DEBUG)>2
|
||||
TCC = $(TCC) -DSQLITE_DEBUG=1 -DSQLITE_USE_W32_FOR_CONSOLE_IO
|
||||
TCC = $(TCC) -DSQLITE_DEBUG=1
|
||||
RCC = $(RCC) -DSQLITE_DEBUG=1
|
||||
!IF $(DYNAMIC_SHELL)==0
|
||||
TCC = $(TCC) -DSQLITE_ENABLE_WHERETRACE -DSQLITE_ENABLE_SELECTTRACE
|
||||
@@ -880,6 +907,56 @@ LTLINKOPTS = /NOLOGO
|
||||
LTLIBOPTS = /NOLOGO
|
||||
!ENDIF
|
||||
|
||||
# When compiling for use in the WinRT environment, the following
|
||||
# linker option must be used to mark the executable as runnable
|
||||
# only in the context of an application container.
|
||||
#
|
||||
!IF $(FOR_WINRT)!=0
|
||||
LTLINKOPTS = $(LTLINKOPTS) /APPCONTAINER
|
||||
!IF "$(VISUALSTUDIOVERSION)"=="12.0" || "$(VISUALSTUDIOVERSION)"=="14.0"
|
||||
!IFNDEF STORELIBPATH
|
||||
!IF "$(PLATFORM)"=="x86"
|
||||
STORELIBPATH = $(CRTLIBPATH)\store
|
||||
!ELSEIF "$(PLATFORM)"=="x64"
|
||||
STORELIBPATH = $(CRTLIBPATH)\store\amd64
|
||||
!ELSEIF "$(PLATFORM)"=="ARM"
|
||||
STORELIBPATH = $(CRTLIBPATH)\store\arm
|
||||
!ELSE
|
||||
STORELIBPATH = $(CRTLIBPATH)\store
|
||||
!ENDIF
|
||||
!ENDIF
|
||||
STORELIBPATH = $(STORELIBPATH:\\=\)
|
||||
LTLINKOPTS = $(LTLINKOPTS) "/LIBPATH:$(STORELIBPATH)"
|
||||
!ENDIF
|
||||
!ENDIF
|
||||
|
||||
# When compiling for Windows Phone 8.1, an extra library path is
|
||||
# required.
|
||||
#
|
||||
!IF $(USE_WP81_OPTS)!=0
|
||||
!IFNDEF WP81LIBPATH
|
||||
!IF "$(PLATFORM)"=="x86"
|
||||
WP81LIBPATH = $(PROGRAMFILES_X86)\Windows Phone Kits\8.1\lib\x86
|
||||
!ELSEIF "$(PLATFORM)"=="ARM"
|
||||
WP81LIBPATH = $(PROGRAMFILES_X86)\Windows Phone Kits\8.1\lib\ARM
|
||||
!ELSE
|
||||
WP81LIBPATH = $(PROGRAMFILES_X86)\Windows Phone Kits\8.1\lib\x86
|
||||
!ENDIF
|
||||
!ENDIF
|
||||
!ENDIF
|
||||
|
||||
# When compiling for Windows Phone 8.1, some extra linker options
|
||||
# are also required.
|
||||
#
|
||||
!IF $(USE_WP81_OPTS)!=0
|
||||
!IFDEF WP81LIBPATH
|
||||
LTLINKOPTS = $(LTLINKOPTS) "/LIBPATH:$(WP81LIBPATH)"
|
||||
!ENDIF
|
||||
LTLINKOPTS = $(LTLINKOPTS) /DYNAMICBASE
|
||||
LTLINKOPTS = $(LTLINKOPTS) WindowsPhoneCore.lib RuntimeObject.lib PhoneAppModelHost.lib
|
||||
LTLINKOPTS = $(LTLINKOPTS) /NODEFAULTLIB:kernel32.lib /NODEFAULTLIB:ole32.lib
|
||||
!ENDIF
|
||||
|
||||
# When compiling for UWP or the Windows 10 platform, some extra linker
|
||||
# options are also required.
|
||||
#
|
||||
@@ -903,9 +980,9 @@ LTLINKOPTS = $(LTLINKOPTS) /NODEFAULTLIB:libucrt.lib /DEFAULTLIB:ucrt.lib
|
||||
# If either debugging or symbols are enabled, enable PDBs.
|
||||
#
|
||||
!IF $(DEBUG)>1 || $(SYMBOLS)!=0
|
||||
LDFLAGS = /NODEFAULTLIB:msvcrt /DEBUG $(LDOPTS)
|
||||
LDFLAGS = /DEBUG $(LDOPTS)
|
||||
!ELSE
|
||||
LDFLAGS = /NODEFAULTLIB:msvcrt $(LDOPTS)
|
||||
LDFLAGS = $(LDOPTS)
|
||||
!ENDIF
|
||||
|
||||
|
||||
@@ -938,10 +1015,8 @@ SHELL_COMPILE_OPTS = $(SHELL_COMPILE_OPTS) -DSQLITE_DQS=0
|
||||
SHELL_COMPILE_OPTS = $(SHELL_COMPILE_OPTS) -DSQLITE_ENABLE_FTS4=1
|
||||
SHELL_COMPILE_OPTS = $(SHELL_COMPILE_OPTS) -DSQLITE_ENABLE_EXPLAIN_COMMENTS=1
|
||||
SHELL_COMPILE_OPTS = $(SHELL_COMPILE_OPTS) -DSQLITE_ENABLE_OFFSET_SQL_FUNC=1
|
||||
SHELL_COMPILE_OPTS = $(SHELL_COMPILE_OPTS) -DSQLITE_ENABLE_PERCENTILE=1
|
||||
SHELL_COMPILE_OPTS = $(SHELL_COMPILE_OPTS) -DSQLITE_ENABLE_UNKNOWN_SQL_FUNCTION=1
|
||||
SHELL_COMPILE_OPTS = $(SHELL_COMPILE_OPTS) -DSQLITE_ENABLE_STMT_SCANSTATUS=1
|
||||
SHELL_COMPILE_OPTS = $(SHELL_COMPILE_OPTS) -DSQLITE_ENABLE_BYTECODE_VTAB=1
|
||||
SHELL_COMPILE_OPTS = $(SHELL_COMPILE_OPTS) -DSQLITE_STRICT_SUBTYPE=1
|
||||
!ENDIF
|
||||
|
||||
@@ -990,8 +1065,6 @@ $(SQLITE3EXE): shell.c $(SHELL_CORE_DEP) $(LIBRESOBJS) $(SHELL_CORE_SRC) $(SQLIT
|
||||
/link $(SQLITE3EXEPDB) $(LDFLAGS) $(LTLINKOPTS) $(SHELL_LINK_OPTS) $(LTLIBPATHS) $(LIBRESOBJS) $(LIBREADLINE) $(LTLIBS) $(TLIBS)
|
||||
|
||||
|
||||
tclsqlite-ex.c:
|
||||
|
||||
# Rule to build the amalgamation
|
||||
#
|
||||
sqlite3.lo: $(SQLITE3C)
|
||||
|
||||
+1
-1
@@ -90,7 +90,7 @@ Other preprocessor defines
|
||||
Additionally, preprocessor defines may be specified by using the OPTS macro
|
||||
on the NMAKE command line. However, not all possible preprocessor defines
|
||||
may be specified in this manner as some require the amalgamation to be built
|
||||
with them enabled (see http://sqlite.org/compile.html). For example, the
|
||||
with them enabled (see http://www.sqlite.org/compile.html). For example, the
|
||||
following will work:
|
||||
|
||||
"OPTS=-DSQLITE_ENABLE_STAT4=1 -DSQLITE_OMIT_JSON=1"
|
||||
|
||||
@@ -11,10 +11,6 @@ sqlite-configure autoconf {
|
||||
sqlite-check-common-system-deps
|
||||
proj-define-for-opt static-shell ENABLE_STATIC_SHELL \
|
||||
"Link library statically into the CLI shell?"
|
||||
proj-define-for-opt static-cli-shell STATIC_CLI_SHELL "Statically link CLI shell?"
|
||||
if {![opt-bool static-shell] && [opt-bool static-cli-shell]} {
|
||||
proj-fatal "--disable-static-shell and --static-cli-shell are mutualy exclusive"
|
||||
}
|
||||
if {![opt-bool shared] && ![opt-bool static-shell]} {
|
||||
proj-opt-set shared 1
|
||||
proj-indented-notice {
|
||||
|
||||
+428
-524
@@ -1,559 +1,463 @@
|
||||
all:
|
||||
# Makefile.in --
|
||||
#
|
||||
# Unless this file is named Makefile.in, you are probably looking
|
||||
# at an automatically generated/filtered copy and should probably not
|
||||
# edit it.
|
||||
# This file is a Makefile for Sample TEA Extension. If it has the name
|
||||
# "Makefile.in" then it is a template for a Makefile; to generate the
|
||||
# actual Makefile, run "./configure", which is a configuration script
|
||||
# generated by the "autoconf" program (constructs like "@foo@" will get
|
||||
# replaced in the actual Makefile.
|
||||
#
|
||||
# This makefile is part of the teaish framework, a tool for building
|
||||
# Tcl extensions, conceptually related to TEA/tclconfig but using the
|
||||
# Autosetup configuration system instead of the GNU Autotools.
|
||||
#
|
||||
# A copy of this makefile gets processed for each extension separately
|
||||
# and populated with info about how to build, test, and install the
|
||||
# extension.
|
||||
#
|
||||
# Maintenance reminder: this file needs to stay portable with POSIX
|
||||
# Make, not just GNU Make. Yes, that's unfortunate because it makes
|
||||
# some things impossible (like skipping over swathes of rules when
|
||||
# 'make distclean' is invoked).
|
||||
# Copyright (c) 1999 Scriptics Corporation.
|
||||
# Copyright (c) 2002-2005 ActiveState Corporation.
|
||||
#
|
||||
# See the file "license.terms" for information on usage and redistribution
|
||||
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
|
||||
CC = @CC@
|
||||
INSTALL = @BIN_INSTALL@
|
||||
INSTALL.noexec = $(INSTALL) -m 0644
|
||||
#========================================================================
|
||||
# Add additional lines to handle any additional AC_SUBST cases that
|
||||
# have been added in a customized configure script.
|
||||
#========================================================================
|
||||
|
||||
#
|
||||
# Var name prefixes:
|
||||
#
|
||||
# teaish. => teaish core
|
||||
# tx. => teaish extension
|
||||
#
|
||||
# Vars with a "tx." or "teaish." prefix are all "public" for purposes
|
||||
# of the extension makefile, but the extension must not any "teaish."
|
||||
# vars and must only modify "tx." vars where that allowance is
|
||||
# specifically noted.
|
||||
#
|
||||
# Vars with a "teaish__" prefix are "private" and must not be used by
|
||||
# the extension makefile. They may change semantics or be removed in
|
||||
# any given teaish build.
|
||||
#
|
||||
tx.name = @TEAISH_NAME@
|
||||
tx.version = @TEAISH_VERSION@
|
||||
tx.name.pkg = @TEAISH_PKGNAME@
|
||||
tx.libdir = @TEAISH_LIBDIR_NAME@
|
||||
tx.loadPrefix = @TEAISH_LOAD_PREFIX@
|
||||
tx.tcl = @TEAISH_TCL@
|
||||
tx.makefile = @TEAISH_MAKEFILE@
|
||||
tx.makefile.in = @TEAISH_MAKEFILE_IN@
|
||||
tx.dll8.basename = @TEAISH_DLL8_BASENAME@
|
||||
tx.dll9.basename = @TEAISH_DLL9_BASENAME@
|
||||
tx.dll8 = @TEAISH_DLL8@
|
||||
tx.dll9 = @TEAISH_DLL9@
|
||||
tx.dll = $(tx.dll$(TCL_MAJOR_VERSION))
|
||||
tx.dir = @TEAISH_EXT_DIR@
|
||||
@if TEAISH_TM_TCL
|
||||
# Input filename for tcl::tm-style module
|
||||
tx.tm = @TEAISH_TM_TCL@
|
||||
# Target filename for tcl::tm-style installation
|
||||
tx.tm.tgt = $(tx.name.pkg)-$(tx.version).tm
|
||||
@endif
|
||||
#SAMPLE_NEW_VAR = @SAMPLE_NEW_VAR@
|
||||
|
||||
@if TEAISH_DIST_NAME
|
||||
tx.name.dist = @TEAISH_DIST_NAME@
|
||||
@else
|
||||
tx.name.dist = $(teaish.name)
|
||||
@endif
|
||||
#========================================================================
|
||||
# Nothing of the variables below this line should need to be changed.
|
||||
# Please check the TARGETS section below to make sure the make targets
|
||||
# are correct.
|
||||
#========================================================================
|
||||
|
||||
teaish.dir = @abs_top_srcdir@
|
||||
#teaish.dir.autosetup = @TEAISH_AUTOSETUP_DIR@
|
||||
teaish.makefile = Makefile
|
||||
teaish.makefile.in = $(teaish.dir)/Makefile.in
|
||||
teaish__auto.def = $(teaish.dir)/auto.def
|
||||
#========================================================================
|
||||
# The names of the source files is defined in the configure script.
|
||||
# The object files are used for linking into the final library.
|
||||
# This will be used when a dist target is added to the Makefile.
|
||||
# It is not important to specify the directory, as long as it is the
|
||||
# $(srcdir) or in the generic, win or unix subdirectory.
|
||||
#========================================================================
|
||||
|
||||
PKG_SOURCES = @PKG_SOURCES@
|
||||
PKG_OBJECTS = @PKG_OBJECTS@
|
||||
|
||||
PKG_STUB_SOURCES = @PKG_STUB_SOURCES@
|
||||
PKG_STUB_OBJECTS = @PKG_STUB_OBJECTS@
|
||||
|
||||
#========================================================================
|
||||
# PKG_TCL_SOURCES identifies Tcl runtime files that are associated with
|
||||
# this package that need to be installed, if any.
|
||||
#========================================================================
|
||||
|
||||
PKG_TCL_SOURCES = @PKG_TCL_SOURCES@
|
||||
|
||||
#========================================================================
|
||||
# This is a list of public header files to be installed, if any.
|
||||
#========================================================================
|
||||
|
||||
PKG_HEADERS = @PKG_HEADERS@
|
||||
|
||||
#========================================================================
|
||||
# "PKG_LIB_FILE" refers to the library (dynamic or static as per
|
||||
# configuration options) composed of the named objects.
|
||||
#========================================================================
|
||||
|
||||
PKG_LIB_FILE = @PKG_LIB_FILE@
|
||||
PKG_LIB_FILE8 = @PKG_LIB_FILE8@
|
||||
PKG_LIB_FILE9 = @PKG_LIB_FILE9@
|
||||
PKG_STUB_LIB_FILE = @PKG_STUB_LIB_FILE@
|
||||
|
||||
lib_BINARIES = $(PKG_LIB_FILE)
|
||||
BINARIES = $(lib_BINARIES)
|
||||
|
||||
SHELL = @SHELL@
|
||||
|
||||
srcdir = @srcdir@
|
||||
prefix = @prefix@
|
||||
exec_prefix = @exec_prefix@
|
||||
|
||||
bindir = @bindir@
|
||||
libdir = @libdir@
|
||||
includedir = @includedir@
|
||||
datarootdir = @datarootdir@
|
||||
runstatedir = @runstatedir@
|
||||
datadir = @datadir@
|
||||
mandir = @mandir@
|
||||
|
||||
DESTDIR =
|
||||
|
||||
PKG_DIR = $(PACKAGE_NAME)$(PACKAGE_VERSION)
|
||||
pkgdatadir = $(datadir)/$(PKG_DIR)
|
||||
pkglibdir = $(libdir)/$(PKG_DIR)
|
||||
pkgincludedir = $(includedir)/$(PKG_DIR)
|
||||
|
||||
top_builddir = @abs_top_builddir@
|
||||
|
||||
INSTALL_OPTIONS =
|
||||
INSTALL = @INSTALL@ $(INSTALL_OPTIONS)
|
||||
INSTALL_DATA_DIR = @INSTALL_DATA_DIR@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
INSTALL_LIBRARY = @INSTALL_LIBRARY@
|
||||
|
||||
PACKAGE_NAME = @PACKAGE_NAME@
|
||||
PACKAGE_VERSION = @PACKAGE_VERSION@
|
||||
CC = @CC@
|
||||
CFLAGS_DEFAULT = @CFLAGS_DEFAULT@
|
||||
CFLAGS_WARNING = @CFLAGS_WARNING@
|
||||
EXEEXT = @EXEEXT@
|
||||
LDFLAGS_DEFAULT = @LDFLAGS_DEFAULT@
|
||||
MAKE_LIB = @MAKE_LIB@
|
||||
MAKE_STUB_LIB = @MAKE_STUB_LIB@
|
||||
OBJEXT = @OBJEXT@
|
||||
RANLIB = @RANLIB@
|
||||
RANLIB_STUB = @RANLIB_STUB@
|
||||
SHLIB_CFLAGS = @SHLIB_CFLAGS@
|
||||
SHLIB_LD = @SHLIB_LD@
|
||||
SHLIB_LD_LIBS = @SHLIB_LD_LIBS@
|
||||
STLIB_LD = @STLIB_LD@
|
||||
#TCL_DEFS = @TCL_DEFS@
|
||||
TCL_BIN_DIR = @TCL_BIN_DIR@
|
||||
TCL_SRC_DIR = @TCL_SRC_DIR@
|
||||
#TK_BIN_DIR = @TK_BIN_DIR@
|
||||
#TK_SRC_DIR = @TK_SRC_DIR@
|
||||
|
||||
# Not used, but retained for reference of what libs Tcl required
|
||||
#TCL_LIBS = @TCL_LIBS@
|
||||
|
||||
#========================================================================
|
||||
# TCLLIBPATH seeds the auto_path in Tcl's init.tcl so we can test our
|
||||
# package without installing. The other environment variables allow us
|
||||
# to test against an uninstalled Tcl. Add special env vars that you
|
||||
# require for testing here (like TCLX_LIBRARY).
|
||||
#========================================================================
|
||||
|
||||
EXTRA_PATH = $(top_builddir):$(TCL_BIN_DIR)
|
||||
#EXTRA_PATH = $(top_builddir):$(TCL_BIN_DIR):$(TK_BIN_DIR)
|
||||
TCLLIBPATH = $(top_builddir)
|
||||
TCLSH_ENV = TCL_LIBRARY=`@CYGPATH@ $(TCL_SRC_DIR)/library`
|
||||
PKG_ENV = @LD_LIBRARY_PATH_VAR@="$(EXTRA_PATH):$(@LD_LIBRARY_PATH_VAR@)" \
|
||||
PATH="$(EXTRA_PATH):$(PATH)" \
|
||||
TCLLIBPATH="$(TCLLIBPATH)"
|
||||
|
||||
TCLSH_PROG = @TCLSH_PROG@
|
||||
TCLSH = $(TCLSH_ENV) $(PKG_ENV) $(TCLSH_PROG)
|
||||
|
||||
#WISH_ENV = TK_LIBRARY=`@CYGPATH@ $(TK_SRC_DIR)/library`
|
||||
#WISH_PROG = @WISH_PROG@
|
||||
#WISH = $(TCLSH_ENV) $(WISH_ENV) $(PKG_ENV) $(WISH_PROG)
|
||||
|
||||
SHARED_BUILD = @SHARED_BUILD@
|
||||
|
||||
INCLUDES = @PKG_INCLUDES@ @TCL_INCLUDES@ -I. -I$(srcdir)/..
|
||||
#INCLUDES = @PKG_INCLUDES@ @TCL_INCLUDES@ @TK_INCLUDES@ @TK_XINCLUDES@
|
||||
|
||||
PKG_CFLAGS = @PKG_CFLAGS@
|
||||
|
||||
# TCL_DEFS is not strictly need here, but if you remove it, then you
|
||||
# must make sure that configure.ac checks for the necessary components
|
||||
# that your library may use. TCL_DEFS can actually be a problem if
|
||||
# you do not compile with a similar machine setup as the Tcl core was
|
||||
# compiled with.
|
||||
#DEFS = $(TCL_DEFS) @DEFS@ $(PKG_CFLAGS)
|
||||
DEFS = @DEFS@ $(PKG_CFLAGS)
|
||||
|
||||
# Move pkgIndex.tcl to 'BINARIES' var if it is generated in the Makefile
|
||||
CONFIG_CLEAN_FILES = Makefile pkgIndex.tcl
|
||||
CLEANFILES = @CLEANFILES@
|
||||
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
LIBS = @PKG_LIBS@ @LIBS@
|
||||
AR = @AR@
|
||||
CFLAGS = @CFLAGS@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LDFLAGS_DEFAULT = @LDFLAGS_DEFAULT@
|
||||
COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) \
|
||||
$(CFLAGS_DEFAULT) $(CFLAGS_WARNING) $(SHLIB_CFLAGS) $(CFLAGS)
|
||||
|
||||
GDB = gdb
|
||||
VALGRIND = valgrind
|
||||
VALGRINDARGS = --tool=memcheck --num-callers=8 --leak-resolution=high \
|
||||
--leak-check=yes --show-reachable=yes -v
|
||||
|
||||
.SUFFIXES: .c .$(OBJEXT)
|
||||
|
||||
#========================================================================
|
||||
# Start of user-definable TARGETS section
|
||||
#========================================================================
|
||||
|
||||
#========================================================================
|
||||
# TEA TARGETS. Please note that the "libraries:" target refers to platform
|
||||
# independent files, and the "binaries:" target includes executable programs and
|
||||
# platform-dependent libraries. Modify these targets so that they install
|
||||
# the various pieces of your package. The make and install rules
|
||||
# for the BINARIES that you specified above have already been done.
|
||||
#========================================================================
|
||||
|
||||
all: binaries libraries doc
|
||||
|
||||
#========================================================================
|
||||
# The binaries target builds executable programs, Windows .dll's, unix
|
||||
# shared/static libraries, and any other platform-dependent files.
|
||||
# The list of targets to build for "binaries:" is specified at the top
|
||||
# of the Makefile, in the "BINARIES" variable.
|
||||
#========================================================================
|
||||
|
||||
binaries: $(BINARIES)
|
||||
|
||||
libraries:
|
||||
|
||||
#========================================================================
|
||||
# Your doc target should differentiate from doc builds (by the developer)
|
||||
# and doc installs (see install-doc), which just install the docs on the
|
||||
# end user machine when building from source.
|
||||
#========================================================================
|
||||
|
||||
doc:
|
||||
@echo "If you have documentation to create, place the commands to"
|
||||
@echo "build the docs in the 'doc:' target. For example:"
|
||||
@echo " xml2nroff sample.xml > sample.n"
|
||||
@echo " xml2html sample.xml > sample.html"
|
||||
|
||||
install: all install-binaries install-libraries install-doc
|
||||
|
||||
install-binaries: binaries install-lib-binaries install-bin-binaries
|
||||
|
||||
#========================================================================
|
||||
# This rule installs platform-independent files, such as header files.
|
||||
# The list=...; for p in $$list handles the empty list case x-platform.
|
||||
#========================================================================
|
||||
|
||||
install-libraries: libraries
|
||||
@$(INSTALL_DATA_DIR) "$(DESTDIR)$(includedir)"
|
||||
@echo "Installing header files in $(DESTDIR)$(includedir)"
|
||||
@list='$(PKG_HEADERS)'; for i in $$list; do \
|
||||
echo "Installing $(srcdir)/$$i" ; \
|
||||
$(INSTALL_DATA) $(srcdir)/$$i "$(DESTDIR)$(includedir)" ; \
|
||||
done;
|
||||
|
||||
#========================================================================
|
||||
# Install documentation. Unix manpages should go in the $(mandir)
|
||||
# directory.
|
||||
#========================================================================
|
||||
|
||||
install-doc: doc
|
||||
@$(INSTALL_DATA_DIR) "$(DESTDIR)$(mandir)/mann"
|
||||
@echo "Installing documentation in $(DESTDIR)$(mandir)"
|
||||
@list='$(srcdir)/doc/*.n'; for i in $$list; do \
|
||||
echo "Installing $$i"; \
|
||||
$(INSTALL_DATA) $$i "$(DESTDIR)$(mandir)/mann" ; \
|
||||
done
|
||||
|
||||
test: binaries libraries
|
||||
@echo "SQLite TEA distribution does not include tests"
|
||||
|
||||
shell: binaries libraries
|
||||
@$(TCLSH) $(SCRIPT)
|
||||
|
||||
gdb:
|
||||
$(TCLSH_ENV) $(PKG_ENV) $(GDB) $(TCLSH_PROG) $(SCRIPT)
|
||||
|
||||
gdb-test: binaries libraries
|
||||
$(TCLSH_ENV) $(PKG_ENV) $(GDB) \
|
||||
--args $(TCLSH_PROG) `@CYGPATH@ $(srcdir)/tests/all.tcl` \
|
||||
$(TESTFLAGS) -singleproc 1 \
|
||||
-load "package ifneeded $(PACKAGE_NAME) $(PACKAGE_VERSION) \
|
||||
[list load `@CYGPATH@ $(PKG_LIB_FILE)` [string totitle $(PACKAGE_NAME)]]"
|
||||
|
||||
valgrind: binaries libraries
|
||||
$(TCLSH_ENV) $(PKG_ENV) $(VALGRIND) $(VALGRINDARGS) $(TCLSH_PROG) \
|
||||
`@CYGPATH@ $(srcdir)/tests/all.tcl` $(TESTFLAGS)
|
||||
|
||||
valgrindshell: binaries libraries
|
||||
$(TCLSH_ENV) $(PKG_ENV) $(VALGRIND) $(VALGRINDARGS) $(TCLSH_PROG) $(SCRIPT)
|
||||
|
||||
depend:
|
||||
|
||||
#========================================================================
|
||||
# $(PKG_LIB_FILE) should be listed as part of the BINARIES variable
|
||||
# mentioned above. That will ensure that this target is built when you
|
||||
# run "make binaries".
|
||||
#
|
||||
# Autotools-conventional vars. We don't actually use these in this
|
||||
# makefile but some may be referenced by vars imported via
|
||||
# tclConfig.sh. They are part of the public API and may be reliably
|
||||
# depended on from teaish.make.in.
|
||||
# The $(PKG_OBJECTS) objects are created and linked into the final
|
||||
# library. In most cases these object files will correspond to the
|
||||
# source files above.
|
||||
#========================================================================
|
||||
|
||||
$(PKG_LIB_FILE): $(PKG_OBJECTS)
|
||||
-rm -f $(PKG_LIB_FILE)
|
||||
${MAKE_LIB}
|
||||
$(RANLIB) $(PKG_LIB_FILE)
|
||||
|
||||
$(PKG_STUB_LIB_FILE): $(PKG_STUB_OBJECTS)
|
||||
-rm -f $(PKG_STUB_LIB_FILE)
|
||||
${MAKE_STUB_LIB}
|
||||
$(RANLIB_STUB) $(PKG_STUB_LIB_FILE)
|
||||
|
||||
#========================================================================
|
||||
# We need to enumerate the list of .c to .o lines here.
|
||||
#
|
||||
bindir = @bindir@
|
||||
datadir = @datadir@
|
||||
exec_prefix = @exec_prefix@
|
||||
includedir = @includedir@
|
||||
infodir = @infodir@
|
||||
libdir = @libdir@
|
||||
libexecdir = @libexecdir@
|
||||
localstatedir = @localstatedir@
|
||||
mandir = @mandir@
|
||||
prefix = @prefix@
|
||||
runstatedir = @runstatedir@
|
||||
sbindir = @sbindir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
sysconfdir = @sysconfdir@
|
||||
# In the following lines, $(srcdir) refers to the toplevel directory
|
||||
# containing your extension. If your sources are in a subdirectory,
|
||||
# you will have to modify the paths to reflect this:
|
||||
#
|
||||
# sample.$(OBJEXT): $(srcdir)/generic/sample.c
|
||||
# $(COMPILE) -c `@CYGPATH@ $(srcdir)/generic/sample.c` -o $@
|
||||
#
|
||||
# Setting the VPATH variable to a list of paths will cause the makefile
|
||||
# to look into these paths when resolving .c to .obj dependencies.
|
||||
# As necessary, add $(srcdir):$(srcdir)/compat:....
|
||||
#========================================================================
|
||||
|
||||
VPATH = $(srcdir):$(srcdir)/generic:$(srcdir)/unix:$(srcdir)/win:$(srcdir)/macosx
|
||||
|
||||
.c.@OBJEXT@:
|
||||
$(COMPILE) -c `@CYGPATH@ $<` -o $@
|
||||
|
||||
|
||||
#
|
||||
# Vars derived (mostly) from tclConfig.sh. These may be reliably
|
||||
# used from the extension makefile.
|
||||
#
|
||||
TCLSH = @TCLSH_CMD@
|
||||
TCL_CONFIG_SH = @TCL_CONFIG_SH@
|
||||
TCL_EXEC_PREFIX = @TCL_EXEC_PREFIX@
|
||||
TCL_INCLUDE_SPEC = @TCL_INCLUDE_SPEC@
|
||||
TCL_LIBS = @TCL_LIBS@
|
||||
TCL_LIB_SPEC = @TCL_LIB_SPEC@
|
||||
TCL_MAJOR_VERSION = @TCL_MAJOR_VERSION@
|
||||
TCL_MINOR_VERSION = @TCL_MINOR_VERSION@
|
||||
TCL_PATCH_LEVEL = @TCL_PATCH_LEVEL@
|
||||
TCL_PREFIX = @TCL_PREFIX@
|
||||
TCL_SHLIB_SUFFIX = @TCL_SHLIB_SUFFIX@
|
||||
TCL_STUB_LIB_SPEC = @TCL_STUB_LIB_SPEC@
|
||||
TCL_VERSION = @TCL_VERSION@
|
||||
TCLLIBDIR = @TCLLIBDIR@
|
||||
#========================================================================
|
||||
# Distribution creation
|
||||
# You may need to tweak this target to make it work correctly.
|
||||
#========================================================================
|
||||
|
||||
#
|
||||
# CFLAGS.configure = CFLAGS as known at configure-time.
|
||||
#
|
||||
# This ordering is deliberate: flags populated via tcl's
|
||||
# [teaish-cflags-add] should preceed CFLAGS and CPPFLAGS (which
|
||||
# typically come from the ./configure command-line invocation).
|
||||
#
|
||||
CFLAGS.configure = @SH_CFLAGS@ @TEAISH_CFLAGS@ @CFLAGS@ @CPPFLAGS@ $(TCL_INCLUDE_SPEC)
|
||||
CFLAGS.configure += -DUSE_TCL_STUBS=@TEAISH_USE_STUBS@
|
||||
#COMPRESS = tar cvf $(PKG_DIR).tar $(PKG_DIR); compress $(PKG_DIR).tar
|
||||
COMPRESS = tar zcvf $(PKG_DIR).tar.gz $(PKG_DIR)
|
||||
DIST_ROOT = /tmp/dist
|
||||
DIST_DIR = $(DIST_ROOT)/$(PKG_DIR)
|
||||
|
||||
#
|
||||
# LDFLAGS.configure = LDFLAGS as known at configure-time.
|
||||
#
|
||||
# This ordering is deliberate: flags populated via tcl's
|
||||
# [teaish-ldflags-add] should precede LDFLAGS (which typically
|
||||
# comes from the ./configure command-line invocation).
|
||||
#
|
||||
LDFLAGS.configure = @TEAISH_LDFLAGS@ @LDFLAGS@
|
||||
DIST_INSTALL_DATA = CPPROG='cp -p' $(INSTALL) -m 644
|
||||
DIST_INSTALL_SCRIPT = CPPROG='cp -p' $(INSTALL) -m 755
|
||||
|
||||
#
|
||||
# Linker flags for linkhing a shared library.
|
||||
#
|
||||
LDFLAGS.shlib = @SH_LDFLAGS@
|
||||
dist-clean:
|
||||
rm -rf $(DIST_DIR) $(DIST_ROOT)/$(PKG_DIR).tar.*
|
||||
|
||||
#
|
||||
# The following tx.XYZ vars may be populated/modified by teaish.tcl
|
||||
# and/or teaish.make.
|
||||
#
|
||||
dist: dist-clean $(srcdir)/manifest.uuid
|
||||
$(INSTALL_DATA_DIR) $(DIST_DIR)
|
||||
|
||||
#
|
||||
# tx.src is the list of source or object files to include in the
|
||||
# (single) compiler/linker invocation. This will initially contain any
|
||||
# sources passed to [teaish-src-add], but may also be appended to by
|
||||
# teaish.make.
|
||||
#
|
||||
tx.src = @TEAISH_EXT_SRC@
|
||||
# TEA files
|
||||
$(DIST_INSTALL_DATA) $(srcdir)/Makefile.in \
|
||||
$(srcdir)/aclocal.m4 $(srcdir)/configure.ac \
|
||||
$(DIST_DIR)/
|
||||
$(DIST_INSTALL_SCRIPT) $(srcdir)/configure $(DIST_DIR)/
|
||||
|
||||
#
|
||||
# tx.CFLAGS is typically set by teaish.make, whereas TEAISH_CFLAGS
|
||||
# gets set up via the configure script.
|
||||
#
|
||||
tx.CFLAGS =
|
||||
tx.CPPFLAGS =
|
||||
$(INSTALL_DATA_DIR) $(DIST_DIR)/tclconfig
|
||||
$(DIST_INSTALL_DATA) $(srcdir)/tclconfig/README.txt \
|
||||
$(srcdir)/manifest.uuid \
|
||||
$(srcdir)/tclconfig/tcl.m4 $(srcdir)/tclconfig/install-sh \
|
||||
$(DIST_DIR)/tclconfig/
|
||||
|
||||
#
|
||||
# tx.LDFLAGS is typically set by teaish.make, whereas TEAISH_LDFLAGS
|
||||
# gets set up via the configure script.
|
||||
#
|
||||
tx.LDFLAGS =
|
||||
# Extension files
|
||||
$(DIST_INSTALL_DATA) \
|
||||
$(srcdir)/ChangeLog \
|
||||
$(srcdir)/README.sha \
|
||||
$(srcdir)/license.terms \
|
||||
$(srcdir)/README \
|
||||
$(srcdir)/pkgIndex.tcl.in \
|
||||
$(DIST_DIR)/
|
||||
|
||||
#
|
||||
# The list of 'dist' files may be appended to from teaish.make.in.
|
||||
# It can also be set up from teaish.tcl using [teaish-dist-add]
|
||||
# and/or [teaish-src-add -dist ...].
|
||||
#
|
||||
tx.dist.files = @TEAISH_DIST_FILES@
|
||||
list='demos doc generic library macosx tests unix win'; \
|
||||
for p in $$list; do \
|
||||
if test -d $(srcdir)/$$p ; then \
|
||||
$(INSTALL_DATA_DIR) $(DIST_DIR)/$$p; \
|
||||
$(DIST_INSTALL_DATA) $(srcdir)/$$p/* $(DIST_DIR)/$$p/; \
|
||||
fi; \
|
||||
done
|
||||
|
||||
#
|
||||
# The base name for a distribution tar/zip file.
|
||||
#
|
||||
tx.dist.basename = $(tx.name.dist)-$(tx.version)
|
||||
(cd $(DIST_ROOT); $(COMPRESS);)
|
||||
|
||||
# List of deps which may trigger an auto-reconfigure.
|
||||
#
|
||||
teaish__autogen.deps = \
|
||||
$(tx.makefile.in) $(teaish.makefile.in) \
|
||||
$(tx.tcl) \
|
||||
@TEAISH_PKGINDEX_TCL_IN@ @TEAISH_TM_TCL_IN@ \
|
||||
@AUTODEPS@
|
||||
#========================================================================
|
||||
# End of user-definable section
|
||||
#========================================================================
|
||||
|
||||
@if TEAISH_MAKEFILE_IN
|
||||
$(tx.makefile): $(tx.makefile.in)
|
||||
@endif
|
||||
#========================================================================
|
||||
# Don't modify the file to clean here. Instead, set the "CLEANFILES"
|
||||
# variable in configure.ac
|
||||
#========================================================================
|
||||
|
||||
teaish.autoreconfig = \
|
||||
@TEAISH_AUTORECONFIG@
|
||||
clean:
|
||||
-test -z "$(BINARIES)" || rm -f $(BINARIES)
|
||||
-rm -f *.$(OBJEXT) core *.core
|
||||
-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
|
||||
|
||||
#
|
||||
# Problem: when more than one target can invoke TEAISH_AUTORECONFIG,
|
||||
# we can get parallel reconfigures running. Thus, targets which
|
||||
# may require reconfigure should depend on...
|
||||
#
|
||||
config.log: $(teaish__autogen.deps)
|
||||
$(teaish.autoreconfig)
|
||||
# ^^^ We would love to skip this when running [dist]clean, but there's
|
||||
# no POSIX Make-portable way to do that. GNU Make can.
|
||||
.PHONY: reconfigure
|
||||
reconfigure:
|
||||
$(teaish.autoreconfig)
|
||||
distclean: clean
|
||||
-rm -f *.tab.c
|
||||
-rm -f $(CONFIG_CLEAN_FILES)
|
||||
-rm -f config.cache config.log config.status
|
||||
|
||||
$(teaish.makefile): $(teaish__auto.def) $(teaish.makefile.in) \
|
||||
@AUTODEPS@
|
||||
#========================================================================
|
||||
# Install binary object libraries. On Windows this includes both .dll and
|
||||
# .lib files. Because the .lib files are not explicitly listed anywhere,
|
||||
# we need to deduce their existence from the .dll file of the same name.
|
||||
# Library files go into the lib directory.
|
||||
# In addition, this will generate the pkgIndex.tcl
|
||||
# file in the install location (assuming it can find a usable tclsh shell)
|
||||
#
|
||||
# You should not have to modify this target.
|
||||
#========================================================================
|
||||
|
||||
@if TEAISH_TESTER_TCL_IN
|
||||
@TEAISH_TESTER_TCL_IN@: $(teaish__autogen.deps)
|
||||
config.log: @TEAISH_TESTER_TCL_IN@
|
||||
@TEAISH_TESTER_TCL@: @TEAISH_TESTER_TCL_IN@
|
||||
@endif
|
||||
@if TEAISH_TEST_TCL_IN
|
||||
@TEAISH_TEST_TCL_IN@: $(teaish__autogen.deps)
|
||||
config.log: @TEAISH_TEST_TCL_IN@
|
||||
@TEAISH_TEST_TCL@: @TEAISH_TEST_TCL_IN@
|
||||
@endif
|
||||
|
||||
#
|
||||
# CC variant for compiling Tcl-using sources.
|
||||
#
|
||||
CC.tcl = \
|
||||
$(CC) -o $@ $(CFLAGS.configure) $(CFLAGS) $(tx.CFLAGS) $(tx.CPPFLAGS)
|
||||
|
||||
#
|
||||
# CC variant for linking $(tx.src) into an extension DLL. Note that
|
||||
# $(tx.src) must come before $(LDFLAGS...) for linking to third-party
|
||||
# libs to work.
|
||||
#
|
||||
CC.dll = \
|
||||
$(CC.tcl) $(tx.src) $(LDFLAGS.shlib) \
|
||||
$(tx.LDFLAGS) $(LDFLAGS.configure) $(LDFLAGS) $(TCL_STUB_LIB_SPEC)
|
||||
|
||||
@if TEAISH_ENABLE_DLL
|
||||
#
|
||||
# The rest of this makefile exists solely to support this brief
|
||||
# target: the extension shared lib.
|
||||
#
|
||||
$(tx.dll): $(tx.src) config.log
|
||||
@if [ "x" = "x$(tx.src)" ]; then \
|
||||
echo "Makefile var tx.src (source/object files) is empty" 1>&2; \
|
||||
exit 1; \
|
||||
install-lib-binaries: binaries
|
||||
@$(INSTALL_DATA_DIR) "$(DESTDIR)$(pkglibdir)"
|
||||
@list='$(lib_BINARIES)'; for p in $$list; do \
|
||||
if test -f $$p; then \
|
||||
echo " $(INSTALL_LIBRARY) $$p $(DESTDIR)$(pkglibdir)/$$p"; \
|
||||
$(INSTALL_LIBRARY) $$p "$(DESTDIR)$(pkglibdir)/$$p"; \
|
||||
ext=`echo $$p|sed -e "s/.*\.//"`; \
|
||||
if test "x$$ext" = "xdll"; then \
|
||||
lib=`basename $$p|sed -e 's/.[^.]*$$//'`.lib; \
|
||||
if test -f $$lib; then \
|
||||
echo " $(INSTALL_DATA) $$lib $(DESTDIR)$(pkglibdir)/$$lib"; \
|
||||
$(INSTALL_DATA) $$lib "$(DESTDIR)$(pkglibdir)/$$lib"; \
|
||||
fi; \
|
||||
fi; \
|
||||
fi; \
|
||||
done
|
||||
@list='$(PKG_TCL_SOURCES)'; for p in $$list; do \
|
||||
if test -f $(srcdir)/$$p; then \
|
||||
destp=`basename $$p`; \
|
||||
echo " Install $$destp $(DESTDIR)$(pkglibdir)/$$destp"; \
|
||||
$(INSTALL_DATA) $(srcdir)/$$p "$(DESTDIR)$(pkglibdir)/$$destp"; \
|
||||
fi; \
|
||||
done
|
||||
@if test "x$(SHARED_BUILD)" = "x1"; then \
|
||||
echo " Install pkgIndex.tcl $(DESTDIR)$(pkglibdir)"; \
|
||||
$(INSTALL_DATA) pkgIndex.tcl "$(DESTDIR)$(pkglibdir)"; \
|
||||
fi
|
||||
$(CC.dll)
|
||||
|
||||
all: $(tx.dll)
|
||||
@endif # TEAISH_ENABLE_DLL
|
||||
#========================================================================
|
||||
# Install binary executables (e.g. .exe files and dependent .dll files)
|
||||
# This is for files that must go in the bin directory (located next to
|
||||
# wish and tclsh), like dependent .dll files on Windows.
|
||||
#
|
||||
# You should not have to modify this target, except to define bin_BINARIES
|
||||
# above if necessary.
|
||||
#========================================================================
|
||||
|
||||
tclsh: $(teaish.makefile) config.log
|
||||
@{ echo "#!/bin/sh"; echo 'exec $(TCLSH) "$$@"'; } > $@
|
||||
@chmod +x $@
|
||||
@echo "Created $@"
|
||||
install-bin-binaries: binaries
|
||||
@$(INSTALL_DATA_DIR) "$(DESTDIR)$(bindir)"
|
||||
@list='$(bin_BINARIES)'; for p in $$list; do \
|
||||
if test -f $$p; then \
|
||||
echo " $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/$$p"; \
|
||||
$(INSTALL_PROGRAM) $$p "$(DESTDIR)$(bindir)/$$p"; \
|
||||
fi; \
|
||||
done
|
||||
|
||||
#
|
||||
# Run the generated test script.
|
||||
#
|
||||
.PHONY: test-pre test-prepre test-core test test-post test-extension
|
||||
test-extension: # this name is reserved for use by teaish.make[.in]
|
||||
@if TEAISH_ENABLE_DLL
|
||||
test-prepre: $(tx.dll)
|
||||
@endif
|
||||
@if TEAISH_TESTER_TCL
|
||||
teaish.tester.tcl = @TEAISH_TESTER_TCL@
|
||||
test-core.args = $(teaish.tester.tcl)
|
||||
@if TEAISH_ENABLE_DLL
|
||||
test-core.args += '$(tx.dll)' '$(tx.loadPrefix)'
|
||||
@else
|
||||
test-core.args += '' ''
|
||||
@endif
|
||||
test-core.args += @TEAISH_TESTUTIL_TCL@
|
||||
# Clients may pass additional args via test.args=...
|
||||
# and ::argv will be rewritten before the test script loads, to
|
||||
# remove $(test-core.args)
|
||||
test.args ?=
|
||||
test-core: test-pre
|
||||
$(TCLSH) $(test-core.args) $(test.args)
|
||||
test-gdb: $(teaish.tester.tcl)
|
||||
gdb --args $(TCLSH) $(test-core.args) $(test.args)
|
||||
test-vg.flags ?= --leak-check=full -v --show-reachable=yes --track-origins=yes
|
||||
test-vg: $(teaish.tester.tcl)
|
||||
valgrind $(test-vg.flags) $(TCLSH) $(test-core.args) $(test.args)
|
||||
@else # !TEAISH_TESTER_TCL
|
||||
test-prepre:
|
||||
@endif # TEAISH_TESTER_TCL
|
||||
test-pre: test-prepre
|
||||
test-core: test-pre
|
||||
test-post: test-core
|
||||
test: test-post
|
||||
.SUFFIXES: .c .$(OBJEXT)
|
||||
|
||||
#
|
||||
# Cleanup rules...
|
||||
#
|
||||
#.PHONY: clean-pre clean-core clean-post clean-extension
|
||||
#
|
||||
clean-pre:
|
||||
clean-core: clean-pre
|
||||
rm -f $(tx.dll8) $(tx.dll9) tclsh
|
||||
clean-post: clean-core
|
||||
clean: clean-post
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
cd $(top_builddir) \
|
||||
&& CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status
|
||||
|
||||
.PHONY: distclean-pre distclean-core distclean-post clean-extension
|
||||
distclean-pre: clean
|
||||
distclean-core: distclean-pre
|
||||
rm -f Makefile
|
||||
rm -f config.log config.defines.txt
|
||||
@if TEAISH_MAKEFILE_IN
|
||||
@if TEAISH_MAKEFILE
|
||||
rm -f @TEAISH_MAKEFILE@
|
||||
@endif
|
||||
@endif
|
||||
@if TEAISH_TESTER_TCL_IN
|
||||
rm -f $(teaish.tester.tcl)
|
||||
@endif
|
||||
@if TEAISH_PKGINDEX_TCL_IN
|
||||
rm -f @TEAISH_PKGINDEX_TCL@
|
||||
@endif
|
||||
@if TEAISH_PKGINIT_TCL_IN
|
||||
rm -f @TEAISH_PKGINIT_TCL@
|
||||
@endif
|
||||
@if TEAISH_TEST_TCL_IN
|
||||
rm -f @TEAISH_TEST_TCL@
|
||||
@endif
|
||||
distclean-post: distclean-core
|
||||
distclean: distclean-post
|
||||
#
|
||||
# The (dist)clean-extension targets are reserved for use by
|
||||
# client-side teaish.make.
|
||||
#
|
||||
# Client code which wants to clean up extra stuff should do so by
|
||||
# adding their cleanup target (e.g. clean-extension) as a dependency
|
||||
# to the 'clean' target, like so:
|
||||
#
|
||||
# clean: distclean-extension
|
||||
# distclean: distclean-extension
|
||||
#
|
||||
distclean-extension:
|
||||
clean-extension:
|
||||
uninstall-binaries:
|
||||
list='$(lib_BINARIES)'; for p in $$list; do \
|
||||
rm -f "$(DESTDIR)$(pkglibdir)/$$p"; \
|
||||
done
|
||||
list='$(PKG_TCL_SOURCES)'; for p in $$list; do \
|
||||
p=`basename $$p`; \
|
||||
rm -f "$(DESTDIR)$(pkglibdir)/$$p"; \
|
||||
done
|
||||
list='$(bin_BINARIES)'; for p in $$list; do \
|
||||
rm -f "$(DESTDIR)$(bindir)/$$p"; \
|
||||
done
|
||||
|
||||
#
|
||||
# Installation rules...
|
||||
#
|
||||
@if TEAISH_ENABLE_INSTALL
|
||||
.PHONY: install-pre install-core install-post install-test install-prepre install-extension
|
||||
install-extension: # this name is reserved for use by teaish.make
|
||||
.PHONY: all binaries clean depend distclean doc install libraries test
|
||||
.PHONY: gdb gdb-test valgrind valgrindshell
|
||||
|
||||
@if TEAISH_ENABLE_DLL
|
||||
install-prepre: $(tx.dll)
|
||||
@else
|
||||
install-prepre:
|
||||
@endif
|
||||
|
||||
@if TEAISH_TM_TCL
|
||||
install-core.tmdir = $(DESTDIR)@TEAISH_TCL_TM_DIR@
|
||||
@endif
|
||||
|
||||
install-pre: install-prepre
|
||||
install-core: install-pre
|
||||
@if [ ! -d "$(DESTDIR)$(TCLLIBDIR)" ]; then \
|
||||
set -x; $(INSTALL) -d "$(DESTDIR)$(TCLLIBDIR)"; \
|
||||
fi
|
||||
# ^^^^ on some platforms, install -d fails if the target already exists.
|
||||
@if TEAISH_ENABLE_DLL
|
||||
$(INSTALL) $(tx.dll) "$(DESTDIR)$(TCLLIBDIR)"
|
||||
@endif
|
||||
@if TEAISH_PKGINDEX_TCL
|
||||
$(INSTALL.noexec) "@TEAISH_PKGINDEX_TCL@" "$(DESTDIR)$(TCLLIBDIR)"
|
||||
@endif
|
||||
@if TEAISH_PKGINIT_TCL
|
||||
$(INSTALL.noexec) "@TEAISH_PKGINIT_TCL@" "$(DESTDIR)$(TCLLIBDIR)"
|
||||
@endif
|
||||
@if TEAISH_TM_TCL
|
||||
@if [ ! -d "$(install-core.tmdir)" ]; then \
|
||||
set -x; $(INSTALL) -d "$(install-core.tmdir)"; \
|
||||
fi
|
||||
$(INSTALL.noexec) "@TEAISH_TM_TCL@" "$(install-core.tmdir)/$(tx.tm.tgt)"
|
||||
@endif
|
||||
install-test: install-core
|
||||
@echo "Post-install test of [package require $(tx.name.pkg) $(tx.version)]..."; \
|
||||
set xtra=""; \
|
||||
if [ x != "x$(DESTDIR)" ]; then \
|
||||
xtra='set ::auto_path [linsert $$::auto_path 0 [file normalize $(DESTDIR)$(TCLLIBDIR)/..]];'; \
|
||||
fi; \
|
||||
if echo \
|
||||
'set c 0; ' $$xtra \
|
||||
'@TEAISH_POSTINST_PREREQUIRE@' \
|
||||
'if {[catch {package require $(tx.name.pkg) $(tx.version)} xc]} {incr c};' \
|
||||
'if {$$c && "" ne $$xc} {puts $$xc; puts "auto_path=$$::auto_path"};' \
|
||||
'exit $$c' \
|
||||
| $(TCLSH) ; then \
|
||||
echo "passed"; \
|
||||
else \
|
||||
echo "FAILED"; \
|
||||
exit 1; \
|
||||
fi
|
||||
install-post: install-test
|
||||
install: install-post
|
||||
|
||||
#
|
||||
# Uninstall rules...
|
||||
#
|
||||
.PHONY: uninstall uninstall-pre uninstall-core uninstall-post uninstall-extension
|
||||
uninstall-extension: # this name is reserved for use by teaish.make
|
||||
uninstall-pre:
|
||||
uninstall-core: uninstall-pre
|
||||
@if TEAISH_ENABLE_DLL
|
||||
rm -fr "$(DESTDIR)$(TCLLIBDIR)"
|
||||
@endif
|
||||
@if TEAISH_TM_TCL
|
||||
rm -f "$(DESTDIR)$(install-core.tmdir)/$(tx.tm.tgt)"
|
||||
@endif
|
||||
|
||||
uninstall-post: uninstall-core
|
||||
@echo "Uninstalled Tcl extension $(tx.name) $(tx.version)"
|
||||
uninstall: uninstall-post
|
||||
@endif # TEAISH_ENABLE_INSTALL
|
||||
|
||||
@if TEAISH_MAKEFILE_IN
|
||||
Makefile: $(tx.makefile.in)
|
||||
config.log: $(teaish.makefile.in)
|
||||
@endif
|
||||
|
||||
#
|
||||
# Package archive generation ("dist") rules...
|
||||
#
|
||||
@if TEAISH_ENABLE_DIST
|
||||
@if BIN_TAR
|
||||
@if BIN_ZIP
|
||||
|
||||
# When installing teaish as part of "make dist", we need to run
|
||||
# configure with similar flags to what we last configured with but we
|
||||
# must not pass on any extension-specific flags, as those won't be
|
||||
# recognized when running in --teaish-install mode, causing
|
||||
# the sub-configure to fail.
|
||||
dist.flags = --with-tclsh=$(TCLSH)
|
||||
dist.reconfig = $(teaish.dir)/configure $(tx.dist.reconfig-flags) $(dist.flags)
|
||||
|
||||
# Temp dir for dist.zip. Must be different than dist.tgz or else
|
||||
# parallel builds may hose the dist.
|
||||
teaish__dist.tmp.zip = teaish__dist_zip
|
||||
#
|
||||
# Make a distribution zip file...
|
||||
#
|
||||
dist.zip = $(tx.dist.basename).zip
|
||||
.PHONY: dist.zip dist.zip-core dist.zip-post
|
||||
#dist.zip-pre:
|
||||
# We apparently can't add a pre-hook here, else "make dist" rebuilds
|
||||
# the archive each time it's run.
|
||||
$(dist.zip): $(tx.dist.files)
|
||||
@rm -fr $(teaish__dist.tmp.zip)
|
||||
@mkdir -p $(teaish__dist.tmp.zip)/$(tx.dist.basename)
|
||||
@tar cf $(teaish__dist.tmp.zip)/tmp.tar $(tx.dist.files)
|
||||
@tar xf $(teaish__dist.tmp.zip)/tmp.tar -C $(teaish__dist.tmp.zip)/$(tx.dist.basename)
|
||||
@if TEAISH_DIST_FULL
|
||||
@$(dist.reconfig) \
|
||||
--teaish-install=$(teaish__dist.tmp.zip)/$(tx.dist.basename) \
|
||||
--t-e-d=$(teaish__dist.tmp.zip)/$(tx.dist.basename) >/dev/null
|
||||
@endif
|
||||
@rm -f $(tx.dist.basename)/tmp.tar $(dist.zip)
|
||||
@cd $(teaish__dist.tmp.zip) && zip -q -r ../$(dist.zip) $(tx.dist.basename)
|
||||
@rm -fr $(teaish__dist.tmp.zip)
|
||||
@ls -la $(dist.zip)
|
||||
dist.zip-core: $(dist.zip)
|
||||
dist.zip-post: dist.zip-core
|
||||
dist.zip: dist.zip-post
|
||||
dist: dist.zip
|
||||
undist-zip:
|
||||
rm -f $(dist.zip)
|
||||
undist: undist-zip
|
||||
@endif #BIN_ZIP
|
||||
|
||||
#
|
||||
# Make a distribution tarball...
|
||||
#
|
||||
teaish__dist.tmp.tgz = teaish__dist_tgz
|
||||
dist.tgz = $(tx.dist.basename).tar.gz
|
||||
.PHONY: dist.tgz dist.tgz-core dist.tgz-post
|
||||
# dist.tgz-pre:
|
||||
# see notes in dist.zip
|
||||
$(dist.tgz): $(tx.dist.files)
|
||||
@rm -fr $(teaish__dist.tmp.tgz)
|
||||
@mkdir -p $(teaish__dist.tmp.tgz)/$(tx.dist.basename)
|
||||
@tar cf $(teaish__dist.tmp.tgz)/tmp.tar $(tx.dist.files)
|
||||
@tar xf $(teaish__dist.tmp.tgz)/tmp.tar -C $(teaish__dist.tmp.tgz)/$(tx.dist.basename)
|
||||
@if TEAISH_DIST_FULL
|
||||
@rm -f $(teaish__dist.tmp.tgz)/$(tx.dist.basename)/pkgIndex.tcl.in; # kludge
|
||||
@$(dist.reconfig) \
|
||||
--teaish-install=$(teaish__dist.tmp.tgz)/$(tx.dist.basename) \
|
||||
--t-e-d=$(teaish__dist.tmp.zip)/$(tx.dist.basename) >/dev/null
|
||||
@endif
|
||||
@rm -f $(tx.dist.basename)/tmp.tar $(dist.tgz)
|
||||
@cd $(teaish__dist.tmp.tgz) && tar czf ../$(dist.tgz) $(tx.dist.basename)
|
||||
@rm -fr $(teaish__dist.tmp.tgz)
|
||||
@ls -la $(dist.tgz)
|
||||
dist.tgz-core: $(dist.tgz)
|
||||
dist.tgz-post: dist.tgz-core
|
||||
dist.tgz: dist.tgz-post
|
||||
dist: dist.tgz
|
||||
undist-tgz:
|
||||
rm -f $(dist.tgz)
|
||||
undist: undist-tgz
|
||||
@else #!BIN_TAR
|
||||
dist:
|
||||
@echo "The dist rules require tar, which configure did not find." 1>&2; exit 1
|
||||
@endif #BIN_TAR
|
||||
@else #!TEAISH_ENABLE_DIST
|
||||
undist:
|
||||
dist:
|
||||
@if TEAISH_OUT_OF_EXT_TREE
|
||||
@echo "'dist' can only be used from an extension's home dir" 1>&2; \
|
||||
echo "In this case: @TEAISH_EXT_DIR@" 1>&2; exit 1
|
||||
@endif
|
||||
@endif #TEAISH_ENABLE_DIST
|
||||
|
||||
Makefile: @TEAISH_TCL@
|
||||
|
||||
@if TEAISH_MAKEFILE_CODE
|
||||
#
|
||||
# TEAISH_MAKEFILE_CODE may contain literal makefile code, which
|
||||
# gets pasted verbatim here. Either [define TEAISH_MAKEFILE_CODE
|
||||
# ...] or use [teaish-make-add] to incrementally build up this
|
||||
# content.
|
||||
#
|
||||
# <TEAISH_MAKEFILE_CODE>
|
||||
@TEAISH_MAKEFILE_CODE@
|
||||
# </TEAISH_MAKEFILE_CODE>
|
||||
@endif
|
||||
|
||||
@if TEAISH_MAKEFILE
|
||||
#
|
||||
# TEAISH_MAKEFILE[_IN] defines any extension-specific state this file
|
||||
# needs.
|
||||
#
|
||||
# It must set the following vars if they're not already accounted for
|
||||
# via teaish.tcl.
|
||||
#
|
||||
# - tx.src = list of the extension's source files, being sure to
|
||||
# prefix each with $(tx.dir) (if it's in the same dir as the
|
||||
# extension) so that out-of-tree builds can find them. Optionally,
|
||||
# [define] TEAISH_EXT_SRC or pass them to [teaish-src-add].
|
||||
#
|
||||
# It may optionally set the following vars:
|
||||
#
|
||||
# - tx.CFLAGS = CFLAGS/CPPFLAGS. Optionally, [define] TEAISH_CFLAGS
|
||||
# or pass them to [teaish-cflags-add].
|
||||
#
|
||||
# - tx.LDFLAGS = LDFLAGS. Optionally, [define] TEAISH_LDFLAGS or
|
||||
# pass them to [teaish-ldflags-add].
|
||||
#
|
||||
# It may optionally hook into various targets as documented in
|
||||
# /doc/extensions.md in the canonical teaish source tree.
|
||||
#
|
||||
# Interestingly, we don't have to pre-filter teaish.makefile.in - we
|
||||
# can just @include it here. That skips its teaish-specific validation
|
||||
# though. Hmm.
|
||||
#
|
||||
# <TEAISH_MAKEFILE>
|
||||
Makefile: @TEAISH_MAKEFILE@
|
||||
@include @TEAISH_MAKEFILE@
|
||||
# </TEAISH_MAKEFILE>
|
||||
@endif
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
.NOEXPORT:
|
||||
|
||||
+36
-52
@@ -1,30 +1,9 @@
|
||||
This is the SQLite extension for Tcl using something akin to
|
||||
the Tcl Extension Architecture (TEA). To build it:
|
||||
This is the SQLite extension for Tcl using the Tcl Extension
|
||||
Architecture (TEA).
|
||||
|
||||
./configure ...flags...
|
||||
----------------------- A BETTER WAY ---------------------------
|
||||
|
||||
e.g.:
|
||||
|
||||
./configure --with-tcl=/path/to/tcl/install/root
|
||||
|
||||
or:
|
||||
|
||||
./configure --with-tclsh=/path/to/tcl/install/root
|
||||
|
||||
Run ./configure --help for the full list of flags.
|
||||
|
||||
The configuration process will fail if tclConfig.sh cannot be found.
|
||||
|
||||
The makefile will only honor CFLAGS and CPPFLAGS passed to the
|
||||
configure script, not those directly passed to the makefile.
|
||||
|
||||
Then:
|
||||
|
||||
make test install
|
||||
|
||||
----------------------- THE PREFERRED WAY ---------------------------
|
||||
|
||||
The preferred way to build the TCL extension for SQLite is to use the
|
||||
A better way to build the TCL extension for SQLite is to use the
|
||||
canonical source code tarball. For Unix:
|
||||
|
||||
./configure --with-tclsh=$(TCLSH)
|
||||
@@ -41,32 +20,24 @@ step-by-step instructions at the links below for more information:
|
||||
https://sqlite.org/src/doc/trunk/doc/compile-for-unix.md
|
||||
https://sqlite.org/src/doc/trunk/doc/compile-for-windows.md
|
||||
|
||||
And info about the extension's Tcl interface can be found at:
|
||||
|
||||
https://sqlite.org/tclsqlite.html
|
||||
|
||||
The whole point of the amalgamation-autoconf tarball (in which this
|
||||
README.txt file is embedded) is to provide a means of compiling SQLite
|
||||
that does not require first installing TCL and/or "tclsh". The
|
||||
canonical Makefile in the SQLite source tree provides more
|
||||
capabilities (such as the the ability to run test cases to ensure that
|
||||
the build worked) and is better maintained. The only downside of the
|
||||
canonical Makefile is that it requires a TCL installation. But if you
|
||||
are wanting to build the TCL extension for SQLite, then presumably you
|
||||
already have a TCL installation. So why not just use the more-capable
|
||||
and better-maintained canoncal Makefile?
|
||||
README.txt file is embedded) is to provide a means of compiling
|
||||
SQLite that does not require first installing TCL and/or "tclsh".
|
||||
The canonical Makefile in the SQLite source tree provides more
|
||||
capabilities (such as the the ability to run test cases to ensure
|
||||
that the build worked) and is better maintained. The only
|
||||
downside of the canonical Makefile is that it requires a TCL
|
||||
installation. But if you are wanting to build the TCL extension for
|
||||
SQLite, then presumably you already have a TCL installation. So why
|
||||
not just use the more-capable and better-maintained canoncal Makefile?
|
||||
|
||||
As of version 3.50.0, this build process uses "teaish":
|
||||
|
||||
https://fossil.wanderinghorse.net/r/teaish
|
||||
|
||||
which is conceptually derived from the pre-3.50 toolchain, TEA:
|
||||
This TEA builder is derived from code found at
|
||||
|
||||
http://core.tcl-lang.org/tclconfig
|
||||
http://core.tcl-lang.org/sampleextension
|
||||
|
||||
It to works for us. It might also work for you. But we cannot
|
||||
promise that.
|
||||
The SQLite developers do not understand how it works. It seems to
|
||||
work for us. It might also work for you. But we cannot promise that.
|
||||
|
||||
If you want to use this TEA builder and it works for you, that's fine.
|
||||
But if you have trouble, the first thing you should do is go back
|
||||
@@ -78,17 +49,30 @@ to using the canonical Makefile in the SQLite source tree.
|
||||
UNIX BUILD
|
||||
==========
|
||||
|
||||
Building under most UNIX systems is easy, just run the configure
|
||||
script and then run make. For example:
|
||||
Building under most UNIX systems is easy, just run the configure script
|
||||
and then run make. For more information about the build process, see
|
||||
the tcl/unix/README file in the Tcl src dist. The following minimal
|
||||
example will install the extension in the /opt/tcl directory.
|
||||
|
||||
$ cd sqlite-*-tea
|
||||
$ ./configure --with-tcl=/path/to/tcl/install/root
|
||||
$ make test
|
||||
$ ./configure --prefix=/opt/tcl
|
||||
$ make
|
||||
$ make install
|
||||
|
||||
WINDOWS BUILD
|
||||
=============
|
||||
|
||||
On Windows this build is known to work on Cygwin and some Msys2
|
||||
environments. We do not currently support Microsoft makefiles for
|
||||
native Windows builds.
|
||||
The recommended method to build extensions under windows is to use the
|
||||
Msys + Mingw build process. This provides a Unix-style build while
|
||||
generating native Windows binaries. Using the Msys + Mingw build tools
|
||||
means that you can use the same configure script as per the Unix build
|
||||
to create a Makefile. See the tcl/win/README file for the URL of
|
||||
the Msys + Mingw download.
|
||||
|
||||
If you have VC++ then you may wish to use the files in the win
|
||||
subdirectory and build the extension using just VC++. These files have
|
||||
been designed to be as generic as possible but will require some
|
||||
additional maintenance by the project developer to synchronise with
|
||||
the TEA configure.in and Makefile.in files. Instructions for using the
|
||||
VC++ makefile are written in the first part of the Makefile.vc
|
||||
file.
|
||||
|
||||
@@ -1,50 +0,0 @@
|
||||
# -*- tcl -*-
|
||||
#
|
||||
# Unless this file is named _teaish.tester.tcl.in, you are probably
|
||||
# looking at an automatically generated/filtered copy and should
|
||||
# probably not edit it.
|
||||
#
|
||||
# This is the wrapper script invoked by teaish's "make test" recipe.
|
||||
# It gets passed 3 args:
|
||||
#
|
||||
# $1 = the DLL name, or "" if the extension has no DLL
|
||||
#
|
||||
# $2 = the "load prefix" for Tcl's [load] or empty if $1 is empty
|
||||
#
|
||||
# $3 = the /path/to/teaish/tester.tcl (test utility code)
|
||||
#
|
||||
@if TEAISH_VSATISFIES_CODE
|
||||
@TEAISH_VSATISFIES_CODE@
|
||||
@endif
|
||||
if {[llength [lindex $::argv 0]] > 0} {
|
||||
load [file normalize [lindex $::argv 0]] [lindex $::argv 1];
|
||||
# ----^^^^^^^ needed on Haiku when argv 0 is just a filename, else
|
||||
# load cannot find the file.
|
||||
}
|
||||
set ::argv [lassign $argv - -]
|
||||
source -encoding utf-8 [lindex $::argv 0]; # teaish/tester.tcl
|
||||
@if TEAISH_PKGINIT_TCL
|
||||
apply {{file} {
|
||||
set dir [file dirname $::argv0]
|
||||
source -encoding utf-8 $file
|
||||
}} [join {@TEAISH_PKGINIT_TCL@}]
|
||||
@endif
|
||||
@if TEAISH_TM_TCL
|
||||
apply {{file} {
|
||||
set dir [file dirname $::argv0]
|
||||
source -encoding utf-8 $file
|
||||
}} [join {@TEAISH_TM_TCL@}]
|
||||
@endif
|
||||
@if TEAISH_TEST_TCL
|
||||
apply {{file} {
|
||||
# Populate state for [tester.tcl::teaish-build-flag*]
|
||||
array set ::teaish__BuildFlags @TEAISH__DEFINES_MAP@
|
||||
set dir [file normalize [file dirname $file]]
|
||||
#test-fail "Just testing"
|
||||
source -encoding utf-8 $file
|
||||
}} [join {@TEAISH_TEST_TCL@}]
|
||||
@else # TEAISH_TEST_TCL
|
||||
# No $TEAISH_TEST_TCL provided, so here's a default test which simply
|
||||
# loads the extension.
|
||||
puts {Extension @TEAISH_NAME@ @TEAISH_VERSION@ successfully loaded from @TEAISH_TESTER_TCL@}
|
||||
@endif
|
||||
Vendored
+9
@@ -0,0 +1,9 @@
|
||||
#
|
||||
# Include the TEA standard macro set
|
||||
#
|
||||
|
||||
builtin(include,tclconfig/tcl.m4)
|
||||
|
||||
#
|
||||
# Add here whatever m4 macros you want to define for your package
|
||||
#
|
||||
@@ -1,8 +0,0 @@
|
||||
#/do/not/tclsh
|
||||
# ^^^ help out editors which guess this file's content type.
|
||||
#
|
||||
# Main configure script entry point for the TEA(ish) framework. All
|
||||
# extension-specific customization goes in teaish.tcl.in or
|
||||
# teaish.tcl.
|
||||
use teaish/core
|
||||
teaish-configure-core
|
||||
Vendored
-20
@@ -1,20 +0,0 @@
|
||||
#!/bin/sh
|
||||
# Look for and run autosetup...
|
||||
dir0="`dirname "$0"`"
|
||||
dirA="$dir0"
|
||||
if [ -d $dirA/autosetup ]; then
|
||||
# A local copy of autosetup
|
||||
dirA=$dirA/autosetup
|
||||
elif [ -d $dirA/../autosetup ]; then
|
||||
# SQLite "autoconf" bundle
|
||||
dirA=$dirA/../autosetup
|
||||
elif [ -d $dirA/../../autosetup ]; then
|
||||
# SQLite canonical source tree
|
||||
dirA=$dirA/../../autosetup
|
||||
else
|
||||
echo "$0: Cannot find autosetup" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
WRAPPER="$0"; export WRAPPER; exec "`"$dirA/autosetup-find-tclsh"`" \
|
||||
"$dirA/autosetup" --teaish-extension-dir="$dir0" \
|
||||
"$@"
|
||||
@@ -0,0 +1,227 @@
|
||||
#!/bin/bash -norc
|
||||
dnl This file is an input file used by the GNU "autoconf" program to
|
||||
dnl generate the file "configure", which is run during Tcl installation
|
||||
dnl to configure the system for the local environment.
|
||||
|
||||
#-----------------------------------------------------------------------
|
||||
# Sample configure.ac for Tcl Extensions. The only places you should
|
||||
# need to modify this file are marked by the string __CHANGE__
|
||||
#-----------------------------------------------------------------------
|
||||
|
||||
#-----------------------------------------------------------------------
|
||||
# __CHANGE__
|
||||
# Set your package name and version numbers here.
|
||||
#
|
||||
# This initializes the environment with PACKAGE_NAME and PACKAGE_VERSION
|
||||
# set as provided. These will also be added as -D defs in your Makefile
|
||||
# so you can encode the package version directly into the source files.
|
||||
# This will also define a special symbol for Windows (BUILD_<PACKAGE_NAME>
|
||||
# so that we create the export library with the dll.
|
||||
#-----------------------------------------------------------------------
|
||||
|
||||
AC_INIT([sqlite],[@VERSION@])
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
# Call TEA_INIT as the first TEA_ macro to set up initial vars.
|
||||
# This will define a ${TEA_PLATFORM} variable == "unix" or "windows"
|
||||
# as well as PKG_LIB_FILE and PKG_STUB_LIB_FILE.
|
||||
#--------------------------------------------------------------------
|
||||
|
||||
TEA_INIT()
|
||||
|
||||
AC_CONFIG_AUX_DIR(tclconfig)
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
# Load the tclConfig.sh file
|
||||
#--------------------------------------------------------------------
|
||||
|
||||
TEA_PATH_TCLCONFIG
|
||||
TEA_LOAD_TCLCONFIG
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
# Load the tkConfig.sh file if necessary (Tk extension)
|
||||
#--------------------------------------------------------------------
|
||||
|
||||
#TEA_PATH_TKCONFIG
|
||||
#TEA_LOAD_TKCONFIG
|
||||
|
||||
#-----------------------------------------------------------------------
|
||||
# Handle the --prefix=... option by defaulting to what Tcl gave.
|
||||
# Must be called after TEA_LOAD_TCLCONFIG and before TEA_SETUP_COMPILER.
|
||||
#-----------------------------------------------------------------------
|
||||
|
||||
TEA_PREFIX
|
||||
|
||||
#-----------------------------------------------------------------------
|
||||
# Standard compiler checks.
|
||||
# This sets up CC by using the CC env var, or looks for gcc otherwise.
|
||||
# This also calls AC_PROG_CC and a few others to create the basic setup
|
||||
# necessary to compile executables.
|
||||
#-----------------------------------------------------------------------
|
||||
|
||||
TEA_SETUP_COMPILER
|
||||
|
||||
#-----------------------------------------------------------------------
|
||||
# __CHANGE__
|
||||
# Specify the C source files to compile in TEA_ADD_SOURCES,
|
||||
# public headers that need to be installed in TEA_ADD_HEADERS,
|
||||
# stub library C source files to compile in TEA_ADD_STUB_SOURCES,
|
||||
# and runtime Tcl library files in TEA_ADD_TCL_SOURCES.
|
||||
# This defines PKG(_STUB)_SOURCES, PKG(_STUB)_OBJECTS, PKG_HEADERS
|
||||
# and PKG_TCL_SOURCES.
|
||||
#-----------------------------------------------------------------------
|
||||
|
||||
TEA_ADD_SOURCES([tclsqlite3.c])
|
||||
TEA_ADD_HEADERS([])
|
||||
TEA_ADD_INCLUDES([])
|
||||
TEA_ADD_LIBS([])
|
||||
TEA_ADD_CFLAGS([-DSQLITE_ENABLE_FTS3=1])
|
||||
TEA_ADD_CFLAGS([-DSQLITE_ENABLE_FTS4=1])
|
||||
TEA_ADD_CFLAGS([-DSQLITE_ENABLE_FTS5=1])
|
||||
TEA_ADD_CFLAGS([-DSQLITE_3_SUFFIX_ONLY=1])
|
||||
TEA_ADD_CFLAGS([-DSQLITE_ENABLE_RTREE=1])
|
||||
TEA_ADD_CFLAGS([-DSQLITE_ENABLE_GEOPOLY=1])
|
||||
TEA_ADD_CFLAGS([-DSQLITE_ENABLE_MATH_FUNCTIONS=1])
|
||||
TEA_ADD_CFLAGS([-DSQLITE_ENABLE_DESERIALIZE=1])
|
||||
TEA_ADD_CFLAGS([-DSQLITE_ENABLE_DBPAGE_VTAB=1])
|
||||
TEA_ADD_CFLAGS([-DSQLITE_ENABLE_BYTECODE_VTAB=1])
|
||||
TEA_ADD_CFLAGS([-DSQLITE_ENABLE_DBSTAT_VTAB=1])
|
||||
TEA_ADD_STUB_SOURCES([])
|
||||
TEA_ADD_TCL_SOURCES([])
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
# The --with-system-sqlite causes the TCL bindings to SQLite to use
|
||||
# the system shared library for SQLite rather than statically linking
|
||||
# against its own private copy. This is dangerous and leads to
|
||||
# undesirable dependences and is not recommended.
|
||||
# Patchs from rmax.
|
||||
#--------------------------------------------------------------------
|
||||
AC_ARG_WITH([system-sqlite],
|
||||
[AS_HELP_STRING([--with-system-sqlite],
|
||||
[use a system-supplied libsqlite3 instead of the bundled one])],
|
||||
[], [with_system_sqlite=no])
|
||||
if test x$with_system_sqlite != xno; then
|
||||
AC_CHECK_HEADER([sqlite3.h],
|
||||
[AC_CHECK_LIB([sqlite3],[sqlite3_initialize],
|
||||
[AC_DEFINE(USE_SYSTEM_SQLITE)
|
||||
LIBS="$LIBS -lsqlite3"])])
|
||||
fi
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
# __CHANGE__
|
||||
#
|
||||
# You can add more files to clean if your extension creates any extra
|
||||
# files by extending CLEANFILES.
|
||||
# Add pkgIndex.tcl if it is generated in the Makefile instead of ./configure
|
||||
# and change Makefile.in to move it from CONFIG_CLEAN_FILES to BINARIES var.
|
||||
#
|
||||
# A few miscellaneous platform-specific items:
|
||||
# TEA_ADD_* any platform specific compiler/build info here.
|
||||
#--------------------------------------------------------------------
|
||||
|
||||
#CLEANFILES="$CLEANFILES pkgIndex.tcl"
|
||||
if test "${TEA_PLATFORM}" = "windows" ; then
|
||||
# Ensure no empty if clauses
|
||||
:
|
||||
#TEA_ADD_SOURCES([win/winFile.c])
|
||||
#TEA_ADD_INCLUDES([-I\"$(${CYGPATH} ${srcdir}/win)\"])
|
||||
else
|
||||
# Ensure no empty else clauses
|
||||
:
|
||||
#TEA_ADD_SOURCES([unix/unixFile.c])
|
||||
#TEA_ADD_LIBS([-lsuperfly])
|
||||
fi
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
# __CHANGE__
|
||||
# Choose which headers you need. Extension authors should try very
|
||||
# hard to only rely on the Tcl public header files. Internal headers
|
||||
# contain private data structures and are subject to change without
|
||||
# notice.
|
||||
# This MUST be called after TEA_LOAD_TCLCONFIG / TEA_LOAD_TKCONFIG
|
||||
#--------------------------------------------------------------------
|
||||
|
||||
TEA_PUBLIC_TCL_HEADERS
|
||||
#TEA_PRIVATE_TCL_HEADERS
|
||||
|
||||
#TEA_PUBLIC_TK_HEADERS
|
||||
#TEA_PRIVATE_TK_HEADERS
|
||||
#TEA_PATH_X
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
# Check whether --enable-threads or --disable-threads was given.
|
||||
# This auto-enables if Tcl was compiled threaded.
|
||||
#--------------------------------------------------------------------
|
||||
|
||||
TEA_ENABLE_THREADS
|
||||
if test "${TCL_THREADS}" = "1" ; then
|
||||
AC_DEFINE(SQLITE_THREADSAFE, 1, [Trigger sqlite threadsafe build])
|
||||
# Not automatically added by Tcl because its assumed Tcl links to them,
|
||||
# but it may not if it isn't really a threaded build.
|
||||
TEA_ADD_LIBS([$THREADS_LIBS])
|
||||
else
|
||||
AC_DEFINE(SQLITE_THREADSAFE, 0, [Trigger sqlite non-threadsafe build])
|
||||
fi
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
# The statement below defines a collection of symbols related to
|
||||
# building as a shared library instead of a static library.
|
||||
#--------------------------------------------------------------------
|
||||
|
||||
TEA_ENABLE_SHARED
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
# This macro figures out what flags to use with the compiler/linker
|
||||
# when building shared/static debug/optimized objects. This information
|
||||
# can be taken from the tclConfig.sh file, but this figures it all out.
|
||||
#--------------------------------------------------------------------
|
||||
|
||||
TEA_CONFIG_CFLAGS
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
# Set the default compiler switches based on the --enable-symbols option.
|
||||
#--------------------------------------------------------------------
|
||||
|
||||
TEA_ENABLE_SYMBOLS
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
# This macro generates a line to use when building a library. It
|
||||
# depends on values set by the TEA_ENABLE_SHARED, TEA_ENABLE_SYMBOLS,
|
||||
# and TEA_LOAD_TCLCONFIG macros above.
|
||||
#--------------------------------------------------------------------
|
||||
|
||||
TEA_MAKE_LIB
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
# Determine the name of the tclsh and/or wish executables in the
|
||||
# Tcl and Tk build directories or the location they were installed
|
||||
# into. These paths are used to support running test cases only,
|
||||
# the Makefile should not be making use of these paths to generate
|
||||
# a pkgIndex.tcl file or anything else at extension build time.
|
||||
#--------------------------------------------------------------------
|
||||
|
||||
TEA_PROG_TCLSH
|
||||
#TEA_PROG_WISH
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
# Setup a *Config.sh.in configuration file.
|
||||
#--------------------------------------------------------------------
|
||||
|
||||
#TEA_EXPORT_CONFIG([sample])
|
||||
#AC_SUBST(SAMPLE_VAR)
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
# Specify files to substitute AC variables in. You may alternatively
|
||||
# have a special pkgIndex.tcl.in or other files which require
|
||||
# substituting the AC variables in. Include these here.
|
||||
#--------------------------------------------------------------------
|
||||
|
||||
AC_CONFIG_FILES([Makefile pkgIndex.tcl])
|
||||
#AC_CONFIG_FILES([sampleConfig.sh])
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
# Finally, substitute all of the various values into the files
|
||||
# specified with AC_CONFIG_FILES.
|
||||
#--------------------------------------------------------------------
|
||||
|
||||
AC_OUTPUT
|
||||
@@ -0,0 +1,15 @@
|
||||
.TH sqlite3 n 4.1 "Tcl-Extensions"
|
||||
.HS sqlite3 tcl
|
||||
.BS
|
||||
.SH NAME
|
||||
sqlite3 \- an interface to the SQLite3 database engine
|
||||
.SH SYNOPSIS
|
||||
\fBsqlite3\fI command_name ?filename?\fR
|
||||
.br
|
||||
.SH DESCRIPTION
|
||||
SQLite3 is a self-contains, zero-configuration, transactional SQL database
|
||||
engine. This extension provides an easy to use interface for accessing
|
||||
SQLite database files from Tcl.
|
||||
.PP
|
||||
For full documentation see \fIhttp://www.sqlite.org/\fR and
|
||||
in particular \fIhttp://www.sqlite.org/tclsqlite.html\fR.
|
||||
@@ -1,40 +1,10 @@
|
||||
# -*- tcl -*-
|
||||
# Tcl package index file
|
||||
# Tcl package index file, version 1.1
|
||||
#
|
||||
# Unless this file is named pkgIndex.tcl.in, you are probably looking
|
||||
# at an automatically generated/filtered copy and should probably not
|
||||
# edit it.
|
||||
#
|
||||
# Adapted from https://core.tcl-lang.org/tcltls
|
||||
@if TEAISH_VSATISFIES_CODE
|
||||
@TEAISH_VSATISFIES_CODE@
|
||||
@endif
|
||||
if {[package vsatisfies [package provide Tcl] 9.0-]} {
|
||||
package ifneeded {@TEAISH_PKGNAME@} {@TEAISH_VERSION@} [list apply {{dir} {
|
||||
@if TEAISH_ENABLE_DLL
|
||||
load [file join $dir {@TEAISH_DLL9@}] @TEAISH_LOAD_PREFIX@
|
||||
@endif
|
||||
@if TEAISH_PKGINIT_TCL_TAIL
|
||||
set initScript [file join $dir {@TEAISH_PKGINIT_TCL_TAIL@}]
|
||||
if {[file exists $initScript]} {
|
||||
source -encoding utf-8 $initScript
|
||||
}
|
||||
@endif
|
||||
}} $dir]
|
||||
package ifneeded sqlite3 @PACKAGE_VERSION@ \
|
||||
[list load [file join $dir @PKG_LIB_FILE9@] Sqlite3]
|
||||
} else {
|
||||
package ifneeded {@TEAISH_PKGNAME@} {@TEAISH_VERSION@} [list apply {{dir} {
|
||||
@if TEAISH_ENABLE_DLL
|
||||
if {[string tolower [file extension {@TEAISH_DLL8@}]] in [list .dll .dylib .so]} {
|
||||
load [file join $dir {@TEAISH_DLL8@}] @TEAISH_LOAD_PREFIX@
|
||||
} else {
|
||||
load {} @TEAISH_LOAD_PREFIX@
|
||||
}
|
||||
@endif
|
||||
@if TEAISH_PKGINIT_TCL_TAIL
|
||||
set initScript [file join $dir {@TEAISH_PKGINIT_TCL_TAIL@}]
|
||||
if {[file exists $initScript]} {
|
||||
source -encoding utf-8 $initScript
|
||||
}
|
||||
@endif
|
||||
}} $dir]
|
||||
package ifneeded sqlite3 @PACKAGE_VERSION@ \
|
||||
[list load [file join $dir @PKG_LIB_FILE8@] Sqlite3]
|
||||
}
|
||||
|
||||
@@ -0,0 +1,541 @@
|
||||
#!/bin/sh
|
||||
# install - install a program, script, or datafile
|
||||
|
||||
scriptversion=2020-11-14.01; # UTC
|
||||
|
||||
# This originates from X11R5 (mit/util/scripts/install.sh), which was
|
||||
# later released in X11R6 (xc/config/util/install.sh) with the
|
||||
# following copyright and license.
|
||||
#
|
||||
# Copyright (C) 1994 X Consortium
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to
|
||||
# deal in the Software without restriction, including without limitation the
|
||||
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
# sell copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
||||
# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
|
||||
# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
#
|
||||
# Except as contained in this notice, the name of the X Consortium shall not
|
||||
# be used in advertising or otherwise to promote the sale, use or other deal-
|
||||
# ings in this Software without prior written authorization from the X Consor-
|
||||
# tium.
|
||||
#
|
||||
#
|
||||
# FSF changes to this file are in the public domain.
|
||||
#
|
||||
# Calling this script install-sh is preferred over install.sh, to prevent
|
||||
# 'make' implicit rules from creating a file called install from it
|
||||
# when there is no Makefile.
|
||||
#
|
||||
# This script is compatible with the BSD install script, but was written
|
||||
# from scratch.
|
||||
|
||||
tab=' '
|
||||
nl='
|
||||
'
|
||||
IFS=" $tab$nl"
|
||||
|
||||
# Set DOITPROG to "echo" to test this script.
|
||||
|
||||
doit=${DOITPROG-}
|
||||
doit_exec=${doit:-exec}
|
||||
|
||||
# Put in absolute file names if you don't have them in your path;
|
||||
# or use environment vars.
|
||||
|
||||
chgrpprog=${CHGRPPROG-chgrp}
|
||||
chmodprog=${CHMODPROG-chmod}
|
||||
chownprog=${CHOWNPROG-chown}
|
||||
cmpprog=${CMPPROG-cmp}
|
||||
cpprog=${CPPROG-cp}
|
||||
mkdirprog=${MKDIRPROG-mkdir}
|
||||
mvprog=${MVPROG-mv}
|
||||
rmprog=${RMPROG-rm}
|
||||
stripprog=${STRIPPROG-strip}
|
||||
|
||||
posix_mkdir=
|
||||
|
||||
# Desired mode of installed file.
|
||||
mode=0755
|
||||
|
||||
# Create dirs (including intermediate dirs) using mode 755.
|
||||
# This is like GNU 'install' as of coreutils 8.32 (2020).
|
||||
mkdir_umask=22
|
||||
|
||||
backupsuffix=
|
||||
chgrpcmd=
|
||||
chmodcmd=$chmodprog
|
||||
chowncmd=
|
||||
mvcmd=$mvprog
|
||||
rmcmd="$rmprog -f"
|
||||
stripcmd=
|
||||
|
||||
src=
|
||||
dst=
|
||||
dir_arg=
|
||||
dst_arg=
|
||||
|
||||
copy_on_change=false
|
||||
is_target_a_directory=possibly
|
||||
|
||||
usage="\
|
||||
Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
|
||||
or: $0 [OPTION]... SRCFILES... DIRECTORY
|
||||
or: $0 [OPTION]... -t DIRECTORY SRCFILES...
|
||||
or: $0 [OPTION]... -d DIRECTORIES...
|
||||
|
||||
In the 1st form, copy SRCFILE to DSTFILE.
|
||||
In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
|
||||
In the 4th, create DIRECTORIES.
|
||||
|
||||
Options:
|
||||
--help display this help and exit.
|
||||
--version display version info and exit.
|
||||
|
||||
-c (ignored)
|
||||
-C install only if different (preserve data modification time)
|
||||
-d create directories instead of installing files.
|
||||
-g GROUP $chgrpprog installed files to GROUP.
|
||||
-m MODE $chmodprog installed files to MODE.
|
||||
-o USER $chownprog installed files to USER.
|
||||
-p pass -p to $cpprog.
|
||||
-s $stripprog installed files.
|
||||
-S SUFFIX attempt to back up existing files, with suffix SUFFIX.
|
||||
-t DIRECTORY install into DIRECTORY.
|
||||
-T report an error if DSTFILE is a directory.
|
||||
|
||||
Environment variables override the default commands:
|
||||
CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG
|
||||
RMPROG STRIPPROG
|
||||
|
||||
By default, rm is invoked with -f; when overridden with RMPROG,
|
||||
it's up to you to specify -f if you want it.
|
||||
|
||||
If -S is not specified, no backups are attempted.
|
||||
|
||||
Email bug reports to bug-automake@gnu.org.
|
||||
Automake home page: https://www.gnu.org/software/automake/
|
||||
"
|
||||
|
||||
while test $# -ne 0; do
|
||||
case $1 in
|
||||
-c) ;;
|
||||
|
||||
-C) copy_on_change=true;;
|
||||
|
||||
-d) dir_arg=true;;
|
||||
|
||||
-g) chgrpcmd="$chgrpprog $2"
|
||||
shift;;
|
||||
|
||||
--help) echo "$usage"; exit $?;;
|
||||
|
||||
-m) mode=$2
|
||||
case $mode in
|
||||
*' '* | *"$tab"* | *"$nl"* | *'*'* | *'?'* | *'['*)
|
||||
echo "$0: invalid mode: $mode" >&2
|
||||
exit 1;;
|
||||
esac
|
||||
shift;;
|
||||
|
||||
-o) chowncmd="$chownprog $2"
|
||||
shift;;
|
||||
|
||||
-p) cpprog="$cpprog -p";;
|
||||
|
||||
-s) stripcmd=$stripprog;;
|
||||
|
||||
-S) backupsuffix="$2"
|
||||
shift;;
|
||||
|
||||
-t)
|
||||
is_target_a_directory=always
|
||||
dst_arg=$2
|
||||
# Protect names problematic for 'test' and other utilities.
|
||||
case $dst_arg in
|
||||
-* | [=\(\)!]) dst_arg=./$dst_arg;;
|
||||
esac
|
||||
shift;;
|
||||
|
||||
-T) is_target_a_directory=never;;
|
||||
|
||||
--version) echo "$0 $scriptversion"; exit $?;;
|
||||
|
||||
--) shift
|
||||
break;;
|
||||
|
||||
-*) echo "$0: invalid option: $1" >&2
|
||||
exit 1;;
|
||||
|
||||
*) break;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
# We allow the use of options -d and -T together, by making -d
|
||||
# take the precedence; this is for compatibility with GNU install.
|
||||
|
||||
if test -n "$dir_arg"; then
|
||||
if test -n "$dst_arg"; then
|
||||
echo "$0: target directory not allowed when installing a directory." >&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then
|
||||
# When -d is used, all remaining arguments are directories to create.
|
||||
# When -t is used, the destination is already specified.
|
||||
# Otherwise, the last argument is the destination. Remove it from $@.
|
||||
for arg
|
||||
do
|
||||
if test -n "$dst_arg"; then
|
||||
# $@ is not empty: it contains at least $arg.
|
||||
set fnord "$@" "$dst_arg"
|
||||
shift # fnord
|
||||
fi
|
||||
shift # arg
|
||||
dst_arg=$arg
|
||||
# Protect names problematic for 'test' and other utilities.
|
||||
case $dst_arg in
|
||||
-* | [=\(\)!]) dst_arg=./$dst_arg;;
|
||||
esac
|
||||
done
|
||||
fi
|
||||
|
||||
if test $# -eq 0; then
|
||||
if test -z "$dir_arg"; then
|
||||
echo "$0: no input file specified." >&2
|
||||
exit 1
|
||||
fi
|
||||
# It's OK to call 'install-sh -d' without argument.
|
||||
# This can happen when creating conditional directories.
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if test -z "$dir_arg"; then
|
||||
if test $# -gt 1 || test "$is_target_a_directory" = always; then
|
||||
if test ! -d "$dst_arg"; then
|
||||
echo "$0: $dst_arg: Is not a directory." >&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if test -z "$dir_arg"; then
|
||||
do_exit='(exit $ret); exit $ret'
|
||||
trap "ret=129; $do_exit" 1
|
||||
trap "ret=130; $do_exit" 2
|
||||
trap "ret=141; $do_exit" 13
|
||||
trap "ret=143; $do_exit" 15
|
||||
|
||||
# Set umask so as not to create temps with too-generous modes.
|
||||
# However, 'strip' requires both read and write access to temps.
|
||||
case $mode in
|
||||
# Optimize common cases.
|
||||
*644) cp_umask=133;;
|
||||
*755) cp_umask=22;;
|
||||
|
||||
*[0-7])
|
||||
if test -z "$stripcmd"; then
|
||||
u_plus_rw=
|
||||
else
|
||||
u_plus_rw='% 200'
|
||||
fi
|
||||
cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;;
|
||||
*)
|
||||
if test -z "$stripcmd"; then
|
||||
u_plus_rw=
|
||||
else
|
||||
u_plus_rw=,u+rw
|
||||
fi
|
||||
cp_umask=$mode$u_plus_rw;;
|
||||
esac
|
||||
fi
|
||||
|
||||
for src
|
||||
do
|
||||
# Protect names problematic for 'test' and other utilities.
|
||||
case $src in
|
||||
-* | [=\(\)!]) src=./$src;;
|
||||
esac
|
||||
|
||||
if test -n "$dir_arg"; then
|
||||
dst=$src
|
||||
dstdir=$dst
|
||||
test -d "$dstdir"
|
||||
dstdir_status=$?
|
||||
# Don't chown directories that already exist.
|
||||
if test $dstdir_status = 0; then
|
||||
chowncmd=""
|
||||
fi
|
||||
else
|
||||
|
||||
# Waiting for this to be detected by the "$cpprog $src $dsttmp" command
|
||||
# might cause directories to be created, which would be especially bad
|
||||
# if $src (and thus $dsttmp) contains '*'.
|
||||
if test ! -f "$src" && test ! -d "$src"; then
|
||||
echo "$0: $src does not exist." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if test -z "$dst_arg"; then
|
||||
echo "$0: no destination specified." >&2
|
||||
exit 1
|
||||
fi
|
||||
dst=$dst_arg
|
||||
|
||||
# If destination is a directory, append the input filename.
|
||||
if test -d "$dst"; then
|
||||
if test "$is_target_a_directory" = never; then
|
||||
echo "$0: $dst_arg: Is a directory" >&2
|
||||
exit 1
|
||||
fi
|
||||
dstdir=$dst
|
||||
dstbase=`basename "$src"`
|
||||
case $dst in
|
||||
*/) dst=$dst$dstbase;;
|
||||
*) dst=$dst/$dstbase;;
|
||||
esac
|
||||
dstdir_status=0
|
||||
else
|
||||
dstdir=`dirname "$dst"`
|
||||
test -d "$dstdir"
|
||||
dstdir_status=$?
|
||||
fi
|
||||
fi
|
||||
|
||||
case $dstdir in
|
||||
*/) dstdirslash=$dstdir;;
|
||||
*) dstdirslash=$dstdir/;;
|
||||
esac
|
||||
|
||||
obsolete_mkdir_used=false
|
||||
|
||||
if test $dstdir_status != 0; then
|
||||
case $posix_mkdir in
|
||||
'')
|
||||
# With -d, create the new directory with the user-specified mode.
|
||||
# Otherwise, rely on $mkdir_umask.
|
||||
if test -n "$dir_arg"; then
|
||||
mkdir_mode=-m$mode
|
||||
else
|
||||
mkdir_mode=
|
||||
fi
|
||||
|
||||
posix_mkdir=false
|
||||
# The $RANDOM variable is not portable (e.g., dash). Use it
|
||||
# here however when possible just to lower collision chance.
|
||||
tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
|
||||
|
||||
trap '
|
||||
ret=$?
|
||||
rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" 2>/dev/null
|
||||
exit $ret
|
||||
' 0
|
||||
|
||||
# Because "mkdir -p" follows existing symlinks and we likely work
|
||||
# directly in world-writeable /tmp, make sure that the '$tmpdir'
|
||||
# directory is successfully created first before we actually test
|
||||
# 'mkdir -p'.
|
||||
if (umask $mkdir_umask &&
|
||||
$mkdirprog $mkdir_mode "$tmpdir" &&
|
||||
exec $mkdirprog $mkdir_mode -p -- "$tmpdir/a/b") >/dev/null 2>&1
|
||||
then
|
||||
if test -z "$dir_arg" || {
|
||||
# Check for POSIX incompatibilities with -m.
|
||||
# HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
|
||||
# other-writable bit of parent directory when it shouldn't.
|
||||
# FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
|
||||
test_tmpdir="$tmpdir/a"
|
||||
ls_ld_tmpdir=`ls -ld "$test_tmpdir"`
|
||||
case $ls_ld_tmpdir in
|
||||
d????-?r-*) different_mode=700;;
|
||||
d????-?--*) different_mode=755;;
|
||||
*) false;;
|
||||
esac &&
|
||||
$mkdirprog -m$different_mode -p -- "$test_tmpdir" && {
|
||||
ls_ld_tmpdir_1=`ls -ld "$test_tmpdir"`
|
||||
test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
|
||||
}
|
||||
}
|
||||
then posix_mkdir=:
|
||||
fi
|
||||
rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir"
|
||||
else
|
||||
# Remove any dirs left behind by ancient mkdir implementations.
|
||||
rmdir ./$mkdir_mode ./-p ./-- "$tmpdir" 2>/dev/null
|
||||
fi
|
||||
trap '' 0;;
|
||||
esac
|
||||
|
||||
if
|
||||
$posix_mkdir && (
|
||||
umask $mkdir_umask &&
|
||||
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir"
|
||||
)
|
||||
then :
|
||||
else
|
||||
|
||||
# mkdir does not conform to POSIX,
|
||||
# or it failed possibly due to a race condition. Create the
|
||||
# directory the slow way, step by step, checking for races as we go.
|
||||
|
||||
case $dstdir in
|
||||
/*) prefix='/';;
|
||||
[-=\(\)!]*) prefix='./';;
|
||||
*) prefix='';;
|
||||
esac
|
||||
|
||||
oIFS=$IFS
|
||||
IFS=/
|
||||
set -f
|
||||
set fnord $dstdir
|
||||
shift
|
||||
set +f
|
||||
IFS=$oIFS
|
||||
|
||||
prefixes=
|
||||
|
||||
for d
|
||||
do
|
||||
test X"$d" = X && continue
|
||||
|
||||
prefix=$prefix$d
|
||||
if test -d "$prefix"; then
|
||||
prefixes=
|
||||
else
|
||||
if $posix_mkdir; then
|
||||
(umask $mkdir_umask &&
|
||||
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break
|
||||
# Don't fail if two instances are running concurrently.
|
||||
test -d "$prefix" || exit 1
|
||||
else
|
||||
case $prefix in
|
||||
*\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;;
|
||||
*) qprefix=$prefix;;
|
||||
esac
|
||||
prefixes="$prefixes '$qprefix'"
|
||||
fi
|
||||
fi
|
||||
prefix=$prefix/
|
||||
done
|
||||
|
||||
if test -n "$prefixes"; then
|
||||
# Don't fail if two instances are running concurrently.
|
||||
(umask $mkdir_umask &&
|
||||
eval "\$doit_exec \$mkdirprog $prefixes") ||
|
||||
test -d "$dstdir" || exit 1
|
||||
obsolete_mkdir_used=true
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if test -n "$dir_arg"; then
|
||||
{ test -z "$chowncmd" || $doit $chowncmd "$dst"; } &&
|
||||
{ test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } &&
|
||||
{ test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false ||
|
||||
test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1
|
||||
else
|
||||
|
||||
# Make a couple of temp file names in the proper directory.
|
||||
dsttmp=${dstdirslash}_inst.$$_
|
||||
rmtmp=${dstdirslash}_rm.$$_
|
||||
|
||||
# Trap to clean up those temp files at exit.
|
||||
trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
|
||||
|
||||
# Copy the file name to the temp name.
|
||||
(umask $cp_umask &&
|
||||
{ test -z "$stripcmd" || {
|
||||
# Create $dsttmp read-write so that cp doesn't create it read-only,
|
||||
# which would cause strip to fail.
|
||||
if test -z "$doit"; then
|
||||
: >"$dsttmp" # No need to fork-exec 'touch'.
|
||||
else
|
||||
$doit touch "$dsttmp"
|
||||
fi
|
||||
}
|
||||
} &&
|
||||
$doit_exec $cpprog "$src" "$dsttmp") &&
|
||||
|
||||
# and set any options; do chmod last to preserve setuid bits.
|
||||
#
|
||||
# If any of these fail, we abort the whole thing. If we want to
|
||||
# ignore errors from any of these, just make sure not to ignore
|
||||
# errors from the above "$doit $cpprog $src $dsttmp" command.
|
||||
#
|
||||
{ test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } &&
|
||||
{ test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } &&
|
||||
{ test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } &&
|
||||
{ test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } &&
|
||||
|
||||
# If -C, don't bother to copy if it wouldn't change the file.
|
||||
if $copy_on_change &&
|
||||
old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` &&
|
||||
new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` &&
|
||||
set -f &&
|
||||
set X $old && old=:$2:$4:$5:$6 &&
|
||||
set X $new && new=:$2:$4:$5:$6 &&
|
||||
set +f &&
|
||||
test "$old" = "$new" &&
|
||||
$cmpprog "$dst" "$dsttmp" >/dev/null 2>&1
|
||||
then
|
||||
rm -f "$dsttmp"
|
||||
else
|
||||
# If $backupsuffix is set, and the file being installed
|
||||
# already exists, attempt a backup. Don't worry if it fails,
|
||||
# e.g., if mv doesn't support -f.
|
||||
if test -n "$backupsuffix" && test -f "$dst"; then
|
||||
$doit $mvcmd -f "$dst" "$dst$backupsuffix" 2>/dev/null
|
||||
fi
|
||||
|
||||
# Rename the file to the real destination.
|
||||
$doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null ||
|
||||
|
||||
# The rename failed, perhaps because mv can't rename something else
|
||||
# to itself, or perhaps because mv is so ancient that it does not
|
||||
# support -f.
|
||||
{
|
||||
# Now remove or move aside any old file at destination location.
|
||||
# We try this two ways since rm can't unlink itself on some
|
||||
# systems and the destination file might be busy for other
|
||||
# reasons. In this case, the final cleanup might fail but the new
|
||||
# file should still install successfully.
|
||||
{
|
||||
test ! -f "$dst" ||
|
||||
$doit $rmcmd "$dst" 2>/dev/null ||
|
||||
{ $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null &&
|
||||
{ $doit $rmcmd "$rmtmp" 2>/dev/null; :; }
|
||||
} ||
|
||||
{ echo "$0: cannot unlink or rename $dst" >&2
|
||||
(exit 1); exit 1
|
||||
}
|
||||
} &&
|
||||
|
||||
# Now rename the file to the real destination.
|
||||
$doit $mvcmd "$dsttmp" "$dst"
|
||||
}
|
||||
fi || exit 1
|
||||
|
||||
trap '' 0
|
||||
fi
|
||||
done
|
||||
|
||||
# Local variables:
|
||||
# eval: (add-hook 'before-save-hook 'time-stamp)
|
||||
# time-stamp-start: "scriptversion="
|
||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||
# time-stamp-time-zone: "UTC0"
|
||||
# time-stamp-end: "; # UTC"
|
||||
# End:
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,569 +0,0 @@
|
||||
# Teaish configure script for the SQLite Tcl extension
|
||||
|
||||
#
|
||||
# State for disparate config-time pieces.
|
||||
#
|
||||
array set sqlite__Config [proj-strip-hash-comments {
|
||||
#
|
||||
# The list of feature --flags which the --all flag implies. This
|
||||
# requires special handling in a few places.
|
||||
#
|
||||
all-flag-enables {fts3 fts4 fts5 rtree geopoly}
|
||||
|
||||
# >0 if building in the canonical tree. -1=undetermined
|
||||
is-canonical -1
|
||||
}]
|
||||
|
||||
#
|
||||
# Set up the package info for teaish...
|
||||
#
|
||||
apply {{dir} {
|
||||
# Figure out the version number...
|
||||
set version ""
|
||||
if {[file exists $dir/../VERSION]} {
|
||||
# The canonical SQLite TEA(ish) build
|
||||
set version [proj-file-content -trim $dir/../VERSION]
|
||||
set ::sqlite__Config(is-canonical) 1
|
||||
set distname sqlite-tcl
|
||||
} elseif {[file exists $dir/generic/tclsqlite3.c]} {
|
||||
# The copy from the teaish tree, used as a dev/test bed before
|
||||
# updating SQLite's tree.
|
||||
set ::sqlite__Config(is-canonical) 0
|
||||
set fd [open $dir/generic/tclsqlite3.c rb]
|
||||
while {[gets $fd line] >=0} {
|
||||
if {[regexp {^#define[ ]+SQLITE_VERSION[ ]+"(3.+)"} \
|
||||
$line - version]} {
|
||||
set distname sqlite-teaish
|
||||
break
|
||||
}
|
||||
}
|
||||
close $fd
|
||||
}
|
||||
|
||||
if {"" eq $version} {
|
||||
proj-fatal "Cannot determine the SQLite version number"
|
||||
}
|
||||
|
||||
proj-assert {$::sqlite__Config(is-canonical) > -1}
|
||||
proj-assert {[string match 3.*.* $version]} \
|
||||
"Unexpected SQLite version: $version"
|
||||
|
||||
set pragmas {}
|
||||
if {$::sqlite__Config(is-canonical)} {
|
||||
# Disable "make dist" in the canonical tree. That tree is
|
||||
# generated from several pieces and creating/testing working
|
||||
# "dist" rules for that sub-build currently feels unnecessary. The
|
||||
# copy in the teaish tree, though, should be able to "make dist".
|
||||
lappend pragmas no-dist
|
||||
} else {
|
||||
lappend pragmas full-dist
|
||||
}
|
||||
|
||||
teaish-pkginfo-set -vars {
|
||||
-name sqlite
|
||||
-name.pkg sqlite3
|
||||
-version $version
|
||||
-name.dist $distname
|
||||
-libDir sqlite$version
|
||||
-pragmas $pragmas
|
||||
-src generic/tclsqlite3.c
|
||||
}
|
||||
# We should also have:
|
||||
# -vsatisfies 8.6-
|
||||
# But at least one platform is failing this vsatisfies check
|
||||
# for no apparent reason:
|
||||
# https://sqlite.org/forum/forumpost/fde857fb8101a4be
|
||||
}} [teaish-get -dir]
|
||||
|
||||
|
||||
#
|
||||
# Must return either an empty string or a list in the form accepted by
|
||||
# autosetup's [options] function.
|
||||
#
|
||||
proc teaish-options {} {
|
||||
# These flags and defaults mostly derive from the historical TEA
|
||||
# build. Some, like ICU, are taken from the canonical SQLite tree.
|
||||
return [subst -nocommands -nobackslashes {
|
||||
with-system-sqlite=0
|
||||
=> {Use the system-level SQLite instead of the copy in this tree.
|
||||
Also requires use of --override-sqlite-version so that the build
|
||||
knows what version number to associate with the system-level SQLite.}
|
||||
override-sqlite-version:VERSION
|
||||
=> {For use with --with-system-sqlite to set the version number.}
|
||||
threadsafe=1 => {Disable mutexing}
|
||||
with-tempstore:=no => {Use an in-RAM database for temporary tables: never,no,yes,always}
|
||||
load-extension=0 => {Enable loading of external extensions}
|
||||
math=1 => {Disable math functions}
|
||||
json=1 => {Disable JSON functions}
|
||||
fts3 => {Enable the FTS3 extension}
|
||||
fts4 => {Enable the FTS4 extension}
|
||||
fts5 => {Enable the FTS5 extension}
|
||||
update-limit => {Enable the UPDATE/DELETE LIMIT clause}
|
||||
geopoly => {Enable the GEOPOLY extension}
|
||||
rtree => {Enable the RTREE extension}
|
||||
session => {Enable the SESSION extension}
|
||||
all=1 => {Disable $::sqlite__Config(all-flag-enables)}
|
||||
with-icu-ldflags:LDFLAGS
|
||||
=> {Enable SQLITE_ENABLE_ICU and add the given linker flags for the
|
||||
ICU libraries. e.g. on Ubuntu systems, try '-licui18n -licuuc -licudata'.}
|
||||
with-icu-cflags:CFLAGS
|
||||
=> {Apply extra CFLAGS/CPPFLAGS necessary for building with ICU.
|
||||
e.g. -I/usr/local/include}
|
||||
with-icu-config:=auto
|
||||
=> {Enable SQLITE_ENABLE_ICU. Value must be one of: auto, pkg-config,
|
||||
/path/to/icu-config}
|
||||
icu-collations=0
|
||||
=> {Enable SQLITE_ENABLE_ICU_COLLATIONS. Requires --with-icu-ldflags=...
|
||||
or --with-icu-config}
|
||||
}]
|
||||
}
|
||||
|
||||
#
|
||||
# Gets called by tea-configure-core. Must perform any configuration
|
||||
# work needed for this extension.
|
||||
#
|
||||
proc teaish-configure {} {
|
||||
use teaish/feature
|
||||
|
||||
if {[proj-opt-was-provided override-sqlite-version]} {
|
||||
teaish-pkginfo-set -version [opt-val override-sqlite-version]
|
||||
proj-warn "overriding sqlite version number:" [teaish-pkginfo-get -version]
|
||||
} elseif {[proj-opt-was-provided with-system-sqlite]
|
||||
&& [opt-val with-system-sqlite] ne "0"} {
|
||||
proj-fatal "when using --with-system-sqlite also use" \
|
||||
"--override-sqlite-version to specify a library version number."
|
||||
}
|
||||
|
||||
define CFLAGS [proj-get-env CFLAGS {-O2}]
|
||||
sqlite-munge-cflags
|
||||
|
||||
#
|
||||
# Add feature flags from legacy configure.ac which are not covered by
|
||||
# --flags.
|
||||
#
|
||||
sqlite-add-feature-flag {
|
||||
-DSQLITE_3_SUFFIX_ONLY=1
|
||||
-DSQLITE_ENABLE_DESERIALIZE=1
|
||||
-DSQLITE_ENABLE_DBPAGE_VTAB=1
|
||||
-DSQLITE_ENABLE_BYTECODE_VTAB=1
|
||||
-DSQLITE_ENABLE_DBSTAT_VTAB=1
|
||||
}
|
||||
|
||||
if {[opt-bool with-system-sqlite]} {
|
||||
msg-result "Using system-level sqlite3."
|
||||
teaish-cflags-add -DUSE_SYSTEM_SQLITE
|
||||
teaish-ldflags-add -lsqlite3
|
||||
} elseif {$::sqlite__Config(is-canonical)} {
|
||||
teaish-cflags-add -I[teaish-get -dir]/..
|
||||
}
|
||||
|
||||
teaish-check-librt
|
||||
teaish-check-libz
|
||||
sqlite-handle-threadsafe
|
||||
sqlite-handle-tempstore
|
||||
sqlite-handle-load-extension
|
||||
sqlite-handle-math
|
||||
sqlite-handle-icu
|
||||
|
||||
sqlite-handle-common-feature-flags; # must be late in the process
|
||||
}; # teaish-configure
|
||||
|
||||
define OPT_FEATURE_FLAGS {} ; # -DSQLITE_OMIT/ENABLE flags.
|
||||
#
|
||||
# Adds $args, if not empty, to OPT_FEATURE_FLAGS. This is intended only for holding
|
||||
# -DSQLITE_ENABLE/OMIT/... flags, but that is not enforced here.
|
||||
proc sqlite-add-feature-flag {args} {
|
||||
if {"" ne $args} {
|
||||
define-append OPT_FEATURE_FLAGS {*}$args
|
||||
}
|
||||
}
|
||||
|
||||
#
|
||||
# Check for log(3) in libm and die with an error if it is not
|
||||
# found. $featureName should be the feature name which requires that
|
||||
# function (it's used only in error messages). defines LDFLAGS_MATH to
|
||||
# the required linker flags (which may be empty even if the math APIs
|
||||
# are found, depending on the OS).
|
||||
proc sqlite-affirm-have-math {featureName} {
|
||||
if {"" eq [get-define LDFLAGS_MATH ""]} {
|
||||
if {![msg-quiet proj-check-function-in-lib log m]} {
|
||||
user-error "Missing math APIs for $featureName"
|
||||
}
|
||||
set lfl [get-define lib_log ""]
|
||||
undefine lib_log
|
||||
if {"" ne $lfl} {
|
||||
user-notice "Forcing requirement of $lfl for $featureName"
|
||||
}
|
||||
define LDFLAGS_MATH $lfl
|
||||
teaish-ldflags-prepend $lfl
|
||||
}
|
||||
}
|
||||
|
||||
#
|
||||
# Handle various SQLITE_ENABLE/OMIT_... feature flags.
|
||||
proc sqlite-handle-common-feature-flags {} {
|
||||
msg-result "Feature flags..."
|
||||
if {![opt-bool all]} {
|
||||
# Special handling for --disable-all
|
||||
foreach flag $::sqlite__Config(all-flag-enables) {
|
||||
if {![proj-opt-was-provided $flag]} {
|
||||
proj-opt-set $flag 0
|
||||
}
|
||||
}
|
||||
}
|
||||
foreach {boolFlag featureFlag ifSetEvalThis} [proj-strip-hash-comments {
|
||||
all {} {
|
||||
# The 'all' option must be first in this list. This impl makes
|
||||
# an effort to only apply flags which the user did not already
|
||||
# apply, so that combinations like (--all --disable-geopoly)
|
||||
# will indeed disable geopoly. There are corner cases where
|
||||
# flags which depend on each other will behave in non-intuitive
|
||||
# ways:
|
||||
#
|
||||
# --all --disable-rtree
|
||||
#
|
||||
# Will NOT disable geopoly, though geopoly depends on rtree.
|
||||
# The --geopoly flag, though, will automatically re-enable
|
||||
# --rtree, so --disable-rtree won't actually disable anything in
|
||||
# that case.
|
||||
foreach k $::sqlite__Config(all-flag-enables) {
|
||||
if {![proj-opt-was-provided $k]} {
|
||||
proj-opt-set $k 1
|
||||
}
|
||||
}
|
||||
}
|
||||
fts3 -DSQLITE_ENABLE_FTS3 {sqlite-affirm-have-math fts3}
|
||||
fts4 -DSQLITE_ENABLE_FTS4 {sqlite-affirm-have-math fts4}
|
||||
fts5 -DSQLITE_ENABLE_FTS5 {sqlite-affirm-have-math fts5}
|
||||
geopoly -DSQLITE_ENABLE_GEOPOLY {proj-opt-set rtree}
|
||||
rtree -DSQLITE_ENABLE_RTREE {}
|
||||
session {-DSQLITE_ENABLE_SESSION -DSQLITE_ENABLE_PREUPDATE_HOOK} {}
|
||||
update-limit -DSQLITE_ENABLE_UPDATE_DELETE_LIMIT {}
|
||||
scanstatus -DSQLITE_ENABLE_STMT_SCANSTATUS {}
|
||||
}] {
|
||||
if {$boolFlag ni $::autosetup(options)} {
|
||||
# Skip flags which are in the canonical build but not
|
||||
# the autoconf bundle.
|
||||
continue
|
||||
}
|
||||
proj-if-opt-truthy $boolFlag {
|
||||
sqlite-add-feature-flag $featureFlag
|
||||
if {0 != [eval $ifSetEvalThis] && "all" ne $boolFlag} {
|
||||
msg-result " + $boolFlag"
|
||||
}
|
||||
} {
|
||||
if {"all" ne $boolFlag} {
|
||||
msg-result " - $boolFlag"
|
||||
}
|
||||
}
|
||||
}
|
||||
#
|
||||
# Invert the above loop's logic for some SQLITE_OMIT_... cases. If
|
||||
# config option $boolFlag is false, [sqlite-add-feature-flag
|
||||
# $featureFlag], where $featureFlag is intended to be
|
||||
# -DSQLITE_OMIT_...
|
||||
foreach {boolFlag featureFlag} {
|
||||
json -DSQLITE_OMIT_JSON
|
||||
} {
|
||||
if {[proj-opt-truthy $boolFlag]} {
|
||||
msg-result " + $boolFlag"
|
||||
} else {
|
||||
sqlite-add-feature-flag $featureFlag
|
||||
msg-result " - $boolFlag"
|
||||
}
|
||||
}
|
||||
|
||||
##
|
||||
# Remove duplicates from the final feature flag sets and show them
|
||||
# to the user.
|
||||
set oFF [get-define OPT_FEATURE_FLAGS]
|
||||
if {"" ne $oFF} {
|
||||
define OPT_FEATURE_FLAGS [lsort -unique $oFF]
|
||||
msg-result "Library feature flags: [get-define OPT_FEATURE_FLAGS]"
|
||||
}
|
||||
if {[lsearch [get-define TARGET_DEBUG ""] -DSQLITE_DEBUG=1] > -1} {
|
||||
msg-result "Note: this is a debug build, so performance will suffer."
|
||||
}
|
||||
teaish-cflags-add -define OPT_FEATURE_FLAGS
|
||||
}; # sqlite-handle-common-feature-flags
|
||||
|
||||
#
|
||||
# If --enable-threadsafe is set, this adds -DSQLITE_THREADSAFE=1 to
|
||||
# OPT_FEATURE_FLAGS and sets LDFLAGS_PTHREAD to the linker flags
|
||||
# needed for linking pthread (possibly an empty string). If
|
||||
# --enable-threadsafe is not set, adds -DSQLITE_THREADSAFE=0 to
|
||||
# OPT_FEATURE_FLAGS and sets LDFLAGS_PTHREAD to an empty string.
|
||||
#
|
||||
# It prepends the flags to the global LDFLAGS.
|
||||
proc sqlite-handle-threadsafe {} {
|
||||
msg-checking "Support threadsafe operation? "
|
||||
define LDFLAGS_PTHREAD ""
|
||||
set enable 0
|
||||
if {[proj-opt-was-provided threadsafe]} {
|
||||
proj-if-opt-truthy threadsafe {
|
||||
if {[proj-check-function-in-lib pthread_create pthread]
|
||||
&& [proj-check-function-in-lib pthread_mutexattr_init pthread]} {
|
||||
incr enable
|
||||
set ldf [get-define lib_pthread_create]
|
||||
define LDFLAGS_PTHREAD $ldf
|
||||
teaish-ldflags-prepend $ldf
|
||||
undefine lib_pthread_create
|
||||
undefine lib_pthread_mutexattr_init
|
||||
} else {
|
||||
user-error "Missing required pthread libraries. Use --disable-threadsafe to disable this check."
|
||||
}
|
||||
# Recall that LDFLAGS_PTHREAD might be empty even if pthreads if
|
||||
# found because it's in -lc on some platforms.
|
||||
} {
|
||||
msg-result "Disabled using --disable-threadsafe"
|
||||
}
|
||||
} else {
|
||||
#
|
||||
# If user does not specify --[disable-]threadsafe then select a
|
||||
# default based on whether it looks like Tcl has threading
|
||||
# support.
|
||||
#
|
||||
catch {
|
||||
scan [exec echo {puts [tcl::pkgconfig get threaded]} | [get-define TCLSH_CMD]] \
|
||||
%d enable
|
||||
}
|
||||
if {$enable} {
|
||||
set flagName "--threadsafe"
|
||||
set lblAbled "enabled"
|
||||
msg-result yes
|
||||
} else {
|
||||
set flagName "--disable-threadsafe"
|
||||
set lblAbled "disabled"
|
||||
msg-result no
|
||||
}
|
||||
msg-result "Defaulting to ${flagName} because Tcl has threading ${lblAbled}."
|
||||
# ^^^ We (probably) don't need to link against -lpthread in the
|
||||
# is-enabled case. We might in the case of static linking. Unsure.
|
||||
}
|
||||
sqlite-add-feature-flag -DSQLITE_THREADSAFE=${enable}
|
||||
return $enable
|
||||
}
|
||||
|
||||
#
|
||||
# Handles the --enable-load-extension flag. Returns 1 if the support
|
||||
# is enabled, else 0. If support for that feature is not found, a
|
||||
# fatal error is triggered if --enable-load-extension is explicitly
|
||||
# provided, else a loud warning is instead emitted. If
|
||||
# --disable-load-extension is used, no check is performed.
|
||||
#
|
||||
# Makes the following environment changes:
|
||||
#
|
||||
# - defines LDFLAGS_DLOPEN to any linker flags needed for this
|
||||
# feature. It may legally be empty on some systems where dlopen()
|
||||
# is in libc.
|
||||
#
|
||||
# - If the feature is not available, adds
|
||||
# -DSQLITE_OMIT_LOAD_EXTENSION=1 to the feature flags list.
|
||||
proc sqlite-handle-load-extension {} {
|
||||
define LDFLAGS_DLOPEN ""
|
||||
set found 0
|
||||
proj-if-opt-truthy load-extension {
|
||||
set found [proj-check-function-in-lib dlopen dl]
|
||||
if {$found} {
|
||||
set ldf [get-define lib_dlopen]
|
||||
define LDFLAGS_DLOPEN $ldf
|
||||
teaish-ldflags-prepend $ldf
|
||||
undefine lib_dlopen
|
||||
} else {
|
||||
if {[proj-opt-was-provided load-extension]} {
|
||||
# Explicit --enable-load-extension: fail if not found
|
||||
proj-indented-notice -error {
|
||||
--enable-load-extension was provided but dlopen()
|
||||
not found. Use --disable-load-extension to bypass this
|
||||
check.
|
||||
}
|
||||
} else {
|
||||
# It was implicitly enabled: warn if not found
|
||||
proj-indented-notice {
|
||||
WARNING: dlopen() not found, so loadable module support will
|
||||
be disabled. Use --disable-load-extension to bypass this
|
||||
check.
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if {$found} {
|
||||
msg-result "Loadable extension support enabled."
|
||||
} else {
|
||||
msg-result "Disabling loadable extension support. Use --enable-load-extension to enable them."
|
||||
sqlite-add-feature-flag -DSQLITE_OMIT_LOAD_EXTENSION=1
|
||||
}
|
||||
return $found
|
||||
}
|
||||
|
||||
#
|
||||
# ICU - International Components for Unicode
|
||||
#
|
||||
# Handles these flags:
|
||||
#
|
||||
# --with-icu-ldflags=LDFLAGS
|
||||
# --with-icu-cflags=CFLAGS
|
||||
# --with-icu-config[=auto | pkg-config | /path/to/icu-config]
|
||||
# --enable-icu-collations
|
||||
#
|
||||
# --with-icu-config values:
|
||||
#
|
||||
# - auto: use the first one of (pkg-config, icu-config) found on the
|
||||
# system.
|
||||
# - pkg-config: use only pkg-config to determine flags
|
||||
# - /path/to/icu-config: use that to determine flags
|
||||
#
|
||||
# If --with-icu-config is used as neither pkg-config nor icu-config
|
||||
# are found, fail fatally.
|
||||
#
|
||||
# If both --with-icu-ldflags and --with-icu-config are provided, they
|
||||
# are cumulative. If neither are provided, icu-collations is not
|
||||
# honored and a warning is emitted if it is provided.
|
||||
#
|
||||
# Design note: though we could automatically enable ICU if the
|
||||
# icu-config binary or (pkg-config icu-io) are found, we specifically
|
||||
# do not. ICU is always an opt-in feature.
|
||||
proc sqlite-handle-icu {} {
|
||||
define LDFLAGS_LIBICU [join [opt-val with-icu-ldflags ""]]
|
||||
define CFLAGS_LIBICU [join [opt-val with-icu-cflags ""]]
|
||||
if {[proj-opt-was-provided with-icu-config]} {
|
||||
msg-result "Checking for ICU support..."
|
||||
set icuConfigBin [opt-val with-icu-config]
|
||||
set tryIcuConfigBin 1; # set to 0 if we end up using pkg-config
|
||||
if {$icuConfigBin in {auto pkg-config}} {
|
||||
uplevel 3 { use pkg-config }
|
||||
if {[pkg-config-init 0] && [pkg-config icu-io]} {
|
||||
# Maintenance reminder: historical docs say to use both of
|
||||
# (icu-io, icu-uc). icu-uc lacks a required lib and icu-io has
|
||||
# all of them on tested OSes.
|
||||
set tryIcuConfigBin 0
|
||||
define LDFLAGS_LIBICU [get-define PKG_ICU_IO_LDFLAGS]
|
||||
define-append LDFLAGS_LIBICU [get-define PKG_ICU_IO_LIBS]
|
||||
define CFLAGS_LIBICU [get-define PKG_ICU_IO_CFLAGS]
|
||||
} elseif {"pkg-config" eq $icuConfigBin} {
|
||||
proj-fatal "pkg-config cannot find package icu-io"
|
||||
} else {
|
||||
proj-assert {"auto" eq $icuConfigBin}
|
||||
}
|
||||
}
|
||||
if {$tryIcuConfigBin} {
|
||||
if {"auto" eq $icuConfigBin} {
|
||||
set icuConfigBin [proj-first-bin-of \
|
||||
/usr/local/bin/icu-config \
|
||||
/usr/bin/icu-config]
|
||||
if {"" eq $icuConfigBin} {
|
||||
proj-indented-notice -error {
|
||||
--with-icu-config=auto cannot find (pkg-config icu-io) or icu-config binary.
|
||||
On Ubuntu-like systems try:
|
||||
--with-icu-ldflags='-licui18n -licuuc -licudata'
|
||||
}
|
||||
}
|
||||
}
|
||||
if {[file-isexec $icuConfigBin]} {
|
||||
set x [exec $icuConfigBin --ldflags]
|
||||
if {"" eq $x} {
|
||||
proj-indented-notice -error \
|
||||
[subst {
|
||||
$icuConfigBin --ldflags returned no data.
|
||||
On Ubuntu-like systems try:
|
||||
--with-icu-ldflags='-licui18n -licuuc -licudata'
|
||||
}]
|
||||
}
|
||||
define-append LDFLAGS_LIBICU $x
|
||||
set x [exec $icuConfigBin --cppflags]
|
||||
define-append CFLAGS_LIBICU $x
|
||||
} else {
|
||||
proj-fatal "--with-icu-config=$icuConfigBin does not refer to an executable"
|
||||
}
|
||||
}
|
||||
}
|
||||
set ldflags [define LDFLAGS_LIBICU [string trim [get-define LDFLAGS_LIBICU]]]
|
||||
set cflags [define CFLAGS_LIBICU [string trim [get-define CFLAGS_LIBICU]]]
|
||||
if {"" ne $ldflags} {
|
||||
sqlite-add-feature-flag -DSQLITE_ENABLE_ICU
|
||||
msg-result "Enabling ICU support with flags: $ldflags $cflags"
|
||||
if {[opt-bool icu-collations]} {
|
||||
msg-result "Enabling ICU collations."
|
||||
sqlite-add-feature-flag -DSQLITE_ENABLE_ICU_COLLATIONS
|
||||
}
|
||||
teaish-ldflags-prepend $ldflags
|
||||
teaish-cflags-add $cflags
|
||||
} elseif {[opt-bool icu-collations]} {
|
||||
proj-warn "ignoring --enable-icu-collations because neither --with-icu-ldflags nor --with-icu-config provided any linker flags"
|
||||
} else {
|
||||
msg-result "ICU support is disabled."
|
||||
}
|
||||
}; # sqlite-handle-icu
|
||||
|
||||
|
||||
#
|
||||
# Handles the --with-tempstore flag.
|
||||
#
|
||||
# The test fixture likes to set SQLITE_TEMP_STORE on its own, so do
|
||||
# not set that feature flag unless it was explicitly provided to the
|
||||
# configure script.
|
||||
proc sqlite-handle-tempstore {} {
|
||||
if {[proj-opt-was-provided with-tempstore]} {
|
||||
set ts [opt-val with-tempstore no]
|
||||
set tsn 1
|
||||
msg-checking "Use an in-RAM database for temporary tables? "
|
||||
switch -exact -- $ts {
|
||||
never { set tsn 0 }
|
||||
no { set tsn 1 }
|
||||
yes { set tsn 2 }
|
||||
always { set tsn 3 }
|
||||
default {
|
||||
user-error "Invalid --with-tempstore value '$ts'. Use one of: never, no, yes, always"
|
||||
}
|
||||
}
|
||||
msg-result $ts
|
||||
sqlite-add-feature-flag -DSQLITE_TEMP_STORE=$tsn
|
||||
}
|
||||
}
|
||||
|
||||
#
|
||||
# Handles the --enable-math flag.
|
||||
proc sqlite-handle-math {} {
|
||||
proj-if-opt-truthy math {
|
||||
if {![proj-check-function-in-lib ceil m]} {
|
||||
user-error "Cannot find libm functions. Use --disable-math to bypass this."
|
||||
}
|
||||
set lfl [get-define lib_ceil]
|
||||
undefine lib_ceil
|
||||
define LDFLAGS_MATH $lfl
|
||||
teaish-ldflags-prepend $lfl
|
||||
sqlite-add-feature-flag -DSQLITE_ENABLE_MATH_FUNCTIONS
|
||||
msg-result "Enabling math SQL functions"
|
||||
} {
|
||||
define LDFLAGS_MATH ""
|
||||
msg-result "Disabling math SQL functions"
|
||||
}
|
||||
}
|
||||
|
||||
#
|
||||
# Move -DSQLITE_OMIT... and -DSQLITE_ENABLE... flags from CFLAGS and
|
||||
# CPPFLAGS to OPT_FEATURE_FLAGS and remove them from BUILD_CFLAGS.
|
||||
proc sqlite-munge-cflags {} {
|
||||
# Move CFLAGS and CPPFLAGS entries matching -DSQLITE_OMIT* and
|
||||
# -DSQLITE_ENABLE* to OPT_FEATURE_FLAGS. This behavior is derived
|
||||
# from the pre-3.48 build.
|
||||
#
|
||||
# If any configure flags for features are in conflict with
|
||||
# CFLAGS/CPPFLAGS-specified feature flags, all bets are off. There
|
||||
# are no guarantees about which one will take precedence.
|
||||
foreach flagDef {CFLAGS CPPFLAGS} {
|
||||
set tmp ""
|
||||
foreach cf [get-define $flagDef ""] {
|
||||
switch -glob -- $cf {
|
||||
-DSQLITE_OMIT* -
|
||||
-DSQLITE_ENABLE* {
|
||||
sqlite-add-feature-flag $cf
|
||||
}
|
||||
default {
|
||||
lappend tmp $cf
|
||||
}
|
||||
}
|
||||
}
|
||||
define $flagDef $tmp
|
||||
}
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
test-expect 1.0-open {
|
||||
sqlite3 db :memory:
|
||||
} {}
|
||||
|
||||
test-assert 1.1-version-3.x {
|
||||
[string match 3.* [db eval {select sqlite_version()}]]
|
||||
}
|
||||
|
||||
test-expect 1.2-select {
|
||||
db eval {select 'hi, world',1,2,3}
|
||||
} {{hi, world} 1 2 3}
|
||||
|
||||
|
||||
test-expect 99.0-db-close {db close} {}
|
||||
@@ -0,0 +1,61 @@
|
||||
#------------------------------------------------------------- -*- makefile -*-
|
||||
#
|
||||
# Sample makefile for building Tcl extensions.
|
||||
#
|
||||
# Basic build, test and install
|
||||
# nmake /s /nologo /f makefile.vc INSTALLDIR=c:\path\to\tcl
|
||||
# nmake /s /nologo /f makefile.vc INSTALLDIR=c:\path\to\tcl test
|
||||
# nmake /s /nologo /f makefile.vc INSTALLDIR=c:\path\to\tcl install
|
||||
#
|
||||
# For other build options (debug, static etc.)
|
||||
# See TIP 477 (https://core.tcl.tk/tips/doc/trunk/tip/477.md) for
|
||||
# detailed documentation.
|
||||
#
|
||||
# See the file "license.terms" for information on usage and redistribution
|
||||
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
#
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
# PROJECT is sqlite, not sqlite3 to match TEA AC_INIT definition.
|
||||
# This makes the generated DLL name also consistent between the two
|
||||
# except for the "t" suffix which is the convention for nmake builds.
|
||||
PROJECT = sqlite
|
||||
PRJ_PACKAGE_TCLNAME = sqlite3
|
||||
|
||||
!include "rules-ext.vc"
|
||||
|
||||
PRJ_OBJS = $(TMP_DIR)\tclsqlite3.obj
|
||||
|
||||
# Preprocessor macros specific to sqlite3.
|
||||
PRJ_DEFINES = -I"$(ROOT)\.." -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE \
|
||||
-DSQLITE_ENABLE_DBPAGE_VTAB=1 -DSQLITE_ENABLE_DBSTAT_VTAB=1 \
|
||||
-DSQLITE_ENABLE_FTS3_PARENTHESIS=1 -DSQLITE_ENABLE_FTS4=1 \
|
||||
-DSQLITE_ENABLE_FTS5=1 -DSQLITE_ENABLE_COLUMN_METADATA=1 \
|
||||
-DSQLITE_ENABLE_JSON1=1 -DSQLITE_LIKE_DOESNT_MATCH_BLOBS=1 \
|
||||
-DSQLITE_3_SUFFIX_ONLY=1 -DSQLITE_ENABLE_RTREE=1 \
|
||||
-DSQLITE_UNTESTABLE=1 -DSQLITE_OMIT_LOOKASIDE=1 \
|
||||
-DSQLITE_SECURE_DELETE=1 -DSQLITE_SOUNDEX=1 -DSQLITE_ENABLE_GEOPOLY=1 \
|
||||
-DSQLITE_ENABLE_UPDATE_DELETE_LIMIT=1 \
|
||||
-DSQLITE_ENABLE_MATH_FUNCTIONS=1 -DDSQLITE_USE_ALLOCA=1 \
|
||||
-DSQLITE_ENABLE_STAT4=1 -DSQLITE_OMIT_DEPRECATED=1 \
|
||||
-DSQLITE_WIN32_GETVERSIONEX=0 -DSQLITE_WIN32_NO_ANSI=1
|
||||
PRJ_DEFINES = $(PRJ_DEFINES) -I$(TMP_DIR)
|
||||
|
||||
# Standard targets to build, install, test etc.
|
||||
!include "$(_RULESDIR)\targets.vc"
|
||||
|
||||
# The built-in pkgindex does no suffice for our extension as
|
||||
# the PROJECT name (sqlite) is not same as init function name (Sqlite3)
|
||||
pkgindex:
|
||||
@echo if {[package vsatisfies [package provide Tcl] 9.0-]} { > $(OUT_DIR)\pkgIndex.tcl
|
||||
@echo package ifneeded $(PRJ_PACKAGE_TCLNAME) $(DOTVERSION) \
|
||||
[list load [file join $$dir $(PRJLIBNAME9)] [string totitle $(PRJ_PACKAGE_TCLNAME)]] >> $(OUT_DIR)\pkgIndex.tcl
|
||||
@echo } else { >> $(OUT_DIR)\pkgIndex.tcl
|
||||
@echo package ifneeded $(PRJ_PACKAGE_TCLNAME) $(DOTVERSION) \
|
||||
[list load [file join $$dir $(PRJLIBNAME8)] [string totitle $(PRJ_PACKAGE_TCLNAME)]] >> $(OUT_DIR)\pkgIndex.tcl
|
||||
@echo } >> $(OUT_DIR)\pkgIndex.tcl
|
||||
|
||||
# Install the manpage though on Windows, doubt it does much good
|
||||
install: default-install-docs-n
|
||||
|
||||
# Explicit dependency rules
|
||||
@@ -0,0 +1,815 @@
|
||||
/*
|
||||
* ----------------------------------------------------------------------------
|
||||
* nmakehlp.c --
|
||||
*
|
||||
* This is used to fix limitations within nmake and the environment.
|
||||
*
|
||||
* Copyright (c) 2002 by David Gravereaux.
|
||||
* Copyright (c) 2006 by Pat Thoyts
|
||||
*
|
||||
* See the file "license.terms" for information on usage and redistribution of
|
||||
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
* ----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#define _CRT_SECURE_NO_DEPRECATE
|
||||
#include <windows.h>
|
||||
#ifdef _MSC_VER
|
||||
#pragma comment (lib, "user32.lib")
|
||||
#pragma comment (lib, "kernel32.lib")
|
||||
#endif
|
||||
#include <stdio.h>
|
||||
#include <math.h>
|
||||
|
||||
/*
|
||||
* This library is required for x64 builds with _some_ versions of MSVC
|
||||
*/
|
||||
#if defined(_M_IA64) || defined(_M_AMD64)
|
||||
#if _MSC_VER >= 1400 && _MSC_VER < 1500
|
||||
#pragma comment(lib, "bufferoverflowU")
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* ISO hack for dumb VC++ */
|
||||
#ifdef _MSC_VER
|
||||
#define snprintf _snprintf
|
||||
#endif
|
||||
|
||||
|
||||
/* protos */
|
||||
|
||||
static int CheckForCompilerFeature(const char *option);
|
||||
static int CheckForLinkerFeature(char **options, int count);
|
||||
static int IsIn(const char *string, const char *substring);
|
||||
static int SubstituteFile(const char *substs, const char *filename);
|
||||
static int QualifyPath(const char *path);
|
||||
static int LocateDependency(const char *keyfile);
|
||||
static const char *GetVersionFromFile(const char *filename, const char *match, int numdots);
|
||||
static DWORD WINAPI ReadFromPipe(LPVOID args);
|
||||
|
||||
/* globals */
|
||||
|
||||
#define CHUNK 25
|
||||
#define STATICBUFFERSIZE 1000
|
||||
typedef struct {
|
||||
HANDLE pipe;
|
||||
char buffer[STATICBUFFERSIZE];
|
||||
} pipeinfo;
|
||||
|
||||
pipeinfo Out = {INVALID_HANDLE_VALUE, ""};
|
||||
pipeinfo Err = {INVALID_HANDLE_VALUE, ""};
|
||||
|
||||
/*
|
||||
* exitcodes: 0 == no, 1 == yes, 2 == error
|
||||
*/
|
||||
|
||||
int
|
||||
main(
|
||||
int argc,
|
||||
char *argv[])
|
||||
{
|
||||
char msg[300];
|
||||
DWORD dwWritten;
|
||||
int chars;
|
||||
const char *s;
|
||||
|
||||
/*
|
||||
* Make sure children (cl.exe and link.exe) are kept quiet.
|
||||
*/
|
||||
|
||||
SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOOPENFILEERRORBOX);
|
||||
|
||||
/*
|
||||
* Make sure the compiler and linker aren't effected by the outside world.
|
||||
*/
|
||||
|
||||
SetEnvironmentVariable("CL", "");
|
||||
SetEnvironmentVariable("LINK", "");
|
||||
|
||||
if (argc > 1 && *argv[1] == '-') {
|
||||
switch (*(argv[1]+1)) {
|
||||
case 'c':
|
||||
if (argc != 3) {
|
||||
chars = snprintf(msg, sizeof(msg) - 1,
|
||||
"usage: %s -c <compiler option>\n"
|
||||
"Tests for whether cl.exe supports an option\n"
|
||||
"exitcodes: 0 == no, 1 == yes, 2 == error\n", argv[0]);
|
||||
WriteFile(GetStdHandle(STD_ERROR_HANDLE), msg, chars,
|
||||
&dwWritten, NULL);
|
||||
return 2;
|
||||
}
|
||||
return CheckForCompilerFeature(argv[2]);
|
||||
case 'l':
|
||||
if (argc < 3) {
|
||||
chars = snprintf(msg, sizeof(msg) - 1,
|
||||
"usage: %s -l <linker option> ?<mandatory option> ...?\n"
|
||||
"Tests for whether link.exe supports an option\n"
|
||||
"exitcodes: 0 == no, 1 == yes, 2 == error\n", argv[0]);
|
||||
WriteFile(GetStdHandle(STD_ERROR_HANDLE), msg, chars,
|
||||
&dwWritten, NULL);
|
||||
return 2;
|
||||
}
|
||||
return CheckForLinkerFeature(&argv[2], argc-2);
|
||||
case 'f':
|
||||
if (argc == 2) {
|
||||
chars = snprintf(msg, sizeof(msg) - 1,
|
||||
"usage: %s -f <string> <substring>\n"
|
||||
"Find a substring within another\n"
|
||||
"exitcodes: 0 == no, 1 == yes, 2 == error\n", argv[0]);
|
||||
WriteFile(GetStdHandle(STD_ERROR_HANDLE), msg, chars,
|
||||
&dwWritten, NULL);
|
||||
return 2;
|
||||
} else if (argc == 3) {
|
||||
/*
|
||||
* If the string is blank, there is no match.
|
||||
*/
|
||||
|
||||
return 0;
|
||||
} else {
|
||||
return IsIn(argv[2], argv[3]);
|
||||
}
|
||||
case 's':
|
||||
if (argc == 2) {
|
||||
chars = snprintf(msg, sizeof(msg) - 1,
|
||||
"usage: %s -s <substitutions file> <file>\n"
|
||||
"Perform a set of string map type substutitions on a file\n"
|
||||
"exitcodes: 0\n",
|
||||
argv[0]);
|
||||
WriteFile(GetStdHandle(STD_ERROR_HANDLE), msg, chars,
|
||||
&dwWritten, NULL);
|
||||
return 2;
|
||||
}
|
||||
return SubstituteFile(argv[2], argv[3]);
|
||||
case 'V':
|
||||
if (argc != 4) {
|
||||
chars = snprintf(msg, sizeof(msg) - 1,
|
||||
"usage: %s -V filename matchstring\n"
|
||||
"Extract a version from a file:\n"
|
||||
"eg: pkgIndex.tcl \"package ifneeded http\"",
|
||||
argv[0]);
|
||||
WriteFile(GetStdHandle(STD_ERROR_HANDLE), msg, chars,
|
||||
&dwWritten, NULL);
|
||||
return 0;
|
||||
}
|
||||
s = GetVersionFromFile(argv[2], argv[3], *(argv[1]+2) - '0');
|
||||
if (s && *s) {
|
||||
printf("%s\n", s);
|
||||
return 0;
|
||||
} else
|
||||
return 1; /* Version not found. Return non-0 exit code */
|
||||
|
||||
case 'Q':
|
||||
if (argc != 3) {
|
||||
chars = snprintf(msg, sizeof(msg) - 1,
|
||||
"usage: %s -Q path\n"
|
||||
"Emit the fully qualified path\n"
|
||||
"exitcodes: 0 == no, 1 == yes, 2 == error\n", argv[0]);
|
||||
WriteFile(GetStdHandle(STD_ERROR_HANDLE), msg, chars,
|
||||
&dwWritten, NULL);
|
||||
return 2;
|
||||
}
|
||||
return QualifyPath(argv[2]);
|
||||
|
||||
case 'L':
|
||||
if (argc != 3) {
|
||||
chars = snprintf(msg, sizeof(msg) - 1,
|
||||
"usage: %s -L keypath\n"
|
||||
"Emit the fully qualified path of directory containing keypath\n"
|
||||
"exitcodes: 0 == success, 1 == not found, 2 == error\n", argv[0]);
|
||||
WriteFile(GetStdHandle(STD_ERROR_HANDLE), msg, chars,
|
||||
&dwWritten, NULL);
|
||||
return 2;
|
||||
}
|
||||
return LocateDependency(argv[2]);
|
||||
}
|
||||
}
|
||||
chars = snprintf(msg, sizeof(msg) - 1,
|
||||
"usage: %s -c|-f|-l|-Q|-s|-V ...\n"
|
||||
"This is a little helper app to equalize shell differences between WinNT and\n"
|
||||
"Win9x and get nmake.exe to accomplish its job.\n",
|
||||
argv[0]);
|
||||
WriteFile(GetStdHandle(STD_ERROR_HANDLE), msg, chars, &dwWritten, NULL);
|
||||
return 2;
|
||||
}
|
||||
|
||||
static int
|
||||
CheckForCompilerFeature(
|
||||
const char *option)
|
||||
{
|
||||
STARTUPINFO si;
|
||||
PROCESS_INFORMATION pi;
|
||||
SECURITY_ATTRIBUTES sa;
|
||||
DWORD threadID;
|
||||
char msg[300];
|
||||
BOOL ok;
|
||||
HANDLE hProcess, h, pipeThreads[2];
|
||||
char cmdline[100];
|
||||
|
||||
hProcess = GetCurrentProcess();
|
||||
|
||||
ZeroMemory(&pi, sizeof(PROCESS_INFORMATION));
|
||||
ZeroMemory(&si, sizeof(STARTUPINFO));
|
||||
si.cb = sizeof(STARTUPINFO);
|
||||
si.dwFlags = STARTF_USESTDHANDLES;
|
||||
si.hStdInput = INVALID_HANDLE_VALUE;
|
||||
|
||||
ZeroMemory(&sa, sizeof(SECURITY_ATTRIBUTES));
|
||||
sa.nLength = sizeof(SECURITY_ATTRIBUTES);
|
||||
sa.lpSecurityDescriptor = NULL;
|
||||
sa.bInheritHandle = FALSE;
|
||||
|
||||
/*
|
||||
* Create a non-inheritible pipe.
|
||||
*/
|
||||
|
||||
CreatePipe(&Out.pipe, &h, &sa, 0);
|
||||
|
||||
/*
|
||||
* Dupe the write side, make it inheritible, and close the original.
|
||||
*/
|
||||
|
||||
DuplicateHandle(hProcess, h, hProcess, &si.hStdOutput, 0, TRUE,
|
||||
DUPLICATE_SAME_ACCESS | DUPLICATE_CLOSE_SOURCE);
|
||||
|
||||
/*
|
||||
* Same as above, but for the error side.
|
||||
*/
|
||||
|
||||
CreatePipe(&Err.pipe, &h, &sa, 0);
|
||||
DuplicateHandle(hProcess, h, hProcess, &si.hStdError, 0, TRUE,
|
||||
DUPLICATE_SAME_ACCESS | DUPLICATE_CLOSE_SOURCE);
|
||||
|
||||
/*
|
||||
* Base command line.
|
||||
*/
|
||||
|
||||
lstrcpy(cmdline, "cl.exe -nologo -c -TC -Zs -X -Fp.\\_junk.pch ");
|
||||
|
||||
/*
|
||||
* Append our option for testing
|
||||
*/
|
||||
|
||||
lstrcat(cmdline, option);
|
||||
|
||||
/*
|
||||
* Filename to compile, which exists, but is nothing and empty.
|
||||
*/
|
||||
|
||||
lstrcat(cmdline, " .\\nul");
|
||||
|
||||
ok = CreateProcess(
|
||||
NULL, /* Module name. */
|
||||
cmdline, /* Command line. */
|
||||
NULL, /* Process handle not inheritable. */
|
||||
NULL, /* Thread handle not inheritable. */
|
||||
TRUE, /* yes, inherit handles. */
|
||||
DETACHED_PROCESS, /* No console for you. */
|
||||
NULL, /* Use parent's environment block. */
|
||||
NULL, /* Use parent's starting directory. */
|
||||
&si, /* Pointer to STARTUPINFO structure. */
|
||||
&pi); /* Pointer to PROCESS_INFORMATION structure. */
|
||||
|
||||
if (!ok) {
|
||||
DWORD err = GetLastError();
|
||||
int chars = snprintf(msg, sizeof(msg) - 1,
|
||||
"Tried to launch: \"%s\", but got error [%u]: ", cmdline, err);
|
||||
|
||||
FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM|FORMAT_MESSAGE_IGNORE_INSERTS|
|
||||
FORMAT_MESSAGE_MAX_WIDTH_MASK, 0L, err, 0, (LPSTR)&msg[chars],
|
||||
(300-chars), 0);
|
||||
WriteFile(GetStdHandle(STD_ERROR_HANDLE), msg, lstrlen(msg), &err,NULL);
|
||||
return 2;
|
||||
}
|
||||
|
||||
/*
|
||||
* Close our references to the write handles that have now been inherited.
|
||||
*/
|
||||
|
||||
CloseHandle(si.hStdOutput);
|
||||
CloseHandle(si.hStdError);
|
||||
|
||||
WaitForInputIdle(pi.hProcess, 5000);
|
||||
CloseHandle(pi.hThread);
|
||||
|
||||
/*
|
||||
* Start the pipe reader threads.
|
||||
*/
|
||||
|
||||
pipeThreads[0] = CreateThread(NULL, 0, ReadFromPipe, &Out, 0, &threadID);
|
||||
pipeThreads[1] = CreateThread(NULL, 0, ReadFromPipe, &Err, 0, &threadID);
|
||||
|
||||
/*
|
||||
* Block waiting for the process to end.
|
||||
*/
|
||||
|
||||
WaitForSingleObject(pi.hProcess, INFINITE);
|
||||
CloseHandle(pi.hProcess);
|
||||
|
||||
/*
|
||||
* Wait for our pipe to get done reading, should it be a little slow.
|
||||
*/
|
||||
|
||||
WaitForMultipleObjects(2, pipeThreads, TRUE, 500);
|
||||
CloseHandle(pipeThreads[0]);
|
||||
CloseHandle(pipeThreads[1]);
|
||||
|
||||
/*
|
||||
* Look for the commandline warning code in both streams.
|
||||
* - in MSVC 6 & 7 we get D4002, in MSVC 8 we get D9002.
|
||||
*/
|
||||
|
||||
return !(strstr(Out.buffer, "D4002") != NULL
|
||||
|| strstr(Err.buffer, "D4002") != NULL
|
||||
|| strstr(Out.buffer, "D9002") != NULL
|
||||
|| strstr(Err.buffer, "D9002") != NULL
|
||||
|| strstr(Out.buffer, "D2021") != NULL
|
||||
|| strstr(Err.buffer, "D2021") != NULL);
|
||||
}
|
||||
|
||||
static int
|
||||
CheckForLinkerFeature(
|
||||
char **options,
|
||||
int count)
|
||||
{
|
||||
STARTUPINFO si;
|
||||
PROCESS_INFORMATION pi;
|
||||
SECURITY_ATTRIBUTES sa;
|
||||
DWORD threadID;
|
||||
char msg[300];
|
||||
BOOL ok;
|
||||
HANDLE hProcess, h, pipeThreads[2];
|
||||
int i;
|
||||
char cmdline[255];
|
||||
|
||||
hProcess = GetCurrentProcess();
|
||||
|
||||
ZeroMemory(&pi, sizeof(PROCESS_INFORMATION));
|
||||
ZeroMemory(&si, sizeof(STARTUPINFO));
|
||||
si.cb = sizeof(STARTUPINFO);
|
||||
si.dwFlags = STARTF_USESTDHANDLES;
|
||||
si.hStdInput = INVALID_HANDLE_VALUE;
|
||||
|
||||
ZeroMemory(&sa, sizeof(SECURITY_ATTRIBUTES));
|
||||
sa.nLength = sizeof(SECURITY_ATTRIBUTES);
|
||||
sa.lpSecurityDescriptor = NULL;
|
||||
sa.bInheritHandle = TRUE;
|
||||
|
||||
/*
|
||||
* Create a non-inheritible pipe.
|
||||
*/
|
||||
|
||||
CreatePipe(&Out.pipe, &h, &sa, 0);
|
||||
|
||||
/*
|
||||
* Dupe the write side, make it inheritible, and close the original.
|
||||
*/
|
||||
|
||||
DuplicateHandle(hProcess, h, hProcess, &si.hStdOutput, 0, TRUE,
|
||||
DUPLICATE_SAME_ACCESS | DUPLICATE_CLOSE_SOURCE);
|
||||
|
||||
/*
|
||||
* Same as above, but for the error side.
|
||||
*/
|
||||
|
||||
CreatePipe(&Err.pipe, &h, &sa, 0);
|
||||
DuplicateHandle(hProcess, h, hProcess, &si.hStdError, 0, TRUE,
|
||||
DUPLICATE_SAME_ACCESS | DUPLICATE_CLOSE_SOURCE);
|
||||
|
||||
/*
|
||||
* Base command line.
|
||||
*/
|
||||
|
||||
lstrcpy(cmdline, "link.exe -nologo ");
|
||||
|
||||
/*
|
||||
* Append our option for testing.
|
||||
*/
|
||||
|
||||
for (i = 0; i < count; i++) {
|
||||
lstrcat(cmdline, " \"");
|
||||
lstrcat(cmdline, options[i]);
|
||||
lstrcat(cmdline, "\"");
|
||||
}
|
||||
|
||||
ok = CreateProcess(
|
||||
NULL, /* Module name. */
|
||||
cmdline, /* Command line. */
|
||||
NULL, /* Process handle not inheritable. */
|
||||
NULL, /* Thread handle not inheritable. */
|
||||
TRUE, /* yes, inherit handles. */
|
||||
DETACHED_PROCESS, /* No console for you. */
|
||||
NULL, /* Use parent's environment block. */
|
||||
NULL, /* Use parent's starting directory. */
|
||||
&si, /* Pointer to STARTUPINFO structure. */
|
||||
&pi); /* Pointer to PROCESS_INFORMATION structure. */
|
||||
|
||||
if (!ok) {
|
||||
DWORD err = GetLastError();
|
||||
int chars = snprintf(msg, sizeof(msg) - 1,
|
||||
"Tried to launch: \"%s\", but got error [%u]: ", cmdline, err);
|
||||
|
||||
FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM|FORMAT_MESSAGE_IGNORE_INSERTS|
|
||||
FORMAT_MESSAGE_MAX_WIDTH_MASK, 0L, err, 0, (LPSTR)&msg[chars],
|
||||
(300-chars), 0);
|
||||
WriteFile(GetStdHandle(STD_ERROR_HANDLE), msg, lstrlen(msg), &err,NULL);
|
||||
return 2;
|
||||
}
|
||||
|
||||
/*
|
||||
* Close our references to the write handles that have now been inherited.
|
||||
*/
|
||||
|
||||
CloseHandle(si.hStdOutput);
|
||||
CloseHandle(si.hStdError);
|
||||
|
||||
WaitForInputIdle(pi.hProcess, 5000);
|
||||
CloseHandle(pi.hThread);
|
||||
|
||||
/*
|
||||
* Start the pipe reader threads.
|
||||
*/
|
||||
|
||||
pipeThreads[0] = CreateThread(NULL, 0, ReadFromPipe, &Out, 0, &threadID);
|
||||
pipeThreads[1] = CreateThread(NULL, 0, ReadFromPipe, &Err, 0, &threadID);
|
||||
|
||||
/*
|
||||
* Block waiting for the process to end.
|
||||
*/
|
||||
|
||||
WaitForSingleObject(pi.hProcess, INFINITE);
|
||||
CloseHandle(pi.hProcess);
|
||||
|
||||
/*
|
||||
* Wait for our pipe to get done reading, should it be a little slow.
|
||||
*/
|
||||
|
||||
WaitForMultipleObjects(2, pipeThreads, TRUE, 500);
|
||||
CloseHandle(pipeThreads[0]);
|
||||
CloseHandle(pipeThreads[1]);
|
||||
|
||||
/*
|
||||
* Look for the commandline warning code in the stderr stream.
|
||||
*/
|
||||
|
||||
return !(strstr(Out.buffer, "LNK1117") != NULL ||
|
||||
strstr(Err.buffer, "LNK1117") != NULL ||
|
||||
strstr(Out.buffer, "LNK4044") != NULL ||
|
||||
strstr(Err.buffer, "LNK4044") != NULL ||
|
||||
strstr(Out.buffer, "LNK4224") != NULL ||
|
||||
strstr(Err.buffer, "LNK4224") != NULL);
|
||||
}
|
||||
|
||||
static DWORD WINAPI
|
||||
ReadFromPipe(
|
||||
LPVOID args)
|
||||
{
|
||||
pipeinfo *pi = (pipeinfo *) args;
|
||||
char *lastBuf = pi->buffer;
|
||||
DWORD dwRead;
|
||||
BOOL ok;
|
||||
|
||||
again:
|
||||
if (lastBuf - pi->buffer + CHUNK > STATICBUFFERSIZE) {
|
||||
CloseHandle(pi->pipe);
|
||||
return (DWORD)-1;
|
||||
}
|
||||
ok = ReadFile(pi->pipe, lastBuf, CHUNK, &dwRead, 0L);
|
||||
if (!ok || dwRead == 0) {
|
||||
CloseHandle(pi->pipe);
|
||||
return 0;
|
||||
}
|
||||
lastBuf += dwRead;
|
||||
goto again;
|
||||
|
||||
return 0; /* makes the compiler happy */
|
||||
}
|
||||
|
||||
static int
|
||||
IsIn(
|
||||
const char *string,
|
||||
const char *substring)
|
||||
{
|
||||
return (strstr(string, substring) != NULL);
|
||||
}
|
||||
|
||||
/*
|
||||
* GetVersionFromFile --
|
||||
* Looks for a match string in a file and then returns the version
|
||||
* following the match where a version is anything acceptable to
|
||||
* package provide or package ifneeded.
|
||||
*/
|
||||
|
||||
static const char *
|
||||
GetVersionFromFile(
|
||||
const char *filename,
|
||||
const char *match,
|
||||
int numdots)
|
||||
{
|
||||
static char szBuffer[100];
|
||||
char *szResult = NULL;
|
||||
FILE *fp = fopen(filename, "rt");
|
||||
|
||||
if (fp != NULL) {
|
||||
/*
|
||||
* Read data until we see our match string.
|
||||
*/
|
||||
|
||||
while (fgets(szBuffer, sizeof(szBuffer), fp) != NULL) {
|
||||
LPSTR p, q;
|
||||
|
||||
p = strstr(szBuffer, match);
|
||||
if (p != NULL) {
|
||||
/*
|
||||
* Skip to first digit after the match.
|
||||
*/
|
||||
|
||||
p += strlen(match);
|
||||
while (*p && !isdigit((unsigned char)*p)) {
|
||||
++p;
|
||||
}
|
||||
|
||||
/*
|
||||
* Find ending whitespace.
|
||||
*/
|
||||
|
||||
q = p;
|
||||
while (*q && (strchr("0123456789.ab", *q)) && (((!strchr(".ab", *q)
|
||||
&& !strchr("ab", q[-1])) || --numdots))) {
|
||||
++q;
|
||||
}
|
||||
|
||||
*q = 0;
|
||||
szResult = p;
|
||||
break;
|
||||
}
|
||||
}
|
||||
fclose(fp);
|
||||
}
|
||||
return szResult;
|
||||
}
|
||||
|
||||
/*
|
||||
* List helpers for the SubstituteFile function
|
||||
*/
|
||||
|
||||
typedef struct list_item_t {
|
||||
struct list_item_t *nextPtr;
|
||||
char * key;
|
||||
char * value;
|
||||
} list_item_t;
|
||||
|
||||
/* insert a list item into the list (list may be null) */
|
||||
static list_item_t *
|
||||
list_insert(list_item_t **listPtrPtr, const char *key, const char *value)
|
||||
{
|
||||
list_item_t *itemPtr = (list_item_t *)malloc(sizeof(list_item_t));
|
||||
if (itemPtr) {
|
||||
itemPtr->key = strdup(key);
|
||||
itemPtr->value = strdup(value);
|
||||
itemPtr->nextPtr = NULL;
|
||||
|
||||
while(*listPtrPtr) {
|
||||
listPtrPtr = &(*listPtrPtr)->nextPtr;
|
||||
}
|
||||
*listPtrPtr = itemPtr;
|
||||
}
|
||||
return itemPtr;
|
||||
}
|
||||
|
||||
static void
|
||||
list_free(list_item_t **listPtrPtr)
|
||||
{
|
||||
list_item_t *tmpPtr, *listPtr = *listPtrPtr;
|
||||
while (listPtr) {
|
||||
tmpPtr = listPtr;
|
||||
listPtr = listPtr->nextPtr;
|
||||
free(tmpPtr->key);
|
||||
free(tmpPtr->value);
|
||||
free(tmpPtr);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* SubstituteFile --
|
||||
* As windows doesn't provide anything useful like sed and it's unreliable
|
||||
* to use the tclsh you are building against (consider x-platform builds -
|
||||
* eg compiling AMD64 target from IX86) we provide a simple substitution
|
||||
* option here to handle autoconf style substitutions.
|
||||
* The substitution file is whitespace and line delimited. The file should
|
||||
* consist of lines matching the regular expression:
|
||||
* \s*\S+\s+\S*$
|
||||
*
|
||||
* Usage is something like:
|
||||
* nmakehlp -S << $** > $@
|
||||
* @PACKAGE_NAME@ $(PACKAGE_NAME)
|
||||
* @PACKAGE_VERSION@ $(PACKAGE_VERSION)
|
||||
* <<
|
||||
*/
|
||||
|
||||
static int
|
||||
SubstituteFile(
|
||||
const char *substitutions,
|
||||
const char *filename)
|
||||
{
|
||||
static char szBuffer[1024], szCopy[1024];
|
||||
list_item_t *substPtr = NULL;
|
||||
FILE *fp, *sp;
|
||||
|
||||
fp = fopen(filename, "rt");
|
||||
if (fp != NULL) {
|
||||
|
||||
/*
|
||||
* Build a list of substutitions from the first filename
|
||||
*/
|
||||
|
||||
sp = fopen(substitutions, "rt");
|
||||
if (sp != NULL) {
|
||||
while (fgets(szBuffer, sizeof(szBuffer), sp) != NULL) {
|
||||
unsigned char *ks, *ke, *vs, *ve;
|
||||
ks = (unsigned char*)szBuffer;
|
||||
while (ks && *ks && isspace(*ks)) ++ks;
|
||||
ke = ks;
|
||||
while (ke && *ke && !isspace(*ke)) ++ke;
|
||||
vs = ke;
|
||||
while (vs && *vs && isspace(*vs)) ++vs;
|
||||
ve = vs;
|
||||
while (ve && *ve && !(*ve == '\r' || *ve == '\n')) ++ve;
|
||||
*ke = 0, *ve = 0;
|
||||
list_insert(&substPtr, (char*)ks, (char*)vs);
|
||||
}
|
||||
fclose(sp);
|
||||
}
|
||||
|
||||
/* debug: dump the list */
|
||||
#ifndef NDEBUG
|
||||
{
|
||||
int n = 0;
|
||||
list_item_t *p = NULL;
|
||||
for (p = substPtr; p != NULL; p = p->nextPtr, ++n) {
|
||||
fprintf(stderr, "% 3d '%s' => '%s'\n", n, p->key, p->value);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Run the substitutions over each line of the input
|
||||
*/
|
||||
|
||||
while (fgets(szBuffer, sizeof(szBuffer), fp) != NULL) {
|
||||
list_item_t *p = NULL;
|
||||
for (p = substPtr; p != NULL; p = p->nextPtr) {
|
||||
char *m = strstr(szBuffer, p->key);
|
||||
if (m) {
|
||||
char *cp, *op, *sp;
|
||||
cp = szCopy;
|
||||
op = szBuffer;
|
||||
while (op != m) *cp++ = *op++;
|
||||
sp = p->value;
|
||||
while (sp && *sp) *cp++ = *sp++;
|
||||
op += strlen(p->key);
|
||||
while (*op) *cp++ = *op++;
|
||||
*cp = 0;
|
||||
memcpy(szBuffer, szCopy, sizeof(szCopy));
|
||||
}
|
||||
}
|
||||
printf("%s", szBuffer);
|
||||
}
|
||||
|
||||
list_free(&substPtr);
|
||||
}
|
||||
fclose(fp);
|
||||
return 0;
|
||||
}
|
||||
|
||||
BOOL FileExists(LPCTSTR szPath)
|
||||
{
|
||||
#ifndef INVALID_FILE_ATTRIBUTES
|
||||
#define INVALID_FILE_ATTRIBUTES ((DWORD)-1)
|
||||
#endif
|
||||
DWORD pathAttr = GetFileAttributes(szPath);
|
||||
return (pathAttr != INVALID_FILE_ATTRIBUTES &&
|
||||
!(pathAttr & FILE_ATTRIBUTE_DIRECTORY));
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* QualifyPath --
|
||||
*
|
||||
* This composes the current working directory with a provided path
|
||||
* and returns the fully qualified and normalized path.
|
||||
* Mostly needed to setup paths for testing.
|
||||
*/
|
||||
|
||||
static int
|
||||
QualifyPath(
|
||||
const char *szPath)
|
||||
{
|
||||
char szCwd[MAX_PATH + 1];
|
||||
|
||||
GetFullPathName(szPath, sizeof(szCwd)-1, szCwd, NULL);
|
||||
printf("%s\n", szCwd);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Implements LocateDependency for a single directory. See that command
|
||||
* for an explanation.
|
||||
* Returns 0 if found after printing the directory.
|
||||
* Returns 1 if not found but no errors.
|
||||
* Returns 2 on any kind of error
|
||||
* Basically, these are used as exit codes for the process.
|
||||
*/
|
||||
static int LocateDependencyHelper(const char *dir, const char *keypath)
|
||||
{
|
||||
HANDLE hSearch;
|
||||
char path[MAX_PATH+1];
|
||||
size_t dirlen;
|
||||
int keylen, ret;
|
||||
WIN32_FIND_DATA finfo;
|
||||
|
||||
if (dir == NULL || keypath == NULL)
|
||||
return 2; /* Have no real error reporting mechanism into nmake */
|
||||
dirlen = strlen(dir);
|
||||
if ((dirlen + 3) > sizeof(path))
|
||||
return 2;
|
||||
strncpy(path, dir, dirlen);
|
||||
strncpy(path+dirlen, "\\*", 3); /* Including terminating \0 */
|
||||
keylen = strlen(keypath);
|
||||
|
||||
#if 0 /* This function is not available in Visual C++ 6 */
|
||||
/*
|
||||
* Use numerics 0 -> FindExInfoStandard,
|
||||
* 1 -> FindExSearchLimitToDirectories,
|
||||
* as these are not defined in Visual C++ 6
|
||||
*/
|
||||
hSearch = FindFirstFileEx(path, 0, &finfo, 1, NULL, 0);
|
||||
#else
|
||||
hSearch = FindFirstFile(path, &finfo);
|
||||
#endif
|
||||
if (hSearch == INVALID_HANDLE_VALUE)
|
||||
return 1; /* Not found */
|
||||
|
||||
/* Loop through all subdirs checking if the keypath is under there */
|
||||
ret = 1; /* Assume not found */
|
||||
do {
|
||||
int sublen;
|
||||
/*
|
||||
* We need to check it is a directory despite the
|
||||
* FindExSearchLimitToDirectories in the above call. See SDK docs
|
||||
*/
|
||||
if ((finfo.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0)
|
||||
continue;
|
||||
sublen = strlen(finfo.cFileName);
|
||||
if ((dirlen+1+sublen+1+keylen+1) > sizeof(path))
|
||||
continue; /* Path does not fit, assume not matched */
|
||||
strncpy(path+dirlen+1, finfo.cFileName, sublen);
|
||||
path[dirlen+1+sublen] = '\\';
|
||||
strncpy(path+dirlen+1+sublen+1, keypath, keylen+1);
|
||||
if (FileExists(path)) {
|
||||
/* Found a match, print to stdout */
|
||||
path[dirlen+1+sublen] = '\0';
|
||||
QualifyPath(path);
|
||||
ret = 0;
|
||||
break;
|
||||
}
|
||||
} while (FindNextFile(hSearch, &finfo));
|
||||
FindClose(hSearch);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
* LocateDependency --
|
||||
*
|
||||
* Locates a dependency for a package.
|
||||
* keypath - a relative path within the package directory
|
||||
* that is used to confirm it is the correct directory.
|
||||
* The search path for the package directory is currently only
|
||||
* the parent and grandparent of the current working directory.
|
||||
* If found, the command prints
|
||||
* name_DIRPATH=<full path of located directory>
|
||||
* and returns 0. If not found, does not print anything and returns 1.
|
||||
*/
|
||||
static int LocateDependency(const char *keypath)
|
||||
{
|
||||
size_t i;
|
||||
int ret;
|
||||
static const char *paths[] = {"..", "..\\..", "..\\..\\.."};
|
||||
|
||||
for (i = 0; i < (sizeof(paths)/sizeof(paths[0])); ++i) {
|
||||
ret = LocateDependencyHelper(paths[i], keypath);
|
||||
if (ret == 0)
|
||||
return ret;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Local variables:
|
||||
* mode: c
|
||||
* c-basic-offset: 4
|
||||
* fill-column: 78
|
||||
* indent-tabs-mode: t
|
||||
* tab-width: 8
|
||||
* End:
|
||||
*/
|
||||
@@ -0,0 +1,123 @@
|
||||
# This file should only be included in makefiles for Tcl extensions,
|
||||
# NOT in the makefile for Tcl itself.
|
||||
|
||||
!ifndef _RULES_EXT_VC
|
||||
|
||||
# We need to run from the directory the parent makefile is located in.
|
||||
# nmake does not tell us what makefile was used to invoke it so parent
|
||||
# makefile has to set the MAKEFILEVC macro or we just make a guess and
|
||||
# warn if we think that is not the case.
|
||||
!if "$(MAKEFILEVC)" == ""
|
||||
|
||||
!if exist("$(PROJECT).vc")
|
||||
MAKEFILEVC = $(PROJECT).vc
|
||||
!elseif exist("makefile.vc")
|
||||
MAKEFILEVC = makefile.vc
|
||||
!endif
|
||||
!endif # "$(MAKEFILEVC)" == ""
|
||||
|
||||
!if !exist("$(MAKEFILEVC)")
|
||||
MSG = ^
|
||||
You must run nmake from the directory containing the project makefile.^
|
||||
If you are doing that and getting this message, set the MAKEFILEVC^
|
||||
macro to the name of the project makefile.
|
||||
!message WARNING: $(MSG)
|
||||
!endif
|
||||
|
||||
!if "$(PROJECT)" == "tcl"
|
||||
!error The rules-ext.vc file is not intended for Tcl itself.
|
||||
!endif
|
||||
|
||||
# We extract version numbers using the nmakehlp program. For now use
|
||||
# the local copy of nmakehlp. Once we locate Tcl, we will use that
|
||||
# one if it is newer.
|
||||
!if "$(MACHINE)" == "IX86" || "$(MACHINE)" == "$(NATIVE_ARCH)"
|
||||
!if [$(CC) -nologo -DNDEBUG "nmakehlp.c" -link -subsystem:console > nul]
|
||||
!endif
|
||||
!else
|
||||
!if [copy x86_64-w64-mingw32-nmakehlp.exe nmakehlp.exe >NUL]
|
||||
!endif
|
||||
!endif
|
||||
|
||||
# First locate the Tcl directory that we are working with.
|
||||
!if "$(TCLDIR)" != ""
|
||||
|
||||
_RULESDIR = $(TCLDIR:/=\)
|
||||
|
||||
!else
|
||||
|
||||
# If an installation path is specified, that is also the Tcl directory.
|
||||
# Also Tk never builds against an installed Tcl, it needs Tcl sources
|
||||
!if defined(INSTALLDIR) && "$(PROJECT)" != "tk"
|
||||
_RULESDIR=$(INSTALLDIR:/=\)
|
||||
!else
|
||||
# Locate Tcl sources
|
||||
!if [echo _RULESDIR = \> nmakehlp.out] \
|
||||
|| [nmakehlp -L generic\tcl.h >> nmakehlp.out]
|
||||
_RULESDIR = ..\..\tcl
|
||||
!else
|
||||
!include nmakehlp.out
|
||||
!endif
|
||||
|
||||
!endif # defined(INSTALLDIR)....
|
||||
|
||||
!endif # ifndef TCLDIR
|
||||
|
||||
# Now look for the targets.vc file under the Tcl root. Note we check this
|
||||
# file and not rules.vc because the latter also exists on older systems.
|
||||
!if exist("$(_RULESDIR)\lib\nmake\targets.vc") # Building against installed Tcl
|
||||
_RULESDIR = $(_RULESDIR)\lib\nmake
|
||||
!elseif exist("$(_RULESDIR)\win\targets.vc") # Building against Tcl sources
|
||||
_RULESDIR = $(_RULESDIR)\win
|
||||
!else
|
||||
# If we have not located Tcl's targets file, most likely we are compiling
|
||||
# against an older version of Tcl and so must use our own support files.
|
||||
_RULESDIR = .
|
||||
!endif
|
||||
|
||||
!if "$(_RULESDIR)" != "."
|
||||
# Potentially using Tcl's support files. If this extension has its own
|
||||
# nmake support files, need to compare the versions and pick newer.
|
||||
|
||||
!if exist("rules.vc") # The extension has its own copy
|
||||
|
||||
!if [echo TCL_RULES_MAJOR = \> versions.vc] \
|
||||
&& [nmakehlp -V "$(_RULESDIR)\rules.vc" RULES_VERSION_MAJOR >> versions.vc]
|
||||
!endif
|
||||
!if [echo TCL_RULES_MINOR = \>> versions.vc] \
|
||||
&& [nmakehlp -V "$(_RULESDIR)\rules.vc" RULES_VERSION_MINOR >> versions.vc]
|
||||
!endif
|
||||
|
||||
!if [echo OUR_RULES_MAJOR = \>> versions.vc] \
|
||||
&& [nmakehlp -V "rules.vc" RULES_VERSION_MAJOR >> versions.vc]
|
||||
!endif
|
||||
!if [echo OUR_RULES_MINOR = \>> versions.vc] \
|
||||
&& [nmakehlp -V "rules.vc" RULES_VERSION_MINOR >> versions.vc]
|
||||
!endif
|
||||
!include versions.vc
|
||||
# We have a newer version of the support files, use them
|
||||
!if ($(TCL_RULES_MAJOR) != $(OUR_RULES_MAJOR)) || ($(TCL_RULES_MINOR) < $(OUR_RULES_MINOR))
|
||||
_RULESDIR = .
|
||||
!endif
|
||||
|
||||
!endif # if exist("rules.vc")
|
||||
|
||||
!endif # if $(_RULESDIR) != "."
|
||||
|
||||
# Let rules.vc know what copy of nmakehlp.c to use.
|
||||
NMAKEHLPC = $(_RULESDIR)\nmakehlp.c
|
||||
|
||||
# Get rid of our internal defines before calling rules.vc
|
||||
!undef TCL_RULES_MAJOR
|
||||
!undef TCL_RULES_MINOR
|
||||
!undef OUR_RULES_MAJOR
|
||||
!undef OUR_RULES_MINOR
|
||||
|
||||
!if exist("$(_RULESDIR)\rules.vc")
|
||||
!message *** Using $(_RULESDIR)\rules.vc
|
||||
!include "$(_RULESDIR)\rules.vc"
|
||||
!else
|
||||
!error *** Could not locate rules.vc in $(_RULESDIR)
|
||||
!endif
|
||||
|
||||
!endif # _RULES_EXT_VC
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,98 @@
|
||||
#------------------------------------------------------------- -*- makefile -*-
|
||||
# targets.vc --
|
||||
#
|
||||
# Part of the nmake based build system for Tcl and its extensions.
|
||||
# This file defines some standard targets for the convenience of extensions
|
||||
# and can be optionally included by the extension makefile.
|
||||
# See TIP 477 (https://core.tcl-lang.org/tips/doc/main/tip/477.md) for docs.
|
||||
|
||||
$(PROJECT): setup pkgindex $(PRJLIB)
|
||||
|
||||
!ifdef PRJ_STUBOBJS
|
||||
$(PROJECT): $(PRJSTUBLIB)
|
||||
$(PRJSTUBLIB): $(PRJ_STUBOBJS)
|
||||
$(LIBCMD) $**
|
||||
|
||||
$(PRJ_STUBOBJS):
|
||||
$(CCSTUBSCMD) %s
|
||||
!endif # PRJ_STUBOBJS
|
||||
|
||||
!ifdef PRJ_MANIFEST
|
||||
$(PROJECT): $(PRJLIB).manifest
|
||||
$(PRJLIB).manifest: $(PRJ_MANIFEST)
|
||||
@nmakehlp -s << $** >$@
|
||||
@MACHINE@ $(MACHINE:IX86=X86)
|
||||
<<
|
||||
!endif
|
||||
|
||||
!if "$(PROJECT)" != "tcl" && "$(PROJECT)" != "tk"
|
||||
$(PRJLIB): $(PRJ_OBJS) $(RESFILE)
|
||||
!if $(STATIC_BUILD)
|
||||
$(LIBCMD) $**
|
||||
!else
|
||||
$(DLLCMD) $**
|
||||
$(_VC_MANIFEST_EMBED_DLL)
|
||||
!endif
|
||||
-@del $*.exp
|
||||
!endif
|
||||
|
||||
!if "$(PRJ_HEADERS)" != "" && "$(PRJ_OBJS)" != ""
|
||||
$(PRJ_OBJS): $(PRJ_HEADERS)
|
||||
!endif
|
||||
|
||||
# If parent makefile has defined stub objects, add their installation
|
||||
# to the default install
|
||||
!if "$(PRJ_STUBOBJS)" != ""
|
||||
default-install: default-install-stubs
|
||||
!endif
|
||||
|
||||
# Unlike the other default targets, these cannot be in rules.vc because
|
||||
# the executed command depends on existence of macro PRJ_HEADERS_PUBLIC
|
||||
# that the parent makefile will not define until after including rules-ext.vc
|
||||
!if "$(PRJ_HEADERS_PUBLIC)" != ""
|
||||
default-install: default-install-headers
|
||||
default-install-headers:
|
||||
@echo Installing headers to '$(INCLUDE_INSTALL_DIR)'
|
||||
@for %f in ($(PRJ_HEADERS_PUBLIC)) do @$(COPY) %f "$(INCLUDE_INSTALL_DIR)"
|
||||
!endif
|
||||
|
||||
!if "$(DISABLE_STANDARD_TARGETS)" == ""
|
||||
DISABLE_STANDARD_TARGETS = 0
|
||||
!endif
|
||||
|
||||
!if "$(DISABLE_TARGET_setup)" == ""
|
||||
DISABLE_TARGET_setup = 0
|
||||
!endif
|
||||
!if "$(DISABLE_TARGET_install)" == ""
|
||||
DISABLE_TARGET_install = 0
|
||||
!endif
|
||||
!if "$(DISABLE_TARGET_clean)" == ""
|
||||
DISABLE_TARGET_clean = 0
|
||||
!endif
|
||||
!if "$(DISABLE_TARGET_test)" == ""
|
||||
DISABLE_TARGET_test = 0
|
||||
!endif
|
||||
!if "$(DISABLE_TARGET_shell)" == ""
|
||||
DISABLE_TARGET_shell = 0
|
||||
!endif
|
||||
|
||||
!if !$(DISABLE_STANDARD_TARGETS)
|
||||
!if !$(DISABLE_TARGET_setup)
|
||||
setup: default-setup
|
||||
!endif
|
||||
!if !$(DISABLE_TARGET_install)
|
||||
install: default-install
|
||||
!endif
|
||||
!if !$(DISABLE_TARGET_clean)
|
||||
clean: default-clean
|
||||
realclean: hose
|
||||
hose: default-hose
|
||||
distclean: realclean default-distclean
|
||||
!endif
|
||||
!if !$(DISABLE_TARGET_test)
|
||||
test: default-test
|
||||
!endif
|
||||
!if !$(DISABLE_TARGET_shell)
|
||||
shell: default-shell
|
||||
!endif
|
||||
!endif # DISABLE_STANDARD_TARGETS
|
||||
+3
-14
@@ -375,29 +375,18 @@ configure process, and check it in.
|
||||
Patching Autosetup for Project-local Changes
|
||||
------------------------------------------------------------------------
|
||||
|
||||
The autosetup files require the following patches after updating
|
||||
from their upstream sources:
|
||||
|
||||
### `--debug` flag
|
||||
|
||||
Autosetup reserves the flag name **`--debug`** for its own purposes,
|
||||
and its own special handling of `--enable-...` flags makes `--debug`
|
||||
an alias for `--enable-debug`. As this project has a long history of
|
||||
using `--enable-debug`, we patch autosetup to use the name
|
||||
`--autosetup-debug` in place of `--debug`. That requires (as of this
|
||||
writing) four small edits in
|
||||
[/autosetup/autosetup](/file/autosetup/autosetup), as demonstrated in
|
||||
[check-in 3296c8d3](/info/3296c8d3).
|
||||
writing) four small edits in [](/file/autosetup/autosetup), as
|
||||
demonstrated in [check-in 3296c8d3](/info/3296c8d3).
|
||||
|
||||
If autosetup is upgraded and this patch is _not_ applied the invoking
|
||||
`./configure` will fail loudly because of the declaration of the
|
||||
`debug` flag in `auto.def` - duplicated flags are not permitted.
|
||||
|
||||
### Fail on `malloc()` error
|
||||
|
||||
See [check-in 72c8a5b94cdf5d](/info/72c8a5b94cdf5d).
|
||||
|
||||
|
||||
<a name="branch-customization"></a>
|
||||
Branch-specific Customization
|
||||
========================================================================
|
||||
@@ -437,7 +426,7 @@ proc sqlite-custom-flags {} {
|
||||
```
|
||||
|
||||
That function must return either an empty string or a list in the form
|
||||
used internally by [sqlite-config.tcl][]'s `sqlite-configure`.
|
||||
used internally by `sqlite-config.tcl:sqlite-configure`.
|
||||
|
||||
Next, define:
|
||||
|
||||
|
||||
+7
-11
@@ -406,8 +406,8 @@ proc options-add {opts} {
|
||||
# Find the corresponding value in the user options
|
||||
# and set the default if necessary
|
||||
if {[string match "-*" $opt]} {
|
||||
# We no longer support documentation-only options, like "-C <dir>"
|
||||
autosetup-error "Option $opt is not supported"
|
||||
# This is a documentation-only option, like "-C <dir>"
|
||||
set opthelp $opt
|
||||
} elseif {$colon eq ""} {
|
||||
# Boolean option
|
||||
lappend autosetup(options) $name
|
||||
@@ -1611,7 +1611,7 @@ proc autosetup_output_block {type lines} {
|
||||
# Generate a command reference from inline documentation
|
||||
proc automf_command_reference {} {
|
||||
lappend files $::autosetup(prog)
|
||||
lappend files {*}[lsort [glob -nocomplain $::autosetup(libdir)/{*/*.tcl,*.tcl}]]
|
||||
lappend files {*}[lsort [glob -nocomplain $::autosetup(libdir)/*.tcl]]
|
||||
|
||||
# We want to process all non-module files before module files
|
||||
# and then modules in alphabetical order.
|
||||
@@ -2124,7 +2124,7 @@ if {$autosetup(istcl)} {
|
||||
set frame [info frame -$i]
|
||||
if {[dict exists $frame file]} {
|
||||
# We don't need proc, so use ""
|
||||
lappend stacktrace "" [dict get $frame file] [dict get $frame line] ""
|
||||
lappend stacktrace "" [dict get $frame file] [dict get $frame line]
|
||||
}
|
||||
}
|
||||
return $stacktrace
|
||||
@@ -2181,12 +2181,8 @@ proc error-location {msg} {
|
||||
if {$::autosetup(debug)} {
|
||||
return -code error $msg
|
||||
}
|
||||
set vars {p f l cmd}
|
||||
if {!$::autosetup(istcl) && ![dict exists $::tcl_platform stackFormat]} {
|
||||
# Older versions of Jim had a 3 element stacktrace
|
||||
set vars {p f l}
|
||||
}
|
||||
foreach $vars [stacktrace] {
|
||||
# Search back through the stack trace for the first error in a .def file
|
||||
foreach {p f l} [stacktrace] {
|
||||
if {[string match *.def $f]} {
|
||||
return "[relative-path $f]:$l: Error: $msg"
|
||||
}
|
||||
@@ -2538,7 +2534,7 @@ if {[catch {main $argv} msg opts] == 1} {
|
||||
show-notices
|
||||
autosetup-full-error [error-dump $msg $opts $autosetup(debug)]
|
||||
if {!$autosetup(debug)} {
|
||||
puts stderr "Try: '[file tail $autosetup(exe)] --debug' for a full stack trace"
|
||||
puts stderr "Try: '[file tail $autosetup(exe)] --autosetup-debug' for a full stack trace"
|
||||
}
|
||||
exit 1
|
||||
}
|
||||
|
||||
@@ -89,15 +89,13 @@ switch -glob -- [get-define host] {
|
||||
define SH_SOPREFIX -Wl,-h,
|
||||
}
|
||||
}
|
||||
*-*-hpux* {
|
||||
define SHOBJ_CFLAGS +z
|
||||
*-*-hpux {
|
||||
# XXX: These haven't been tested
|
||||
define SHOBJ_CFLAGS "+O3 +z"
|
||||
define SHOBJ_LDFLAGS -b
|
||||
define SH_CFLAGS +z
|
||||
define SH_LDFLAGS -b
|
||||
define SH_LINKFLAGS -Wl,+s
|
||||
define SH_LINKRPATH "-Wl,+b -Wl,%s"
|
||||
define SH_SOPREFIX -Wl,+h,
|
||||
define STRIPLIBFLAGS -Wl,-s
|
||||
define LD_LIBRARY_PATH SHLIB_PATH
|
||||
}
|
||||
*-*-haiku {
|
||||
define SHOBJ_CFLAGS ""
|
||||
|
||||
+4
-6
@@ -7409,13 +7409,11 @@ void *JimDefaultAllocator(void *ptr, size_t size)
|
||||
free(ptr);
|
||||
return NULL;
|
||||
}
|
||||
else if (ptr) {
|
||||
return realloc(ptr, size);
|
||||
}
|
||||
else {
|
||||
void *p = realloc(ptr, size);
|
||||
if( p==0 ){
|
||||
fprintf(stderr,"Out of memory\n");
|
||||
exit(1);
|
||||
}
|
||||
return p;
|
||||
return malloc(size);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+183
-1292
File diff suppressed because it is too large
Load Diff
+163
-294
@@ -1,7 +1,7 @@
|
||||
# This file holds functions for autosetup which are specific to the
|
||||
# sqlite build tree. They are in this file, instead of auto.def, so
|
||||
# that they can be reused in the autoconf sub-tree. This file requires
|
||||
# functions from the project-agnostic proj.tcl.
|
||||
# functions from proj.tcl.
|
||||
|
||||
if {[string first " " $autosetup(srcdir)] != -1} {
|
||||
user-error "The pathname of the source tree\
|
||||
@@ -11,7 +11,7 @@ if {[string first " " $autosetup(builddir)] != -1} {
|
||||
user-error "The pathname of the build directory\
|
||||
may not contain space characters"
|
||||
}
|
||||
|
||||
#parray ::autosetup; exit 0
|
||||
use proj
|
||||
#
|
||||
# We want the package version info to be emitted early on, but doing
|
||||
@@ -24,7 +24,6 @@ if {"--help" ni $::argv} {
|
||||
}
|
||||
use system ; # Will output "Host System" and "Build System" lines
|
||||
if {"--help" ni $::argv} {
|
||||
proj-tweak-default-env-dirs
|
||||
msg-result "Source dir = $::autosetup(srcdir)"
|
||||
msg-result "Build dir = $::autosetup(builddir)"
|
||||
use cc cc-db cc-shared cc-lib pkg-config
|
||||
@@ -60,19 +59,6 @@ array set sqliteConfig [subst [proj-strip-hash-comments {
|
||||
# (dump-defines-txt) but also a JSON file named after this option's
|
||||
# value.
|
||||
dump-defines-json ""
|
||||
|
||||
#
|
||||
# The list of feature --flags which the --all flag implies. This
|
||||
# requires special handling in a few places.
|
||||
#
|
||||
all-flag-enables {fts4 fts5 rtree geopoly session dbpage dbstat carray}
|
||||
|
||||
#
|
||||
# Default value for the --all flag. Can hypothetically be modified
|
||||
# by non-canonical builds (it was added for a Tcl extension build
|
||||
# mode which was eventually removed).
|
||||
#
|
||||
all-flag-default 0
|
||||
}]]
|
||||
|
||||
########################################################################
|
||||
@@ -93,30 +79,22 @@ array set sqliteConfig [subst [proj-strip-hash-comments {
|
||||
# sqlite-configure BUILD_NAME { build-specific configure script }
|
||||
#
|
||||
# There are snippets of build-mode-specific decision-making in
|
||||
# [sqlite-configure-finalize], which gets run after $configScript.
|
||||
# [sqlite-configure-finalize]
|
||||
proc sqlite-configure {buildMode configScript} {
|
||||
proj-assert {$::sqliteConfig(build-mode) eq "unknown"} \
|
||||
"sqlite-configure must not be called more than once"
|
||||
set allBuildModes {canonical autoconf}
|
||||
set allBuildModes {canonical autoconf tcl-extension}
|
||||
if {$buildMode ni $allBuildModes} {
|
||||
user-error "Invalid build mode: $buildMode. Expecting one of: $allBuildModes"
|
||||
}
|
||||
if {$::sqliteConfig(all-flag-default)} {
|
||||
set allFlagHelp "Disable these extensions: $::sqliteConfig(all-flag-enables)"
|
||||
} else {
|
||||
set allFlagHelp "Enable these extensions: $::sqliteConfig(all-flag-enables)"
|
||||
}
|
||||
|
||||
set ::sqliteConfig(build-mode) $buildMode
|
||||
########################################################################
|
||||
# A gentle introduction to flags handling in autosetup
|
||||
#
|
||||
# Reference: https://msteveb.github.io/autosetup/developer/
|
||||
#
|
||||
# All configure flags must be described in one or more calls to
|
||||
# autosetup's [options] and [options-add] functions. The general
|
||||
# syntax of the single argument to those functions is a list contain
|
||||
# a mapping of flags to help text:
|
||||
# All configure flags must be described in an 'options' call. The
|
||||
# general syntax is:
|
||||
#
|
||||
# FLAG => {Help text}
|
||||
#
|
||||
@@ -167,18 +145,13 @@ proc sqlite-configure {buildMode configScript} {
|
||||
########################################################################
|
||||
set allFlags {
|
||||
# Structure: a list of M {Z} pairs, where M is a descriptive
|
||||
# option group name and Z is a list of X Y pairs. X is a list of
|
||||
# option group name and Z is a list of X Y pairs. X is a list of
|
||||
# $buildMode name(s) to which the Y flags apply, or {*} to apply
|
||||
# to all builds. Y is a {block} in the form expected by
|
||||
# autosetup's [options] and [options-add] command. Each block
|
||||
# which is applicable to $buildMode is passed on to
|
||||
# [options-add]. The order of each Y and sub-Y is retained, which
|
||||
# is significant for rendering of --help.
|
||||
#
|
||||
# Maintenance note: [options] does not support comments in
|
||||
# options, but we filter this object through
|
||||
# [proj-strip-hash-comments] to remove them before passing them on
|
||||
# to [options].
|
||||
# autosetup's [options] command. Each block which is applicable
|
||||
# to $buildMode is appended to a new list before that list is
|
||||
# passed on to [options]. The order of each Y and sub-Y is
|
||||
# retained, which is significant for rendering of --help.
|
||||
|
||||
# When writing {help text blocks}, be aware that:
|
||||
#
|
||||
@@ -188,7 +161,7 @@ proc sqlite-configure {buildMode configScript} {
|
||||
# pretty-printed.
|
||||
#
|
||||
# B) Vars and commands are NOT expanded, but we use a [subst] call
|
||||
# below which will replace (only) $var refs.
|
||||
# below which will replace (only) var refs.
|
||||
|
||||
# Options for how to build the library
|
||||
build-modes {
|
||||
@@ -220,19 +193,11 @@ proc sqlite-configure {buildMode configScript} {
|
||||
geopoly => {Enable the GEOPOLY extension}
|
||||
rtree => {Enable the RTREE extension}
|
||||
session => {Enable the SESSION extension}
|
||||
dbpage => {Enable the sqlite3_dbpage extension}
|
||||
dbstat => {Enable the sqlite3_dbstat extension}
|
||||
carray=1 => {Disable the CARRAY extension}
|
||||
all=$::sqliteConfig(all-flag-default) => {$allFlagHelp}
|
||||
all => {Enable FTS4, FTS5, Geopoly, RTree, Sessions}
|
||||
largefile=1
|
||||
=> {This legacy flag has no effect on the library but may influence
|
||||
the generated sqlite_cfg.h by adding #define HAVE_LFS}
|
||||
}
|
||||
{canonical} {
|
||||
column-metadata => {Enable the column metadata APIs}
|
||||
# ^^^ Affects how sqlite3.c is generated, so is not available in
|
||||
# the autoconf build.
|
||||
}
|
||||
}
|
||||
|
||||
# Options for TCL support
|
||||
@@ -243,6 +208,8 @@ proc sqlite-configure {buildMode configScript} {
|
||||
This tree requires TCL for code generation but can use the in-tree
|
||||
copy of autosetup/jimsh0.c for that. The SQLite TCL extension and the
|
||||
test code require a canonical tclsh.}
|
||||
}
|
||||
{canonical tcl-extension} {
|
||||
with-tcl:DIR
|
||||
=> {Directory containing tclConfig.sh or a directory one level up from
|
||||
that, from which we can derive a directory containing tclConfig.sh.
|
||||
@@ -250,16 +217,9 @@ proc sqlite-configure {buildMode configScript} {
|
||||
the --prefix flag.}
|
||||
with-tclsh:PATH
|
||||
=> {Full pathname of tclsh to use. It is used for (A) trying to find
|
||||
tclConfig.sh and (B) all TCL-based code generation. Use --with-tcl
|
||||
unless you have a specific need for this flag. Warning: if its
|
||||
containing dir has multiple tclsh versions, it may select the
|
||||
tclConfig.sh and (B) all TCL-based code generation. Warning: if
|
||||
its containing dir has multiple tclsh versions, it may select the
|
||||
wrong tclConfig.sh!}
|
||||
static-tclsqlite3=0
|
||||
=> {Statically-link tclsqlite3. This only works if TCL support is
|
||||
enabled and all requisite libraries are available in
|
||||
static form. Note that glibc is unable to fully statically
|
||||
link certain libraries required by tclsqlite3, so this won't
|
||||
work on most Linux environments.}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -312,27 +272,13 @@ proc sqlite-configure {buildMode configScript} {
|
||||
=> {Top-most dir of the wasi-sdk for a WASI build}
|
||||
}
|
||||
|
||||
{*} {
|
||||
# Note that --static-cli-shell has a completely different
|
||||
# meaning from --static-shell in the autoconf build!
|
||||
# --[disable-]static-shell is a legacy flag which we can't
|
||||
# remove without breaking downstream builds.
|
||||
static-cli-shell=0
|
||||
=> {Statically-link the sqlite3 CLI shell.
|
||||
This only works if the requisite libraries are all available in
|
||||
static form.}
|
||||
}
|
||||
|
||||
{canonical} {
|
||||
static-shells=0
|
||||
=> {Shorthand for --static-cli-shell --static-tclsqlite3}
|
||||
|
||||
with-emsdk:=auto
|
||||
=> {Top-most dir of the Emscripten SDK installation.
|
||||
Needed only by ext/wasm. Default=EMSDK env var.}
|
||||
|
||||
amalgamation-extra-src:FILES
|
||||
=> {Space-separated list of source files to append as-is to the resulting
|
||||
=> {Space-separated list of soure files to append as-is to the resulting
|
||||
sqlite3.c amalgamation file. May be provided multiple times.}
|
||||
}
|
||||
}
|
||||
@@ -341,13 +287,12 @@ proc sqlite-configure {buildMode configScript} {
|
||||
packaging {
|
||||
{autoconf} {
|
||||
# --disable-static-shell: https://sqlite.org/forum/forumpost/cc219ee704
|
||||
# Note that this has a different meaning from --static-cli-shell in the
|
||||
# canonical build!
|
||||
static-shell=1
|
||||
=> {Link the sqlite3 shell app against the DLL instead of embedding sqlite3.c}
|
||||
}
|
||||
{canonical autoconf} {
|
||||
rpath=1 => {Disable use of the rpath linker flag}
|
||||
# A potential TODO without a current use case:
|
||||
#rpath=1 => {Disable use of the rpath linker flag}
|
||||
# soname: https://sqlite.org/src/forumpost/5a3b44f510df8ded
|
||||
soname:=legacy
|
||||
=> {SONAME for libsqlite3.so. "none", or not using this flag, sets no
|
||||
@@ -418,6 +363,7 @@ proc sqlite-configure {buildMode configScript} {
|
||||
# ^^^ lappend of [sqlite-custom-flags] introduces weirdness if
|
||||
# we delay [proj-strip-hash-comments] until after that.
|
||||
|
||||
|
||||
########################################################################
|
||||
# sqlite-custom.tcl is intended only for vendor-branch-specific
|
||||
# customization. See autosetup/README.md#branch-customization for
|
||||
@@ -435,18 +381,20 @@ proc sqlite-configure {buildMode configScript} {
|
||||
}
|
||||
}
|
||||
|
||||
#lappend allFlags just-testing {{*} {soname:=duplicateEntry => {x}}}
|
||||
|
||||
# Filter allFlags to create the set of [options] legal for this build
|
||||
foreach {group XY} [subst -nobackslashes -nocommands $allFlags] {
|
||||
set opts {}
|
||||
foreach {group XY} [subst -nobackslashes -nocommands \
|
||||
[proj-strip-hash-comments $allFlags]] {
|
||||
foreach {X Y} $XY {
|
||||
if { $buildMode in $X || "*" in $X } {
|
||||
options-add $Y
|
||||
foreach y $Y {
|
||||
lappend opts $y
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if {[catch {options {}} msg xopts]} {
|
||||
#lappend opts "soname:=duplicateEntry => {x}"; #just testing
|
||||
if {[catch {options $opts} msg xopts]} {
|
||||
# Workaround for <https://github.com/msteveb/autosetup/issues/73>
|
||||
# where [options] behaves oddly on _some_ TCL builds when it's
|
||||
# called from deeper than the global scope.
|
||||
@@ -460,9 +408,8 @@ proc sqlite-configure {buildMode configScript} {
|
||||
|
||||
########################################################################
|
||||
# Runs "phase 1" of the configure process: after initial --flags
|
||||
# handling but before sqlite-configure's $configScript argument is
|
||||
# run. $buildMode must be the mode which was passed to
|
||||
# [sqlite-configure].
|
||||
# handling but before the build-specific parts are run. $buildMode
|
||||
# must be the mode which was passed to [sqlite-configure].
|
||||
proc sqlite-configure-phase1 {buildMode} {
|
||||
define PACKAGE_NAME sqlite
|
||||
define PACKAGE_URL {https://sqlite.org}
|
||||
@@ -478,7 +425,7 @@ proc sqlite-configure-phase1 {buildMode} {
|
||||
}
|
||||
set ::sqliteConfig(msg-debug-enabled) [proj-val-truthy [get-env msg-debug 0]]
|
||||
proc-debug "msg-debug is enabled"
|
||||
proj-setup-autoreconfig SQLITE_AUTORECONFIG
|
||||
sqlite-autoreconfig
|
||||
proj-file-extensions
|
||||
if {".exe" eq [get-define TARGET_EXEEXT]} {
|
||||
define SQLITE_OS_UNIX 0
|
||||
@@ -499,12 +446,6 @@ proc sqlite-configure-phase1 {buildMode} {
|
||||
# may not) define HAVE_LFS.
|
||||
cc-check-lfs
|
||||
}
|
||||
set srcdir $::autosetup(srcdir)
|
||||
proj-dot-ins-append $srcdir/Makefile.in
|
||||
if {[file exists $srcdir/sqlite3.pc.in]} {
|
||||
proj-dot-ins-append $srcdir/sqlite3.pc.in
|
||||
}
|
||||
sqlite-handle-hpux; # must be relatively early so that other config tests can work
|
||||
}; # sqlite-configure-phase1
|
||||
|
||||
########################################################################
|
||||
@@ -537,6 +478,7 @@ proc sqlite-configure-finalize {} {
|
||||
sqlite-handle-common-feature-flags
|
||||
sqlite-finalize-feature-flags
|
||||
sqlite-process-dot-in-files; # do not [define] anything after this
|
||||
sqlite-post-config-validation
|
||||
sqlite-dump-defines
|
||||
}
|
||||
|
||||
@@ -553,35 +495,37 @@ proc msg-debug {msg} {
|
||||
# the debug message. It is not legal to call this from the global
|
||||
# scope.
|
||||
proc proc-debug {msg} {
|
||||
msg-debug "\[[proj-scope 1]\]: $msg"
|
||||
msg-debug "\[[proj-current-proc-name 1]\]: $msg"
|
||||
}
|
||||
|
||||
########################################################################
|
||||
# Sets up the SQLITE_AUTORECONFIG define.
|
||||
proc sqlite-autoreconfig {} {
|
||||
# SQLITE_AUTORECONFIG contains make target rules for re-running the
|
||||
# configure script with the same arguments it was initially invoked
|
||||
# with. This can be used to automatically reconfigure.
|
||||
set squote {{arg} {
|
||||
# Wrap $arg in single-quotes if it looks like it might need that
|
||||
# to avoid mis-handling as a shell argument. We assume that $arg
|
||||
# will never contain any single-quote characters.
|
||||
if {[string match {*[ &;$*"]*} $arg]} { return '$arg' }
|
||||
return $arg
|
||||
}}
|
||||
define-append SQLITE_AUTORECONFIG cd [apply $squote $::autosetup(builddir)] \
|
||||
&& [apply $squote $::autosetup(srcdir)/configure]
|
||||
#{*}$::autosetup(argv) breaks with --flag='val with spaces', so...
|
||||
foreach arg $::autosetup(argv) {
|
||||
define-append SQLITE_AUTORECONFIG [apply $squote $arg]
|
||||
}
|
||||
}
|
||||
|
||||
define OPT_FEATURE_FLAGS {} ; # -DSQLITE_OMIT/ENABLE flags.
|
||||
#
|
||||
# OPT_SHELL = feature-related CFLAGS for the sqlite3 CLI app. The
|
||||
# list's initial values are defaults which are always applied and not
|
||||
# affected by --feature-flags. The list is appended to by various
|
||||
# --feature-flags.
|
||||
define OPT_SHELL {
|
||||
-DSQLITE_DQS=0
|
||||
-DSQLITE_ENABLE_FTS4
|
||||
-DSQLITE_ENABLE_RTREE
|
||||
-DSQLITE_ENABLE_EXPLAIN_COMMENTS
|
||||
-DSQLITE_ENABLE_UNKNOWN_SQL_FUNCTION
|
||||
-DSQLITE_ENABLE_STMTVTAB
|
||||
-DSQLITE_ENABLE_DBPAGE_VTAB
|
||||
-DSQLITE_ENABLE_DBSTAT_VTAB
|
||||
-DSQLITE_ENABLE_BYTECODE_VTAB
|
||||
-DSQLITE_ENABLE_OFFSET_SQL_FUNC
|
||||
-DSQLITE_ENABLE_PERCENTILE
|
||||
-DSQLITE_STRICT_SUBTYPE=1
|
||||
}
|
||||
define OPT_SHELL {} ; # Feature-related CFLAGS for the sqlite3 CLI app
|
||||
########################################################################
|
||||
# Adds $args, if not empty, to OPT_FEATURE_FLAGS. If the first arg is
|
||||
# -shell then it strips that arg and passes the remaining args the
|
||||
# sqlite-add-shell-opt in addition to adding them to
|
||||
# OPT_FEATURE_FLAGS. This is intended only for holding
|
||||
# -DSQLITE_ENABLE/OMIT/... flags, but that is not enforced here.
|
||||
# OPT_FEATURE_FLAGS.
|
||||
proc sqlite-add-feature-flag {args} {
|
||||
set shell ""
|
||||
if {"-shell" eq [lindex $args 0]} {
|
||||
@@ -614,12 +558,8 @@ proc sqlite-affirm-have-math {featureName} {
|
||||
if {![msg-quiet proj-check-function-in-lib log m]} {
|
||||
user-error "Missing math APIs for $featureName"
|
||||
}
|
||||
set lfl [get-define lib_log ""]
|
||||
define LDFLAGS_MATH [get-define lib_log ""]
|
||||
undefine lib_log
|
||||
if {"" ne $lfl} {
|
||||
user-notice "Forcing requirement of $lfl for $featureName"
|
||||
}
|
||||
define LDFLAGS_MATH $lfl
|
||||
}
|
||||
}
|
||||
|
||||
@@ -649,23 +589,17 @@ proc sqlite-check-common-system-deps {} {
|
||||
|
||||
# Check for needed/wanted functions
|
||||
cc-check-functions gmtime_r isnan localtime_r localtime_s \
|
||||
usleep utime pread pread64 pwrite pwrite64
|
||||
malloc_usable_size strchrnul usleep utime pread pread64 pwrite pwrite64
|
||||
|
||||
apply {{} {
|
||||
set ldrt ""
|
||||
# Collapse funcs from librt into LDFLAGS_RT.
|
||||
# Some systems (ex: SunOS) require -lrt in order to use nanosleep
|
||||
foreach func {fdatasync nanosleep} {
|
||||
if {[proj-check-function-in-lib $func rt]} {
|
||||
set ldrt [get-define lib_${func} ""]
|
||||
undefine lib_${func}
|
||||
if {"" ne $ldrt} {
|
||||
break
|
||||
}
|
||||
}
|
||||
set ldrt ""
|
||||
# Collapse funcs from librt into LDFLAGS_RT.
|
||||
# Some systems (ex: SunOS) require -lrt in order to use nanosleep
|
||||
foreach func {fdatasync nanosleep} {
|
||||
if {[proj-check-function-in-lib $func rt]} {
|
||||
lappend ldrt [get-define lib_${func}]
|
||||
}
|
||||
define LDFLAGS_RT $ldrt
|
||||
}}
|
||||
}
|
||||
define LDFLAGS_RT [join [lsort -unique $ldrt] ""]
|
||||
|
||||
# Check for needed/wanted headers
|
||||
cc-check-includes \
|
||||
@@ -679,7 +613,6 @@ proc sqlite-check-common-system-deps {} {
|
||||
define HAVE_ZLIB 1
|
||||
define LDFLAGS_ZLIB -lz
|
||||
sqlite-add-shell-opt -DSQLITE_HAVE_ZLIB=1
|
||||
sqlite-add-feature-flag -DSQLITE_HAVE_ZLIB=1
|
||||
} else {
|
||||
define HAVE_ZLIB 0
|
||||
define LDFLAGS_ZLIB ""
|
||||
@@ -761,36 +694,15 @@ proc sqlite-setup-default-cflags {} {
|
||||
# Handle various SQLITE_ENABLE/OMIT_... feature flags.
|
||||
proc sqlite-handle-common-feature-flags {} {
|
||||
msg-result "Feature flags..."
|
||||
if {![opt-bool all]} {
|
||||
# Special handling for --disable-all
|
||||
foreach flag $::sqliteConfig(all-flag-enables) {
|
||||
if {![proj-opt-was-provided $flag]} {
|
||||
proj-opt-set $flag 0
|
||||
}
|
||||
}
|
||||
}
|
||||
foreach {boolFlag featureFlag ifSetEvalThis} [proj-strip-hash-comments {
|
||||
foreach {boolFlag featureFlag ifSetEvalThis} {
|
||||
all {} {
|
||||
# The 'all' option must be first in this list. This impl makes
|
||||
# an effort to only apply flags which the user did not already
|
||||
# apply, so that combinations like (--all --disable-geopoly)
|
||||
# will indeed disable geopoly. There are corner cases where
|
||||
# flags which depend on each other will behave in non-intuitive
|
||||
# ways:
|
||||
#
|
||||
# --all --disable-rtree
|
||||
#
|
||||
# Will NOT disable geopoly, though geopoly depends on rtree.
|
||||
# The --geopoly flag, though, will automatically re-enable
|
||||
# --rtree, so --disable-rtree won't actually disable anything in
|
||||
# that case.
|
||||
foreach k $::sqliteConfig(all-flag-enables) {
|
||||
if {![proj-opt-was-provided $k]} {
|
||||
proj-opt-set $k 1
|
||||
}
|
||||
}
|
||||
# The 'all' option must be first in this list.
|
||||
proj-opt-set fts4
|
||||
proj-opt-set fts5
|
||||
proj-opt-set geopoly
|
||||
proj-opt-set rtree
|
||||
proj-opt-set session
|
||||
}
|
||||
fts3 -DSQLITE_ENABLE_FTS3 {sqlite-affirm-have-math fts3}
|
||||
fts4 -DSQLITE_ENABLE_FTS4 {sqlite-affirm-have-math fts4}
|
||||
fts5 -DSQLITE_ENABLE_FTS5 {sqlite-affirm-have-math fts5}
|
||||
geopoly -DSQLITE_ENABLE_GEOPOLY {proj-opt-set rtree}
|
||||
@@ -806,13 +718,8 @@ proc sqlite-handle-common-feature-flags {} {
|
||||
sqlite-add-feature-flag -DSQLITE_ENABLE_MEMSYS3
|
||||
}
|
||||
}
|
||||
bytecode-vtab -DSQLITE_ENABLE_BYTECODE_VTAB {}
|
||||
scanstatus {-DSQLITE_ENABLE_STMT_SCANSTATUS -DSQLITE_ENABLE_BYTECODE_VTAB} {}
|
||||
column-metadata -DSQLITE_ENABLE_COLUMN_METADATA {}
|
||||
dbpage -DSQLITE_ENABLE_DBPAGE_VTAB {}
|
||||
dbstat -DSQLITE_ENABLE_DBSTAT_VTAB {}
|
||||
carray -DSQLITE_ENABLE_CARRAY {}
|
||||
}] {
|
||||
scanstatus -DSQLITE_ENABLE_STMT_SCANSTATUS {}
|
||||
} {
|
||||
if {$boolFlag ni $::autosetup(options)} {
|
||||
# Skip flags which are in the canonical build but not
|
||||
# the autoconf bundle.
|
||||
@@ -864,9 +771,6 @@ proc sqlite-finalize-feature-flags {} {
|
||||
proj-assert {"canonical" eq $::sqliteConfig(build-mode)}
|
||||
msg-result "Appending source files to amalgamation: $extraSrc"
|
||||
}
|
||||
if {[lsearch [get-define TARGET_DEBUG ""] -DSQLITE_DEBUG=1] > -1} {
|
||||
msg-result "Note: this is a debug build, so performance will suffer."
|
||||
}
|
||||
}
|
||||
|
||||
########################################################################
|
||||
@@ -876,8 +780,7 @@ proc sqlite-finalize-feature-flags {} {
|
||||
proc sqlite-handle-debug {} {
|
||||
msg-checking "SQLITE_DEBUG build? "
|
||||
proj-if-opt-truthy debug {
|
||||
define TARGET_DEBUG {-g -DSQLITE_DEBUG=1 -O0 -Wall}
|
||||
sqlite-add-feature-flag -DSQLITE_ENABLE_SELECTTRACE -DSQLITE_ENABLE_WHERETRACE
|
||||
define TARGET_DEBUG {-g -DSQLITE_DEBUG=1 -DSQLITE_ENABLE_SELECTTRACE -DSQLITE_ENABLE_WHERETRACE -O0 -Wall}
|
||||
proj-opt-set memsys5
|
||||
msg-result yes
|
||||
} {
|
||||
@@ -1032,10 +935,8 @@ proc sqlite-handle-emsdk {} {
|
||||
# Maybe there's a copy in the path?
|
||||
proj-bin-define wasm-opt BIN_WASM_OPT
|
||||
}
|
||||
proj-dot-ins-append $emccSh.in $emccSh {
|
||||
catch {exec chmod u+x $dotInsOut}
|
||||
}
|
||||
proj-dot-ins-append $extWasmConfig.in $extWasmConfig
|
||||
proj-make-from-dot-in $emccSh $extWasmConfig
|
||||
catch {exec chmod u+x $emccSh}
|
||||
} else {
|
||||
define EMCC_WRAPPER ""
|
||||
file delete -force -- $emccSh $extWasmConfig
|
||||
@@ -1053,7 +954,7 @@ proc sqlite-handle-emsdk {} {
|
||||
proc sqlite-get-readline-dir-list {} {
|
||||
# Historical note: the dirs list, except for the inclusion of
|
||||
# $prefix and some platform-specific dirs, originates from the
|
||||
# legacy configure script.
|
||||
# legacy configure script
|
||||
set dirs [list [get-define prefix]]
|
||||
switch -glob -- [get-define host] {
|
||||
*-linux-android {
|
||||
@@ -1071,7 +972,7 @@ proc sqlite-get-readline-dir-list {} {
|
||||
if {[opt-val with-readline-ldflags] in {auto ""}} {
|
||||
# If the user did not supply their own --with-readline-ldflags
|
||||
# value, hijack that flag to inject options which are known to
|
||||
# work on Haiku OS installations.
|
||||
# work on a default Haiku installation.
|
||||
if {"" ne [glob -nocomplain /boot/system/lib/libreadline*]} {
|
||||
proj-opt-set with-readline-ldflags {-L/boot/system/lib -lreadline}
|
||||
}
|
||||
@@ -1121,8 +1022,8 @@ proc sqlite-get-readline-dir-list {} {
|
||||
# 4) Default to automatic search for optional readline
|
||||
#
|
||||
# 5) Try to find readline or editline. If it's not found AND the
|
||||
# corresponding --FEATURE flag was explicitly given then fail
|
||||
# fatally, else fail non-fatally.
|
||||
# corresponding --FEATURE flag was explicitly given, fail fatally,
|
||||
# else fail silently.
|
||||
proc sqlite-check-line-editing {} {
|
||||
msg-result "Checking for line-editing capability..."
|
||||
define HAVE_READLINE 0
|
||||
@@ -1135,7 +1036,7 @@ proc sqlite-check-line-editing {} {
|
||||
# if the library is not found.
|
||||
set libsForReadline {readline edit} ; # -l<LIB> names to check for readline().
|
||||
# The libedit check changes this.
|
||||
set editLibName "readline" ; # "readline" or "editline"
|
||||
set editLibName "readline" ; # "readline" or "editline"
|
||||
set editLibDef "HAVE_READLINE" ; # "HAVE_READLINE" or "HAVE_EDITLINE"
|
||||
set dirLn [opt-val with-linenoise]
|
||||
if {"" ne $dirLn} {
|
||||
@@ -1152,7 +1053,7 @@ proc sqlite-check-line-editing {} {
|
||||
foreach f $lnCOpts {
|
||||
if {[file exists $dirLn/$f]} {
|
||||
set lnC $dirLn/$f
|
||||
break
|
||||
break;
|
||||
}
|
||||
}
|
||||
if {"" eq $lnC} {
|
||||
@@ -1262,18 +1163,16 @@ proc sqlite-check-line-editing {} {
|
||||
set rlLib [opt-val with-readline-ldflags]
|
||||
#proc-debug "rlLib=$rlLib"
|
||||
if {$rlLib in {auto ""}} {
|
||||
set rlLib "" ; # make sure it's not "auto", as we may append to it below
|
||||
set libTerm ""; # lib with tgetent(3)
|
||||
if {[proj-check-function-in-lib tgetent [list $editLibName ncurses curses termcap]]} {
|
||||
set rlLib ""
|
||||
set libTerm ""
|
||||
if {[proj-check-function-in-lib tgetent "$editLibName ncurses curses termcap"]} {
|
||||
# ^^^ that libs list comes from the legacy configure script ^^^
|
||||
set libTerm [get-define lib_tgetent]
|
||||
undefine lib_tgetent
|
||||
}
|
||||
if {$editLibName eq $libTerm} {
|
||||
# tgetent(3) was found in the editing library
|
||||
set rlLib $libTerm
|
||||
} elseif {[proj-check-function-in-lib readline $libsForReadline $libTerm]} {
|
||||
# tgetent(3) was found in an external lib
|
||||
set rlLib [get-define lib_readline]
|
||||
lappend rlLib $libTerm
|
||||
undefine lib_readline
|
||||
@@ -1303,8 +1202,8 @@ proc sqlite-check-line-editing {} {
|
||||
msg-result "Using $editLibName flags: $rlInc $rlLib"
|
||||
# Check whether rl_completion_matches() has a signature we can use
|
||||
# and disable that sub-feature if it doesn't.
|
||||
if {![cctest -cflags "$rlInc -D${editLibDef}" -libs $rlLib -nooutput 1 \
|
||||
-source {
|
||||
if {![cctest \
|
||||
-cflags "$rlInc -D${editLibDef}" -libs $rlLib -nooutput 1 -source {
|
||||
#include <stdio.h>
|
||||
#ifdef HAVE_EDITLINE
|
||||
#include <editline/readline.h>
|
||||
@@ -1357,7 +1256,7 @@ proc sqlite-handle-line-editing {} {
|
||||
# - pkg-config: use only pkg-config to determine flags
|
||||
# - /path/to/icu-config: use that to determine flags
|
||||
#
|
||||
# If --with-icu-config is used and neither pkg-config nor icu-config
|
||||
# If --with-icu-config is used as neither pkg-config nor icu-config
|
||||
# are found, fail fatally.
|
||||
#
|
||||
# If both --with-icu-ldflags and --with-icu-config are provided, they
|
||||
@@ -1450,53 +1349,42 @@ proc sqlite-handle-icu {} {
|
||||
# Makes the following environment changes:
|
||||
#
|
||||
# - defines LDFLAGS_DLOPEN to any linker flags needed for this
|
||||
# feature. It may legally be empty on (A) some systems where
|
||||
# dlopen() is in libc and (B) certain Unix-esque Windows
|
||||
# environments which identify as Windows for SQLite's purposes so
|
||||
# use LoadLibrary().
|
||||
# feature. It may legally be empty on some systems where dlopen()
|
||||
# is in libc.
|
||||
#
|
||||
# - If the feature is not available, adds
|
||||
# -DSQLITE_OMIT_LOAD_EXTENSION=1 to the feature flags list.
|
||||
proc sqlite-handle-load-extension {} {
|
||||
define LDFLAGS_DLOPEN ""
|
||||
set found 0
|
||||
set suffix ""
|
||||
proj-if-opt-truthy load-extension {
|
||||
switch -glob -- [get-define host] {
|
||||
*-*-mingw* - *windows* {
|
||||
incr found
|
||||
set suffix "Using LoadLibrary()"
|
||||
}
|
||||
default {
|
||||
set found [proj-check-function-in-lib dlopen dl]
|
||||
if {$found} {
|
||||
set suffix [define LDFLAGS_DLOPEN [get-define lib_dlopen]]
|
||||
undefine lib_dlopen
|
||||
} else {
|
||||
if {[proj-opt-was-provided load-extension]} {
|
||||
# Explicit --enable-load-extension: fail if not found
|
||||
proj-indented-notice -error {
|
||||
--enable-load-extension was provided but dlopen()
|
||||
not found. Use --disable-load-extension to bypass this
|
||||
check.
|
||||
}
|
||||
} else {
|
||||
# It was implicitly enabled: warn if not found
|
||||
proj-indented-notice {
|
||||
WARNING: dlopen() not found, so loadable module support will
|
||||
be disabled. Use --disable-load-extension to bypass this
|
||||
check.
|
||||
}
|
||||
}
|
||||
set found [proj-check-function-in-lib dlopen dl]
|
||||
if {$found} {
|
||||
define LDFLAGS_DLOPEN [get-define lib_dlopen]
|
||||
undefine lib_dlopen
|
||||
} else {
|
||||
if {[proj-opt-was-provided load-extension]} {
|
||||
# Explicit --enable-load-extension: fail if not found
|
||||
proj-indented-notice -error {
|
||||
--enable-load-extension was provided but dlopen()
|
||||
not found. Use --disable-load-extension to bypass this
|
||||
check.
|
||||
}
|
||||
} else {
|
||||
# It was implicitly enabled: warn if not found
|
||||
proj-indented-notice {
|
||||
WARNING: dlopen() not found, so loadable module support will
|
||||
be disabled. Use --disable-load-extension to bypass this
|
||||
check.
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if {$found} {
|
||||
msg-result "Loadable extension support enabled. $suffix"
|
||||
msg-result "Loadable extension support enabled."
|
||||
} else {
|
||||
msg-result "Disabling loadable extension support. Use --enable-load-extension to enable them."
|
||||
sqlite-add-feature-flag -DSQLITE_OMIT_LOAD_EXTENSION=1
|
||||
sqlite-add-feature-flag {-DSQLITE_OMIT_LOAD_EXTENSION=1}
|
||||
}
|
||||
return $found
|
||||
}
|
||||
@@ -1510,7 +1398,7 @@ proc sqlite-handle-math {} {
|
||||
}
|
||||
define LDFLAGS_MATH [get-define lib_ceil]
|
||||
undefine lib_ceil
|
||||
sqlite-add-feature-flag -DSQLITE_ENABLE_MATH_FUNCTIONS -DSQLITE_ENABLE_PERCENTILE
|
||||
sqlite-add-feature-flag {-DSQLITE_ENABLE_MATH_FUNCTIONS}
|
||||
msg-result "Enabling math SQL functions"
|
||||
} {
|
||||
define LDFLAGS_MATH ""
|
||||
@@ -1550,41 +1438,6 @@ proc sqlite-handle-mac-cversion {} {
|
||||
return $rc
|
||||
}
|
||||
|
||||
########################################################################
|
||||
# If this is a Mac platform, check for support for
|
||||
# -Wl,-install_name,... and, if it's available, define
|
||||
# LDFLAGS_MAC_INSTALL_NAME to a variant of that string which is
|
||||
# intended to expand at make-time, else set LDFLAGS_MAC_INSTALL_NAME
|
||||
# to an empty string.
|
||||
#
|
||||
# https://sqlite.org/forum/forumpost/5651662b8875ec0a
|
||||
proc sqlite-handle-mac-install-name {} {
|
||||
define LDFLAGS_MAC_INSTALL_NAME ""; # {-Wl,-install_name,"$(install-dir.lib)/$(libsqlite3.DLL)"}
|
||||
set rc 0
|
||||
if {[proj-looks-like-mac]} {
|
||||
cc-with {-link 1} {
|
||||
if {[cc-check-flags "-Wl,-install_name,/usr/local/lib/libsqlite3.dylib"]} {
|
||||
define LDFLAGS_MAC_INSTALL_NAME {-Wl,-install_name,"$(install-dir.lib)/$(libsqlite3.DLL)"}
|
||||
set rc 1
|
||||
}
|
||||
}
|
||||
}
|
||||
return $rc
|
||||
}
|
||||
|
||||
#
|
||||
# Checks specific to HP-UX.
|
||||
#
|
||||
proc sqlite-handle-hpux {} {
|
||||
switch -glob -- [get-define host] {
|
||||
*hpux* {
|
||||
if {[cc-check-flags "-Ae"]} {
|
||||
define-append CFLAGS -Ae
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
########################################################################
|
||||
# Handles the --dll-basename configure flag. [define]'s
|
||||
# SQLITE_DLL_BASENAME to the DLL's preferred base name (minus
|
||||
@@ -1757,7 +1610,6 @@ proc sqlite-handle-env-quirks {} {
|
||||
sqlite-handle-dll-basename
|
||||
sqlite-handle-out-implib
|
||||
sqlite-handle-mac-cversion
|
||||
sqlite-handle-mac-install-name
|
||||
if {[llength [info proc sqlite-custom-handle-flags]] > 0} {
|
||||
# sqlite-custom-handle-flags is assumed to be imported via a
|
||||
# client-specific import: autosetup/sqlite-custom.tcl.
|
||||
@@ -1780,7 +1632,15 @@ proc sqlite-process-dot-in-files {} {
|
||||
# (e.g. [proj-check-rpath]) may do so before we "mangle" them here.
|
||||
proj-remap-autoconf-dir-vars
|
||||
|
||||
proj-dot-ins-process -validate
|
||||
set srcdir $::autosetup(srcdir)/
|
||||
foreach f {Makefile sqlite3.pc} {
|
||||
if {[file exists $srcdir/$f.in]} {
|
||||
# ^^^ we do this only so that this block can be made to work for
|
||||
# multiple builds. e.g. the tea build (under construction) does
|
||||
# not hae sqlite3.pc.in.
|
||||
proj-make-from-dot-in -touch $f
|
||||
}
|
||||
}
|
||||
make-config-header sqlite_cfg.h \
|
||||
-bare {SIZEOF_* HAVE_DECL_*} \
|
||||
-none {HAVE_CFLAG_* LDFLAGS_* SH_* SQLITE_AUTORECONFIG
|
||||
@@ -1790,6 +1650,32 @@ proc sqlite-process-dot-in-files {} {
|
||||
proj-touch sqlite_cfg.h ; # help avoid frequent unnecessary @SQLITE_AUTORECONFIG@
|
||||
}
|
||||
|
||||
########################################################################
|
||||
# Perform some high-level validation on the generated files...
|
||||
#
|
||||
# 1) Ensure that no unresolved @VAR@ placeholders are in files which
|
||||
# use those.
|
||||
#
|
||||
# 2) TBD
|
||||
proc sqlite-post-config-validation {} {
|
||||
# Check #1: ensure that files which get filtered for @VAR@ do not
|
||||
# contain any unresolved @VAR@ refs. That may indicate an
|
||||
# unexported/unused var or a typo.
|
||||
set srcdir $::autosetup(srcdir)
|
||||
foreach f [list Makefile sqlite3.pc \
|
||||
$srcdir/tool/emcc.sh \
|
||||
$srcdir/ext/wasm/config.make] {
|
||||
if {![file exists $f]} continue
|
||||
set lnno 1
|
||||
foreach line [proj-file-content-list $f] {
|
||||
if {[regexp {(@[A-Za-z0-9_]+@)} $line match]} {
|
||||
error "Unresolved reference to $match at line $lnno of $f"
|
||||
}
|
||||
incr lnno
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
########################################################################
|
||||
# Handle --with-wasi-sdk[=DIR]
|
||||
#
|
||||
@@ -2034,14 +1920,13 @@ proc sqlite-check-tcl {} {
|
||||
# TCLLIBDIR from here, which will cause the canonical makefile to
|
||||
# use this one rather than to re-calculate it at make-time.
|
||||
set tcllibdir [get-env TCLLIBDIR ""]
|
||||
set sq3Ver [get-define PACKAGE_VERSION]
|
||||
if {"" eq $tcllibdir} {
|
||||
# Attempt to extract TCLLIBDIR from TCL's $auto_path
|
||||
if {"" ne $with_tclsh &&
|
||||
[catch {exec echo "puts stdout \$auto_path" | "$with_tclsh"} result] == 0} {
|
||||
foreach i $result {
|
||||
if {[file isdir $i]} {
|
||||
set tcllibdir $i/sqlite${sq3Ver}
|
||||
set tcllibdir $i/sqlite3
|
||||
break
|
||||
}
|
||||
}
|
||||
@@ -2173,35 +2058,20 @@ proc sqlite-determine-codegen-tcl {} {
|
||||
}; # sqlite-determine-codegen-tcl
|
||||
|
||||
########################################################################
|
||||
# Runs sqlite-check-tcl and, if this is the canonical build,
|
||||
# sqlite-determine-codegen-tcl.
|
||||
proc sqlite-handle-tcl {} {
|
||||
# Runs sqlite-check-tcl and, if $alsoCheckCodeGen is true,
|
||||
# sqlite-determine-codegen-tcl (intended only for the canonical
|
||||
# build).
|
||||
proc sqlite-handle-tcl {{alsoCheckCodeGen 1}} {
|
||||
sqlite-check-tcl
|
||||
if {"canonical" ne $::sqliteConfig(build-mode)} return
|
||||
msg-result "TCL for code generation: [sqlite-determine-codegen-tcl]"
|
||||
|
||||
# Determine the base name of the Tcl extension's DLL
|
||||
#
|
||||
if {[get-define HAVE_TCL]} {
|
||||
if {[string match *-cygwin [get-define host]]} {
|
||||
set libname cyg
|
||||
} else {
|
||||
set libname lib
|
||||
}
|
||||
if {[get-define TCL_MAJOR_VERSION] > 8} {
|
||||
append libname tcl9
|
||||
}
|
||||
append libname sqlite
|
||||
} else {
|
||||
set libname ""
|
||||
if {$alsoCheckCodeGen} {
|
||||
msg-result "TCL for code generation: [sqlite-determine-codegen-tcl]"
|
||||
}
|
||||
define TCL_EXT_DLL_BASENAME $libname
|
||||
# The extension is added in the makefile
|
||||
}
|
||||
|
||||
########################################################################
|
||||
# Handle the --enable/disable-rpath flag.
|
||||
proc sqlite-handle-rpath {} {
|
||||
proj-check-rpath
|
||||
# autosetup/cc-shared.tcl sets the rpath flag definition in
|
||||
# [get-define SH_LINKRPATH], but it does so on a per-platform basis
|
||||
# rather than as a compiler check. Though we should do a proper
|
||||
@@ -2210,13 +2080,12 @@ proc sqlite-handle-rpath {} {
|
||||
# for which sqlite-env-is-unix-on-windows returns a non-empty
|
||||
# string.
|
||||
|
||||
# https://sqlite.org/forum/forumpost/13cac3b56516f849
|
||||
if {[proj-opt-truthy rpath]} {
|
||||
proj-check-rpath
|
||||
} else {
|
||||
msg-result "Disabling use of rpath."
|
||||
define LDFLAGS_RPATH ""
|
||||
}
|
||||
# if {[proj-opt-truthy rpath]} {
|
||||
# proj-check-rpath
|
||||
# } else {
|
||||
# msg-result "Disabling use of rpath."
|
||||
# define LDFLAGS_RPATH ""
|
||||
# }
|
||||
}
|
||||
|
||||
########################################################################
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
The *.tcl files in this directory are part of the SQLite's "autoconf"
|
||||
bundle which are specific to the TEA(-ish) build. During the tarball
|
||||
generation process, they are copied into <TOP>/autoconf/autosetup/teaish
|
||||
(which itself is created as part of that process).
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,214 +0,0 @@
|
||||
########################################################################
|
||||
# 2025 April 7
|
||||
#
|
||||
# The author disclaims copyright to this source code. In place of
|
||||
# a legal notice, here is a blessing:
|
||||
#
|
||||
# * May you do good and not evil.
|
||||
# * May you find forgiveness for yourself and forgive others.
|
||||
# * May you share freely, never taking more than you give.
|
||||
#
|
||||
########################################################################
|
||||
# ----- @module feature-tests.tcl -----
|
||||
# @section TEA-ish collection of feature tests.
|
||||
#
|
||||
# Functions in this file with a prefix of teaish__ are
|
||||
# private/internal APIs. Those with a prefix of teaish- are
|
||||
# public APIs.
|
||||
|
||||
|
||||
# @teaish-check-libz
|
||||
#
|
||||
# Checks for zlib.h and the function deflate in libz. If found,
|
||||
# prepends -lz to the extension's ldflags and returns 1, else returns
|
||||
# 0. It also defines LDFLAGS_LIBZ to the libs flag.
|
||||
#
|
||||
proc teaish-check-libz {} {
|
||||
teaish-check-cached "Checking for libz" {
|
||||
set rc 0
|
||||
if {[msg-quiet cc-check-includes zlib.h] && [msg-quiet proj-check-function-in-lib deflate z]} {
|
||||
teaish-ldflags-prepend [define LDFLAGS_LIBZ [get-define lib_deflate]]
|
||||
undefine lib_deflate
|
||||
incr rc
|
||||
}
|
||||
expr $rc
|
||||
}
|
||||
}
|
||||
|
||||
# @teaish-check-librt ?funclist?
|
||||
#
|
||||
# Checks whether -lrt is needed for any of the given functions. If
|
||||
# so, appends -lrt via [teaish-ldflags-prepend] and returns 1, else
|
||||
# returns 0. It also defines LDFLAGS_LIBRT to the libs flag or an
|
||||
# empty string.
|
||||
#
|
||||
# Some systems (ex: SunOS) require -lrt in order to use nanosleep.
|
||||
#
|
||||
proc teaish-check-librt {{funclist {fdatasync nanosleep}}} {
|
||||
teaish-check-cached -nostatus "Checking whether ($funclist) need librt" {
|
||||
define LDFLAGS_LIBRT ""
|
||||
foreach func $funclist {
|
||||
if {[msg-quiet proj-check-function-in-lib $func rt]} {
|
||||
set ldrt [get-define lib_${func}]
|
||||
undefine lib_${func}
|
||||
if {"" ne $ldrt} {
|
||||
teaish-ldflags-prepend -r [define LDFLAGS_LIBRT $ldrt]
|
||||
msg-result $ldrt
|
||||
return 1
|
||||
} else {
|
||||
msg-result "no lib needed"
|
||||
return 1
|
||||
}
|
||||
}
|
||||
}
|
||||
msg-result "not found"
|
||||
return 0
|
||||
}
|
||||
}
|
||||
|
||||
# @teaish-check-stdint
|
||||
#
|
||||
# A thin proxy for [cc-with] which checks for <stdint.h> and the
|
||||
# various fixed-size int types it declares. It defines HAVE_STDINT_T
|
||||
# to 0 or 1 and (if it's 1) defines HAVE_XYZ_T for each XYZ int type
|
||||
# to 0 or 1, depending on whether its available.
|
||||
proc teaish-check-stdint {} {
|
||||
teaish-check-cached "Checking for stdint.h" {
|
||||
msg-quiet cc-with {-includes stdint.h} \
|
||||
{cc-check-types int8_t int16_t int32_t int64_t intptr_t \
|
||||
uint8_t uint16_t uint32_t uint64_t uintptr_t}
|
||||
}
|
||||
}
|
||||
|
||||
# @teaish-is-mingw
|
||||
#
|
||||
# Returns 1 if building for mingw, else 0.
|
||||
proc teaish-is-mingw {} {
|
||||
return [expr {
|
||||
[string match *mingw* [get-define host]] &&
|
||||
![file exists /dev/null]
|
||||
}]
|
||||
}
|
||||
|
||||
# @teaish-check-libdl
|
||||
#
|
||||
# Checks for whether dlopen() can be found and whether it requires
|
||||
# -ldl for linking. If found, returns 1, defines LDFLAGS_DLOPEN to the
|
||||
# linker flags (if any), and passes those flags to
|
||||
# teaish-ldflags-prepend. It unconditionally defines HAVE_DLOPEN to 0
|
||||
# or 1 (the its return result value).
|
||||
proc teaish-check-dlopen {} {
|
||||
teaish-check-cached -nostatus "Checking for dlopen()" {
|
||||
set rc 0
|
||||
set lfl ""
|
||||
if {[cc-with {-includes dlfcn.h} {
|
||||
cctest -link 1 -declare "extern char* dlerror(void);" -code "dlerror();"}]} {
|
||||
msg-result "-ldl not needed"
|
||||
incr rc
|
||||
} elseif {[cc-check-includes dlfcn.h]} {
|
||||
incr rc
|
||||
if {[cc-check-function-in-lib dlopen dl]} {
|
||||
set lfl [get-define lib_dlopen]
|
||||
undefine lib_dlopen
|
||||
msg-result " dlopen() needs $lfl"
|
||||
} else {
|
||||
msg-result " - dlopen() not found in libdl. Assuming dlopen() is built-in."
|
||||
}
|
||||
} else {
|
||||
msg-result "not found"
|
||||
}
|
||||
teaish-ldflags-prepend [define LDFLAGS_DLOPEN $lfl]
|
||||
define HAVE_DLOPEN $rc
|
||||
}
|
||||
}
|
||||
|
||||
#
|
||||
# @teaish-check-libmath
|
||||
#
|
||||
# Handles the --enable-math flag. Returns 1 if found, else 0.
|
||||
# If found, it prepends -lm (if needed) to the linker flags.
|
||||
proc teaish-check-libmath {} {
|
||||
teaish-check-cached "Checking for libc math library" {
|
||||
set lfl ""
|
||||
set rc 0
|
||||
if {[msg-quiet proj-check-function-in-lib ceil m]} {
|
||||
incr rc
|
||||
set lfl [get-define lib_ceil]
|
||||
undefine lib_ceil
|
||||
teaish-ldflags-prepend $lfl
|
||||
msg-checking "$lfl "
|
||||
}
|
||||
define LDFLAGS_LIBMATH $lfl
|
||||
expr $rc
|
||||
}
|
||||
}
|
||||
|
||||
# @teaish-import-features ?-flags? feature-names...
|
||||
#
|
||||
# For each $name in feature-names... it invokes:
|
||||
#
|
||||
# use teaish/feature/$name
|
||||
#
|
||||
# to load TEAISH_AUTOSETUP_DIR/feature/$name.tcl
|
||||
#
|
||||
# By default, if a proc named teaish-check-${name}-options is defined
|
||||
# after sourcing a file, it is called and its result is passed to
|
||||
# proj-append-options. This can be suppressed with the -no-options
|
||||
# flag.
|
||||
#
|
||||
# Flags:
|
||||
#
|
||||
# -no-options: disables the automatic running of
|
||||
# teaish-check-NAME-options,
|
||||
#
|
||||
# -run: if the function teaish-check-NAME exists after importing
|
||||
# then it is called. This flag must not be used when calling this
|
||||
# function from teaish-options. This trumps both -pre and -post.
|
||||
#
|
||||
# -pre: if the function teaish-check-NAME exists after importing
|
||||
# then it is passed to [teaish-checks-queue -pre].
|
||||
#
|
||||
# -post: works like -pre but instead uses[teaish-checks-queue -post].
|
||||
proc teaish-import-features {args} {
|
||||
set pk ""
|
||||
set doOpt 1
|
||||
proj-parse-simple-flags args flags {
|
||||
-no-options 0 {set doOpt 0}
|
||||
-run 0 {expr 1}
|
||||
-pre 0 {set pk -pre}
|
||||
-post 0 {set pk -post}
|
||||
}
|
||||
#
|
||||
# TODO: never import the same module more than once. The "use"
|
||||
# command is smart enough to not do that but we would need to
|
||||
# remember whether or not any teaish-check-${arg}* procs have been
|
||||
# called before, and skip them.
|
||||
#
|
||||
if {$flags(-run) && "" ne $pk} {
|
||||
proj-error "Cannot use both -run and $pk" \
|
||||
" (called from [proj-scope 1])"
|
||||
}
|
||||
|
||||
foreach arg $args {
|
||||
uplevel "use teaish/feature/$arg"
|
||||
if {$doOpt} {
|
||||
set n "teaish-check-${arg}-options"
|
||||
if {[llength [info proc $n]] > 0} {
|
||||
if {"" ne [set x [$n]]} {
|
||||
options-add $x
|
||||
}
|
||||
}
|
||||
}
|
||||
if {$flags(-run)} {
|
||||
set n "teaish-check-${arg}"
|
||||
if {[llength [info proc $n]] > 0} {
|
||||
uplevel 1 $n
|
||||
}
|
||||
} elseif {"" ne $pk} {
|
||||
set n "teaish-check-${arg}"
|
||||
if {[llength [info proc $n]] > 0} {
|
||||
teaish-checks-queue {*}$pk $n
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,293 +0,0 @@
|
||||
########################################################################
|
||||
# 2025 April 5
|
||||
#
|
||||
# The author disclaims copyright to this source code. In place of
|
||||
# a legal notice, here is a blessing:
|
||||
#
|
||||
# * May you do good and not evil.
|
||||
# * May you find forgiveness for yourself and forgive others.
|
||||
# * May you share freely, never taking more than you give.
|
||||
#
|
||||
########################################################################
|
||||
#
|
||||
# Helper routines for running tests on teaish extensions
|
||||
#
|
||||
########################################################################
|
||||
# ----- @module teaish/tester.tcl -----
|
||||
#
|
||||
# @section TEA-ish Testing APIs.
|
||||
#
|
||||
# Though these are part of the autosup dir hierarchy, they are not
|
||||
# intended to be run from autosetup code. Rather, they're for use
|
||||
# with/via teaish.tester.tcl and target canonical Tcl only, not JimTcl
|
||||
# (which the autosetup pieces do target).
|
||||
|
||||
#
|
||||
# @test-current-scope ?lvl?
|
||||
#
|
||||
# Returns the name of the _calling_ proc from ($lvl + 1) levels up the
|
||||
# call stack (where the caller's level will be 1 up from _this_
|
||||
# call). If $lvl would resolve to global scope "global scope" is
|
||||
# returned and if it would be negative then a string indicating such
|
||||
# is returned (as opposed to throwing an error).
|
||||
#
|
||||
proc test-current-scope {{lvl 0}} {
|
||||
#uplevel [expr {$lvl + 1}] {lindex [info level 0] 0}
|
||||
set ilvl [info level]
|
||||
set offset [expr {$ilvl - $lvl - 1}]
|
||||
if { $offset < 0} {
|
||||
return "invalid scope ($offset)"
|
||||
} elseif { $offset == 0} {
|
||||
return "global scope"
|
||||
} else {
|
||||
return [lindex [info level $offset] 0]
|
||||
}
|
||||
}
|
||||
|
||||
# @test-msg
|
||||
#
|
||||
# Emits all arugments to stdout.
|
||||
#
|
||||
proc test-msg {args} {
|
||||
puts "$args"
|
||||
}
|
||||
|
||||
# @test-warn
|
||||
#
|
||||
# Emits all arugments to stderr.
|
||||
#
|
||||
proc test-warn {args} {
|
||||
puts stderr "WARNING: $args"
|
||||
}
|
||||
|
||||
#
|
||||
# @test-error msg
|
||||
#
|
||||
# Triggers a test-failed error with a string describing the calling
|
||||
# scope and the provided message.
|
||||
#
|
||||
proc test-fail {args} {
|
||||
#puts stderr "ERROR: \[[test-current-scope 1]]: $msg"
|
||||
#exit 1
|
||||
error "FAIL: \[[test-current-scope 1]]: $args"
|
||||
}
|
||||
|
||||
array set ::test__Counters {}
|
||||
array set ::test__Config {
|
||||
verbose-assert 0 verbose-affirm 0
|
||||
}
|
||||
|
||||
# Internal impl for affirm and assert.
|
||||
#
|
||||
# $args = ?-v? script {msg-on-fail ""}
|
||||
proc test__affert {failMode args} {
|
||||
if {$failMode} {
|
||||
set what assert
|
||||
} else {
|
||||
set what affirm
|
||||
}
|
||||
set verbose $::test__Config(verbose-$what)
|
||||
if {"-v" eq [lindex $args 0]} {
|
||||
lassign $args - script msg
|
||||
if {1 == [llength $args]} {
|
||||
# If -v is the only arg, toggle default verbose mode
|
||||
set ::test__Config(verbose-$what) [expr {!$::test__Config(verbose-$what)}]
|
||||
return
|
||||
}
|
||||
incr verbose
|
||||
} else {
|
||||
lassign $args script msg
|
||||
}
|
||||
incr ::test__Counters($what)
|
||||
if {![uplevel 1 expr [list $script]]} {
|
||||
if {"" eq $msg} {
|
||||
set msg $script
|
||||
}
|
||||
set txt [join [list $what # $::test__Counters($what) "failed:" $msg]]
|
||||
if {$failMode} {
|
||||
puts stderr $txt
|
||||
exit 1
|
||||
} else {
|
||||
error $txt
|
||||
}
|
||||
} elseif {$verbose} {
|
||||
puts stderr [join [list $what # $::test__Counters($what) "passed:" $script]]
|
||||
}
|
||||
}
|
||||
|
||||
#
|
||||
# @affirm ?-v? script ?msg?
|
||||
#
|
||||
# Works like a conventional assert method does, but reports failures
|
||||
# using [error] instead of [exit]. If -v is used, it reports passing
|
||||
# assertions to stderr. $script is evaluated in the caller's scope as
|
||||
# an argument to [expr].
|
||||
#
|
||||
proc affirm {args} {
|
||||
tailcall test__affert 0 {*}$args
|
||||
}
|
||||
|
||||
#
|
||||
# @assert ?-v? script ?msg?
|
||||
#
|
||||
# Works like [affirm] but exits on error.
|
||||
#
|
||||
proc assert {args} {
|
||||
tailcall test__affert 1 {*}$args
|
||||
}
|
||||
|
||||
#
|
||||
# @assert-matches ?-e? pattern ?-e? rhs ?msg?
|
||||
#
|
||||
# Equivalent to assert {[string match $pattern $rhs]} except that
|
||||
# if either of those are prefixed with an -e flag, they are eval'd
|
||||
# and their results are used.
|
||||
#
|
||||
proc assert-matches {args} {
|
||||
set evalLhs 0
|
||||
set evalRhs 0
|
||||
if {"-e" eq [lindex $args 0]} {
|
||||
incr evalLhs
|
||||
set args [lassign $args -]
|
||||
}
|
||||
set args [lassign $args pattern]
|
||||
if {"-e" eq [lindex $args 0]} {
|
||||
incr evalRhs
|
||||
set args [lassign $args -]
|
||||
}
|
||||
set args [lassign $args rhs msg]
|
||||
|
||||
if {$evalLhs} {
|
||||
set pattern [uplevel 1 $pattern]
|
||||
}
|
||||
if {$evalRhs} {
|
||||
set rhs [uplevel 1 $rhs]
|
||||
}
|
||||
#puts "***pattern=$pattern\n***rhs=$rhs"
|
||||
tailcall test__affert 1 \
|
||||
[join [list \[ string match [list $pattern] [list $rhs] \]]] $msg
|
||||
# why does this not work? [list \[ string match [list $pattern] [list $rhs] \]] $msg
|
||||
# "\[string match [list $pattern] [list $rhs]\]"
|
||||
}
|
||||
|
||||
#
|
||||
# @test-assert testId script ?msg?
|
||||
#
|
||||
# Works like [assert] but emits $testId to stdout first.
|
||||
#
|
||||
proc test-assert {testId script {msg ""}} {
|
||||
puts "test $testId"
|
||||
tailcall test__affert 1 $script $msg
|
||||
}
|
||||
|
||||
#
|
||||
# @test-expect testId script result
|
||||
#
|
||||
# Runs $script in the calling scope and compares its result to
|
||||
# $result, minus any leading or trailing whitespace. If they differ,
|
||||
# it triggers an [assert].
|
||||
#
|
||||
proc test-expect {testId script result} {
|
||||
puts "test $testId"
|
||||
set x [string trim [uplevel 1 $script]]
|
||||
set result [string trim $result]
|
||||
tailcall test__affert 0 [list "{$x}" eq "{$result}"] \
|
||||
"\nEXPECTED: <<$result>>\nGOT: <<$x>>"
|
||||
}
|
||||
|
||||
#
|
||||
# @test-catch cmd ?...args?
|
||||
#
|
||||
# Runs [cmd ...args], repressing any exception except to possibly log
|
||||
# the failure. Returns 1 if it caught anything, 0 if it didn't.
|
||||
#
|
||||
proc test-catch {cmd args} {
|
||||
if {[catch {
|
||||
uplevel 1 $cmd {*}$args
|
||||
} rc xopts]} {
|
||||
puts "[test-current-scope] ignoring failure of: $cmd [lindex $args 0]: $rc"
|
||||
return 1
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
#
|
||||
# @test-catch-matching pattern (script|cmd args...)
|
||||
#
|
||||
# Works like test-catch, but it expects its argument(s) to to throw an
|
||||
# error matching the given string (checked with [string match]). If
|
||||
# they do not throw, or the error does not match $pattern, this
|
||||
# function throws, else it returns 1.
|
||||
#
|
||||
# If there is no second argument, the $cmd is assumed to be a script,
|
||||
# and will be eval'd in the caller's scope.
|
||||
#
|
||||
# TODO: add -glob and -regex flags to control matching flavor.
|
||||
#
|
||||
proc test-catch-matching {pattern cmd args} {
|
||||
if {[catch {
|
||||
#puts "**** catch-matching cmd=$cmd args=$args"
|
||||
if {0 == [llength $args]} {
|
||||
uplevel 1 $cmd {*}$args
|
||||
} else {
|
||||
$cmd {*}$args
|
||||
}
|
||||
} rc xopts]} {
|
||||
if {[string match $pattern $rc]} {
|
||||
return 1
|
||||
} else {
|
||||
error "[test-current-scope] exception does not match {$pattern}: {$rc}"
|
||||
}
|
||||
}
|
||||
error "[test-current-scope] expecting to see an error matching {$pattern}"
|
||||
}
|
||||
|
||||
if {![array exists ::teaish__BuildFlags]} {
|
||||
array set ::teaish__BuildFlags {}
|
||||
}
|
||||
|
||||
#
|
||||
# @teaish-build-flag3 flag tgtVar ?dflt?
|
||||
#
|
||||
# If the current build has the configure-time flag named $flag set
|
||||
# then tgtVar is assigned its value and 1 is returned, else tgtVal is
|
||||
# assigned $dflt and 0 is returned.
|
||||
#
|
||||
# Caveat #1: only valid when called in the context of teaish's default
|
||||
# "make test" recipe, e.g. from teaish.test.tcl. It is not valid from
|
||||
# a teaish.tcl configure script because (A) the state it relies on
|
||||
# doesn't fully exist at that point and (B) that level of the API has
|
||||
# more direct access to the build state. This function requires that
|
||||
# an external script have populated its internal state, which is
|
||||
# normally handled via teaish.tester.tcl.in.
|
||||
#
|
||||
# Caveat #2: defines in the style of HAVE_FEATURENAME with a value of
|
||||
# 0 are, by long-standing configure script conventions, treated as
|
||||
# _undefined_ here.
|
||||
#
|
||||
proc teaish-build-flag3 {flag tgtVar {dflt ""}} {
|
||||
upvar $tgtVar tgt
|
||||
if {[info exists ::teaish__BuildFlags($flag)]} {
|
||||
set tgt $::teaish__BuildFlags($flag)
|
||||
return 1;
|
||||
} elseif {0==[array size ::teaish__BuildFlags]} {
|
||||
test-warn \
|
||||
"\[[test-current-scope]] was called from " \
|
||||
"[test-current-scope 1] without the build flags imported."
|
||||
}
|
||||
set tgt $dflt
|
||||
return 0
|
||||
}
|
||||
|
||||
#
|
||||
# @teaish-build-flag flag ?dflt?
|
||||
#
|
||||
# Convenience form of teaish-build-flag3 which returns the
|
||||
# configure-time-defined value of $flag or "" if it's not defined (or
|
||||
# if it's an empty string).
|
||||
#
|
||||
proc teaish-build-flag {flag {dflt ""}} {
|
||||
set tgt ""
|
||||
teaish-build-flag3 $flag tgt $dflt
|
||||
return $tgt
|
||||
}
|
||||
+3
-10
@@ -22,10 +22,9 @@ guidance on building for Windows.
|
||||
or <https://sqlite.org/tmp/tcl9.0.0.tar.gz>.
|
||||
<li>Untar the source archive. CD into the "unix/" subfolder
|
||||
of the source tree.
|
||||
<li>Run:   `mkdir $HOME/local`
|
||||
<li>Run:   `./configure --prefix=$HOME/local`<br>
|
||||
SQLite deliverable builds add:   `--static CFLAGS=-Os`
|
||||
<li>Run:   `make install`
|
||||
<li>Run: `mkdir $HOME/local`
|
||||
<li>Run: `./configure --prefix=$HOME/local`
|
||||
<li>Run: `make install`
|
||||
</ol>
|
||||
<p>
|
||||
As of 2024-10-25, TCL is not longer required for many
|
||||
@@ -42,12 +41,6 @@ guidance on building for Windows.
|
||||
You do not need to use --with-tclsh if the tclsh you want to use is the
|
||||
first one on your PATH or if you are building without TCL.
|
||||
|
||||
The SQLite developers typically add the
|
||||
  `--with-linenoise=$HOME/linenoise`   option
|
||||
to provide command-line editing. "$HOME/linenoise" is a directory
|
||||
that contains [linenoise](https://github.com/antirez/linenoise) source
|
||||
code files, `linenoise.c` and `linenoise.h`.
|
||||
|
||||
6. Run the "`Makefile`" makefile with an appropriate target.
|
||||
Examples:
|
||||
<ul>
|
||||
|
||||
+17
-44
@@ -1,7 +1,7 @@
|
||||
# Notes On Compiling SQLite On Windows 11
|
||||
|
||||
Below are step-by-step instructions on how to build SQLite from
|
||||
canonical source on a new Windows 11 PC, as of 2025-10-31.
|
||||
canonical source on a new Windows 11 PC, as of 2024-10-09.
|
||||
See [](./compile-for-unix.md) for a similar guide for unix-like
|
||||
systems, including MacOS.
|
||||
|
||||
@@ -24,8 +24,7 @@ systems, including MacOS.
|
||||
application to your task bar, as you will use it a lot. Bring up
|
||||
an instance of this command prompt and do all of the subsequent steps
|
||||
in that "x64 Native Tools" command prompt. (Or use "x86" if you want
|
||||
a 32-bit build. Or use "ARM64" if you want to do a build for Windows
|
||||
on ARM.) The subsequent steps will not work in a vanilla
|
||||
a 32-bit build.) The subsequent steps will not work in a vanilla
|
||||
DOS prompt. Nor will they work in PowerShell.
|
||||
|
||||
3. *(Optional):* Install TCL development libraries.
|
||||
@@ -134,7 +133,9 @@ following minor changes:
|
||||
The command the developers use for building the deliverable DLL on the
|
||||
[download page](https://sqlite.org/download.html) is as follows:
|
||||
|
||||
> nmake /f Makefile.msc sqlite3.dll USE_NATIVE_LIBPATHS=1 "OPTS=-DSQLITE_ENABLE_FTS3=1 -DSQLITE_ENABLE_FTS4=1 -DSQLITE_ENABLE_FTS5=1 -DSQLITE_ENABLE_RTREE=1 -DSQLITE_ENABLE_JSON1=1 -DSQLITE_ENABLE_GEOPOLY=1 -DSQLITE_ENABLE_SESSION=1 -DSQLITE_ENABLE_PREUPDATE_HOOK=1 -DSQLITE_ENABLE_SERIALIZE=1 -DSQLITE_ENABLE_MATH_FUNCTIONS=1"
|
||||
> ~~~~
|
||||
nmake /f Makefile.msc sqlite3.dll USE_NATIVE_LIBPATHS=1 "OPTS=-DSQLITE_ENABLE_FTS3=1 -DSQLITE_ENABLE_FTS4=1 -DSQLITE_ENABLE_FTS5=1 -DSQLITE_ENABLE_RTREE=1 -DSQLITE_ENABLE_JSON1=1 -DSQLITE_ENABLE_GEOPOLY=1 -DSQLITE_ENABLE_SESSION=1 -DSQLITE_ENABLE_PREUPDATE_HOOK=1 -DSQLITE_ENABLE_SERIALIZE=1 -DSQLITE_ENABLE_MATH_FUNCTIONS=1"
|
||||
~~~~
|
||||
|
||||
That command generates both the sqlite3.dll and sqlite3.def files. The same
|
||||
command works for both 32-bit and 64-bit builds.
|
||||
@@ -146,7 +147,9 @@ with TCL in order to function. The [sqlite3_analyzer.exe program](https://sqlit
|
||||
is an example. You can build as described above, and then
|
||||
enter:
|
||||
|
||||
> nmake /f Makefile.msc sqlite3_analyzer.exe
|
||||
> ~~~~
|
||||
nmake /f Makefile.msc sqlite3_analyzer.exe
|
||||
~~~~
|
||||
|
||||
And you will end up with a working executable. However, that executable
|
||||
will depend on having the "tcl98.dll" library somewhere on your %PATH%.
|
||||
@@ -172,47 +175,17 @@ statically linked so that it does not depend on separate DLL:
|
||||
5. CD into your SQLite source code directory and build the desired
|
||||
utility program, but add the following extra argument to the
|
||||
nmake command line:
|
||||
<blockquote><pre>STATICALLY_LINK_TCL=1</pre></blockquote>
|
||||
<blockquote><pre>
|
||||
STATICALLY_LINK_TCL=1
|
||||
</pre></blockquote>
|
||||
<p>So, for example, to build a statically linked version of
|
||||
sqlite3_analyzer.exe, you might type:
|
||||
<blockquote><pre>nmake /f Makefile.msc STATICALLY_LINK_TCL=1 sqlite3_analyzer.exe</pre></blockquote>
|
||||
<blockquote><pre>
|
||||
nmake /f Makefile.msc STATICALLY_LINK_TCL=1 sqlite3_analyzer.exe
|
||||
</pre></blockquote>
|
||||
|
||||
6. After your executable is built, you can verify that it does not
|
||||
depend on the TCL DLL by running:
|
||||
<blockquote><pre>dumpbin /dependents sqlite3_analyzer.exe</pre></blockquote>
|
||||
|
||||
## Linking Against ZLIB
|
||||
|
||||
Some feature (such as zip-file support in the CLI) require the ZLIB
|
||||
compression library. That library is more or less universally available
|
||||
on unix platforms, but is seldom provided on Windows. You will probably
|
||||
need to provide it yourself. Here the the steps needed:
|
||||
|
||||
1. Download the zlib-1.3.1.tar.gz tarball (or a similar version).
|
||||
Unpack the tarball sources. You can put them wherever you like.
|
||||
For the purposes of this document, let's assume you put the source
|
||||
tree in c:\\zlib-64. Note: If you are building for both x64 and
|
||||
x86, you will need separate builds of ZLIB for each, thus separate
|
||||
build directories.
|
||||
|
||||
2. Before building SQLite (as described above) first make these
|
||||
environment changes. The lead-programmer for SQLite (who writes
|
||||
these words) has BAT files named "env-x64.bat" and "env-x32.bat"
|
||||
and "env-arm64.bat" that make these changes, and he runs those
|
||||
BAT file whenever he starts a new shell. These are the settings
|
||||
needed:
|
||||
<blockquote>
|
||||
set USE_ZLIB=1<br>
|
||||
set BUILD_ZLIB=0<br>
|
||||
set ZLIBDIR=c:\\zlib-64
|
||||
</blockquote>
|
||||
|
||||
3. Because the settings in step 2 specify "BUILD_ZLIB=0", you will need
|
||||
to build the library at least once. I recommand:
|
||||
<blockquote>
|
||||
make clean sqlite3.exe BUILD_ZLIB=1
|
||||
</blockquote>
|
||||
|
||||
4. After making the environment changes specified in steps 1 through 3
|
||||
above, you then build and test SQLite as you normally would. The
|
||||
environment variable changes will cause ZLIB to be linked automatically.
|
||||
<blockquote><pre>
|
||||
dumpbin /dependents sqlite3_analyzer.exe
|
||||
</pre></blockquote>
|
||||
|
||||
+9
-8
@@ -149,10 +149,11 @@ RFC 8259 format, without extensions. The payload is the ASCII
|
||||
text representation of that numeric value.
|
||||
|
||||
<li value="4"><p><b>INT5</b> →
|
||||
The element is a JSON integer literal in hexadecimal notation.
|
||||
The payload is the ASCII text representation of the literal.
|
||||
Because the payload is in a non-standard format, it will need
|
||||
to be translated when the JSONB is converted into RFC 8259 text JSON.
|
||||
The element is a JSON integer value that is not in the
|
||||
canonical format. The payload is the ASCII
|
||||
text representation of that numeric value. Because the payload is in a
|
||||
non-standard format, it will need to be translated when the JSONB is
|
||||
converted into RFC 8259 text JSON.
|
||||
|
||||
<li value="5"><p><b>FLOAT</b> →
|
||||
The element is a JSON floating-point value in the canonical
|
||||
@@ -161,10 +162,10 @@ text representation of that numeric value.
|
||||
|
||||
<li value="6"><p><b>FLOAT5</b> →
|
||||
The element is a JSON floating-point value that is not in the
|
||||
canonical JSON format but rather the extended JSON5 format.
|
||||
The payload is the ASCII text representation of that numeric value.
|
||||
Because the payload is in a non-standard format, it will need to
|
||||
be translated when the JSONB is converted into RFC 8259 text JSON.
|
||||
canonical format. The payload is the ASCII
|
||||
text representation of that numeric value. Because the payload is in a
|
||||
non-standard format, it will need to be translated when the JSONB is
|
||||
converted into RFC 8259 text JSON.
|
||||
|
||||
<li value="7"><p><b>TEXT</b> →
|
||||
The element is a JSON string value that does not contain
|
||||
|
||||
+9
-23
@@ -696,7 +696,6 @@ other than that, the order of directives in Lemon is arbitrary.</p>
|
||||
<li><tt><a href='#pright'>%right</a></tt>
|
||||
<li><tt><a href='#reallc'>%realloc</a></tt>
|
||||
<li><tt><a href='#stack_overflow'>%stack_overflow</a></tt>
|
||||
<li><tt><a href='#reallc'>%stack_size_limit</a></tt>
|
||||
<li><tt><a href='#stack_size'>%stack_size</a></tt>
|
||||
<li><tt><a href='#start_symbol'>%start_symbol</a></tt>
|
||||
<li><tt><a href='#syntax_error'>%syntax_error</a></tt>
|
||||
@@ -847,7 +846,7 @@ or more tokens. The alternative meaning is tried if the original token
|
||||
would have generated a syntax error.</p>
|
||||
|
||||
<p>The <tt>%fallback</tt> directive was added to support robust parsing of SQL
|
||||
syntax in <a href='https://sqlite.org/'>SQLite</a>.
|
||||
syntax in <a href='https://www.sqlite.org/'>SQLite</a>.
|
||||
The SQL language contains a large assortment of keywords, each of which
|
||||
appears as a different token to the language parser. SQL contains so
|
||||
many keywords that it can be difficult for programmers to keep up with
|
||||
@@ -1204,33 +1203,20 @@ the wildcard token and some other token, the other token is always used.
|
||||
The wildcard token is only matched if there are no alternatives.</p>
|
||||
|
||||
<a id='reallc'></a>
|
||||
<h4>4.4.26 The <tt>%realloc</tt>, <tt>%free</tt>, and
|
||||
<tt>%stack_size_limit</tt> directives</h4>
|
||||
<h4>4.4.26 The <tt>%realloc</tt> and <tt>%free</tt> directives</h4>
|
||||
|
||||
<p>The <tt>%realloc</tt> and <tt>%free</tt> directives defines function
|
||||
that allocate and free heap memory. The signatures and semantics of
|
||||
these functions are similar to the realloc() and free() functions from
|
||||
the standard C library, except that these functions take an extra
|
||||
parameter at the end that is determined by %extra_context. If
|
||||
%extra_context is not defined, then the extra argument is 0. The
|
||||
extra parameter provides the capability to do better error reporting
|
||||
in the event of a memory allocation error, and/or to use an alternative
|
||||
private application heap.
|
||||
that allocate and free heap memory. The signatures of these functions
|
||||
should be the same as the realloc() and free() functions from the standard
|
||||
C library.
|
||||
|
||||
<p>If both of these functions are defined then they are used to
|
||||
allocate and free memory for supplemental parser stack space, if
|
||||
the initial parse stack space is exceeded. The initial parser stack size
|
||||
<p>If both of these functions are defined
|
||||
then these functions are used to allocate and free
|
||||
memory for supplemental parser stack space, if the initial
|
||||
parse stack space is exceeded. The initial parser stack size
|
||||
is specified by either <tt>%stack_size</tt> or the
|
||||
-DYYSTACKDEPTH compile-time flag.
|
||||
|
||||
<p>The <tt>%stack_size_limit</tt> directive defines a function that returns
|
||||
the maximum allowed parser stack size. If this diretive does not exist,
|
||||
no size limit is enforced. This function takes a single argument which
|
||||
is the %extra_context value or "0" if %extra_context is not defined.
|
||||
The function should return an integer that is the maximum
|
||||
number of parser stack entries. If more stack space
|
||||
than this is needed, the %stack_overflow code is invoked.
|
||||
|
||||
<a id='errors'></a>
|
||||
<h2>5.0 Error Processing</h2>
|
||||
|
||||
|
||||
+51
-107
@@ -35,69 +35,84 @@ perspective on how to compile SQLite on unix-like systems.
|
||||
### 2.1 Setup
|
||||
|
||||
<ol type="1">
|
||||
<li value="1">
|
||||
[Fossil][] installed.
|
||||
<li value="1">
|
||||
[Fossil](https://fossil-scm.org/) installed.
|
||||
<li> Check out source code and set environment variables:
|
||||
<ol type="a">
|
||||
<li> **TCLSOURCE** →
|
||||
The top-level directory of a [Fossil][] check-out of the
|
||||
[TCL source tree][tcl-fossil].
|
||||
The top-level directory of a Fossil check-out of the TCL source tree.
|
||||
<li> **SQLITESOURCE** →
|
||||
A Fossil check-out of the SQLite source tree.
|
||||
<li> **TCLHOME** →
|
||||
<li> **TCLBUILD** →
|
||||
A directory that does not exist at the start of the test and which
|
||||
will be deleted at the end of the test, and that will contain the
|
||||
test builds of the TCL libraries and the SQLite TCL Extensions.
|
||||
It is the top-most installation directory, i.e. the one provided
|
||||
to Tcl's `./configure --prefix=/path/to/tcl`.
|
||||
<li> **TCLVERSION** →
|
||||
The `X.Y`-form version of Tcl being used: 8.6, 9.0, 9.1...
|
||||
</ol>
|
||||
</ol>
|
||||
|
||||
### 2.2 Testing TCL 8.x and 9.x on unix
|
||||
|
||||
From a checked-out copy of [the core Tcl tree][tcl-fossil]
|
||||
### 2.2 Testing TCL 8.6 on unix
|
||||
|
||||
<ol type="1">
|
||||
<li value="3">`TCLVERSION=8.6` <br>
|
||||
↑ A version of your choice. This process has been tested with
|
||||
values of 8.6, 9.0, and 9.1 (as of 2025-04-16). The out-of-life
|
||||
version 8.5 fails some of `make devtest` for undetermined reasons.
|
||||
<li>`TCLHOME=$HOME/tcl/$TCLVERSION`
|
||||
<li>`TCLSOURCE=/path/to/tcl/checkout`
|
||||
<li>`SQLITESOURCE=/path/to/sqlite/checkout`
|
||||
<li>`rm -fr $TCLHOME` <br>
|
||||
↑ Ensure that no stale Tcl installation is laying around.
|
||||
<li> `cd $TCLSOURCE`
|
||||
<li> `fossil up core-8-6-branch` <br>
|
||||
↑ The branch corresponding to `$TCLVERSION`, e.g.
|
||||
`core-9-0-branch` or `trunk`.
|
||||
<li value="3"> `mkdir -p $TCLBUILD/tcl86`
|
||||
<li> `cd $TCLSOURCE/unix`
|
||||
<li> `fossil up core-8-6-16` <br>
|
||||
↑ Or some other version of Tcl8.6.
|
||||
<li> `fossil clean -x`
|
||||
<li> `cd unix`
|
||||
<li> `./configure --prefix=$TCLHOME --disable-shared` <br>
|
||||
↑ The `--disable-shared` is to avoid the need to set `LD_LIBRARY_PATH`
|
||||
<li> `./configure --prefix=$TCLBUILD/tcl86 --disable-shared` <br>
|
||||
↑ The --disable-shared is to avoid the need to set LD_LIBRARY_PATH
|
||||
when using this Tcl build.
|
||||
<li> `make install`
|
||||
<li> `cd $SQLITESOURCE`
|
||||
<li> `fossil clean -x`
|
||||
<li> `./configure --with-tcl=$TCLHOME --all`
|
||||
<li> `./configure --with-tclsh=$TCLBUILD/tcl86/bin/tclsh8.6 --all`
|
||||
<li> `make tclextension-install` <br>
|
||||
↑ Verify extension installed at
|
||||
`$TCLHOME/lib/tcl${TCLVERSION}/sqlite<SQLITE_VERSION>`.
|
||||
↑ Verify extension installed at $TCLBUILD/tcl86/lib/tcl8.6/sqlite3.*
|
||||
<li> `make tclextension-list` <br>
|
||||
↑ Verify TCL extension correctly installed.
|
||||
<li> `make tclextension-verify` <br>
|
||||
↑ Verify that the correct version is installed.
|
||||
<li> `$TCLHOME/bin/tclsh[89].[0-9] test/testrunner.tcl release --explain` <br>
|
||||
<li> `$TCLBUILD/tcl86/bin/tclsh8.6 test/testrunner.tcl release --explain` <br>
|
||||
↑ Verify thousands of lines of output with no errors. Or
|
||||
consider running "devtest" without --explain instead of "release".
|
||||
</ol>
|
||||
|
||||
### 2.3 Cleanup
|
||||
### 2.3 Testing TCL 9.0 on unix
|
||||
|
||||
<ol>
|
||||
<li value="16"> `mkdir -p $TCLBUILD/tcl90`
|
||||
<li> `fossil up core-9-0-0` <br>
|
||||
↑ Or some other version of Tcl9
|
||||
<li> `fossil clean -x`
|
||||
<li> `./configure --prefix=$TCLBUILD/tcl90 --disable-shared` <br>
|
||||
↑ The --disable-shared is to avoid the need to set LD_LIBRARY_PATH
|
||||
when using this Tcl build.
|
||||
<li> `make install`
|
||||
<li> `cp -r ../library $TCLBUILD/tcl90/lib/tcl9.0` <br>
|
||||
↑ The Tcl library is not installed by "make install" for Tcl9.0 unless
|
||||
you also include the --disable-zipfs to ./configure. But if you do that
|
||||
then the generated tclsh9.0 is no longer stand-alone. On the other hand,
|
||||
if you don't install the Tcl library, other programs like testfixture
|
||||
won't be able to find the Tcl library and hence won't work. This
|
||||
extra installation step resolves the dilemma.
|
||||
This step is not required when building Tcl8.6, which lacks support for
|
||||
zipfs and hence always installs its Tcl library.
|
||||
<li> `cd $SQLITESOURCE`
|
||||
<li> `fossil clean -x`
|
||||
<li> `./configure --with-tclsh=$TCLBUILD/tcl90/bin/tclsh9.0 --all`
|
||||
<li> `make tclextension-install` <br>
|
||||
↑ Verify extension installed at $TCLBUILD/tcl90/lib/sqlite3.*
|
||||
<li> `make tclextension-list` <br>
|
||||
↑ Verify TCL extension correctly installed.
|
||||
<li> `make tclextension-verify`
|
||||
<li> `$TCLBUILD/tcl90/bin/tclsh9.0 test/testrunner.tcl release --explain` <br>
|
||||
↑ Verify thousands of lines of output with no errors. Or
|
||||
consider running "devtest" without --explain instead of "release".
|
||||
</ol>
|
||||
|
||||
### 2.4 Cleanup
|
||||
|
||||
<ol type="1">
|
||||
<li value="29"> `rm -rf $TCLHOME`
|
||||
<li value="29"> `rm -rf $TCLBUILD`
|
||||
</ol>
|
||||
|
||||
<a id="windows"></a>
|
||||
@@ -108,11 +123,9 @@ perspective on how to compile SQLite on Windows.
|
||||
|
||||
### 3.1 Setup for Windows
|
||||
|
||||
(These docs are not as up-to-date as the Unix docs, above.)
|
||||
|
||||
<ol type="1">
|
||||
<li value="1">
|
||||
[Fossil][] installed.
|
||||
<li value="1">
|
||||
[Fossil](https://fossil-scm.org/) installed.
|
||||
<li>
|
||||
Unix-like command-line tools installed. Example:
|
||||
[unxutils](https://unxutils.sourceforge.net/)
|
||||
@@ -193,72 +206,3 @@ perspective on how to compile SQLite on Windows.
|
||||
<ol type="1">
|
||||
<li value="35"> `rm -rf %TCLBUILD%`
|
||||
</ol>
|
||||
|
||||
## 4.0 Testing the TEA(ish) Build (unix only)
|
||||
|
||||
This part requires following the setup instructions for Unix systems,
|
||||
at the top of this document.
|
||||
|
||||
The former TEA, now TEA(ish), build of this extension uses the same
|
||||
code as the builds described above but is provided in a form more
|
||||
convenient for downstream Tcl users.
|
||||
|
||||
It lives in `autoconf/tea` and, as part of the `autoconf` bundle,
|
||||
_cannot be tested directly from the canonical tree_. Instead it has to
|
||||
be packaged.
|
||||
|
||||
### 4.1 Teaish Setup
|
||||
|
||||
Follow the same Tcl- and environment-related related setup described
|
||||
in the first section of this document, up to and including the
|
||||
installation of Tcl (unless, of course, it was already installed using
|
||||
those same instructions).
|
||||
|
||||
### 4.2 Teaish Testing
|
||||
|
||||
<ol>
|
||||
<li>`cd $SQLITESOURCE`
|
||||
<li>Run either `make snapshot-tarball` or `make amalgamation-tarball`
|
||||
↑
|
||||
Those steps will leave behind a temp dir called `mkpkg_tmp_dir`,
|
||||
under which the extension is most readily reached. It can optionally
|
||||
be extracted from the generated tarball, but that tarball was
|
||||
generated from this dir, and reusing this dir is a time saver
|
||||
during development.
|
||||
<li> `cd mkpkg_tmp/tea`
|
||||
<li> `./configure --with-tcl=$TCLHOME`
|
||||
<li> `make test install` <br>
|
||||
↑ Should run to completion without any errors.
|
||||
<li> `make uninstall` <br>
|
||||
↑ Will uninstall the extension. This _can_ be run
|
||||
in the same invocation as the `install` target, but only
|
||||
if the `-j#` make flag is _not_ used. If it is, the
|
||||
install/uninstall steps will race and make a mess of things.
|
||||
Parallel builds do not help in this build, anyway, as there's
|
||||
only a single C file to compile.
|
||||
</ol>
|
||||
|
||||
When actively developing and testing the teaish build, which requires
|
||||
going through the tarball generation, there's a caveat about the
|
||||
`mkpkg_tmp_dir` dir: it will be deleted every time a tarball is
|
||||
built, the shell console which is parked in that
|
||||
directory for testing needs to add `cd $PWD &&` to the start of the
|
||||
build commands, like:
|
||||
|
||||
>
|
||||
```
|
||||
[user@host:.../mkpkg_tmp_dir/tea]$ \
|
||||
cd $PWD && ./configure CFLAGS=-O0 --with-tcl=$TCLHOME \
|
||||
&& make test install uninstall
|
||||
```
|
||||
|
||||
### 4.3 Teaish Cleanup
|
||||
|
||||
|
||||
<ol type="1">
|
||||
<li> `rm -rf $TCLHOME`
|
||||
<li> `cd $SQLITESOURCE; rm -fr mkpkg_tmp_dir; fossil clean -x`
|
||||
</ol>
|
||||
|
||||
[Fossil]: https://fossil-scm.org/home
|
||||
[tcl-fossil]: https://core.tcl-lang.org/tcl
|
||||
|
||||
+66
-159
@@ -4,12 +4,6 @@
|
||||
|
||||
<ul type=none>
|
||||
<li> 1. <a href=#overview>Overview</a>
|
||||
<ul type=none>
|
||||
<li> 1.1. <a href=#runtr>Running testrunner.tcl</a>
|
||||
<li> 1.2. <a href=#runviamake>Run using "make"</a>
|
||||
<li> 1.3. <a href=#outputs>Outputs from testrunner.tcl</a>
|
||||
<li> 1.4. <a href=#help>Built-in help</a>
|
||||
</ul>
|
||||
<li> 2. <a href=#binary_tests>Binary Tests</a>
|
||||
<ul type=none>
|
||||
<li> 2.1. <a href=#organization_tests>Organization of Tcl Tests</a>
|
||||
@@ -21,7 +15,6 @@
|
||||
<li> 3.1. <a href=#commands_to_run_tests>Commands to Run SQLite Tests</a>
|
||||
<li> 3.2. <a href=#zipvfs_tests>Running ZipVFS Tests</a>
|
||||
<li> 3.3. <a href=#source_code_test_failures>Investigating Source Code Test Failures</a>
|
||||
<li> 3.4. <a href=#fuzzdb>External Fuzzcheck Databases</a>
|
||||
</ul>
|
||||
<li> 4. <a href=#testrunner_options>Extra testrunner.tcl Options</a>
|
||||
<li> 5. <a href=#cpu_cores>Controlling CPU Core Utilization</a>
|
||||
@@ -30,117 +23,66 @@
|
||||
<a name=overview></a>
|
||||
# 1. Overview
|
||||
|
||||
The testrunner.tcl program is a Tcl script used to run multiple SQLite
|
||||
tests in parallel, thus reducing testing time on multi-core machines.
|
||||
The testrunner.tcl supports running tests that based on `testfixture`,
|
||||
`sqlite3`, and `fuzzcheck`.
|
||||
testrunner.tcl is a Tcl script used to run multiple SQLite tests using
|
||||
multiple jobs. It supports the following types of tests:
|
||||
|
||||
<a name="runtr"></a>
|
||||
## 1.1 Running testrunner.tcl
|
||||
* Tcl test scripts.
|
||||
|
||||
The testrunner.tcl script is located in the "test" subdirectory of the
|
||||
SQLite source tree. So if your shell is current positioned at the top
|
||||
of the source tree, you would normally run the script using the command:
|
||||
"<tt>test/testrunner.tcl</tt>". On Windows, you have to specify the
|
||||
`tclsh` interpreter command first, like this:
|
||||
"<tt>tclsh test/testrunner.tcl</tt>".
|
||||
* Tests run with `make` commands. Examples:
|
||||
- `make mdevtest`
|
||||
- `make releasetest`
|
||||
- `make sdevtest`
|
||||
- `make testrunner`
|
||||
|
||||
In this document, we will assume that you are on a unix-like OS
|
||||
(not on Windows) and that your current directory is the root
|
||||
of the SQLite source tree, and so all invocations of the testrunner.tcl
|
||||
script will be of the form "<tt>test/testrunner.tcl</tt>". If you
|
||||
are in a different directory, then make appropriate adjustments to
|
||||
the path. On Windows, add the "<tt>tclsh</tt>" interpreter command
|
||||
up front.
|
||||
|
||||
<a name="runviamake"></a>
|
||||
## 1.2 Run using make
|
||||
|
||||
The standard Makefiles for SQLite include targets that invoke
|
||||
testrunner.tcl. So the following commands also run testrunner.tcl:
|
||||
|
||||
* `make devtest`
|
||||
* `make releasetest`
|
||||
* `make sdevtest`
|
||||
* `make testrunner`
|
||||
|
||||
<a name="outputs"></a>
|
||||
## 1.3 Outputs from testrunner.tcl
|
||||
|
||||
The testrunner.tcl program stores output of all tests and builds run in
|
||||
log file **testrunner.log**, created in the current working directory.
|
||||
Search this file to find details of errors. Suggested search commands:
|
||||
testrunner.tcl pipes the output of all tests and builds run into log file
|
||||
**testrunner.log**, created in the current working directory. Search this
|
||||
file to find details of errors. Suggested search commands:
|
||||
|
||||
* `grep "^!" testrunner.log`
|
||||
* `grep failed testrunner.log`
|
||||
|
||||
The testrunner.tcl program also populates SQLite database **testrunner.db**.
|
||||
This database contains details of all tests run, running and to be run.
|
||||
A useful query might be:
|
||||
testrunner.tcl also populates SQLite database **testrunner.db**. This database
|
||||
contains details of all tests run, running and to be run. A useful query
|
||||
might be:
|
||||
|
||||
```
|
||||
SELECT * FROM script WHERE state='failed'
|
||||
```
|
||||
|
||||
You can get a summary of errors in a prior run by invoking commands like
|
||||
those shown below. Note that the testrunner.tcl script can be run directly
|
||||
on unix systems (including Macs) but you will need to add <tt>tclsh</tt>
|
||||
to the front on Windows.
|
||||
|
||||
```
|
||||
test/testrunner.tcl errors
|
||||
test/testrunner.tcl errors -v
|
||||
```
|
||||
|
||||
Running the command:
|
||||
|
||||
```
|
||||
test/testrunner.tcl status
|
||||
./testfixture $(TESTDIR)/testrunner.tcl status
|
||||
```
|
||||
|
||||
in the directory containing the testrunner.db database runs various queries
|
||||
to produce a succinct report on the state of a running testrunner.tcl script.
|
||||
A good way to keep and eye on test progress is to run either of the two
|
||||
following commands:
|
||||
Running:
|
||||
|
||||
```
|
||||
watch test/testrunner.tcl status
|
||||
test/testrunner.tcl status -d 2
|
||||
watch ./testfixture $(TESTDIR)/testrunner.tcl status
|
||||
```
|
||||
|
||||
Both of the commands above accomplish about the same thing, but the second
|
||||
one has the advantage of not requiring "watch" to be installed on your
|
||||
system.
|
||||
in another terminal is a good way to keep an eye on a long running test.
|
||||
|
||||
Sometimes testrunner.tcl uses the `testfixture` and `sqlite3` binaries that
|
||||
are in the directory from which testrunner.tcl is run.
|
||||
(see "Binary Tests" below). Sometimes it builds testfixture and
|
||||
Sometimes testrunner.tcl uses the `testfixture` binary that it is run with
|
||||
to run tests (see "Binary Tests" below). Sometimes it builds testfixture and
|
||||
other binaries in specific configurations to test (see "Source Tests").
|
||||
|
||||
<a name=help></a>
|
||||
## 1.4 Built-in help
|
||||
|
||||
Run this command:
|
||||
|
||||
```
|
||||
test/testrunner.tcl help
|
||||
```
|
||||
|
||||
To get a summary of all of the various command-line options available
|
||||
with testrunner.tcl
|
||||
|
||||
|
||||
<a name=binary_tests></a>
|
||||
# 2. Binary Tests
|
||||
|
||||
The commands described in this section all run various combinations of the Tcl
|
||||
test scripts using whatever `testfixture` binary (and maybe also the `sqlite3`
|
||||
binary, depending on the test) that is found in the directory from which
|
||||
testrunner.tcl is launched. So typically, one must first run something
|
||||
like "`make testfixture sqlite3`" before launching binary tests. In other
|
||||
words, testrunner.tcl does not automatically build the binaries under test
|
||||
for binary tests. The testrunner.tcl expects the binaries to be available
|
||||
already.
|
||||
test scripts using the `testfixture` binary used to run the testrunner.tcl
|
||||
script (i.e. they do not invoke the compiler to build new binaries, or the
|
||||
`make` command to run tests that are not Tcl scripts). The procedure to run
|
||||
these tests is therefore:
|
||||
|
||||
1. Build the "testfixture" (or "testfixture.exe" for windows) binary using
|
||||
whatever method seems convenient.
|
||||
|
||||
2. Test the binary built in step 1 by running testrunner.tcl with it,
|
||||
perhaps with various options.
|
||||
|
||||
The following sub-sections describe the various options that can be
|
||||
passed to testrunner.tcl to test binary testfixture builds.
|
||||
@@ -182,22 +124,22 @@ are defined in file *testrunner_data.tcl*.
|
||||
To run the "veryquick" test set, use either of the following:
|
||||
|
||||
```
|
||||
test/testrunner.tcl
|
||||
test/testrunner.tcl veryquick
|
||||
./testfixture $TESTDIR/testrunner.tcl
|
||||
./testfixture $TESTDIR/testrunner.tcl veryquick
|
||||
```
|
||||
|
||||
To run the "full" test suite:
|
||||
|
||||
```
|
||||
test/testrunner.tcl full
|
||||
./testfixture $TESTDIR/testrunner.tcl full
|
||||
```
|
||||
|
||||
To run the subset of the "full" test suite for which the test file name matches
|
||||
a specified pattern (e.g. all tests that start with "fts5"), either of:
|
||||
|
||||
```
|
||||
test/testrunner.tcl fts5%
|
||||
test/testrunner.tcl 'fts5*'
|
||||
./testfixture $TESTDIR/testrunner.tcl fts5%
|
||||
./testfixture $TESTDIR/testrunner.tcl 'fts5*'
|
||||
```
|
||||
|
||||
Strictly speaking, for a test to be run the pattern must match the script
|
||||
@@ -209,7 +151,7 @@ characters specified as part of the pattern are transformed to "\*".
|
||||
To run "all" tests (full + permutations):
|
||||
|
||||
```
|
||||
test/testrunner.tcl all
|
||||
./testfixture $TESTDIR/testrunner.tcl all
|
||||
```
|
||||
|
||||
<a name=binary_test_failures></a>
|
||||
@@ -228,15 +170,10 @@ If there is no permutation, the individual test script may be run with:
|
||||
Or, if the failure occured as part of a permutation:
|
||||
|
||||
```
|
||||
test/testrunner.tcl $PERMUTATION $PATH_TO_SCRIPT
|
||||
./testfixture $TESTDIR/testrunner.tcl $PERMUTATION $PATH_TO_SCRIPT
|
||||
```
|
||||
|
||||
One can also rerun all tests that failed or did not complete
|
||||
in the previous invocation by typing:
|
||||
|
||||
```
|
||||
test/testrunner.tcl retest
|
||||
```
|
||||
TODO: An example instead of "$PERMUTATION" and $PATH\_TO\_SCRIPT?
|
||||
|
||||
<a name=source_code_tests></a>
|
||||
# 3. Source Code Tests
|
||||
@@ -251,9 +188,11 @@ other tests. The advantages of this are that:
|
||||
* it ensures that tests are always run using binaries created with the
|
||||
same set of compiler options.
|
||||
|
||||
The testrunner.tcl commands described in this section do not require that
|
||||
the testfixture and/or sqlite3 binaries be built ahead of time. Those
|
||||
binaries will be constructed automatically.
|
||||
The testrunner.tcl commands described in this section may be run using
|
||||
either a *testfixture* (or testfixture.exe) build, or with any other Tcl
|
||||
shell that supports SQLite 3.31.1 or newer via "package require sqlite3".
|
||||
|
||||
TODO: ./configure + Makefile.msc build systems.
|
||||
|
||||
<a name=commands_to_run_tests></a>
|
||||
## 3.1. Commands to Run SQLite Tests
|
||||
@@ -263,7 +202,7 @@ the `make fuzztest` target once for each of two --enable-all builds - one
|
||||
with debugging enabled and one without:
|
||||
|
||||
```
|
||||
test/testrunner.tcl mdevtest
|
||||
tclsh $TESTDIR/testrunner.tcl mdevtest
|
||||
```
|
||||
|
||||
In other words, it is equivalent to running:
|
||||
@@ -272,13 +211,13 @@ In other words, it is equivalent to running:
|
||||
$TOP/configure --enable-all --enable-debug
|
||||
make fuzztest
|
||||
make testfixture
|
||||
$TOP/test/testrunner.tcl veryquick
|
||||
./testfixture $TOP/test/testrunner.tcl veryquick
|
||||
|
||||
# Then, after removing files created by the tests above:
|
||||
$TOP/configure --enable-all OPTS="-O0"
|
||||
make fuzztest
|
||||
make testfixture
|
||||
$TOP/test/testrunner.tcl veryquick
|
||||
./testfixture $TOP/test/testrunner.tcl veryquick
|
||||
```
|
||||
|
||||
The **sdevtest** command is identical to the mdevtest command, except that the
|
||||
@@ -286,7 +225,7 @@ second of the two builds is a sanitizer build. Specifically, this means that
|
||||
OPTS="-fsanitize=address,undefined" is specified instead of OPTS="-O0":
|
||||
|
||||
```
|
||||
test/testrunner.tcl sdevtest
|
||||
tclsh $TESTDIR/testrunner.tcl sdevtest
|
||||
```
|
||||
|
||||
The **release** command runs lots of tests under lots of builds. It runs
|
||||
@@ -295,15 +234,17 @@ on Linux, Windows or OSX. Refer to *testrunner\_data.tcl* for the details
|
||||
of the specific tests run.
|
||||
|
||||
```
|
||||
test/testrunner.tcl release
|
||||
tclsh $TESTDIR/testrunner.tcl release
|
||||
```
|
||||
|
||||
As with <a href=#source code tests>source code tests</a>, one or more patterns
|
||||
may be appended to any of the above commands (mdevtest, sdevtest or release).
|
||||
Pattern matching is used for both Tcl tests and fuzz tests.
|
||||
In that case only Tcl tests (no fuzz or other tests) that match the specified
|
||||
pattern are run. For example, to run the just the Tcl rtree tests in all
|
||||
builds and configurations supported by "release":
|
||||
|
||||
```
|
||||
test/testrunner.tcl release rtree%
|
||||
tclsh $TESTDIR/testrunner.tcl release rtree%
|
||||
```
|
||||
|
||||
<a name=zipvfs_tests></a>
|
||||
@@ -313,14 +254,14 @@ testrunner.tcl can build a zipvfs-enabled testfixture and use it to run
|
||||
tests from the Zipvfs project with the following command:
|
||||
|
||||
```
|
||||
test/testrunner.tcl --zipvfs $PATH_TO_ZIPVFS
|
||||
tclsh $TESTDIR/testrunner.tcl --zipvfs $PATH_TO_ZIPVFS
|
||||
```
|
||||
|
||||
This can be combined with any of "mdevtest", "sdevtest" or "release" to
|
||||
test both SQLite and Zipvfs with a single command:
|
||||
|
||||
```
|
||||
test/testrunner.tcl --zipvfs $PATH_TO_ZIPVFS mdevtest
|
||||
tclsh $TESTDIR/testrunner.tcl --zipvfs $PATH_TO_ZIPVFS mdevtest
|
||||
```
|
||||
|
||||
<a name=source_code_test_failures></a>
|
||||
@@ -340,10 +281,10 @@ a dos \*.bat file on windows. For example:
|
||||
```
|
||||
# Create a script that recreates build configuration "Device-One" on
|
||||
# Linux or OSX:
|
||||
test/testrunner.tcl script Device-One > make.sh
|
||||
tclsh $TESTDIR/testrunner.tcl script Device-One > make.sh
|
||||
|
||||
# Create a script that recreates build configuration "Have-Not" on Windows:
|
||||
test/testrunner.tcl script Have-Not > make.bat
|
||||
tclsh $TESTDIR/testrunner.tcl script Have-Not > make.bat
|
||||
```
|
||||
|
||||
The generated bash or \*.bat file script accepts a single argument - a makefile
|
||||
@@ -351,34 +292,6 @@ target to build. This may be used either to run a `make` command test directly,
|
||||
or else to build a testfixture (or testfixture.exe) binary with which to
|
||||
run a Tcl test script, as <a href=#binary_test_failures>described above</a>.
|
||||
|
||||
<a name=fuzzdb></a>
|
||||
## 3.4 External Fuzzcheck Databases
|
||||
|
||||
Testrunner.tcl will also run fuzzcheck against an external (out of tree)
|
||||
database, for example fuzzcheck databases generated by dbsqlfuzz. To do
|
||||
this, simply add the "`--fuzzdb` *FILENAME*" command-line option or set
|
||||
the FUZZDB environment variable to the name of the external
|
||||
database. For large external databases, testrunner.tcl will automatically use
|
||||
the "`--slice`" command-line option of fuzzcheck to divide the work up into
|
||||
multiple jobs, to increase parallelism.
|
||||
|
||||
Thus, for example, to run a full releasetest including an external
|
||||
dbsqlfuzz database, run a command like one of these:
|
||||
|
||||
```
|
||||
test/testrunner.tcl releasetest --fuzzdb ../fuzz/20250415.db
|
||||
FUZZDB=../fuzz/20250415.db make releasetest
|
||||
nmake /f Makefile.msc FUZZDB=../fuzz/20250415.db releasetest
|
||||
```
|
||||
|
||||
The patternlist option to testrunner.tcl will match against fuzzcheck
|
||||
databases. So if you want to run *only* tests involving the external
|
||||
database, you can use a command something like this:
|
||||
|
||||
```
|
||||
test/testrunner.tcl releasetest 20250415 --fuzzdb ../fuzz/20250415.db
|
||||
```
|
||||
|
||||
<a name=testrunner_options></a>
|
||||
# 4. Extra testrunner.tcl Options
|
||||
|
||||
@@ -390,7 +303,7 @@ required by a test, not to run any actual tests. For example:
|
||||
|
||||
```
|
||||
# Build binaries required by release test.
|
||||
test/testrunner.tcl --buildonly release"
|
||||
tclsh $TESTDIR/testrunner.tcl --buildonly release"
|
||||
```
|
||||
|
||||
The **--dryrun** option prevents testrunner.tcl from building any binaries
|
||||
@@ -399,25 +312,19 @@ would normally execute into the testrunner.log file. Example:
|
||||
|
||||
```
|
||||
# Log the shell commmands that make up the mdevtest test.
|
||||
test/testrunner.tcl --dryrun mdevtest"
|
||||
tclsh $TESTDIR/testrunner.tcl --dryrun mdevtest"
|
||||
```
|
||||
|
||||
The **--explain** option is similar to --dryrun in that it prevents
|
||||
testrunner.tcl from building any binaries or running any tests. The
|
||||
difference is that --explain prints on standard output a human-readable
|
||||
summary of all the builds and tests that would have been run.
|
||||
The **--explain** option is similar to --dryrun in that it prevents testrunner.tcl
|
||||
from building any binaries or running any tests. The difference is that --explain
|
||||
prints on standard output a human-readable summary of all the builds and tests that
|
||||
would have been run.
|
||||
|
||||
```
|
||||
# Show what builds and tests would have been run
|
||||
test/testrunner.tcl --explain mdevtest
|
||||
tclsh $TESTDIR/testrunner.tcl --explain mdevtest
|
||||
```
|
||||
|
||||
The **--status** option uses VT100 escape sequences to display the test
|
||||
status full-screen. This is similar to running
|
||||
"`watch test/testrunner status`" in a separate window, just more convenient.
|
||||
Unfortunately, this option does not work correctly on Windows, due to the
|
||||
sketchy implementation of VT100 escapes on the Windows console.
|
||||
|
||||
<a name=cpu_cores></a>
|
||||
# 5. Controlling CPU Core Utilization
|
||||
|
||||
@@ -425,7 +332,7 @@ When running either binary or source code tests, testrunner.tcl reports the
|
||||
number of jobs it intends to use to stdout. e.g.
|
||||
|
||||
```
|
||||
$ test/testrunner.tcl
|
||||
$ ./testfixture $TESTDIR/testrunner.tcl
|
||||
splitting work across 16 jobs
|
||||
... more output ...
|
||||
```
|
||||
@@ -435,7 +342,7 @@ of real cores on the machine. This can be overridden using the "--jobs" (or -j)
|
||||
switch:
|
||||
|
||||
```
|
||||
$ test/testrunner.tcl --jobs 8
|
||||
$ ./testfixture $TESTDIR/testrunner.tcl --jobs 8
|
||||
splitting work across 8 jobs
|
||||
... more output ...
|
||||
```
|
||||
@@ -445,5 +352,5 @@ running by exucuting the following command from the directory containing the
|
||||
testrunner.log and testrunner.db files:
|
||||
|
||||
```
|
||||
$ test/testrunner.tcl njob $NEW_NUMBER_OF_JOBS
|
||||
$ ./testfixture $TESTDIR/testrunner.tcl njob $NEW_NUMBER_OF_JOBS
|
||||
```
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
## Loadable Extensions
|
||||
|
||||
Various [loadable extensions](https://sqlite.org/loadext.html) for
|
||||
Various [loadable extensions](https://www.sqlite.org/loadext.html) for
|
||||
SQLite are found in subfolders.
|
||||
|
||||
Most subfolders are dedicated to a single loadable extension (for
|
||||
|
||||
@@ -90,7 +90,7 @@ foreach {tn setup} {
|
||||
proc do_rec_test {tn sql res} {
|
||||
set res [squish [string trim $res]]
|
||||
set tst [subst -nocommands {
|
||||
squish [string trim [exec $::CLI -noinit test.db ".expert" {$sql;}]]
|
||||
squish [string trim [exec $::CLI test.db ".expert" {$sql;}]]
|
||||
}]
|
||||
uplevel [list do_test $tn $tst $res]
|
||||
}
|
||||
|
||||
+25
-27
@@ -172,11 +172,11 @@ struct sqlite3expert {
|
||||
** Allocate and return nByte bytes of zeroed memory using sqlite3_malloc().
|
||||
** If the allocation fails, set *pRc to SQLITE_NOMEM and return NULL.
|
||||
*/
|
||||
static void *idxMalloc(int *pRc, i64 nByte){
|
||||
static void *idxMalloc(int *pRc, int nByte){
|
||||
void *pRet;
|
||||
assert( *pRc==SQLITE_OK );
|
||||
assert( nByte>0 );
|
||||
pRet = sqlite3_malloc64(nByte);
|
||||
pRet = sqlite3_malloc(nByte);
|
||||
if( pRet ){
|
||||
memset(pRet, 0, nByte);
|
||||
}else{
|
||||
@@ -243,7 +243,7 @@ static int idxHashAdd(
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
pEntry = idxMalloc(pRc, sizeof(IdxHashEntry) + (i64)nKey+1 + (i64)nVal+1);
|
||||
pEntry = idxMalloc(pRc, sizeof(IdxHashEntry) + nKey+1 + nVal+1);
|
||||
if( pEntry ){
|
||||
pEntry->zKey = (char*)&pEntry[1];
|
||||
memcpy(pEntry->zKey, zKey, nKey);
|
||||
@@ -378,15 +378,15 @@ struct ExpertCsr {
|
||||
};
|
||||
|
||||
static char *expertDequote(const char *zIn){
|
||||
i64 n = STRLEN(zIn);
|
||||
char *zRet = sqlite3_malloc64(n);
|
||||
int n = STRLEN(zIn);
|
||||
char *zRet = sqlite3_malloc(n);
|
||||
|
||||
assert( zIn[0]=='\'' );
|
||||
assert( zIn[n-1]=='\'' );
|
||||
|
||||
if( zRet ){
|
||||
i64 iOut = 0;
|
||||
i64 iIn = 0;
|
||||
int iOut = 0;
|
||||
int iIn = 0;
|
||||
for(iIn=1; iIn<(n-1); iIn++){
|
||||
if( zIn[iIn]=='\'' ){
|
||||
assert( zIn[iIn+1]=='\'' );
|
||||
@@ -699,7 +699,7 @@ static int idxGetTableInfo(
|
||||
sqlite3_stmt *p1 = 0;
|
||||
int nCol = 0;
|
||||
int nTab;
|
||||
i64 nByte;
|
||||
int nByte;
|
||||
IdxTable *pNew = 0;
|
||||
int rc, rc2;
|
||||
char *pCsr = 0;
|
||||
@@ -791,14 +791,14 @@ static char *idxAppendText(int *pRc, char *zIn, const char *zFmt, ...){
|
||||
va_list ap;
|
||||
char *zAppend = 0;
|
||||
char *zRet = 0;
|
||||
i64 nIn = zIn ? STRLEN(zIn) : 0;
|
||||
i64 nAppend = 0;
|
||||
int nIn = zIn ? STRLEN(zIn) : 0;
|
||||
int nAppend = 0;
|
||||
va_start(ap, zFmt);
|
||||
if( *pRc==SQLITE_OK ){
|
||||
zAppend = sqlite3_vmprintf(zFmt, ap);
|
||||
if( zAppend ){
|
||||
nAppend = STRLEN(zAppend);
|
||||
zRet = (char*)sqlite3_malloc64(nIn + nAppend + 1);
|
||||
zRet = (char*)sqlite3_malloc(nIn + nAppend + 1);
|
||||
}
|
||||
if( zAppend && zRet ){
|
||||
if( nIn ) memcpy(zRet, zIn, nIn);
|
||||
@@ -1562,8 +1562,8 @@ struct IdxRemCtx {
|
||||
int eType; /* SQLITE_NULL, INTEGER, REAL, TEXT, BLOB */
|
||||
i64 iVal; /* SQLITE_INTEGER value */
|
||||
double rVal; /* SQLITE_FLOAT value */
|
||||
i64 nByte; /* Bytes of space allocated at z */
|
||||
i64 n; /* Size of buffer z */
|
||||
int nByte; /* Bytes of space allocated at z */
|
||||
int n; /* Size of buffer z */
|
||||
char *z; /* SQLITE_TEXT/BLOB value */
|
||||
} aSlot[1];
|
||||
};
|
||||
@@ -1599,13 +1599,11 @@ static void idxRemFunc(
|
||||
break;
|
||||
|
||||
case SQLITE_BLOB:
|
||||
assert( pSlot->n <= 0x7fffffff );
|
||||
sqlite3_result_blob(pCtx, pSlot->z, (int)pSlot->n, SQLITE_TRANSIENT);
|
||||
sqlite3_result_blob(pCtx, pSlot->z, pSlot->n, SQLITE_TRANSIENT);
|
||||
break;
|
||||
|
||||
case SQLITE_TEXT:
|
||||
assert( pSlot->n <= 0x7fffffff );
|
||||
sqlite3_result_text(pCtx, pSlot->z, (int)pSlot->n, SQLITE_TRANSIENT);
|
||||
sqlite3_result_text(pCtx, pSlot->z, pSlot->n, SQLITE_TRANSIENT);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1625,10 +1623,10 @@ static void idxRemFunc(
|
||||
|
||||
case SQLITE_BLOB:
|
||||
case SQLITE_TEXT: {
|
||||
i64 nByte = sqlite3_value_bytes(argv[1]);
|
||||
int nByte = sqlite3_value_bytes(argv[1]);
|
||||
const void *pData = 0;
|
||||
if( nByte>pSlot->nByte ){
|
||||
char *zNew = (char*)sqlite3_realloc64(pSlot->z, nByte*2);
|
||||
char *zNew = (char*)sqlite3_realloc(pSlot->z, nByte*2);
|
||||
if( zNew==0 ){
|
||||
sqlite3_result_error_nomem(pCtx);
|
||||
return;
|
||||
@@ -1683,7 +1681,7 @@ static int idxPopulateOneStat1(
|
||||
int nCol = 0;
|
||||
int i;
|
||||
sqlite3_stmt *pQuery = 0;
|
||||
i64 *aStat = 0;
|
||||
int *aStat = 0;
|
||||
int rc = SQLITE_OK;
|
||||
|
||||
assert( p->iSample>0 );
|
||||
@@ -1729,7 +1727,7 @@ static int idxPopulateOneStat1(
|
||||
sqlite3_free(zQuery);
|
||||
|
||||
if( rc==SQLITE_OK ){
|
||||
aStat = (i64*)idxMalloc(&rc, sizeof(i64)*(nCol+1));
|
||||
aStat = (int*)idxMalloc(&rc, sizeof(int)*(nCol+1));
|
||||
}
|
||||
if( rc==SQLITE_OK && SQLITE_ROW==sqlite3_step(pQuery) ){
|
||||
IdxHashEntry *pEntry;
|
||||
@@ -1746,11 +1744,11 @@ static int idxPopulateOneStat1(
|
||||
}
|
||||
|
||||
if( rc==SQLITE_OK ){
|
||||
i64 s0 = aStat[0];
|
||||
zStat = sqlite3_mprintf("%lld", s0);
|
||||
int s0 = aStat[0];
|
||||
zStat = sqlite3_mprintf("%d", s0);
|
||||
if( zStat==0 ) rc = SQLITE_NOMEM;
|
||||
for(i=1; rc==SQLITE_OK && i<=nCol; i++){
|
||||
zStat = idxAppendText(&rc, zStat, " %lld", (s0+aStat[i]/2) / aStat[i]);
|
||||
zStat = idxAppendText(&rc, zStat, " %d", (s0+aStat[i]/2) / aStat[i]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1829,7 +1827,7 @@ static int idxPopulateStat1(sqlite3expert *p, char **pzErr){
|
||||
rc = sqlite3_exec(p->dbm, "ANALYZE; PRAGMA writable_schema=1", 0, 0, 0);
|
||||
|
||||
if( rc==SQLITE_OK ){
|
||||
i64 nByte = sizeof(struct IdxRemCtx) + (sizeof(struct IdxRemSlot) * nMax);
|
||||
int nByte = sizeof(struct IdxRemCtx) + (sizeof(struct IdxRemSlot) * nMax);
|
||||
pCtx = (struct IdxRemCtx*)idxMalloc(&rc, nByte);
|
||||
}
|
||||
|
||||
@@ -1846,7 +1844,7 @@ static int idxPopulateStat1(sqlite3expert *p, char **pzErr){
|
||||
}
|
||||
|
||||
if( rc==SQLITE_OK ){
|
||||
pCtx->nSlot = (i64)nMax+1;
|
||||
pCtx->nSlot = nMax+1;
|
||||
rc = idxPrepareStmt(p->dbm, &pAllIndex, pzErr, zAllIndex);
|
||||
}
|
||||
if( rc==SQLITE_OK ){
|
||||
@@ -2113,7 +2111,7 @@ int sqlite3_expert_sql(
|
||||
if( pStmt ){
|
||||
IdxStatement *pNew;
|
||||
const char *z = sqlite3_sql(pStmt);
|
||||
i64 n = STRLEN(z);
|
||||
int n = STRLEN(z);
|
||||
pNew = (IdxStatement*)idxMalloc(&rc, sizeof(IdxStatement) + n+1);
|
||||
if( rc==SQLITE_OK ){
|
||||
pNew->zSql = (char*)&pNew[1];
|
||||
|
||||
+6
-3
@@ -1816,7 +1816,9 @@ static int fts3CursorSeekStmt(Fts3Cursor *pCsr){
|
||||
zSql = sqlite3_mprintf("SELECT %s WHERE rowid = ?", p->zReadExprlist);
|
||||
if( !zSql ) return SQLITE_NOMEM;
|
||||
p->bLock++;
|
||||
rc = sqlite3Fts3PrepareStmt(p, zSql, 1, 1, &pCsr->pStmt);
|
||||
rc = sqlite3_prepare_v3(
|
||||
p->db, zSql,-1,SQLITE_PREPARE_PERSISTENT,&pCsr->pStmt,0
|
||||
);
|
||||
p->bLock--;
|
||||
sqlite3_free(zSql);
|
||||
}
|
||||
@@ -3391,7 +3393,9 @@ static int fts3FilterMethod(
|
||||
}
|
||||
if( zSql ){
|
||||
p->bLock++;
|
||||
rc = sqlite3Fts3PrepareStmt(p, zSql, 1, 1, &pCsr->pStmt);
|
||||
rc = sqlite3_prepare_v3(
|
||||
p->db,zSql,-1,SQLITE_PREPARE_PERSISTENT,&pCsr->pStmt,0
|
||||
);
|
||||
p->bLock--;
|
||||
sqlite3_free(zSql);
|
||||
}else{
|
||||
@@ -4014,7 +4018,6 @@ static int fts3IntegrityMethod(
|
||||
|
||||
UNUSED_PARAMETER(isQuick);
|
||||
rc = sqlite3Fts3IntegrityCheck(p, &bOk);
|
||||
assert( pVtab->zErrMsg==0 || rc!=SQLITE_OK );
|
||||
assert( rc!=SQLITE_CORRUPT_VTAB );
|
||||
if( rc==SQLITE_ERROR || (rc&0xFF)==SQLITE_CORRUPT ){
|
||||
*pzErr = sqlite3_mprintf("unable to validate the inverted index for"
|
||||
|
||||
+13
-18
@@ -14,13 +14,6 @@
|
||||
#ifndef _FTSINT_H
|
||||
#define _FTSINT_H
|
||||
|
||||
/*
|
||||
** Activate assert() only if SQLITE_TEST is enabled.
|
||||
*/
|
||||
#if !defined(NDEBUG) && !defined(SQLITE_DEBUG)
|
||||
# define NDEBUG 1
|
||||
#endif
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdlib.h>
|
||||
#include <stddef.h>
|
||||
@@ -28,6 +21,10 @@
|
||||
#include <string.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
#if !defined(NDEBUG) && !defined(SQLITE_DEBUG)
|
||||
# define NDEBUG 1
|
||||
#endif
|
||||
|
||||
/* FTS3/FTS4 require virtual tables */
|
||||
#ifdef SQLITE_OMIT_VIRTUALTABLE
|
||||
# undef SQLITE_ENABLE_FTS3
|
||||
@@ -47,7 +44,7 @@
|
||||
|
||||
/* If not building as part of the core, include sqlite3ext.h. */
|
||||
#ifndef SQLITE_CORE
|
||||
# include "sqlite3ext.h"
|
||||
# include "sqlite3ext.h"
|
||||
SQLITE_EXTENSION_INIT3
|
||||
#endif
|
||||
|
||||
@@ -189,6 +186,13 @@ typedef sqlite3_int64 i64; /* 8-byte signed integer */
|
||||
*/
|
||||
#define UNUSED_PARAMETER(x) (void)(x)
|
||||
|
||||
/*
|
||||
** Activate assert() only if SQLITE_TEST is enabled.
|
||||
*/
|
||||
#if !defined(NDEBUG) && !defined(SQLITE_DEBUG)
|
||||
# define NDEBUG 1
|
||||
#endif
|
||||
|
||||
/*
|
||||
** The TESTONLY macro is used to enclose variable declarations or
|
||||
** other bits of code that are needed to support the arguments
|
||||
@@ -209,7 +213,7 @@ typedef sqlite3_int64 i64; /* 8-byte signed integer */
|
||||
** Macros needed to provide flexible arrays in a portable way
|
||||
*/
|
||||
#ifndef offsetof
|
||||
# define offsetof(ST,M) ((size_t)((char*)&((ST*)0)->M - (char*)0))
|
||||
# define offsetof(STRUCTURE,FIELD) ((size_t)((char*)&((STRUCTURE*)0)->FIELD))
|
||||
#endif
|
||||
#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)
|
||||
# define FLEXARRAY
|
||||
@@ -601,15 +605,6 @@ int sqlite3Fts3Incrmerge(Fts3Table*,int,int);
|
||||
(*(u8*)(p)&0x80) ? sqlite3Fts3GetVarint32(p, piVal) : (*piVal=*(u8*)(p), 1) \
|
||||
)
|
||||
|
||||
int sqlite3Fts3PrepareStmt(
|
||||
Fts3Table *p, /* Prepare for this connection */
|
||||
const char *zSql, /* SQL to prepare */
|
||||
int bPersist, /* True to set SQLITE_PREPARE_PERSISTENT */
|
||||
int bAllowVtab, /* True to omit SQLITE_PREPARE_NO_VTAB */
|
||||
sqlite3_stmt **pp /* OUT: Prepared statement */
|
||||
);
|
||||
|
||||
|
||||
/* fts3.c */
|
||||
void sqlite3Fts3ErrMsg(char**,const char*,...);
|
||||
int sqlite3Fts3PutVarint(char *, sqlite3_int64);
|
||||
|
||||
@@ -17,6 +17,10 @@
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
|
||||
#ifndef SQLITE_AMALGAMATION
|
||||
typedef sqlite3_int64 i64;
|
||||
#endif
|
||||
|
||||
/*
|
||||
** Characters that may appear in the second argument to matchinfo().
|
||||
*/
|
||||
@@ -1023,16 +1027,16 @@ static size_t fts3MatchinfoSize(MatchInfo *pInfo, char cArg){
|
||||
break;
|
||||
|
||||
case FTS3_MATCHINFO_LHITS:
|
||||
nVal = (size_t)pInfo->nCol * pInfo->nPhrase;
|
||||
nVal = pInfo->nCol * pInfo->nPhrase;
|
||||
break;
|
||||
|
||||
case FTS3_MATCHINFO_LHITS_BM:
|
||||
nVal = (size_t)pInfo->nPhrase * ((pInfo->nCol + 31) / 32);
|
||||
nVal = pInfo->nPhrase * ((pInfo->nCol + 31) / 32);
|
||||
break;
|
||||
|
||||
default:
|
||||
assert( cArg==FTS3_MATCHINFO_HITS );
|
||||
nVal = (size_t)pInfo->nCol * pInfo->nPhrase * 3;
|
||||
nVal = pInfo->nCol * pInfo->nPhrase * 3;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -346,7 +346,7 @@ static int fts3tokFilterMethod(
|
||||
fts3tokResetCursor(pCsr);
|
||||
if( idxNum==1 ){
|
||||
const char *zByte = (const char *)sqlite3_value_text(apVal[0]);
|
||||
sqlite3_int64 nByte = sqlite3_value_bytes(apVal[0]);
|
||||
int nByte = sqlite3_value_bytes(apVal[0]);
|
||||
pCsr->zInput = sqlite3_malloc64(nByte+1);
|
||||
if( pCsr->zInput==0 ){
|
||||
rc = SQLITE_NOMEM;
|
||||
|
||||
+14
-36
@@ -98,9 +98,9 @@ typedef struct SegmentWriter SegmentWriter;
|
||||
** incrementally. See function fts3PendingListAppend() for details.
|
||||
*/
|
||||
struct PendingList {
|
||||
sqlite3_int64 nData;
|
||||
int nData;
|
||||
char *aData;
|
||||
sqlite3_int64 nSpace;
|
||||
int nSpace;
|
||||
sqlite3_int64 iLastDocid;
|
||||
sqlite3_int64 iLastCol;
|
||||
sqlite3_int64 iLastPos;
|
||||
@@ -273,24 +273,6 @@ struct SegmentNode {
|
||||
#define SQL_UPDATE_LEVEL_IDX 38
|
||||
#define SQL_UPDATE_LEVEL 39
|
||||
|
||||
/*
|
||||
** Wrapper around sqlite3_prepare_v3() to ensure that SQLITE_PREPARE_FROM_DDL
|
||||
** is always set.
|
||||
*/
|
||||
int sqlite3Fts3PrepareStmt(
|
||||
Fts3Table *p, /* Prepare for this connection */
|
||||
const char *zSql, /* SQL to prepare */
|
||||
int bPersist, /* True to set SQLITE_PREPARE_PERSISTENT */
|
||||
int bAllowVtab, /* True to omit SQLITE_PREPARE_NO_VTAB */
|
||||
sqlite3_stmt **pp /* OUT: Prepared statement */
|
||||
){
|
||||
int f = SQLITE_PREPARE_FROM_DDL
|
||||
|((bAllowVtab==0) ? SQLITE_PREPARE_NO_VTAB : 0)
|
||||
|(bPersist ? SQLITE_PREPARE_PERSISTENT : 0);
|
||||
|
||||
return sqlite3_prepare_v3(p->db, zSql, -1, f, pp, NULL);
|
||||
}
|
||||
|
||||
/*
|
||||
** This function is used to obtain an SQLite prepared statement handle
|
||||
** for the statement identified by the second argument. If successful,
|
||||
@@ -416,12 +398,12 @@ static int fts3SqlStmt(
|
||||
|
||||
pStmt = p->aStmt[eStmt];
|
||||
if( !pStmt ){
|
||||
int bAllowVtab = 0;
|
||||
int f = SQLITE_PREPARE_PERSISTENT|SQLITE_PREPARE_NO_VTAB;
|
||||
char *zSql;
|
||||
if( eStmt==SQL_CONTENT_INSERT ){
|
||||
zSql = sqlite3_mprintf(azSql[eStmt], p->zDb, p->zName, p->zWriteExprlist);
|
||||
}else if( eStmt==SQL_SELECT_CONTENT_BY_ROWID ){
|
||||
bAllowVtab = 1;
|
||||
f &= ~SQLITE_PREPARE_NO_VTAB;
|
||||
zSql = sqlite3_mprintf(azSql[eStmt], p->zReadExprlist);
|
||||
}else{
|
||||
zSql = sqlite3_mprintf(azSql[eStmt], p->zDb, p->zName);
|
||||
@@ -429,7 +411,7 @@ static int fts3SqlStmt(
|
||||
if( !zSql ){
|
||||
rc = SQLITE_NOMEM;
|
||||
}else{
|
||||
rc = sqlite3Fts3PrepareStmt(p, zSql, 1, bAllowVtab, &pStmt);
|
||||
rc = sqlite3_prepare_v3(p->db, zSql, -1, f, &pStmt, NULL);
|
||||
sqlite3_free(zSql);
|
||||
assert( rc==SQLITE_OK || pStmt==0 );
|
||||
p->aStmt[eStmt] = pStmt;
|
||||
@@ -778,9 +760,7 @@ static int fts3PendingTermsAddOne(
|
||||
|
||||
pList = (PendingList *)fts3HashFind(pHash, zToken, nToken);
|
||||
if( pList ){
|
||||
assert( (i64)pList->nData+(i64)nToken+(i64)sizeof(Fts3HashElem)
|
||||
<= (i64)p->nPendingData );
|
||||
p->nPendingData -= (int)(pList->nData + nToken + sizeof(Fts3HashElem));
|
||||
p->nPendingData -= (pList->nData + nToken + sizeof(Fts3HashElem));
|
||||
}
|
||||
if( fts3PendingListAppend(&pList, p->iPrevDocid, iCol, iPos, &rc) ){
|
||||
if( pList==fts3HashInsert(pHash, zToken, nToken, pList) ){
|
||||
@@ -793,9 +773,7 @@ static int fts3PendingTermsAddOne(
|
||||
}
|
||||
}
|
||||
if( rc==SQLITE_OK ){
|
||||
assert( (i64)p->nPendingData + pList->nData + nToken
|
||||
+ sizeof(Fts3HashElem) <= 0x3fffffff );
|
||||
p->nPendingData += (int)(pList->nData + nToken + sizeof(Fts3HashElem));
|
||||
p->nPendingData += (pList->nData + nToken + sizeof(Fts3HashElem));
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
@@ -3596,7 +3574,7 @@ static int fts3DoRebuild(Fts3Table *p){
|
||||
if( !zSql ){
|
||||
rc = SQLITE_NOMEM;
|
||||
}else{
|
||||
rc = sqlite3Fts3PrepareStmt(p, zSql, 0, 1, &pStmt);
|
||||
rc = sqlite3_prepare_v2(p->db, zSql, -1, &pStmt, 0);
|
||||
sqlite3_free(zSql);
|
||||
}
|
||||
|
||||
@@ -3736,8 +3714,8 @@ struct NodeWriter {
|
||||
** to an appendable b-tree segment.
|
||||
*/
|
||||
struct IncrmergeWriter {
|
||||
i64 nLeafEst; /* Space allocated for leaf blocks */
|
||||
i64 nWork; /* Number of leaf pages flushed */
|
||||
int nLeafEst; /* Space allocated for leaf blocks */
|
||||
int nWork; /* Number of leaf pages flushed */
|
||||
sqlite3_int64 iAbsLevel; /* Absolute level of input segments */
|
||||
int iIdx; /* Index of *output* segment in iAbsLevel+1 */
|
||||
sqlite3_int64 iStart; /* Block number of first allocated block */
|
||||
@@ -4483,7 +4461,7 @@ static int fts3IncrmergeWriter(
|
||||
){
|
||||
int rc; /* Return Code */
|
||||
int i; /* Iterator variable */
|
||||
i64 nLeafEst = 0; /* Blocks allocated for leaf nodes */
|
||||
int nLeafEst = 0; /* Blocks allocated for leaf nodes */
|
||||
sqlite3_stmt *pLeafEst = 0; /* SQL used to determine nLeafEst */
|
||||
sqlite3_stmt *pFirstBlock = 0; /* SQL used to determine first block */
|
||||
|
||||
@@ -4493,7 +4471,7 @@ static int fts3IncrmergeWriter(
|
||||
sqlite3_bind_int64(pLeafEst, 1, iAbsLevel);
|
||||
sqlite3_bind_int64(pLeafEst, 2, pCsr->nSegment);
|
||||
if( SQLITE_ROW==sqlite3_step(pLeafEst) ){
|
||||
nLeafEst = sqlite3_column_int64(pLeafEst, 0);
|
||||
nLeafEst = sqlite3_column_int(pLeafEst, 0);
|
||||
}
|
||||
rc = sqlite3_reset(pLeafEst);
|
||||
}
|
||||
@@ -5349,7 +5327,7 @@ int sqlite3Fts3IntegrityCheck(Fts3Table *p, int *pbOk){
|
||||
if( !zSql ){
|
||||
rc = SQLITE_NOMEM;
|
||||
}else{
|
||||
rc = sqlite3Fts3PrepareStmt(p, zSql, 0, 1, &pStmt);
|
||||
rc = sqlite3_prepare_v2(p->db, zSql, -1, &pStmt, 0);
|
||||
sqlite3_free(zSql);
|
||||
}
|
||||
|
||||
@@ -5479,7 +5457,7 @@ static int fts3SpecialInsert(Fts3Table *p, sqlite3_value *pVal){
|
||||
v = atoi(&zVal[9]);
|
||||
if( v>=24 && v<=p->nPgsz-35 ) p->nNodeSize = v;
|
||||
rc = SQLITE_OK;
|
||||
}else if( nVal>11 && 0==sqlite3_strnicmp(zVal, "maxpending=", 11) ){
|
||||
}else if( nVal>11 && 0==sqlite3_strnicmp(zVal, "maxpending=", 9) ){
|
||||
v = atoi(&zVal[11]);
|
||||
if( v>=64 && v<=FTS3_MAX_PENDING_DATA ) p->nMaxPendingData = v;
|
||||
rc = SQLITE_OK;
|
||||
|
||||
+17
-17
@@ -20,7 +20,6 @@ SQLITE_EXTENSION_INIT1
|
||||
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#ifndef SQLITE_AMALGAMATION
|
||||
|
||||
@@ -60,20 +59,27 @@ typedef sqlite3_uint64 u64;
|
||||
# define LARGEST_INT64 (0xffffffff|(((i64)0x7fffffff)<<32))
|
||||
# define SMALLEST_INT64 (((i64)-1) - LARGEST_INT64)
|
||||
|
||||
/*
|
||||
** This macro is used in a single assert() within fts5 to check that an
|
||||
** allocation is aligned to an 8-byte boundary. But it is a complicated
|
||||
** macro to get right for multiple platforms without generating warnings.
|
||||
** So instead of reproducing the entire definition from sqliteInt.h, we
|
||||
** just do without this assert() for the rare non-amalgamation builds.
|
||||
/* The uptr type is an unsigned integer large enough to hold a pointer
|
||||
*/
|
||||
#define EIGHT_BYTE_ALIGNMENT(x) 1
|
||||
#if defined(HAVE_STDINT_H)
|
||||
typedef uintptr_t uptr;
|
||||
#elif SQLITE_PTRSIZE==4
|
||||
typedef u32 uptr;
|
||||
#else
|
||||
typedef u64 uptr;
|
||||
#endif
|
||||
|
||||
#ifdef SQLITE_4_BYTE_ALIGNED_MALLOC
|
||||
# define EIGHT_BYTE_ALIGNMENT(X) ((((uptr)(X) - (uptr)0)&3)==0)
|
||||
#else
|
||||
# define EIGHT_BYTE_ALIGNMENT(X) ((((uptr)(X) - (uptr)0)&7)==0)
|
||||
#endif
|
||||
|
||||
/*
|
||||
** Macros needed to provide flexible arrays in a portable way
|
||||
*/
|
||||
#ifndef offsetof
|
||||
# define offsetof(ST,M) ((size_t)((char*)&((ST*)0)->M - (char*)0))
|
||||
# define offsetof(STRUCTURE,FIELD) ((size_t)((char*)&((STRUCTURE*)0)->FIELD))
|
||||
#endif
|
||||
#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)
|
||||
# define FLEXARRAY
|
||||
@@ -81,13 +87,7 @@ typedef sqlite3_uint64 u64;
|
||||
# define FLEXARRAY 1
|
||||
#endif
|
||||
|
||||
#endif /* SQLITE_AMALGAMATION */
|
||||
|
||||
/*
|
||||
** Constants for the largest and smallest possible 32-bit signed integers.
|
||||
*/
|
||||
# define LARGEST_INT32 ((int)(0x7fffffff))
|
||||
# define SMALLEST_INT32 ((int)((-1) - LARGEST_INT32))
|
||||
#endif
|
||||
|
||||
/* Truncate very long tokens to this many bytes. Hard limit is
|
||||
** (65536-1-1-4-9)==65521 bytes. The limiting factor is the 16-bit offset
|
||||
@@ -821,7 +821,7 @@ int sqlite3Fts5ExprPattern(
|
||||
** i64 iRowid = sqlite3Fts5ExprRowid(pExpr);
|
||||
** }
|
||||
*/
|
||||
int sqlite3Fts5ExprFirst(Fts5Expr*, Fts5Index *pIdx, i64 iMin, i64, int bDesc);
|
||||
int sqlite3Fts5ExprFirst(Fts5Expr*, Fts5Index *pIdx, i64 iMin, int bDesc);
|
||||
int sqlite3Fts5ExprNext(Fts5Expr*, i64 iMax);
|
||||
int sqlite3Fts5ExprEof(Fts5Expr*);
|
||||
i64 sqlite3Fts5ExprRowid(Fts5Expr*);
|
||||
|
||||
+1
-10
@@ -1549,13 +1549,7 @@ static int fts5ExprNodeFirst(Fts5Expr *pExpr, Fts5ExprNode *pNode){
|
||||
** Return SQLITE_OK if successful, or an SQLite error code otherwise. It
|
||||
** is not considered an error if the query does not match any documents.
|
||||
*/
|
||||
int sqlite3Fts5ExprFirst(
|
||||
Fts5Expr *p,
|
||||
Fts5Index *pIdx,
|
||||
i64 iFirst,
|
||||
i64 iLast,
|
||||
int bDesc
|
||||
){
|
||||
int sqlite3Fts5ExprFirst(Fts5Expr *p, Fts5Index *pIdx, i64 iFirst, int bDesc){
|
||||
Fts5ExprNode *pRoot = p->pRoot;
|
||||
int rc; /* Return code */
|
||||
|
||||
@@ -1577,9 +1571,6 @@ int sqlite3Fts5ExprFirst(
|
||||
assert( pRoot->bEof==0 );
|
||||
rc = fts5ExprNodeNext(p, pRoot, 0, 0);
|
||||
}
|
||||
if( fts5RowidCmp(p, pRoot->iRowid, iLast)>0 ){
|
||||
pRoot->bEof = 1;
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
||||
+87
-157
@@ -554,36 +554,6 @@ struct Fts5SegIter {
|
||||
u8 bDel; /* True if the delete flag is set */
|
||||
};
|
||||
|
||||
static int fts5IndexCorruptRowid(Fts5Index *pIdx, i64 iRowid){
|
||||
pIdx->rc = FTS5_CORRUPT;
|
||||
sqlite3Fts5ConfigErrmsg(pIdx->pConfig,
|
||||
"fts5: corruption found reading blob %lld from table \"%s\"",
|
||||
iRowid, pIdx->pConfig->zName
|
||||
);
|
||||
return SQLITE_CORRUPT_VTAB;
|
||||
}
|
||||
#define FTS5_CORRUPT_ROWID(pIdx, iRowid) fts5IndexCorruptRowid(pIdx, iRowid)
|
||||
|
||||
static int fts5IndexCorruptIter(Fts5Index *pIdx, Fts5SegIter *pIter){
|
||||
pIdx->rc = FTS5_CORRUPT;
|
||||
sqlite3Fts5ConfigErrmsg(pIdx->pConfig,
|
||||
"fts5: corruption on page %d, segment %d, table \"%s\"",
|
||||
pIter->iLeafPgno, pIter->pSeg->iSegid, pIdx->pConfig->zName
|
||||
);
|
||||
return SQLITE_CORRUPT_VTAB;
|
||||
}
|
||||
#define FTS5_CORRUPT_ITER(pIdx, pIter) fts5IndexCorruptIter(pIdx, pIter)
|
||||
|
||||
static int fts5IndexCorruptIdx(Fts5Index *pIdx){
|
||||
pIdx->rc = FTS5_CORRUPT;
|
||||
sqlite3Fts5ConfigErrmsg(pIdx->pConfig,
|
||||
"fts5: corruption in table \"%s\"", pIdx->pConfig->zName
|
||||
);
|
||||
return SQLITE_CORRUPT_VTAB;
|
||||
}
|
||||
#define FTS5_CORRUPT_IDX(pIdx) fts5IndexCorruptIdx(pIdx)
|
||||
|
||||
|
||||
/*
|
||||
** Array of tombstone pages. Reference counted.
|
||||
*/
|
||||
@@ -873,13 +843,13 @@ static Fts5Data *fts5DataRead(Fts5Index *p, i64 iRowid){
|
||||
** All the reasons those functions might return SQLITE_ERROR - missing
|
||||
** table, missing row, non-blob/text in block column - indicate
|
||||
** backing store corruption. */
|
||||
if( rc==SQLITE_ERROR ) rc = FTS5_CORRUPT_ROWID(p, iRowid);
|
||||
if( rc==SQLITE_ERROR ) rc = FTS5_CORRUPT;
|
||||
|
||||
if( rc==SQLITE_OK ){
|
||||
u8 *aOut = 0; /* Read blob data into this buffer */
|
||||
i64 nByte = sqlite3_blob_bytes(p->pReader);
|
||||
i64 szData = (sizeof(Fts5Data) + 7) & ~7;
|
||||
i64 nAlloc = szData + nByte + FTS5_DATA_PADDING;
|
||||
int nByte = sqlite3_blob_bytes(p->pReader);
|
||||
int szData = (sizeof(Fts5Data) + 7) & ~7;
|
||||
sqlite3_int64 nAlloc = szData + nByte + FTS5_DATA_PADDING;
|
||||
pRet = (Fts5Data*)sqlite3_malloc64(nAlloc);
|
||||
if( pRet ){
|
||||
pRet->nn = nByte;
|
||||
@@ -923,7 +893,7 @@ static Fts5Data *fts5LeafRead(Fts5Index *p, i64 iRowid){
|
||||
Fts5Data *pRet = fts5DataRead(p, iRowid);
|
||||
if( pRet ){
|
||||
if( pRet->nn<4 || pRet->szLeaf>pRet->nn ){
|
||||
FTS5_CORRUPT_ROWID(p, iRowid);
|
||||
p->rc = FTS5_CORRUPT;
|
||||
fts5DataRelease(pRet);
|
||||
pRet = 0;
|
||||
}
|
||||
@@ -1282,14 +1252,8 @@ static Fts5Structure *fts5StructureReadUncached(Fts5Index *p){
|
||||
/* TODO: Do we need this if the leaf-index is appended? Probably... */
|
||||
memset(&pData->p[pData->nn], 0, FTS5_DATA_PADDING);
|
||||
p->rc = fts5StructureDecode(pData->p, pData->nn, &iCookie, &pRet);
|
||||
if( p->rc==SQLITE_OK ){
|
||||
if( (pConfig->pgsz==0 || pConfig->iCookie!=iCookie) ){
|
||||
p->rc = sqlite3Fts5ConfigLoad(pConfig, iCookie);
|
||||
}
|
||||
}else if( p->rc==SQLITE_CORRUPT_VTAB ){
|
||||
sqlite3Fts5ConfigErrmsg(p->pConfig,
|
||||
"fts5: corrupt structure record for table \"%s\"", p->pConfig->zName
|
||||
);
|
||||
if( p->rc==SQLITE_OK && (pConfig->pgsz==0 || pConfig->iCookie!=iCookie) ){
|
||||
p->rc = sqlite3Fts5ConfigLoad(pConfig, iCookie);
|
||||
}
|
||||
fts5DataRelease(pData);
|
||||
if( p->rc!=SQLITE_OK ){
|
||||
@@ -1912,7 +1876,7 @@ static void fts5SegIterLoadRowid(Fts5Index *p, Fts5SegIter *pIter){
|
||||
while( iOff>=pIter->pLeaf->szLeaf ){
|
||||
fts5SegIterNextPage(p, pIter);
|
||||
if( pIter->pLeaf==0 ){
|
||||
if( p->rc==SQLITE_OK ) FTS5_CORRUPT_ITER(p, pIter);
|
||||
if( p->rc==SQLITE_OK ) p->rc = FTS5_CORRUPT;
|
||||
return;
|
||||
}
|
||||
iOff = 4;
|
||||
@@ -1944,7 +1908,7 @@ static void fts5SegIterLoadTerm(Fts5Index *p, Fts5SegIter *pIter, int nKeep){
|
||||
|
||||
iOff += fts5GetVarint32(&a[iOff], nNew);
|
||||
if( iOff+nNew>pIter->pLeaf->szLeaf || nKeep>pIter->term.n || nNew==0 ){
|
||||
FTS5_CORRUPT_ITER(p, pIter);
|
||||
p->rc = FTS5_CORRUPT;
|
||||
return;
|
||||
}
|
||||
pIter->term.n = nKeep;
|
||||
@@ -1986,9 +1950,9 @@ static void fts5SegIterSetNext(Fts5Index *p, Fts5SegIter *pIter){
|
||||
** leave an error in the Fts5Index object.
|
||||
*/
|
||||
static void fts5SegIterAllocTombstone(Fts5Index *p, Fts5SegIter *pIter){
|
||||
const i64 nTomb = (i64)pIter->pSeg->nPgTombstone;
|
||||
const int nTomb = pIter->pSeg->nPgTombstone;
|
||||
if( nTomb>0 ){
|
||||
i64 nByte = SZ_FTS5TOMBSTONEARRAY(nTomb+1);
|
||||
int nByte = SZ_FTS5TOMBSTONEARRAY(nTomb+1);
|
||||
Fts5TombstoneArray *pNew;
|
||||
pNew = (Fts5TombstoneArray*)sqlite3Fts5MallocZero(&p->rc, nByte);
|
||||
if( pNew ){
|
||||
@@ -2074,7 +2038,6 @@ static void fts5SegIterReverseInitPage(Fts5Index *p, Fts5SegIter *pIter){
|
||||
while( 1 ){
|
||||
u64 iDelta = 0;
|
||||
|
||||
if( i>=n ) break;
|
||||
if( eDetail==FTS5_DETAIL_NONE ){
|
||||
/* todo */
|
||||
if( i<n && a[i]==0 ){
|
||||
@@ -2140,7 +2103,7 @@ static void fts5SegIterReverseNewPage(Fts5Index *p, Fts5SegIter *pIter){
|
||||
iRowidOff = fts5LeafFirstRowidOff(pNew);
|
||||
if( iRowidOff ){
|
||||
if( iRowidOff>=pNew->szLeaf ){
|
||||
FTS5_CORRUPT_ITER(p, pIter);
|
||||
p->rc = FTS5_CORRUPT;
|
||||
}else{
|
||||
pIter->pLeaf = pNew;
|
||||
pIter->iLeafOffset = iRowidOff;
|
||||
@@ -2374,7 +2337,7 @@ static void fts5SegIterNext(
|
||||
}
|
||||
assert_nc( iOff<pLeaf->szLeaf );
|
||||
if( iOff>pLeaf->szLeaf ){
|
||||
FTS5_CORRUPT_ITER(p, pIter);
|
||||
p->rc = FTS5_CORRUPT;
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -2482,20 +2445,18 @@ static void fts5SegIterReverse(Fts5Index *p, Fts5SegIter *pIter){
|
||||
fts5DataRelease(pIter->pLeaf);
|
||||
pIter->pLeaf = pLast;
|
||||
pIter->iLeafPgno = pgnoLast;
|
||||
if( p->rc==SQLITE_OK ){
|
||||
iOff = fts5LeafFirstRowidOff(pLast);
|
||||
if( iOff>pLast->szLeaf ){
|
||||
FTS5_CORRUPT_ITER(p, pIter);
|
||||
return;
|
||||
}
|
||||
iOff += fts5GetVarint(&pLast->p[iOff], (u64*)&pIter->iRowid);
|
||||
pIter->iLeafOffset = iOff;
|
||||
iOff = fts5LeafFirstRowidOff(pLast);
|
||||
if( iOff>pLast->szLeaf ){
|
||||
p->rc = FTS5_CORRUPT;
|
||||
return;
|
||||
}
|
||||
iOff += fts5GetVarint(&pLast->p[iOff], (u64*)&pIter->iRowid);
|
||||
pIter->iLeafOffset = iOff;
|
||||
|
||||
if( fts5LeafIsTermless(pLast) ){
|
||||
pIter->iEndofDoclist = pLast->nn+1;
|
||||
}else{
|
||||
pIter->iEndofDoclist = fts5LeafFirstTermOff(pLast);
|
||||
}
|
||||
if( fts5LeafIsTermless(pLast) ){
|
||||
pIter->iEndofDoclist = pLast->nn+1;
|
||||
}else{
|
||||
pIter->iEndofDoclist = fts5LeafFirstTermOff(pLast);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2565,7 +2526,7 @@ static void fts5LeafSeek(
|
||||
iPgidx += fts5GetVarint32(&a[iPgidx], iTermOff);
|
||||
iOff = iTermOff;
|
||||
if( iOff>n ){
|
||||
FTS5_CORRUPT_ITER(p, pIter);
|
||||
p->rc = FTS5_CORRUPT;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2608,7 +2569,7 @@ static void fts5LeafSeek(
|
||||
iOff = iTermOff;
|
||||
|
||||
if( iOff>=n ){
|
||||
FTS5_CORRUPT_ITER(p, pIter);
|
||||
p->rc = FTS5_CORRUPT;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2630,7 +2591,7 @@ static void fts5LeafSeek(
|
||||
iPgidx = (u32)pIter->pLeaf->szLeaf;
|
||||
iPgidx += fts5GetVarint32(&pIter->pLeaf->p[iPgidx], iOff);
|
||||
if( iOff<4 || (i64)iOff>=pIter->pLeaf->szLeaf ){
|
||||
FTS5_CORRUPT_ITER(p, pIter);
|
||||
p->rc = FTS5_CORRUPT;
|
||||
return;
|
||||
}else{
|
||||
nKeep = 0;
|
||||
@@ -2645,7 +2606,7 @@ static void fts5LeafSeek(
|
||||
|
||||
search_success:
|
||||
if( (i64)iOff+nNew>n || nNew<1 ){
|
||||
FTS5_CORRUPT_ITER(p, pIter);
|
||||
p->rc = FTS5_CORRUPT;
|
||||
return;
|
||||
}
|
||||
pIter->iLeafOffset = iOff + nNew;
|
||||
@@ -3110,7 +3071,7 @@ static void fts5SegIterGotoPage(
|
||||
assert( iLeafPgno>pIter->iLeafPgno );
|
||||
|
||||
if( iLeafPgno>pIter->pSeg->pgnoLast ){
|
||||
FTS5_CORRUPT_IDX(p);
|
||||
p->rc = FTS5_CORRUPT;
|
||||
}else{
|
||||
fts5DataRelease(pIter->pNextLeaf);
|
||||
pIter->pNextLeaf = 0;
|
||||
@@ -3125,7 +3086,7 @@ static void fts5SegIterGotoPage(
|
||||
u8 *a = pIter->pLeaf->p;
|
||||
int n = pIter->pLeaf->szLeaf;
|
||||
if( iOff<4 || iOff>=n ){
|
||||
FTS5_CORRUPT_IDX(p);
|
||||
p->rc = FTS5_CORRUPT;
|
||||
}else{
|
||||
iOff += fts5GetVarint(&a[iOff], (u64*)&pIter->iRowid);
|
||||
pIter->iLeafOffset = iOff;
|
||||
@@ -3604,7 +3565,7 @@ static void fts5ChunkIterate(
|
||||
if( nRem<=0 ){
|
||||
break;
|
||||
}else if( pSeg->pSeg==0 ){
|
||||
FTS5_CORRUPT_IDX(p);
|
||||
p->rc = FTS5_CORRUPT;
|
||||
return;
|
||||
}else{
|
||||
pgno++;
|
||||
@@ -4707,7 +4668,7 @@ static void fts5TrimSegments(Fts5Index *p, Fts5Iter *pIter){
|
||||
** a single page has been assigned to more than one segment. In
|
||||
** this case a prior iteration of this loop may have corrupted the
|
||||
** segment currently being trimmed. */
|
||||
FTS5_CORRUPT_ROWID(p, iLeafRowid);
|
||||
p->rc = FTS5_CORRUPT;
|
||||
}else{
|
||||
fts5BufferZero(&buf);
|
||||
fts5BufferGrow(&p->rc, &buf, pData->nn);
|
||||
@@ -5174,7 +5135,7 @@ static void fts5SecureDeleteOverflow(
|
||||
}else if( bDetailNone ){
|
||||
break;
|
||||
}else if( iNext>=pLeaf->szLeaf || pLeaf->nn<pLeaf->szLeaf || iNext<4 ){
|
||||
FTS5_CORRUPT_ROWID(p, iRowid);
|
||||
p->rc = FTS5_CORRUPT;
|
||||
break;
|
||||
}else{
|
||||
int nShift = iNext - 4;
|
||||
@@ -5194,7 +5155,7 @@ static void fts5SecureDeleteOverflow(
|
||||
|
||||
i1 += fts5GetVarint32(&aPg[i1], iFirst);
|
||||
if( iFirst<iNext ){
|
||||
FTS5_CORRUPT_ROWID(p, iRowid);
|
||||
p->rc = FTS5_CORRUPT;
|
||||
break;
|
||||
}
|
||||
aIdx = sqlite3Fts5MallocZero(&p->rc, (pLeaf->nn-pLeaf->szLeaf)+2);
|
||||
@@ -5240,7 +5201,7 @@ static void fts5DoSecureDelete(
|
||||
int iSegid = pSeg->pSeg->iSegid;
|
||||
u8 *aPg = pSeg->pLeaf->p;
|
||||
int nPg = pSeg->pLeaf->nn;
|
||||
int iPgIdx = pSeg->pLeaf->szLeaf; /* Offset of page footer */
|
||||
int iPgIdx = pSeg->pLeaf->szLeaf;
|
||||
|
||||
u64 iDelta = 0;
|
||||
int iNextOff = 0;
|
||||
@@ -5319,7 +5280,7 @@ static void fts5DoSecureDelete(
|
||||
iSOP += fts5GetVarint32(&aPg[iSOP], nPos);
|
||||
}
|
||||
assert_nc( iSOP==pSeg->iLeafOffset );
|
||||
iNextOff = iSOP + pSeg->nPos;
|
||||
iNextOff = pSeg->iLeafOffset + pSeg->nPos;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5399,32 +5360,32 @@ static void fts5DoSecureDelete(
|
||||
** is another term following it on this page. So the subsequent term
|
||||
** needs to be moved to replace the term associated with the entry
|
||||
** being removed. */
|
||||
u64 nPrefix = 0;
|
||||
u64 nSuffix = 0;
|
||||
u64 nPrefix2 = 0;
|
||||
u64 nSuffix2 = 0;
|
||||
int nPrefix = 0;
|
||||
int nSuffix = 0;
|
||||
int nPrefix2 = 0;
|
||||
int nSuffix2 = 0;
|
||||
|
||||
iDelKeyOff = iNextOff;
|
||||
iNextOff += fts5GetVarint(&aPg[iNextOff], &nPrefix2);
|
||||
iNextOff += fts5GetVarint(&aPg[iNextOff], &nSuffix2);
|
||||
iNextOff += fts5GetVarint32(&aPg[iNextOff], nPrefix2);
|
||||
iNextOff += fts5GetVarint32(&aPg[iNextOff], nSuffix2);
|
||||
|
||||
if( iKey!=1 ){
|
||||
iKeyOff += fts5GetVarint(&aPg[iKeyOff], &nPrefix);
|
||||
iKeyOff += fts5GetVarint32(&aPg[iKeyOff], nPrefix);
|
||||
}
|
||||
iKeyOff += fts5GetVarint(&aPg[iKeyOff], &nSuffix);
|
||||
iKeyOff += fts5GetVarint32(&aPg[iKeyOff], nSuffix);
|
||||
|
||||
nPrefix = MIN(nPrefix, nPrefix2);
|
||||
nSuffix = (nPrefix2 + nSuffix2) - nPrefix;
|
||||
|
||||
if( (iKeyOff+nSuffix)>(u64)iPgIdx || (iNextOff+nSuffix2)>(u64)iPgIdx ){
|
||||
FTS5_CORRUPT_IDX(p);
|
||||
if( (iKeyOff+nSuffix)>iPgIdx || (iNextOff+nSuffix2)>iPgIdx ){
|
||||
p->rc = FTS5_CORRUPT;
|
||||
}else{
|
||||
if( iKey!=1 ){
|
||||
iOff += sqlite3Fts5PutVarint(&aPg[iOff], nPrefix);
|
||||
}
|
||||
iOff += sqlite3Fts5PutVarint(&aPg[iOff], nSuffix);
|
||||
if( nPrefix2>(u64)pSeg->term.n ){
|
||||
FTS5_CORRUPT_IDX(p);
|
||||
if( nPrefix2>pSeg->term.n ){
|
||||
p->rc = FTS5_CORRUPT;
|
||||
}else if( nPrefix2>nPrefix ){
|
||||
memcpy(&aPg[iOff], &pSeg->term.p[nPrefix], nPrefix2-nPrefix);
|
||||
iOff += (nPrefix2-nPrefix);
|
||||
@@ -5454,7 +5415,7 @@ static void fts5DoSecureDelete(
|
||||
u8 *aTermIdx = &pTerm->p[pTerm->szLeaf];
|
||||
int nTermIdx = pTerm->nn - pTerm->szLeaf;
|
||||
int iTermIdx = 0;
|
||||
i64 iTermOff = 0;
|
||||
int iTermOff = 0;
|
||||
|
||||
while( 1 ){
|
||||
u32 iVal = 0;
|
||||
@@ -5465,15 +5426,12 @@ static void fts5DoSecureDelete(
|
||||
}
|
||||
nTermIdx = iTermIdx;
|
||||
|
||||
if( iTermOff>pTerm->szLeaf ){
|
||||
FTS5_CORRUPT_IDX(p);
|
||||
}else{
|
||||
memmove(&pTerm->p[iTermOff], &pTerm->p[pTerm->szLeaf], nTermIdx);
|
||||
fts5PutU16(&pTerm->p[2], iTermOff);
|
||||
fts5DataWrite(p, iId, pTerm->p, iTermOff+nTermIdx);
|
||||
if( nTermIdx==0 ){
|
||||
fts5SecureDeleteIdxEntry(p, iSegid, pSeg->iTermLeafPgno);
|
||||
}
|
||||
memmove(&pTerm->p[iTermOff], &pTerm->p[pTerm->szLeaf], nTermIdx);
|
||||
fts5PutU16(&pTerm->p[2], iTermOff);
|
||||
|
||||
fts5DataWrite(p, iId, pTerm->p, iTermOff+nTermIdx);
|
||||
if( nTermIdx==0 ){
|
||||
fts5SecureDeleteIdxEntry(p, iSegid, pSeg->iTermLeafPgno);
|
||||
}
|
||||
}
|
||||
fts5DataRelease(pTerm);
|
||||
@@ -5496,9 +5454,7 @@ static void fts5DoSecureDelete(
|
||||
int iPrevKeyOut = 0;
|
||||
int iKeyIn = 0;
|
||||
|
||||
if( nMove>0 ){
|
||||
memmove(&aPg[iOff], &aPg[iNextOff], nMove);
|
||||
}
|
||||
memmove(&aPg[iOff], &aPg[iNextOff], nMove);
|
||||
iPgIdx -= nShift;
|
||||
nPg = iPgIdx;
|
||||
fts5PutU16(&aPg[2], iPgIdx);
|
||||
@@ -5853,7 +5809,7 @@ static Fts5Structure *fts5IndexOptimizeStruct(
|
||||
}
|
||||
|
||||
nByte += (((i64)pStruct->nLevel)+1) * sizeof(Fts5StructureLevel);
|
||||
assert( nByte==(i64)SZ_FTS5STRUCTURE(pStruct->nLevel+2) );
|
||||
assert( nByte==SZ_FTS5STRUCTURE(pStruct->nLevel+2) );
|
||||
pNew = (Fts5Structure*)sqlite3Fts5MallocZero(&p->rc, nByte);
|
||||
|
||||
if( pNew ){
|
||||
@@ -5936,7 +5892,7 @@ int sqlite3Fts5IndexMerge(Fts5Index *p, int nMerge){
|
||||
fts5StructureRelease(pStruct);
|
||||
pStruct = pNew;
|
||||
nMin = 1;
|
||||
nMerge = (nMerge==SMALLEST_INT32 ? LARGEST_INT32 : (nMerge*-1));
|
||||
nMerge = nMerge*-1;
|
||||
}
|
||||
if( pStruct && pStruct->nLevel ){
|
||||
if( fts5IndexMerge(p, &pStruct, nMerge, nMin) ){
|
||||
@@ -6222,7 +6178,7 @@ static void fts5MergePrefixLists(
|
||||
}
|
||||
|
||||
if( pHead==0 || pHead->pNext==0 ){
|
||||
FTS5_CORRUPT_IDX(p);
|
||||
p->rc = FTS5_CORRUPT;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -6259,7 +6215,7 @@ static void fts5MergePrefixLists(
|
||||
assert_nc( tmp.n+nTail<=nTmp );
|
||||
assert( tmp.n+nTail<=nTmp+nMerge*10 );
|
||||
if( tmp.n+nTail>nTmp-FTS5_DATA_ZERO_PADDING ){
|
||||
if( p->rc==SQLITE_OK ) FTS5_CORRUPT_IDX(p);
|
||||
if( p->rc==SQLITE_OK ) p->rc = FTS5_CORRUPT;
|
||||
break;
|
||||
}
|
||||
fts5BufferSafeAppendVarint(&out, (tmp.n+nTail) * 2);
|
||||
@@ -6828,14 +6784,11 @@ int sqlite3Fts5IndexRollback(Fts5Index *p){
|
||||
*/
|
||||
int sqlite3Fts5IndexReinit(Fts5Index *p){
|
||||
Fts5Structure *pTmp;
|
||||
union {
|
||||
Fts5Structure sFts;
|
||||
u8 tmpSpace[SZ_FTS5STRUCTURE(1)];
|
||||
} uFts;
|
||||
u8 tmpSpace[SZ_FTS5STRUCTURE(1)];
|
||||
fts5StructureInvalidate(p);
|
||||
fts5IndexDiscardData(p);
|
||||
pTmp = &uFts.sFts;
|
||||
memset(uFts.tmpSpace, 0, sizeof(uFts.tmpSpace));
|
||||
pTmp = (Fts5Structure*)tmpSpace;
|
||||
memset(pTmp, 0, SZ_FTS5STRUCTURE(1));
|
||||
if( p->pConfig->bContentlessDelete ){
|
||||
pTmp->nOriginCntr = 1;
|
||||
}
|
||||
@@ -8295,27 +8248,19 @@ static int fts5TestUtf8(const char *z, int n){
|
||||
/*
|
||||
** This function is also purely an internal test. It does not contribute to
|
||||
** FTS functionality, or even the integrity-check, in any way.
|
||||
**
|
||||
** This function sets output variable (*pbFail) to true if the test fails. Or
|
||||
** leaves it unchanged if the test succeeds.
|
||||
*/
|
||||
static void fts5TestTerm(
|
||||
Fts5Index *p,
|
||||
Fts5Buffer *pPrev, /* Previous term */
|
||||
const char *z, int n, /* Possibly new term to test */
|
||||
u64 expected,
|
||||
u64 *pCksum,
|
||||
int *pbFail
|
||||
u64 *pCksum
|
||||
){
|
||||
int rc = p->rc;
|
||||
if( pPrev->n==0 ){
|
||||
fts5BufferSet(&rc, pPrev, n, (const u8*)z);
|
||||
}else
|
||||
if( *pbFail==0
|
||||
&& rc==SQLITE_OK
|
||||
&& (pPrev->n!=n || memcmp(pPrev->p, z, n))
|
||||
&& (p->pHash==0 || p->pHash->nEntry==0)
|
||||
){
|
||||
if( rc==SQLITE_OK && (pPrev->n!=n || memcmp(pPrev->p, z, n)) ){
|
||||
u64 cksum3 = *pCksum;
|
||||
const char *zTerm = (const char*)&pPrev->p[1]; /* term sans prefix-byte */
|
||||
int nTerm = pPrev->n-1; /* Size of zTerm in bytes */
|
||||
@@ -8365,7 +8310,7 @@ static void fts5TestTerm(
|
||||
fts5BufferSet(&rc, pPrev, n, (const u8*)z);
|
||||
|
||||
if( rc==SQLITE_OK && cksum3!=expected ){
|
||||
*pbFail = 1;
|
||||
rc = FTS5_CORRUPT;
|
||||
}
|
||||
*pCksum = cksum3;
|
||||
}
|
||||
@@ -8374,7 +8319,7 @@ static void fts5TestTerm(
|
||||
|
||||
#else
|
||||
# define fts5TestDlidxReverse(x,y,z)
|
||||
# define fts5TestTerm(t,u,v,w,x,y,z)
|
||||
# define fts5TestTerm(u,v,w,x,y,z)
|
||||
#endif
|
||||
|
||||
/*
|
||||
@@ -8399,17 +8344,14 @@ static void fts5IndexIntegrityCheckEmpty(
|
||||
for(i=iFirst; p->rc==SQLITE_OK && i<=iLast; i++){
|
||||
Fts5Data *pLeaf = fts5DataRead(p, FTS5_SEGMENT_ROWID(pSeg->iSegid, i));
|
||||
if( pLeaf ){
|
||||
if( !fts5LeafIsTermless(pLeaf)
|
||||
|| (i>=iNoRowid && 0!=fts5LeafFirstRowidOff(pLeaf))
|
||||
){
|
||||
FTS5_CORRUPT_ROWID(p, FTS5_SEGMENT_ROWID(pSeg->iSegid, i));
|
||||
}
|
||||
if( !fts5LeafIsTermless(pLeaf) ) p->rc = FTS5_CORRUPT;
|
||||
if( i>=iNoRowid && 0!=fts5LeafFirstRowidOff(pLeaf) ) p->rc = FTS5_CORRUPT;
|
||||
}
|
||||
fts5DataRelease(pLeaf);
|
||||
}
|
||||
}
|
||||
|
||||
static void fts5IntegrityCheckPgidx(Fts5Index *p, i64 iRowid, Fts5Data *pLeaf){
|
||||
static void fts5IntegrityCheckPgidx(Fts5Index *p, Fts5Data *pLeaf){
|
||||
i64 iTermOff = 0;
|
||||
int ii;
|
||||
|
||||
@@ -8427,12 +8369,12 @@ static void fts5IntegrityCheckPgidx(Fts5Index *p, i64 iRowid, Fts5Data *pLeaf){
|
||||
iOff = iTermOff;
|
||||
|
||||
if( iOff>=pLeaf->szLeaf ){
|
||||
FTS5_CORRUPT_ROWID(p, iRowid);
|
||||
p->rc = FTS5_CORRUPT;
|
||||
}else if( iTermOff==nIncr ){
|
||||
int nByte;
|
||||
iOff += fts5GetVarint32(&pLeaf->p[iOff], nByte);
|
||||
if( (iOff+nByte)>pLeaf->szLeaf ){
|
||||
FTS5_CORRUPT_ROWID(p, iRowid);
|
||||
p->rc = FTS5_CORRUPT;
|
||||
}else{
|
||||
fts5BufferSet(&p->rc, &buf1, nByte, &pLeaf->p[iOff]);
|
||||
}
|
||||
@@ -8441,7 +8383,7 @@ static void fts5IntegrityCheckPgidx(Fts5Index *p, i64 iRowid, Fts5Data *pLeaf){
|
||||
iOff += fts5GetVarint32(&pLeaf->p[iOff], nKeep);
|
||||
iOff += fts5GetVarint32(&pLeaf->p[iOff], nByte);
|
||||
if( nKeep>buf1.n || (iOff+nByte)>pLeaf->szLeaf ){
|
||||
FTS5_CORRUPT_ROWID(p, iRowid);
|
||||
p->rc = FTS5_CORRUPT;
|
||||
}else{
|
||||
buf1.n = nKeep;
|
||||
fts5BufferAppendBlob(&p->rc, &buf1, nByte, &pLeaf->p[iOff]);
|
||||
@@ -8449,7 +8391,7 @@ static void fts5IntegrityCheckPgidx(Fts5Index *p, i64 iRowid, Fts5Data *pLeaf){
|
||||
|
||||
if( p->rc==SQLITE_OK ){
|
||||
res = fts5BufferCompare(&buf1, &buf2);
|
||||
if( res<=0 ) FTS5_CORRUPT_ROWID(p, iRowid);
|
||||
if( res<=0 ) p->rc = FTS5_CORRUPT;
|
||||
}
|
||||
}
|
||||
fts5BufferSet(&p->rc, &buf2, buf1.n, buf1.p);
|
||||
@@ -8510,7 +8452,7 @@ static void fts5IndexIntegrityCheckSegment(
|
||||
** entry even if all the terms are removed from it by secure-delete
|
||||
** operations. */
|
||||
}else{
|
||||
FTS5_CORRUPT_ROWID(p, iRow);
|
||||
p->rc = FTS5_CORRUPT;
|
||||
}
|
||||
|
||||
}else{
|
||||
@@ -8522,15 +8464,15 @@ static void fts5IndexIntegrityCheckSegment(
|
||||
iOff = fts5LeafFirstTermOff(pLeaf);
|
||||
iRowidOff = fts5LeafFirstRowidOff(pLeaf);
|
||||
if( iRowidOff>=iOff || iOff>=pLeaf->szLeaf ){
|
||||
FTS5_CORRUPT_ROWID(p, iRow);
|
||||
p->rc = FTS5_CORRUPT;
|
||||
}else{
|
||||
iOff += fts5GetVarint32(&pLeaf->p[iOff], nTerm);
|
||||
res = fts5Memcmp(&pLeaf->p[iOff], zIdxTerm, MIN(nTerm, nIdxTerm));
|
||||
if( res==0 ) res = nTerm - nIdxTerm;
|
||||
if( res<0 ) FTS5_CORRUPT_ROWID(p, iRow);
|
||||
if( res<0 ) p->rc = FTS5_CORRUPT;
|
||||
}
|
||||
|
||||
fts5IntegrityCheckPgidx(p, iRow, pLeaf);
|
||||
fts5IntegrityCheckPgidx(p, pLeaf);
|
||||
}
|
||||
fts5DataRelease(pLeaf);
|
||||
if( p->rc ) break;
|
||||
@@ -8560,7 +8502,7 @@ static void fts5IndexIntegrityCheckSegment(
|
||||
iKey = FTS5_SEGMENT_ROWID(iSegid, iPg);
|
||||
pLeaf = fts5DataRead(p, iKey);
|
||||
if( pLeaf ){
|
||||
if( fts5LeafFirstRowidOff(pLeaf)!=0 ) FTS5_CORRUPT_ROWID(p, iKey);
|
||||
if( fts5LeafFirstRowidOff(pLeaf)!=0 ) p->rc = FTS5_CORRUPT;
|
||||
fts5DataRelease(pLeaf);
|
||||
}
|
||||
}
|
||||
@@ -8575,12 +8517,12 @@ static void fts5IndexIntegrityCheckSegment(
|
||||
int iRowidOff = fts5LeafFirstRowidOff(pLeaf);
|
||||
ASSERT_SZLEAF_OK(pLeaf);
|
||||
if( iRowidOff>=pLeaf->szLeaf ){
|
||||
FTS5_CORRUPT_ROWID(p, iKey);
|
||||
p->rc = FTS5_CORRUPT;
|
||||
}else if( bSecureDelete==0 || iRowidOff>0 ){
|
||||
i64 iDlRowid = fts5DlidxIterRowid(pDlidx);
|
||||
fts5GetVarint(&pLeaf->p[iRowidOff], (u64*)&iRowid);
|
||||
if( iRowid<iDlRowid || (bSecureDelete==0 && iRowid!=iDlRowid) ){
|
||||
FTS5_CORRUPT_ROWID(p, iKey);
|
||||
p->rc = FTS5_CORRUPT;
|
||||
}
|
||||
}
|
||||
fts5DataRelease(pLeaf);
|
||||
@@ -8632,7 +8574,6 @@ int sqlite3Fts5IndexIntegrityCheck(Fts5Index *p, u64 cksum, int bUseCksum){
|
||||
/* Used by extra internal tests only run if NDEBUG is not defined */
|
||||
u64 cksum3 = 0; /* Checksum based on contents of indexes */
|
||||
Fts5Buffer term = {0,0,0}; /* Buffer used to hold most recent term */
|
||||
int bTestFail = 0;
|
||||
#endif
|
||||
const int flags = FTS5INDEX_QUERY_NOOUTPUT;
|
||||
|
||||
@@ -8675,7 +8616,7 @@ int sqlite3Fts5IndexIntegrityCheck(Fts5Index *p, u64 cksum, int bUseCksum){
|
||||
char *z = (char*)fts5MultiIterTerm(pIter, &n);
|
||||
|
||||
/* If this is a new term, query for it. Update cksum3 with the results. */
|
||||
fts5TestTerm(p, &term, z, n, cksum2, &cksum3, &bTestFail);
|
||||
fts5TestTerm(p, &term, z, n, cksum2, &cksum3);
|
||||
if( p->rc ) break;
|
||||
|
||||
if( eDetail==FTS5_DETAIL_NONE ){
|
||||
@@ -8693,26 +8634,15 @@ int sqlite3Fts5IndexIntegrityCheck(Fts5Index *p, u64 cksum, int bUseCksum){
|
||||
}
|
||||
}
|
||||
}
|
||||
fts5TestTerm(p, &term, 0, 0, cksum2, &cksum3, &bTestFail);
|
||||
fts5TestTerm(p, &term, 0, 0, cksum2, &cksum3);
|
||||
|
||||
fts5MultiIterFree(pIter);
|
||||
if( p->rc==SQLITE_OK && bUseCksum && cksum!=cksum2 ){
|
||||
p->rc = FTS5_CORRUPT;
|
||||
sqlite3Fts5ConfigErrmsg(p->pConfig,
|
||||
"fts5: checksum mismatch for table \"%s\"", p->pConfig->zName
|
||||
);
|
||||
}
|
||||
#ifdef SQLITE_DEBUG
|
||||
/* In SQLITE_DEBUG builds, expensive extra checks were run as part of
|
||||
** the integrity-check above. If no other errors were detected, but one
|
||||
** of these tests failed, set the result to SQLITE_CORRUPT_VTAB here. */
|
||||
if( p->rc==SQLITE_OK && bTestFail ){
|
||||
p->rc = FTS5_CORRUPT;
|
||||
}
|
||||
fts5BufferFree(&term);
|
||||
#endif
|
||||
if( p->rc==SQLITE_OK && bUseCksum && cksum!=cksum2 ) p->rc = FTS5_CORRUPT;
|
||||
|
||||
fts5StructureRelease(pStruct);
|
||||
#ifdef SQLITE_DEBUG
|
||||
fts5BufferFree(&term);
|
||||
#endif
|
||||
fts5BufferFree(&poslist);
|
||||
return fts5IndexReturn(p);
|
||||
}
|
||||
|
||||
+18
-40
@@ -511,17 +511,6 @@ static void fts5SetUniqueFlag(sqlite3_index_info *pIdxInfo){
|
||||
#endif
|
||||
}
|
||||
|
||||
static void fts5SetEstimatedRows(sqlite3_index_info *pIdxInfo, i64 nRow){
|
||||
#if SQLITE_VERSION_NUMBER>=3008002
|
||||
#ifndef SQLITE_CORE
|
||||
if( sqlite3_libversion_number()>=3008002 )
|
||||
#endif
|
||||
{
|
||||
pIdxInfo->estimatedRows = nRow;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
static int fts5UsePatternMatch(
|
||||
Fts5Config *pConfig,
|
||||
struct sqlite3_index_constraint *p
|
||||
@@ -657,7 +646,7 @@ static int fts5BestIndexMethod(sqlite3_vtab *pVTab, sqlite3_index_info *pInfo){
|
||||
nSeenMatch++;
|
||||
idxStr[iIdxStr++] = 'M';
|
||||
sqlite3_snprintf(6, &idxStr[iIdxStr], "%d", iCol);
|
||||
iIdxStr += (int)strlen(&idxStr[iIdxStr]);
|
||||
idxStr += strlen(&idxStr[iIdxStr]);
|
||||
assert( idxStr[iIdxStr]=='\0' );
|
||||
}
|
||||
pInfo->aConstraintUsage[i].argvIndex = ++iCons;
|
||||
@@ -676,7 +665,6 @@ static int fts5BestIndexMethod(sqlite3_vtab *pVTab, sqlite3_index_info *pInfo){
|
||||
idxStr[iIdxStr++] = '=';
|
||||
bSeenEq = 1;
|
||||
pInfo->aConstraintUsage[i].argvIndex = ++iCons;
|
||||
pInfo->aConstraintUsage[i].omit = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -724,21 +712,17 @@ static int fts5BestIndexMethod(sqlite3_vtab *pVTab, sqlite3_index_info *pInfo){
|
||||
|
||||
/* Calculate the estimated cost based on the flags set in idxFlags. */
|
||||
if( bSeenEq ){
|
||||
pInfo->estimatedCost = nSeenMatch ? 1000.0 : 25.0;
|
||||
fts5SetUniqueFlag(pInfo);
|
||||
fts5SetEstimatedRows(pInfo, 1);
|
||||
pInfo->estimatedCost = nSeenMatch ? 1000.0 : 10.0;
|
||||
if( nSeenMatch==0 ) fts5SetUniqueFlag(pInfo);
|
||||
}else if( bSeenLt && bSeenGt ){
|
||||
pInfo->estimatedCost = nSeenMatch ? 5000.0 : 250000.0;
|
||||
}else if( bSeenLt || bSeenGt ){
|
||||
pInfo->estimatedCost = nSeenMatch ? 7500.0 : 750000.0;
|
||||
}else{
|
||||
if( bSeenLt && bSeenGt ){
|
||||
pInfo->estimatedCost = nSeenMatch ? 5000.0 : 750000.0;
|
||||
}else if( bSeenLt || bSeenGt ){
|
||||
pInfo->estimatedCost = nSeenMatch ? 7500.0 : 2250000.0;
|
||||
}else{
|
||||
pInfo->estimatedCost = nSeenMatch ? 10000.0 : 3000000.0;
|
||||
}
|
||||
for(i=1; i<nSeenMatch; i++){
|
||||
pInfo->estimatedCost *= 0.4;
|
||||
}
|
||||
fts5SetEstimatedRows(pInfo, (i64)(pInfo->estimatedCost / 4.0));
|
||||
pInfo->estimatedCost = nSeenMatch ? 10000.0 : 1000000.0;
|
||||
}
|
||||
for(i=1; i<nSeenMatch; i++){
|
||||
pInfo->estimatedCost *= 0.4;
|
||||
}
|
||||
|
||||
pInfo->idxNum = idxFlags;
|
||||
@@ -937,9 +921,7 @@ static int fts5CursorReseek(Fts5Cursor *pCsr, int *pbSkip){
|
||||
int bDesc = pCsr->bDesc;
|
||||
i64 iRowid = sqlite3Fts5ExprRowid(pCsr->pExpr);
|
||||
|
||||
rc = sqlite3Fts5ExprFirst(
|
||||
pCsr->pExpr, pTab->p.pIndex, iRowid, pCsr->iLastRowid, bDesc
|
||||
);
|
||||
rc = sqlite3Fts5ExprFirst(pCsr->pExpr, pTab->p.pIndex, iRowid, bDesc);
|
||||
if( rc==SQLITE_OK && iRowid!=sqlite3Fts5ExprRowid(pCsr->pExpr) ){
|
||||
*pbSkip = 1;
|
||||
}
|
||||
@@ -1111,9 +1093,7 @@ static int fts5CursorFirstSorted(
|
||||
static int fts5CursorFirst(Fts5FullTable *pTab, Fts5Cursor *pCsr, int bDesc){
|
||||
int rc;
|
||||
Fts5Expr *pExpr = pCsr->pExpr;
|
||||
rc = sqlite3Fts5ExprFirst(
|
||||
pExpr, pTab->p.pIndex, pCsr->iFirstRowid, pCsr->iLastRowid, bDesc
|
||||
);
|
||||
rc = sqlite3Fts5ExprFirst(pExpr, pTab->p.pIndex, pCsr->iFirstRowid, bDesc);
|
||||
if( sqlite3Fts5ExprEof(pExpr) ){
|
||||
CsrFlagSet(pCsr, FTS5CSR_EOF);
|
||||
}
|
||||
@@ -2081,7 +2061,6 @@ static int fts5UpdateMethod(
|
||||
}
|
||||
|
||||
update_out:
|
||||
sqlite3Fts5IndexCloseReader(pTab->p.pIndex);
|
||||
pTab->p.pConfig->pzErrmsg = 0;
|
||||
return rc;
|
||||
}
|
||||
@@ -3622,9 +3601,9 @@ static void fts5LocaleFunc(
|
||||
sqlite3_value **apArg /* Function arguments */
|
||||
){
|
||||
const char *zLocale = 0;
|
||||
i64 nLocale = 0;
|
||||
int nLocale = 0;
|
||||
const char *zText = 0;
|
||||
i64 nText = 0;
|
||||
int nText = 0;
|
||||
|
||||
assert( nArg==2 );
|
||||
UNUSED_PARAM(nArg);
|
||||
@@ -3641,10 +3620,10 @@ static void fts5LocaleFunc(
|
||||
Fts5Global *p = (Fts5Global*)sqlite3_user_data(pCtx);
|
||||
u8 *pBlob = 0;
|
||||
u8 *pCsr = 0;
|
||||
i64 nBlob = 0;
|
||||
int nBlob = 0;
|
||||
|
||||
nBlob = FTS5_LOCALE_HDR_SIZE + nLocale + 1 + nText;
|
||||
pBlob = (u8*)sqlite3_malloc64(nBlob);
|
||||
pBlob = (u8*)sqlite3_malloc(nBlob);
|
||||
if( pBlob==0 ){
|
||||
sqlite3_result_error_nomem(pCtx);
|
||||
return;
|
||||
@@ -3722,9 +3701,8 @@ static int fts5IntegrityMethod(
|
||||
" FTS5 table %s.%s: %s",
|
||||
zSchema, zTabname, sqlite3_errstr(rc));
|
||||
}
|
||||
}else if( (rc&0xff)==SQLITE_CORRUPT ){
|
||||
rc = SQLITE_OK;
|
||||
}
|
||||
|
||||
sqlite3Fts5IndexCloseReader(pTab->p.pIndex);
|
||||
pTab->p.pConfig->pzErrmsg = 0;
|
||||
|
||||
|
||||
+5
-18
@@ -539,7 +539,6 @@ static int fts5StorageDeleteFromIndex(
|
||||
for(iCol=1; rc==SQLITE_OK && iCol<=pConfig->nCol; iCol++){
|
||||
if( pConfig->abUnindexed[iCol-1]==0 ){
|
||||
sqlite3_value *pVal = 0;
|
||||
sqlite3_value *pFree = 0;
|
||||
const char *pText = 0;
|
||||
int nText = 0;
|
||||
const char *pLoc = 0;
|
||||
@@ -556,22 +555,11 @@ static int fts5StorageDeleteFromIndex(
|
||||
if( pConfig->bLocale && sqlite3Fts5IsLocaleValue(pConfig, pVal) ){
|
||||
rc = sqlite3Fts5DecodeLocaleValue(pVal, &pText, &nText, &pLoc, &nLoc);
|
||||
}else{
|
||||
if( sqlite3_value_type(pVal)!=SQLITE_TEXT ){
|
||||
/* Make a copy of the value to work with. This is because the call
|
||||
** to sqlite3_value_text() below forces the type of the value to
|
||||
** SQLITE_TEXT, and we may need to use it again later. */
|
||||
pFree = pVal = sqlite3_value_dup(pVal);
|
||||
if( pVal==0 ){
|
||||
rc = SQLITE_NOMEM;
|
||||
}
|
||||
}
|
||||
if( rc==SQLITE_OK ){
|
||||
pText = (const char*)sqlite3_value_text(pVal);
|
||||
nText = sqlite3_value_bytes(pVal);
|
||||
if( pConfig->bLocale && pSeek ){
|
||||
pLoc = (const char*)sqlite3_column_text(pSeek, iCol+pConfig->nCol);
|
||||
nLoc = sqlite3_column_bytes(pSeek, iCol + pConfig->nCol);
|
||||
}
|
||||
pText = (const char*)sqlite3_value_text(pVal);
|
||||
nText = sqlite3_value_bytes(pVal);
|
||||
if( pConfig->bLocale && pSeek ){
|
||||
pLoc = (const char*)sqlite3_column_text(pSeek, iCol + pConfig->nCol);
|
||||
nLoc = sqlite3_column_bytes(pSeek, iCol + pConfig->nCol);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -587,7 +575,6 @@ static int fts5StorageDeleteFromIndex(
|
||||
}
|
||||
sqlite3Fts5ClearLocale(pConfig);
|
||||
}
|
||||
sqlite3_value_free(pFree);
|
||||
}
|
||||
}
|
||||
if( rc==SQLITE_OK && p->nTotalRow<1 ){
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
** versions of FTS5. It contains the implementation of an FTS5 auxiliary
|
||||
** function very similar to the FTS4 function matchinfo():
|
||||
**
|
||||
** https://sqlite.org/fts3.html#matchinfo
|
||||
** https://www.sqlite.org/fts3.html#matchinfo
|
||||
**
|
||||
** Known differences are that:
|
||||
**
|
||||
|
||||
@@ -778,3 +778,4 @@ void sqlite3Fts5UnicodeAscii(u8 *aArray, u8 *aAscii){
|
||||
}
|
||||
aAscii[0] = 0; /* 0x00 is never a token character */
|
||||
}
|
||||
|
||||
|
||||
@@ -396,12 +396,7 @@ static int fts5VocabOpenMethod(
|
||||
return rc;
|
||||
}
|
||||
|
||||
/*
|
||||
** Restore cursor pCsr to the state it was in immediately after being
|
||||
** created by the xOpen() method.
|
||||
*/
|
||||
static void fts5VocabResetCursor(Fts5VocabCursor *pCsr){
|
||||
int nCol = pCsr->pFts5->pConfig->nCol;
|
||||
pCsr->rowid = 0;
|
||||
sqlite3Fts5IterClose(pCsr->pIter);
|
||||
sqlite3Fts5StructureRelease(pCsr->pStruct);
|
||||
@@ -411,12 +406,6 @@ static void fts5VocabResetCursor(Fts5VocabCursor *pCsr){
|
||||
pCsr->nLeTerm = -1;
|
||||
pCsr->zLeTerm = 0;
|
||||
pCsr->bEof = 0;
|
||||
pCsr->iCol = 0;
|
||||
pCsr->iInstPos = 0;
|
||||
pCsr->iInstOff = 0;
|
||||
pCsr->colUsed = 0;
|
||||
memset(pCsr->aCnt, 0, sizeof(i64)*nCol);
|
||||
memset(pCsr->aDoc, 0, sizeof(i64)*nCol);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -428,7 +428,7 @@ do_execsql_test 15.1 {
|
||||
}
|
||||
do_catchsql_test 15.2 {
|
||||
INSERT INTO t1(t1) VALUES('integrity-check');
|
||||
} {1 {fts5: checksum mismatch for table "t1"}}
|
||||
} {1 {database disk image is malformed}}
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
|
||||
@@ -294,39 +294,6 @@ do_execsql_test 7.0 {
|
||||
INSERT INTO x1 VALUES($doc);
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
# Forum post: https://sqlite.org/forum/forumpost/ea4d8c9acb
|
||||
#
|
||||
reset_db
|
||||
do_execsql_test 8.0 {
|
||||
PRAGMA encoding = 'UTF-16le';
|
||||
CREATE VIRTUAL TABLE vt0 USING fts5(c0);
|
||||
}
|
||||
set v [db one {SELECT x'2a12'}]
|
||||
do_execsql_test 8.1 {
|
||||
INSERT INTO vt0 VALUES ($v);
|
||||
}
|
||||
do_execsql_test 8.2 {
|
||||
SELECT quote(c0) FROM vt0
|
||||
} {X'2A12'}
|
||||
do_execsql_test 8.3 {
|
||||
INSERT INTO vt0(vt0) VALUES('integrity-check');
|
||||
} {}
|
||||
reset_db
|
||||
do_execsql_test 8.4 {
|
||||
PRAGMA encoding = 'UTF-16le';
|
||||
CREATE VIRTUAL TABLE vt0 USING fts5(c0);
|
||||
}
|
||||
do_execsql_test 8.5 {
|
||||
INSERT INTO vt0 VALUES (x'2a12');
|
||||
}
|
||||
do_execsql_test 8.6 {
|
||||
SELECT quote(c0) FROM vt0
|
||||
} {X'2A12'}
|
||||
do_execsql_test 8.7 {
|
||||
INSERT INTO vt0(vt0) VALUES('integrity-check');
|
||||
} {}
|
||||
|
||||
} ;# foreach_detail_mode...
|
||||
|
||||
|
||||
|
||||
@@ -47,10 +47,11 @@ do_test 1.3 {
|
||||
DELETE FROM t1_data WHERE rowid = fts5_rowid('segment', $segid, 4);
|
||||
}
|
||||
catchsql { INSERT INTO t1(t1) VALUES('integrity-check') }
|
||||
} {1 {fts5: corruption found reading blob 137438953476 from table "t1"}}
|
||||
} {1 {database disk image is malformed}}
|
||||
do_execsql_test 1.3b {
|
||||
PRAGMA integrity_check(t1);
|
||||
} {{fts5: corruption found reading blob 137438953476 from table "t1"}}
|
||||
} {{malformed inverted index for FTS5 table main.t1}}
|
||||
|
||||
|
||||
do_test 1.4 {
|
||||
db_restore_and_reopen
|
||||
@@ -60,7 +61,7 @@ do_test 1.4 {
|
||||
rowid = fts5_rowid('segment', $segid, 4);
|
||||
}
|
||||
catchsql { INSERT INTO t1(t1) VALUES('integrity-check') }
|
||||
} {1 {fts5: corruption found reading blob 137438953476 from table "t1"}}
|
||||
} {1 {database disk image is malformed}}
|
||||
|
||||
db_restore_and_reopen
|
||||
#db eval {SELECT rowid, fts5_decode(rowid, block) aS r FROM t1_data} {puts $r}
|
||||
|
||||
@@ -109,12 +109,12 @@ for {set i [expr $nbyte-2]} {$i>=0} {incr i -1} {
|
||||
|
||||
do_catchsql_test 2.$i.2 {
|
||||
INSERT INTO t1(t1) VALUES('integrity-check');
|
||||
} {/1.*fts5: corruption.*/}
|
||||
} {1 {database disk image is malformed}}
|
||||
|
||||
do_test 2.$i.3 {
|
||||
set res [catchsql {SELECT rowid FROM t1 WHERE t1 MATCH 'x*'}]
|
||||
expr {
|
||||
[string match {*fts5: corruption*} $res]
|
||||
$res=="1 {database disk image is malformed}"
|
||||
|| $res=="0 {$all}"
|
||||
}
|
||||
} 1
|
||||
@@ -160,17 +160,17 @@ foreach {tn hdr} {
|
||||
close $fd
|
||||
|
||||
set res [catchsql {SELECT rowid FROM x3 WHERE x3 MATCH 'x AND a'}]
|
||||
if {[string match {*fts5: corruption*} $res]} {incr nCorrupt}
|
||||
if {$res == "1 {database disk image is malformed}"} {incr nCorrupt}
|
||||
set {} 1
|
||||
} {1}
|
||||
|
||||
if {($tn2 % 10)==0 && $existing != $hdr} {
|
||||
do_test 3.$tn.$tn2.2 {
|
||||
catchsql { INSERT INTO x3(x3) VALUES('integrity-check') }
|
||||
} {/.*fts5: corruption.*/}
|
||||
} {1 {database disk image is malformed}}
|
||||
do_execsql_test 3.$tn.$tn2.3 {
|
||||
PRAGMA integrity_check(x3);
|
||||
} {/.*fts5: corruption.*/}
|
||||
} {{malformed inverted index for FTS5 table main.x3}}
|
||||
}
|
||||
|
||||
execsql ROLLBACK
|
||||
@@ -209,7 +209,7 @@ foreach {tn nCut} {
|
||||
set res [catchsql {
|
||||
SELECT rowid FROM x4 WHERE x4 MATCH 'a' ORDER BY 1 DESC
|
||||
}]
|
||||
if {[string match {*fts5: corruption*} $res]} {incr nCorrupt}
|
||||
if {$res == "1 {database disk image is malformed}"} {incr nCorrupt}
|
||||
set {} 1
|
||||
} {1}
|
||||
|
||||
|
||||
+43
-616
File diff suppressed because one or more lines are too long
@@ -237,7 +237,7 @@ do_test 1.0 {
|
||||
|
||||
do_catchsql_test 1.1 {
|
||||
SELECT * FROM t1('R*') WHERE (a,b)<=(current_date,0) ORDER BY rowid DESC;
|
||||
} {/.*fts5: corrupt.*/}
|
||||
} {1 {database disk image is malformed}}
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
@@ -450,7 +450,7 @@ do_test 2.0 {
|
||||
|
||||
do_catchsql_test 2.1 {
|
||||
SELECT * FROM t1('R*R*R*R*') WHERE (a,b)<=(current_date,0) ORDER BY rowid DESC;
|
||||
} {/.*fts5: corrupt.*/}
|
||||
} {1 {database disk image is malformed}}
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
reset_db
|
||||
@@ -569,7 +569,7 @@ do_test 3.0 {
|
||||
|
||||
do_catchsql_test 3.1 {
|
||||
UPDATE t1 SET b=quote(zeroblob(200)) WHERE a MATCH 'thra*T';
|
||||
} {/.*fts5: corrupt.*/}
|
||||
} {1 {database disk image is malformed}}
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
reset_db
|
||||
@@ -878,7 +878,7 @@ do_execsql_test 5.1 {
|
||||
}
|
||||
do_catchsql_test 5.4 {
|
||||
UPDATE t1 SET content=randomblob(500);
|
||||
} {/.*fts5: corrupt.*/}
|
||||
} {1 {database disk image is malformed}}
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
reset_db
|
||||
|
||||
@@ -123,6 +123,6 @@ do_execsql_test 2.2 {
|
||||
|
||||
do_catchsql_test 2.3 {
|
||||
DELETE FROM t1 WHERE rowid = 1
|
||||
} {/.*fts5: corrupt.*/}
|
||||
} {1 {database disk image is malformed}}
|
||||
|
||||
finish_test
|
||||
|
||||
@@ -32,7 +32,7 @@ sqlite3 db test.db
|
||||
|
||||
do_catchsql_test 1.2 {
|
||||
SELECT * FROM t1
|
||||
} {1 {fts5: corrupt structure record for table "t1"}}
|
||||
} {1 {database disk image is malformed}}
|
||||
do_catchsql_test 1.3 {
|
||||
DROP TABLE t1
|
||||
} {0 {}}
|
||||
@@ -90,58 +90,5 @@ do_execsql_test 3.7 {
|
||||
SELECT * FROM sqlite_schema
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
reset_db
|
||||
|
||||
proc hex_to_blob {hex} {
|
||||
binary encode hex $hex
|
||||
}
|
||||
db func hex_to_blob hex_to_blob
|
||||
|
||||
do_execsql_test 4.0 {
|
||||
CREATE VIRTUAL TABLE x1 USING fts5(x, content='', contentless_delete=1);
|
||||
BEGIN;
|
||||
INSERT INTO x1(rowid, x) VALUES(1, 'a b c d e f g h');
|
||||
INSERT INTO x1(rowid, x) VALUES(2, 'a b c d e f g h');
|
||||
COMMIT;
|
||||
DELETE FROM x1 WHERE rowid=1;
|
||||
}
|
||||
|
||||
do_execsql_test 4.1 {
|
||||
SELECT hex(block) FROM x1_data WHERE id=10
|
||||
} {
|
||||
00000000FF00000101010200010101010101010102
|
||||
}
|
||||
|
||||
do_execsql_test 4.2.1 {
|
||||
UPDATE x1_data SET block=
|
||||
X'00000000FF00000101010200010101010101819C9B95A8000102'
|
||||
WHERE id=10;
|
||||
}
|
||||
|
||||
do_catchsql_test 4.2.2 {
|
||||
SELECT * FROM x1('c d e');
|
||||
} {1 {out of memory}}
|
||||
|
||||
do_execsql_test 4.3.1 {
|
||||
UPDATE x1_data SET block=
|
||||
X'00000000FF000001010102000101010101019282AFF9A0000102'
|
||||
WHERE id=10;
|
||||
}
|
||||
|
||||
do_catchsql_test 4.3.2 {
|
||||
SELECT * FROM x1('c d e');
|
||||
} {1 {out of memory}}
|
||||
|
||||
do_execsql_test 4.4.1 {
|
||||
UPDATE x1_data SET block=
|
||||
X'00000000FF000001010102000101010101018181808080130102'
|
||||
WHERE id=10;
|
||||
}
|
||||
|
||||
do_catchsql_test 4.3.2 {
|
||||
SELECT * FROM x1('c d e');
|
||||
} {1 {out of memory}}
|
||||
|
||||
finish_test
|
||||
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -1,53 +0,0 @@
|
||||
# 2025 October 13
|
||||
#
|
||||
# The author disclaims copyright to this source code. In place of
|
||||
# a legal notice, here is a blessing:
|
||||
#
|
||||
# May you do good and not evil.
|
||||
# May you find forgiveness for yourself and forgive others.
|
||||
# May you share freely, never taking more than you give.
|
||||
#
|
||||
#***********************************************************************
|
||||
#
|
||||
# This test is focused on really large position lists. Those that require
|
||||
# 4 or 5 byte position-list size varints. Because of the amount of memory
|
||||
# required, these tests only run on 64-bit platforms.
|
||||
#
|
||||
|
||||
source [file join [file dirname [info script]] fts5_common.tcl]
|
||||
set testprefix fts5corruptbig
|
||||
|
||||
# If SQLITE_ENABLE_FTS5 is not defined, omit this file.
|
||||
ifcapable !fts5 {
|
||||
finish_test
|
||||
return
|
||||
}
|
||||
|
||||
if { $tcl_platform(wordSize)<8 } {
|
||||
finish_test
|
||||
return
|
||||
}
|
||||
|
||||
if { $SQLITE_MAX_LENGTH!=0x7FFFFFFF } {
|
||||
finish_test
|
||||
return
|
||||
}
|
||||
|
||||
do_execsql_test 1.0 {
|
||||
CREATE VIRTUAL TABLE t1 USING fts5(x);
|
||||
}
|
||||
|
||||
do_execsql_test 1.1 {
|
||||
UPDATE t1_data SET block = zeroblob(2147483640) WHERE id=10;
|
||||
}
|
||||
|
||||
do_execsql_test 1.2 {
|
||||
SELECT id, length(block) FROM t1_data
|
||||
} {1 0 10 2147483640}
|
||||
|
||||
do_catchsql_test 1.3 {
|
||||
SELECT * FROM t1('abc')
|
||||
} {1 {out of memory}}
|
||||
|
||||
finish_test
|
||||
|
||||
@@ -325,25 +325,5 @@ ifcapable foreignkey {
|
||||
}
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
reset_db
|
||||
|
||||
do_execsql_test 13.0 {
|
||||
CREATE VIRTUAL TABLE t1 USING fts5(a, b);
|
||||
INSERT INTO t1 VALUES('abc def', X'123456');
|
||||
}
|
||||
faultsim_save_and_close
|
||||
|
||||
|
||||
do_faultsim_test 13 -faults oom* -prep {
|
||||
faultsim_restore_and_reopen
|
||||
} -body {
|
||||
execsql {
|
||||
UPDATE t1 SET a='def abc'
|
||||
}
|
||||
} -test {
|
||||
faultsim_test_result {0 {}}
|
||||
}
|
||||
|
||||
finish_test
|
||||
|
||||
|
||||
@@ -37,12 +37,6 @@ do_execsql_test 2.1 {
|
||||
INSERT INTO yy(yy) VALUES('integrity-check');
|
||||
}
|
||||
|
||||
db close
|
||||
sqlite3 db test.db
|
||||
do_execsql_test 2.1 {
|
||||
INSERT INTO yy(yy) VALUES('integrity-check');
|
||||
}
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
#
|
||||
do_execsql_test 3.0 {
|
||||
|
||||
@@ -64,21 +64,4 @@ foreach {tn sql} {
|
||||
}
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
# Verify that https://sqlite.org/forum/forumpost/95413eb410 has been
|
||||
# fixed.
|
||||
#
|
||||
reset_db
|
||||
do_execsql_test 2.0 {
|
||||
CREATE VIRTUAL TABLE f1 USING fts5(x);
|
||||
BEGIN TRANSACTION;
|
||||
INSERT INTO f1(x) VALUES('abc def ghi');
|
||||
}
|
||||
do_test 2.1 {
|
||||
sqlite3_interrupt db
|
||||
} {}
|
||||
do_execsql_test 2.2 {
|
||||
ROLLBACK
|
||||
}
|
||||
|
||||
finish_test
|
||||
|
||||
@@ -1,69 +0,0 @@
|
||||
# 2014 June 17
|
||||
#
|
||||
# The author disclaims copyright to this source code. In place of
|
||||
# a legal notice, here is a blessing:
|
||||
#
|
||||
# May you do good and not evil.
|
||||
# May you find forgiveness for yourself and forgive others.
|
||||
# May you share freely, never taking more than you give.
|
||||
#
|
||||
#*************************************************************************
|
||||
# This file implements regression tests for SQLite library. The
|
||||
# focus of this script is testing the FTS5 module.
|
||||
#
|
||||
|
||||
source [file join [file dirname [info script]] fts5_common.tcl]
|
||||
set testprefix fts5join
|
||||
|
||||
# If SQLITE_ENABLE_FTS5 is not defined, omit this file.
|
||||
ifcapable !fts5 {
|
||||
finish_test
|
||||
return
|
||||
}
|
||||
|
||||
do_execsql_test 1.0 {
|
||||
CREATE VIRTUAL TABLE vt USING fts5(x);
|
||||
INSERT INTO vt VALUES('abc');
|
||||
INSERT INTO vt VALUES('xyz');
|
||||
|
||||
CREATE TABLE t1(a INTEGER PRIMARY KEY, b TIMESTAMP);
|
||||
INSERT INTO t1 VALUES(1, 1), (2, 2);
|
||||
CREATE INDEX i1 ON t1(b);
|
||||
}
|
||||
|
||||
# set sqlite_where_trace [expr 0xFFF]
|
||||
|
||||
do_eqp_test 1.1 {
|
||||
SELECT * FROM vt, t1 WHERE vt.rowid = t1.rowid ORDER BY t1.rowid;
|
||||
} {
|
||||
QUERY PLAN
|
||||
|--SCAN t1
|
||||
`--SCAN vt VIRTUAL TABLE INDEX 0:=
|
||||
}
|
||||
|
||||
do_eqp_test 1.2 {
|
||||
SELECT * FROM vt, t1 WHERE vt.rowid = t1.rowid AND b>? ORDER BY b LIMIT 10
|
||||
} {
|
||||
QUERY PLAN
|
||||
|--SEARCH t1 USING COVERING INDEX i1 (b>?)
|
||||
`--SCAN vt VIRTUAL TABLE INDEX 0:=
|
||||
}
|
||||
|
||||
do_eqp_test 1.3 {
|
||||
SELECT * FROM vt, t1 WHERE vt.rowid = t1.rowid AND b>?
|
||||
} {
|
||||
QUERY PLAN
|
||||
|--SEARCH t1 USING COVERING INDEX i1 (b>?)
|
||||
`--SCAN vt VIRTUAL TABLE INDEX 0:=
|
||||
}
|
||||
|
||||
do_eqp_test 1.4 {
|
||||
SELECT * FROM vt, t1 WHERE vt.rowid = t1.rowid ORDER BY b
|
||||
} {
|
||||
QUERY PLAN
|
||||
|--SCAN t1 USING COVERING INDEX i1
|
||||
`--SCAN vt VIRTUAL TABLE INDEX 0:=
|
||||
}
|
||||
|
||||
|
||||
finish_test
|
||||
@@ -40,53 +40,4 @@ do_execsql_test 1.2 {
|
||||
SELECT * FROM t1 LEFT JOIN vt ON (vt MATCH 'abc')
|
||||
} {1 abc 2 abc}
|
||||
|
||||
|
||||
do_execsql_test 1.3 {
|
||||
DELETE FROM t1;
|
||||
INSERT INTO t1 VALUES(14);
|
||||
}
|
||||
|
||||
do_execsql_test 1.4 {
|
||||
SELECT * FROM vt LEFT JOIN t1 ON vt.rowid = 1;
|
||||
} {
|
||||
abc 14
|
||||
xyz {}
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
reset_db
|
||||
do_execsql_test 2.0 {
|
||||
CREATE VIRTUAL TABLE t0 USING fts5(a,b);
|
||||
INSERT INTO t0(a,b)VALUES(1,0);
|
||||
CREATE TABLE t1(x);
|
||||
}
|
||||
|
||||
do_execsql_test 2.1 {
|
||||
SELECT * FROM t0 LEFT JOIN t1;
|
||||
} {1 0 {}}
|
||||
|
||||
breakpoint
|
||||
do_catchsql_test 2.2 {
|
||||
SELECT * FROM t0 LEFT JOIN t1 ON t0.b MATCH '1';
|
||||
} {1 {no query solution}}
|
||||
|
||||
do_execsql_test 2.3 {
|
||||
SELECT * FROM t0 LEFT JOIN t1 ON +b MATCH '1';
|
||||
} {1 0 {}}
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
reset_db
|
||||
|
||||
do_execsql_test 3.0 {
|
||||
CREATE VIRTUAL TABLE t0 USING fts5(c0, c1);
|
||||
INSERT INTO t0(c0,c1) VALUES (1,0);
|
||||
}
|
||||
|
||||
do_catchsql_test 3.1 {
|
||||
SELECT * FROM t0
|
||||
LEFT JOIN ( SELECT 0 AS col_0 )
|
||||
ON ((((t0.c1 MATCH '1')AND(CASE WHEN t0.c0 THEN CAST(t0.c1 AS INTEGER) ELSE 1 END))));
|
||||
} {1 {no query solution}}
|
||||
|
||||
|
||||
finish_test
|
||||
|
||||
@@ -528,12 +528,9 @@ do_execsql_test 16.0 {
|
||||
BEGIN EXCLUSIVE;
|
||||
}
|
||||
|
||||
sqlite3 db2 test.db
|
||||
do_test 16.1 {
|
||||
set rc [catch {
|
||||
sqlite3 db2 test.db
|
||||
db2 eval {SELECT * FROM t1}
|
||||
} errmsg]
|
||||
lappend rc $errmsg
|
||||
catchsql { SELECT * FROM t1 } db2
|
||||
} {1 {database is locked}}
|
||||
|
||||
do_execsql_test 16.2 {
|
||||
@@ -545,3 +542,4 @@ do_test 16.3 {
|
||||
} {0 {}}
|
||||
|
||||
finish_test
|
||||
|
||||
|
||||
@@ -238,22 +238,6 @@ do_execsql_test 6.3 {
|
||||
INSERT INTO g1(g1) VALUES('integrity-check');
|
||||
}
|
||||
|
||||
#--------------------------------------------------------------------------
|
||||
# Check that passing -2147483648 as the parameter to a merge command
|
||||
# does not cause a signed integer overflow error.
|
||||
#
|
||||
reset_db
|
||||
do_execsql_test 7.0 {
|
||||
CREATE VIRTUAL TABLE f1 USING fts5(a);
|
||||
}
|
||||
do_execsql_test 7.1 {
|
||||
INSERT INTO f1 VALUES('one two three');
|
||||
INSERT INTO f1 VALUES('four five six');
|
||||
INSERT INTO f1 VALUES('seven eight nine');
|
||||
}
|
||||
do_execsql_test 7.2 {
|
||||
INSERT INTO f1(f1, rank) VALUES('merge', -2147483648);
|
||||
}
|
||||
|
||||
|
||||
finish_test
|
||||
|
||||
@@ -685,17 +685,5 @@ do_execsql_test 26.1 {
|
||||
COMMIT;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
reset_db
|
||||
|
||||
do_execsql_test 27.0 {
|
||||
CREATE VIRTUAL TABLE ft1 USING fts5(a, b);
|
||||
INSERT INTO ft1(rowid, a, b) VALUES(3, '3', '3');
|
||||
}
|
||||
|
||||
do_execsql_test 27.1 {
|
||||
SELECT * FROM ft1 WHERE rowid=3 AND b MATCH 'hello';
|
||||
}
|
||||
|
||||
finish_test
|
||||
|
||||
|
||||
@@ -38,15 +38,15 @@ foreach {tn sql uses} {
|
||||
1.2 { DELETE FROM ft WHERE rowid=? } 0
|
||||
1.3 { DELETE FROM ft WHERE rowid=? } 0
|
||||
1.4 { DELETE FROM ft WHERE ft MATCH '1' } 1
|
||||
1.5 { DELETE FROM ft WHERE ft MATCH '1' AND rowid=? } 0
|
||||
1.6 { DELETE FROM ft WHERE ft MATCH '1' AND rowid=? } 0
|
||||
1.5 { DELETE FROM ft WHERE ft MATCH '1' AND rowid=? } 1
|
||||
1.6 { DELETE FROM ft WHERE ft MATCH '1' AND rowid=? } 1
|
||||
|
||||
2.1 { UPDATE ft SET content='a b c' } 1
|
||||
2.2 { UPDATE ft SET content='a b c' WHERE rowid=? } 0
|
||||
2.3 { UPDATE ft SET content='a b c' WHERE rowid=? } 0
|
||||
2.4 { UPDATE ft SET content='a b c' WHERE ft MATCH '1' } 1
|
||||
2.5 { UPDATE ft SET content='a b c' WHERE ft MATCH '1' AND rowid=? } 0
|
||||
2.6 { UPDATE ft SET content='a b c' WHERE ft MATCH '1' AND rowid=? } 0
|
||||
2.5 { UPDATE ft SET content='a b c' WHERE ft MATCH '1' AND rowid=? } 1
|
||||
2.6 { UPDATE ft SET content='a b c' WHERE ft MATCH '1' AND rowid=? } 1
|
||||
} {
|
||||
do_test 1.$tn { sql_uses_stmt db $sql } $uses
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ do_execsql_test 1.5 {
|
||||
|
||||
do_catchsql_test 1.6 {
|
||||
INSERT INTO f1(f1) VALUES('integrity-check');
|
||||
} {/.*fts5: corrupt.*/}
|
||||
} {1 {database disk image is malformed}}
|
||||
|
||||
do_execsql_test 1.7 {
|
||||
INSERT INTO f1(f1) VALUES('rebuild');
|
||||
|
||||
@@ -28,34 +28,4 @@ do_execsql_test 1.1 {
|
||||
INSERT INTO sss VALUES('まりや');
|
||||
}
|
||||
|
||||
foreach {tn enc tok} {
|
||||
1 utf-8 ascii
|
||||
2 utf-16 ascii
|
||||
3 utf-8 unicode61
|
||||
4 utf-16 unicode61
|
||||
} {
|
||||
reset_db
|
||||
|
||||
do_execsql_test 1.$tn.0 "
|
||||
PRAGMA encoding = '$enc';
|
||||
CREATE VIRTUAL TABLE vt2 USING fts5(c0, c1, tokenize=$tok);
|
||||
"
|
||||
|
||||
do_execsql_test 1.$tn.1 {
|
||||
INSERT INTO vt2(c0, c1) VALUES ('bhal', x'17db');
|
||||
}
|
||||
|
||||
do_execsql_test 1.$tn.2 {
|
||||
UPDATE vt2 SET c0='bhal';
|
||||
}
|
||||
|
||||
do_execsql_test 1.$tn.3 {
|
||||
INSERT INTO vt2(vt2) VALUES('integrity-check')
|
||||
}
|
||||
|
||||
do_execsql_test 1.$tn.4 {
|
||||
SELECT quote(c1) FROM vt2
|
||||
} {X'17DB'}
|
||||
}
|
||||
|
||||
finish_test
|
||||
|
||||
@@ -305,28 +305,6 @@ do_catchsql_test 6.2 {
|
||||
|
||||
sqlite3_fts5_may_be_corrupt 0
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
reset_db
|
||||
do_execsql_test 7.0 {
|
||||
CREATE VIRTUAL TABLE t1 USING fts5(a, b);
|
||||
CREATE VIRTUAL TABLE v1 USING fts5vocab(t1, col);
|
||||
|
||||
INSERT INTO t1 VALUES('xx', 'xx');
|
||||
|
||||
CREATE TABLE x1(t);
|
||||
INSERT INTO x1 VALUES('xx');
|
||||
INSERT INTO x1 VALUES('xx');
|
||||
|
||||
SELECT term, col FROM v1;
|
||||
} {
|
||||
xx a xx b
|
||||
}
|
||||
|
||||
do_execsql_test 7.1 {
|
||||
SELECT * FROM x1 WHERE 'a'=(SELECT col FROM v1 WHERE term=t)
|
||||
} {xx xx}
|
||||
|
||||
|
||||
finish_test
|
||||
|
||||
|
||||
|
||||
@@ -139,7 +139,6 @@ do_test 2.3 {
|
||||
sqlite3_test_control SQLITE_TESTCTRL_IMPOSTER db main 0 0
|
||||
|
||||
db eval {
|
||||
PRAGMA writable_schema=on;
|
||||
DELETE FROM imp1 WHERE rowid=1;
|
||||
DELETE FROM imp2 WHERE rowid=2;
|
||||
}
|
||||
@@ -175,7 +174,6 @@ do_test 3.2 {
|
||||
sqlite3_test_control SQLITE_TESTCTRL_IMPOSTER db main 0 0
|
||||
|
||||
db eval {
|
||||
PRAGMA writable_schema=on;
|
||||
DELETE FROM imp1 WHERE a=5;
|
||||
}
|
||||
execsql_pp {
|
||||
|
||||
@@ -29,7 +29,6 @@ do_execsql_test 1.0 {
|
||||
proc imposter_edit {obj create sql} {
|
||||
sqlite3 xdb test.db
|
||||
set pgno [xdb one {SELECT rootpage FROM sqlite_schema WHERE name=$obj}]
|
||||
xdb eval {PRAGMA Writable_schema=ON}
|
||||
|
||||
sqlite3_test_control SQLITE_TESTCTRL_IMPOSTER xdb main 1 $pgno
|
||||
xdb eval $create
|
||||
|
||||
@@ -160,7 +160,6 @@ static char *intckMprintf(sqlite3_intck *p, const char *zFmt, ...){
|
||||
sqlite3_free(zRet);
|
||||
zRet = 0;
|
||||
}
|
||||
va_end(ap);
|
||||
return zRet;
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -429,7 +429,7 @@ $(doc.index): $(JAVA_FILES.main) $(MAKEFILE)
|
||||
.FORCE: doc
|
||||
doc: $(doc.index)
|
||||
javadoc: $(doc.index)
|
||||
# Force rebuild of docs
|
||||
# Force rebild of docs
|
||||
redoc:
|
||||
@rm -f $(doc.index)
|
||||
@$(MAKE) doc
|
||||
|
||||
+16
-19
@@ -13,14 +13,11 @@ Technical support is available in the forum:
|
||||
<https://sqlite.org/forum>
|
||||
|
||||
|
||||
> **FOREWARNING:** the JNI subproject is experimental and subject to
|
||||
any number of changes. This API is "feature-complete", with only a
|
||||
few difficult-to-reach corners of the C API not represented here,
|
||||
but it is not a supported deliverable of the project so does not
|
||||
have same backward compatibility guarantees which the C APIs
|
||||
do. That said: the [C-style API](#1to1ish) is especially resistent
|
||||
to compatibility breakage because it's designed to be as close to
|
||||
the C API as feasible.
|
||||
> **FOREWARNING:** this subproject is very much in development and
|
||||
subject to any number of changes. Please do not rely on any
|
||||
information about its API until this disclaimer is removed. The JNI
|
||||
bindings released with version 3.43 are a "tech preview." Once
|
||||
finalized, strong backward compatibility guarantees will apply.
|
||||
|
||||
Project goals/requirements:
|
||||
|
||||
@@ -165,13 +162,11 @@ or propagate exceptions and must return error information (if any) via
|
||||
result codes or `null`. The only cases where the C-style APIs may
|
||||
throw is through client-side misuse, e.g. passing in a null where it
|
||||
may cause a `NullPointerException`. The APIs clearly mark function
|
||||
parameters which should not be null, and it internally uses the
|
||||
`SQLITE_API_ARMOR` mechanism to help product against such misuse. Some
|
||||
C-style APIs explicitly accept `null` as a no-op for usability's sake,
|
||||
and some of the JNI APIs deliberately return an error code, instead of
|
||||
segfaulting, when passed a `null`. There are no known cases where it
|
||||
will misuse memory if passed a `null` or out-of-range value from
|
||||
client code.
|
||||
parameters which should not be null, but does not generally actively
|
||||
defend itself against such misuse. Some C-style APIs explicitly accept
|
||||
`null` as a no-op for usability's sake, and some of the JNI APIs
|
||||
deliberately return an error code, instead of segfaulting, when passed
|
||||
a `null`.
|
||||
|
||||
Client-defined callbacks _must never throw exceptions_ unless _very
|
||||
explicitly documented_ as being throw-safe. Exceptions are generally
|
||||
@@ -199,8 +194,7 @@ Some constructs, when modelled 1-to-1 from C to Java, are unduly
|
||||
clumsy to work with in Java because they try to shoehorn C's way of
|
||||
doing certain things into Java's wildly different ways. The following
|
||||
subsections cover those, starting with a verbose explanation and
|
||||
demonstration of where such changes are "really necessary" for
|
||||
usability's sake...
|
||||
demonstration of where such changes are "really necessary"...
|
||||
|
||||
### Custom Collations
|
||||
|
||||
@@ -292,9 +286,12 @@ binding. The Java API has only one core function-registration function:
|
||||
|
||||
```java
|
||||
int sqlite3_create_function(sqlite3 db, String funcName, int nArgs,
|
||||
int flags, SQLFunction func);
|
||||
int encoding, SQLFunction func);
|
||||
```
|
||||
|
||||
> Design question: does the encoding argument serve any purpose in
|
||||
Java? That's as-yet undetermined. If not, it will be removed.
|
||||
|
||||
`SQLFunction` is not used directly, but is instead instantiated via
|
||||
one of its three subclasses:
|
||||
|
||||
@@ -316,4 +313,4 @@ in-flux nature of this API.
|
||||
Various APIs which accept callbacks, e.g. `sqlite3_trace_v2()` and
|
||||
`sqlite3_update_hook()`, use interfaces similar to those shown above.
|
||||
Despite the changes in signature, the JNI layer makes every effort to
|
||||
provide the same semantics as the C API documentation describes.
|
||||
provide the same semantics as the C API documentation suggests.
|
||||
|
||||
+58
-67
@@ -133,9 +133,11 @@
|
||||
** Which sqlite3.c we're using needs to be configurable to enable
|
||||
** building against a custom copy, e.g. the SEE variant. We have to
|
||||
** include sqlite3.c, as opposed to sqlite3.h, in order to get access
|
||||
** to some internal details like SQLITE_MAX_... and friends, and keep
|
||||
** those consistent with this build. This increases the rebuild time
|
||||
** considerably, however.
|
||||
** to some interal details like SQLITE_MAX_... and friends. This
|
||||
** increases the rebuild time considerably but we need this in order
|
||||
** to access some internal functionality and keep the to-Java-exported
|
||||
** values of SQLITE_MAX_... and SQLITE_LIMIT_... in sync with the C
|
||||
** build.
|
||||
*/
|
||||
#ifndef SQLITE_C
|
||||
# define SQLITE_C sqlite3.c
|
||||
@@ -166,10 +168,6 @@
|
||||
** Creates a verbose JNI function name. Suffix must be
|
||||
** the JNI-mangled form of the function's name, minus the
|
||||
** prefix seen in this macro.
|
||||
**
|
||||
** If you get java.lang.UnsatisfiedLinkError when calling newly-added
|
||||
** native bindings, be sure that the mangled name is correct. It can
|
||||
** be found in the generated sqlite3-jni.h.
|
||||
*/
|
||||
#define JniFuncName(Suffix) \
|
||||
Java_org_sqlite_jni_capi_CApi_sqlite3_ ## Suffix
|
||||
@@ -179,10 +177,10 @@
|
||||
JNIEXPORT ReturnType JNICALL JniFuncName(Suffix)
|
||||
|
||||
/*
|
||||
** S3JniApi's intent is that CFunc be the name(s) of the C API func(s)
|
||||
** the being-declared JNI function is wrapping, making it easier to
|
||||
** find those bindings' JNI-side entry points. The other args are for
|
||||
** JniDecl. See the many examples in this file.
|
||||
** S3JniApi's intent is that CFunc be the C API func(s) the
|
||||
** being-declared JNI function is wrapping, making it easier to find
|
||||
** that function's JNI-side entry point. The other args are for JniDecl.
|
||||
** See the many examples in this file.
|
||||
*/
|
||||
#define S3JniApi(CFunc,ReturnType,Suffix) JniDecl(ReturnType,Suffix)
|
||||
|
||||
@@ -333,7 +331,7 @@ struct S3JniNphOp {
|
||||
const char * const zMember /* Name of member property */;
|
||||
const char * const zTypeSig /* JNI type signature of zMember */;
|
||||
/*
|
||||
** klazz is a global ref to the class represented by zName.
|
||||
** klazz is a global ref to the class represented by pRef.
|
||||
**
|
||||
** According to:
|
||||
**
|
||||
@@ -997,20 +995,19 @@ static S3JniEnv * S3JniEnv__get(JNIEnv * const env){
|
||||
** JNI bindings such as sqlite3_prepare_v2/v3(), and definitely not
|
||||
** from client code.
|
||||
**
|
||||
** Returns err_code _unless_ err_code is 0 and sqlite3_set_errmsg()
|
||||
** fails with OOM, in which case it may return SQLITE_OOM or fail
|
||||
** fatally.
|
||||
**
|
||||
** This function predates sqlite3_set_errmsg(), which is why it has a
|
||||
** slightly different interface. Before that function was introduced,
|
||||
** this code used the SQLite-internal APIs to do this.
|
||||
** Returns err_code.
|
||||
*/
|
||||
static int s3jni_db_error(JNIEnv * env, sqlite3* const db,
|
||||
int err_code, const char * const zMsg){
|
||||
static int s3jni_db_error(sqlite3* const db, int err_code,
|
||||
const char * const zMsg){
|
||||
if( db!=0 ){
|
||||
int const rc = sqlite3_set_errmsg(db, err_code, zMsg);
|
||||
s3jni_oom_fatal(0==rc);
|
||||
if( rc && !err_code ) err_code=rc;
|
||||
if( 0==zMsg ){
|
||||
sqlite3Error(db, err_code);
|
||||
}else{
|
||||
const int nMsg = sqlite3Strlen30(zMsg);
|
||||
sqlite3_mutex_enter(sqlite3_db_mutex(db));
|
||||
sqlite3ErrorWithMsg(db, err_code, "%.*s", nMsg, zMsg);
|
||||
sqlite3_mutex_leave(sqlite3_db_mutex(db));
|
||||
}
|
||||
}
|
||||
return err_code;
|
||||
}
|
||||
@@ -1234,11 +1231,11 @@ static int s3jni__db_exception(JNIEnv * const env, sqlite3 * const pDb,
|
||||
char * zMsg;
|
||||
S3JniExceptionClear;
|
||||
zMsg = s3jni_exception_error_msg(env, ex);
|
||||
s3jni_db_error(env, pDb, errCode, zMsg ? zMsg : zDfltMsg);
|
||||
s3jni_db_error(pDb, errCode, zMsg ? zMsg : zDfltMsg);
|
||||
sqlite3_free(zMsg);
|
||||
S3JniUnrefLocal(ex);
|
||||
}else if( zDfltMsg ){
|
||||
s3jni_db_error(env, pDb, errCode, zDfltMsg);
|
||||
s3jni_db_error(pDb, errCode, zDfltMsg);
|
||||
}
|
||||
return errCode;
|
||||
}
|
||||
@@ -1955,6 +1952,15 @@ static void S3JniUdf_finalizer(void * s){
|
||||
S3JniUdf_free(s3jni_env(), (S3JniUdf*)s, 1);
|
||||
}
|
||||
|
||||
/*
|
||||
** Helper for processing args to UDF handlers with signature
|
||||
** (sqlite3_context*,int,sqlite3_value**).
|
||||
*/
|
||||
typedef struct {
|
||||
jobject jcx /* sqlite3_context */;
|
||||
jobjectArray jargv /* sqlite3_value[] */;
|
||||
} udf_jargs;
|
||||
|
||||
/*
|
||||
** Converts the given (cx, argc, argv) into arguments for the given
|
||||
** UDF, writing the result (Java wrappers for cx and argv) in the
|
||||
@@ -1996,7 +2002,7 @@ error_oom:
|
||||
/*
|
||||
** Requires that jCx and jArgv are sqlite3_context
|
||||
** resp. array-of-sqlite3_value values initialized by udf_args(). The
|
||||
** (argc,argv) are (0,NULL) for UDF types with no arguments. This
|
||||
** latter will be 0-and-NULL for UDF types with no arguments. This
|
||||
** function zeroes out the nativePointer member of jCx and each entry
|
||||
** in jArgv. This is a safety-net precaution to avoid undefined
|
||||
** behavior if a Java-side UDF holds a reference to its context or one
|
||||
@@ -2089,19 +2095,19 @@ static int udf_xFSI(sqlite3_context* const pCx, int argc,
|
||||
sqlite3_value** const argv, S3JniUdf * const s,
|
||||
jmethodID xMethodID, const char * const zFuncType){
|
||||
S3JniDeclLocal_env;
|
||||
jobject jcx = 0 /* sqlite3_context */;
|
||||
jobjectArray jargv = 0 /* sqlite3_value[] */;
|
||||
int rc = udf_args(env, pCx, argc, argv, &jcx, &jargv);
|
||||
udf_jargs args = {0,0};
|
||||
int rc = udf_args(env, pCx, argc, argv, &args.jcx, &args.jargv);
|
||||
|
||||
if( 0 == rc ){
|
||||
(*env)->CallVoidMethod(env, s->jObj, xMethodID, jcx, jargv);
|
||||
(*env)->CallVoidMethod(env, s->jObj, xMethodID, args.jcx, args.jargv);
|
||||
S3JniIfThrew{
|
||||
rc = udf_report_exception(env, 'F'==zFuncType[1]/*xFunc*/, pCx,
|
||||
s->zFuncName, zFuncType);
|
||||
}
|
||||
udf_unargs(env, jcx, argc, jargv);
|
||||
udf_unargs(env, args.jcx, argc, args.jargv);
|
||||
}
|
||||
S3JniUnrefLocal(jcx);
|
||||
S3JniUnrefLocal(jargv);
|
||||
S3JniUnrefLocal(args.jcx);
|
||||
S3JniUnrefLocal(args.jargv);
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -3290,7 +3296,7 @@ static jobject s3jni_commit_rollback_hook(int isCommit, JNIEnv * const env,
|
||||
S3JniDb_mutex_enter;
|
||||
ps = S3JniDb_from_jlong(jpDb);
|
||||
if( !ps ){
|
||||
s3jni_db_error(env, ps->pDb, SQLITE_MISUSE, 0);
|
||||
s3jni_db_error(ps->pDb, SQLITE_MISUSE, 0);
|
||||
S3JniDb_mutex_leave;
|
||||
return 0;
|
||||
}
|
||||
@@ -3310,14 +3316,13 @@ static jobject s3jni_commit_rollback_hook(int isCommit, JNIEnv * const env,
|
||||
else sqlite3_rollback_hook(ps->pDb, 0, 0);
|
||||
}else{
|
||||
jclass const klazz = (*env)->GetObjectClass(env, jHook);
|
||||
jmethodID const xCallback =
|
||||
(*env)->GetMethodID(env, klazz, "call",
|
||||
isCommit ? "()I" : "()V");
|
||||
jmethodID const xCallback = (*env)->GetMethodID(env, klazz, "call",
|
||||
isCommit ? "()I" : "()V");
|
||||
S3JniUnrefLocal(klazz);
|
||||
S3JniIfThrew {
|
||||
S3JniExceptionReport;
|
||||
S3JniExceptionClear;
|
||||
s3jni_db_error(env, ps->pDb, SQLITE_ERROR,
|
||||
s3jni_db_error(ps->pDb, SQLITE_ERROR,
|
||||
"Cannot not find matching call() method in"
|
||||
"hook object.");
|
||||
}else{
|
||||
@@ -3597,7 +3602,7 @@ S3JniApi(sqlite3_create_collation() sqlite3_create_collation_v2(),
|
||||
(*env)->GetMethodID(env, klazz, "call", "([B[B)I");
|
||||
S3JniUnrefLocal(klazz);
|
||||
S3JniIfThrew{
|
||||
rc = s3jni_db_error(env, ps->pDb, SQLITE_ERROR,
|
||||
rc = s3jni_db_error(ps->pDb, SQLITE_ERROR,
|
||||
"Could not get call() method from "
|
||||
"CollationCallback object.");
|
||||
}else{
|
||||
@@ -3636,15 +3641,15 @@ S3JniApi(sqlite3_create_function() sqlite3_create_function_v2()
|
||||
|
||||
if( !pDb || !jFuncName ){
|
||||
return SQLITE_MISUSE;
|
||||
}else if( !encodingTypeIsValid(eTextRep & 0x0f) ){
|
||||
return s3jni_db_error(env, pDb, SQLITE_FORMAT,
|
||||
}else if( !encodingTypeIsValid(eTextRep) ){
|
||||
return s3jni_db_error(pDb, SQLITE_FORMAT,
|
||||
"Invalid function encoding option.");
|
||||
}
|
||||
s = S3JniUdf_alloc(env, jFunctor);
|
||||
if( !s ) return SQLITE_NOMEM;
|
||||
|
||||
if( UDF_UNKNOWN_TYPE==s->type ){
|
||||
rc = s3jni_db_error(env, pDb, SQLITE_MISUSE,
|
||||
rc = s3jni_db_error(pDb, SQLITE_MISUSE,
|
||||
"Cannot unambiguously determine function type.");
|
||||
S3JniUdf_free(env, s, 1);
|
||||
goto error_cleanup;
|
||||
@@ -3851,19 +3856,6 @@ S3JniApi(sqlite3_errmsg(),jstring,1errmsg)(
|
||||
effect should be identical to using errmsg16(), however. */;
|
||||
}
|
||||
|
||||
S3JniApi(sqlite3_set_errmsg(),jint,1set_1errmsg)(
|
||||
JniArgsEnvClass, jobject jpDb, jint errCode, jstring msg
|
||||
){
|
||||
sqlite3 * const pDb = PtrGet_sqlite3(jpDb);
|
||||
const char *zUtf8;
|
||||
jint rc;
|
||||
if( !pDb ) return SQLITE_MISUSE;
|
||||
zUtf8 = msg ? s3jni_jstring_to_mutf8(msg) : NULL;
|
||||
rc = sqlite3_set_errmsg(pDb, (int)errCode, zUtf8);
|
||||
s3jni_mutf8_release(msg, zUtf8);
|
||||
return rc;
|
||||
}
|
||||
|
||||
S3JniApi(sqlite3_errstr(),jstring,1errstr)(
|
||||
JniArgsEnvClass, jint rcCode
|
||||
){
|
||||
@@ -4003,7 +3995,7 @@ S3JniApi(sqlite3_jni_db_error(), jint, 1jni_1db_1error)(
|
||||
zStr = jStr
|
||||
? s3jni_jstring_to_utf8( jStr, 0)
|
||||
: NULL;
|
||||
rc = s3jni_db_error(env, ps->pDb, (int)jRc, zStr );
|
||||
rc = s3jni_db_error( ps->pDb, (int)jRc, zStr );
|
||||
sqlite3_free(zStr);
|
||||
}
|
||||
return rc;
|
||||
@@ -4312,7 +4304,7 @@ static void s3jni_updatepre_hook_impl(void * pState, sqlite3 *pDb, int opId,
|
||||
jTable = jDbName ? s3jni_utf8_to_jstring( zTable, -1) : 0;
|
||||
S3JniIfThrew {
|
||||
S3JniExceptionClear;
|
||||
s3jni_db_error(env, ps->pDb, SQLITE_NOMEM, 0);
|
||||
s3jni_db_error(ps->pDb, SQLITE_NOMEM, 0);
|
||||
}else{
|
||||
assert( hook.jObj );
|
||||
assert( hook.midCallback );
|
||||
@@ -4414,7 +4406,7 @@ static jobject s3jni_updatepre_hook(JNIEnv * env, int isPre, jlong jpDb, jobject
|
||||
S3JniUnrefLocal(klazz);
|
||||
S3JniIfThrew {
|
||||
S3JniExceptionClear;
|
||||
s3jni_db_error(env, ps->pDb, SQLITE_ERROR,
|
||||
s3jni_db_error(ps->pDb, SQLITE_ERROR,
|
||||
"Cannot not find matching callback on "
|
||||
"(pre)update hook object.");
|
||||
}else{
|
||||
@@ -4523,7 +4515,7 @@ S3JniApi(sqlite3_progress_handler(),void,1progress_1handler)(
|
||||
S3JniUnrefLocal(klazz);
|
||||
S3JniIfThrew {
|
||||
S3JniExceptionClear;
|
||||
s3jni_db_error(env, ps->pDb, SQLITE_ERROR,
|
||||
s3jni_db_error(ps->pDb, SQLITE_ERROR,
|
||||
"Cannot not find matching xCallback() on "
|
||||
"ProgressHandler object.");
|
||||
}else{
|
||||
@@ -4897,9 +4889,8 @@ S3JniApi(sqlite3_set_authorizer(),jint,1set_1authorizer)(
|
||||
")I");
|
||||
S3JniUnrefLocal(klazz);
|
||||
S3JniIfThrew {
|
||||
rc = s3jni_db_error(env, ps->pDb, SQLITE_ERROR,
|
||||
"Error setting up Java parts of "
|
||||
"authorizer hook.");
|
||||
rc = s3jni_db_error(ps->pDb, SQLITE_ERROR,
|
||||
"Error setting up Java parts of authorizer hook.");
|
||||
}else{
|
||||
rc = sqlite3_set_authorizer(ps->pDb, s3jni_xAuth, ps);
|
||||
}
|
||||
@@ -5183,7 +5174,7 @@ S3JniApi(sqlite3_trace_v2(),jint,1trace_1v2)(
|
||||
S3JniUnrefLocal(klazz);
|
||||
S3JniIfThrew {
|
||||
S3JniExceptionClear;
|
||||
rc = s3jni_db_error(env, ps->pDb, SQLITE_ERROR,
|
||||
rc = s3jni_db_error(ps->pDb, SQLITE_ERROR,
|
||||
"Cannot not find matching call() on "
|
||||
"TracerCallback object.");
|
||||
}else{
|
||||
@@ -5521,7 +5512,7 @@ static inline jobject new_java_fts5_api(JNIEnv * const env, fts5_api *sv){
|
||||
** Returns a per-JNIEnv global ref to the Fts5ExtensionApi singleton
|
||||
** instance, or NULL on OOM.
|
||||
*/
|
||||
static jobject s3jni_getFts5ExtensionApi(JNIEnv * const env){
|
||||
static jobject s3jni_getFts5ExensionApi(JNIEnv * const env){
|
||||
if( !SJG.fts5.jExt ){
|
||||
S3JniGlobal_mutex_enter;
|
||||
if( !SJG.fts5.jExt ){
|
||||
@@ -5587,7 +5578,7 @@ JniDeclFtsApi(jobject,getInstanceForDb)(JniArgsEnvClass,jobject jDb){
|
||||
|
||||
|
||||
JniDeclFtsXA(jobject,getInstance)(JniArgsEnvClass){
|
||||
return s3jni_getFts5ExtensionApi(env);
|
||||
return s3jni_getFts5ExensionApi(env);
|
||||
}
|
||||
|
||||
JniDeclFtsXA(jint,xColumnCount)(JniArgsEnvObj,jobject jCtx){
|
||||
@@ -5650,7 +5641,7 @@ static void s3jni_fts5_extension_function(Fts5ExtensionApi const *pApi,
|
||||
S3JniDeclLocal_env;
|
||||
|
||||
assert(pAux);
|
||||
jFXA = s3jni_getFts5ExtensionApi(env);
|
||||
jFXA = s3jni_getFts5ExensionApi(env);
|
||||
if( !jFXA ) goto error_oom;
|
||||
jpFts = new_java_Fts5Context(env, pFts);
|
||||
if( !jpFts ) goto error_oom;
|
||||
|
||||
@@ -245,10 +245,8 @@ extern "C" {
|
||||
#define org_sqlite_jni_capi_CApi_SQLITE_DBSTATUS_CACHE_USED_SHARED 11L
|
||||
#undef org_sqlite_jni_capi_CApi_SQLITE_DBSTATUS_CACHE_SPILL
|
||||
#define org_sqlite_jni_capi_CApi_SQLITE_DBSTATUS_CACHE_SPILL 12L
|
||||
#undef org_sqlite_jni_capi_CApi_SQLITE_DBSTATUS_TEMPBUF_SPILL
|
||||
#define org_sqlite_jni_capi_CApi_SQLITE_DBSTATUS_TEMPBUF_SPILL 13L
|
||||
#undef org_sqlite_jni_capi_CApi_SQLITE_DBSTATUS_MAX
|
||||
#define org_sqlite_jni_capi_CApi_SQLITE_DBSTATUS_MAX 13L
|
||||
#define org_sqlite_jni_capi_CApi_SQLITE_DBSTATUS_MAX 12L
|
||||
#undef org_sqlite_jni_capi_CApi_SQLITE_UTF8
|
||||
#define org_sqlite_jni_capi_CApi_SQLITE_UTF8 1L
|
||||
#undef org_sqlite_jni_capi_CApi_SQLITE_UTF16LE
|
||||
@@ -1419,14 +1417,6 @@ JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1errcode
|
||||
JNIEXPORT jstring JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1errmsg
|
||||
(JNIEnv *, jclass, jobject);
|
||||
|
||||
/*
|
||||
* Class: org_sqlite_jni_capi_CApi
|
||||
* Method: sqlite3_set_errmsg
|
||||
* Signature: (Lorg/sqlite/jni/capi/sqlite3;ILjava/lang/String;)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_org_sqlite_jni_capi_CApi_sqlite3_1set_1errmsg
|
||||
(JNIEnv *, jclass, jobject, jint, jstring);
|
||||
|
||||
/*
|
||||
* Class: org_sqlite_jni_capi_CApi
|
||||
* Method: sqlite3_error_offset
|
||||
|
||||
@@ -31,11 +31,11 @@ import java.lang.annotation.*;
|
||||
never pass a null value to the callback for that parameter.</p>
|
||||
|
||||
<p>Passing a null, for this annotation's definition of null, for
|
||||
any parameter marked with this annotation specifically invokes
|
||||
any parameter marked with this annoation specifically invokes
|
||||
undefined behavior (see below).</p>
|
||||
|
||||
<p>Passing 0 (i.e. C NULL) or a negative value for any long-type
|
||||
parameter marked with this annotation specifically invokes undefined
|
||||
parameter marked with this annoation specifically invokes undefined
|
||||
behavior (see below). Such values are treated as C pointers in the
|
||||
JNI layer.</p>
|
||||
|
||||
|
||||
@@ -120,7 +120,7 @@ public abstract class AggregateFunction<T> implements SQLFunction {
|
||||
argument, the context is set to the given initial value. On all other
|
||||
calls, the 2nd argument is ignored.
|
||||
|
||||
@see AggregateFunction.PerContextState#getAggregateState
|
||||
@see SQLFunction.PerContextState#getAggregateState
|
||||
*/
|
||||
protected final ValueHolder<T> getAggregateState(sqlite3_context cx, T initialValue){
|
||||
return map.getAggregateState(cx, initialValue);
|
||||
@@ -130,7 +130,7 @@ public abstract class AggregateFunction<T> implements SQLFunction {
|
||||
To be called from the implementation's xFinal() method to fetch
|
||||
the final state of the UDF and remove its mapping.
|
||||
|
||||
see AggregateFunction.PerContextState#takeAggregateState
|
||||
see SQLFunction.PerContextState#takeAggregateState
|
||||
*/
|
||||
protected final T takeAggregateState(sqlite3_context cx){
|
||||
return map.takeAggregateState(cx);
|
||||
|
||||
@@ -12,9 +12,14 @@
|
||||
** This file declares the main JNI bindings for the sqlite3 C API.
|
||||
*/
|
||||
package org.sqlite.jni.capi;
|
||||
import java.util.Arrays;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.ElementType;
|
||||
import org.sqlite.jni.annotation.*;
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
This class contains the entire C-style sqlite3 JNI API binding,
|
||||
@@ -115,9 +120,8 @@ public final class CApi {
|
||||
JNIEnv is not cached, else returns true, but this information is
|
||||
primarily for testing of the JNI bindings and is not information
|
||||
which client-level code can use to make any informed
|
||||
decisions. The semantics of its return type and value are not
|
||||
considered stable and may change at any time. i.e. act as if it
|
||||
returns null.
|
||||
decisions. Its return type and semantics are not considered
|
||||
stable and may change at any time.
|
||||
*/
|
||||
public static native boolean sqlite3_java_uncache_thread();
|
||||
|
||||
@@ -165,7 +169,7 @@ public final class CApi {
|
||||
<p>Like the C API, it returns 0 if allocation fails or if
|
||||
initialize is false and no prior aggregate context was allocated
|
||||
for cx. If initialize is true then it returns 0 only on
|
||||
allocation error. In all cases, 0 is considered the sentinel
|
||||
allocation error. In all casses, 0 is considered the sentinel
|
||||
"not a key" value.
|
||||
*/
|
||||
public static native long sqlite3_aggregate_context(sqlite3_context cx, boolean initialize);
|
||||
@@ -559,7 +563,7 @@ public final class CApi {
|
||||
sqlite3_blob_open(db.getNativePointer(), dbName, tableName, columnName,
|
||||
iRow, flags, out);
|
||||
return out.take();
|
||||
}
|
||||
};
|
||||
|
||||
private static native int sqlite3_blob_read(
|
||||
@NotNull long ptrToBlob, @NotNull byte[] target, int srcOffset
|
||||
@@ -1198,15 +1202,10 @@ public final class CApi {
|
||||
|
||||
public static native String sqlite3_errmsg(@NotNull sqlite3 db);
|
||||
|
||||
/** Added in 3.51.0. */
|
||||
public static native int sqlite3_set_errmsg(@NotNull sqlite3 db,
|
||||
int resultCode,
|
||||
String msg);
|
||||
|
||||
private static native int sqlite3_error_offset(@NotNull long ptrToDb);
|
||||
|
||||
/**
|
||||
Caveat: the returned byte offset values assume UTF-8-encoded
|
||||
Note that the returned byte offset values assume UTF-8-encoded
|
||||
inputs, so won't always match character offsets in Java Strings.
|
||||
*/
|
||||
public static int sqlite3_error_offset(@NotNull sqlite3 db){
|
||||
@@ -1299,7 +1298,7 @@ public final class CApi {
|
||||
final OutputPointer.sqlite3 out = new OutputPointer.sqlite3();
|
||||
sqlite3_open(filename, out);
|
||||
return out.take();
|
||||
}
|
||||
};
|
||||
|
||||
public static native int sqlite3_open_v2(
|
||||
@Nullable String filename, @NotNull OutputPointer.sqlite3 ppDb,
|
||||
@@ -1315,7 +1314,7 @@ public final class CApi {
|
||||
final OutputPointer.sqlite3 out = new OutputPointer.sqlite3();
|
||||
sqlite3_open_v2(filename, out, flags, zVfs);
|
||||
return out.take();
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
The sqlite3_prepare() family of functions require slightly
|
||||
@@ -1411,7 +1410,7 @@ public final class CApi {
|
||||
|
||||
/**
|
||||
Works like the canonical sqlite3_prepare_v2() but its "tail"
|
||||
output parameter is returned as the index offset into the given
|
||||
output paramter is returned as the index offset into the given
|
||||
byte array at which SQL parsing stopped.
|
||||
*/
|
||||
public static int sqlite3_prepare_v2(
|
||||
@@ -1463,7 +1462,7 @@ public final class CApi {
|
||||
|
||||
/**
|
||||
Works like the canonical sqlite3_prepare_v2() but its "tail"
|
||||
output parameter is returned as the index offset into the given
|
||||
output paramter is returned as the index offset into the given
|
||||
byte array at which SQL parsing stopped.
|
||||
*/
|
||||
public static int sqlite3_prepare_v3(
|
||||
@@ -1543,7 +1542,7 @@ public final class CApi {
|
||||
int rc = 0;
|
||||
final OutputPointer.sqlite3_stmt outStmt = new OutputPointer.sqlite3_stmt();
|
||||
while( 0==rc && pos<sqlChunk.length ){
|
||||
sqlite3_stmt stmt;
|
||||
sqlite3_stmt stmt = null;
|
||||
if( pos>0 ){
|
||||
sqlChunk = Arrays.copyOfRange(sqlChunk, pos,
|
||||
sqlChunk.length);
|
||||
@@ -2586,8 +2585,7 @@ public final class CApi {
|
||||
public static final int SQLITE_DBSTATUS_DEFERRED_FKS = 10;
|
||||
public static final int SQLITE_DBSTATUS_CACHE_USED_SHARED = 11;
|
||||
public static final int SQLITE_DBSTATUS_CACHE_SPILL = 12;
|
||||
public static final int SQLITE_DBSTATUS_TEMPBUF_SPILL = 13;
|
||||
public static final int SQLITE_DBSTATUS_MAX = 13;
|
||||
public static final int SQLITE_DBSTATUS_MAX = 12;
|
||||
|
||||
// encodings
|
||||
public static final int SQLITE_UTF8 = 1;
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
*/
|
||||
package org.sqlite.jni.capi;
|
||||
/**
|
||||
This marker interface exists solely for use as a documentation and
|
||||
This marker interface exists soley for use as a documentation and
|
||||
class-grouping tool. It should be applied to interfaces or
|
||||
classes which have a call() method implementing some specific
|
||||
callback interface on behalf of the C library.
|
||||
@@ -34,7 +34,7 @@ package org.sqlite.jni.capi;
|
||||
proxying for, minus the {@code sqlite3_} prefix, plus a {@code
|
||||
Callback} suffix. e.g. {@code sqlite3_busy_handler()}'s callback is
|
||||
named {@code BusyHandlerCallback}. Exceptions are made where that
|
||||
would potentially be ambiguous, e.g. {@link ConfigSqlLogCallback}
|
||||
would potentially be ambiguous, e.g. {@link ConfigSqllogCallback}
|
||||
instead of {@code ConfigCallback} because the {@code
|
||||
sqlite3_config()} interface may need to support more callback types
|
||||
in the future.
|
||||
|
||||
@@ -20,7 +20,7 @@ package org.sqlite.jni.capi;
|
||||
from the native JNI code is unduly quirky due to a lack of
|
||||
autoboxing at that level.
|
||||
|
||||
<p>The usage is similar for all of these types:
|
||||
<p>The usage is similar for all of thes types:
|
||||
|
||||
<pre>{@code
|
||||
OutputPointer.sqlite3 out = new OutputPointer.sqlite3();
|
||||
@@ -55,9 +55,9 @@ public final class OutputPointer {
|
||||
/** Sets the current value to null. */
|
||||
public void clear(){value = null;}
|
||||
/** Returns the current value. */
|
||||
public org.sqlite.jni.capi.sqlite3 get(){return value;}
|
||||
public final org.sqlite.jni.capi.sqlite3 get(){return value;}
|
||||
/** Equivalent to calling get() then clear(). */
|
||||
public org.sqlite.jni.capi.sqlite3 take(){
|
||||
public final org.sqlite.jni.capi.sqlite3 take(){
|
||||
final org.sqlite.jni.capi.sqlite3 v = value;
|
||||
value = null;
|
||||
return v;
|
||||
@@ -76,9 +76,9 @@ public final class OutputPointer {
|
||||
/** Sets the current value to null. */
|
||||
public void clear(){value = null;}
|
||||
/** Returns the current value. */
|
||||
public org.sqlite.jni.capi.sqlite3_blob get(){return value;}
|
||||
public final org.sqlite.jni.capi.sqlite3_blob get(){return value;}
|
||||
/** Equivalent to calling get() then clear(). */
|
||||
public org.sqlite.jni.capi.sqlite3_blob take(){
|
||||
public final org.sqlite.jni.capi.sqlite3_blob take(){
|
||||
final org.sqlite.jni.capi.sqlite3_blob v = value;
|
||||
value = null;
|
||||
return v;
|
||||
@@ -98,9 +98,9 @@ public final class OutputPointer {
|
||||
/** Sets the current value to null. */
|
||||
public void clear(){value = null;}
|
||||
/** Returns the current value. */
|
||||
public org.sqlite.jni.capi.sqlite3_stmt get(){return value;}
|
||||
public final org.sqlite.jni.capi.sqlite3_stmt get(){return value;}
|
||||
/** Equivalent to calling get() then clear(). */
|
||||
public org.sqlite.jni.capi.sqlite3_stmt take(){
|
||||
public final org.sqlite.jni.capi.sqlite3_stmt take(){
|
||||
final org.sqlite.jni.capi.sqlite3_stmt v = value;
|
||||
value = null;
|
||||
return v;
|
||||
@@ -120,9 +120,9 @@ public final class OutputPointer {
|
||||
/** Sets the current value to null. */
|
||||
public void clear(){value = null;}
|
||||
/** Returns the current value. */
|
||||
public org.sqlite.jni.capi.sqlite3_value get(){return value;}
|
||||
public final org.sqlite.jni.capi.sqlite3_value get(){return value;}
|
||||
/** Equivalent to calling get() then clear(). */
|
||||
public org.sqlite.jni.capi.sqlite3_value take(){
|
||||
public final org.sqlite.jni.capi.sqlite3_value take(){
|
||||
final org.sqlite.jni.capi.sqlite3_value v = value;
|
||||
value = null;
|
||||
return v;
|
||||
@@ -144,9 +144,9 @@ public final class OutputPointer {
|
||||
/** Initializes with the value v. */
|
||||
public Bool(boolean v){value = v;}
|
||||
/** Returns the current value. */
|
||||
public boolean get(){return value;}
|
||||
public final boolean get(){return value;}
|
||||
/** Sets the current value to v. */
|
||||
public void set(boolean v){value = v;}
|
||||
public final void set(boolean v){value = v;}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -164,9 +164,9 @@ public final class OutputPointer {
|
||||
/** Initializes with the value v. */
|
||||
public Int32(int v){value = v;}
|
||||
/** Returns the current value. */
|
||||
public int get(){return value;}
|
||||
public final int get(){return value;}
|
||||
/** Sets the current value to v. */
|
||||
public void set(int v){value = v;}
|
||||
public final void set(int v){value = v;}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -184,9 +184,9 @@ public final class OutputPointer {
|
||||
/** Initializes with the value v. */
|
||||
public Int64(long v){value = v;}
|
||||
/** Returns the current value. */
|
||||
public long get(){return value;}
|
||||
public final long get(){return value;}
|
||||
/** Sets the current value. */
|
||||
public void set(long v){value = v;}
|
||||
public final void set(long v){value = v;}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -204,9 +204,9 @@ public final class OutputPointer {
|
||||
/** Initializes with the value v. */
|
||||
public String(java.lang.String v){value = v;}
|
||||
/** Returns the current value. */
|
||||
public java.lang.String get(){return value;}
|
||||
public final java.lang.String get(){return value;}
|
||||
/** Sets the current value. */
|
||||
public void set(java.lang.String v){value = v;}
|
||||
public final void set(java.lang.String v){value = v;}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -224,9 +224,9 @@ public final class OutputPointer {
|
||||
/** Initializes with the value v. */
|
||||
public ByteArray(byte[] v){value = v;}
|
||||
/** Returns the current value. */
|
||||
public byte[] get(){return value;}
|
||||
public final byte[] get(){return value;}
|
||||
/** Sets the current value. */
|
||||
public void set(byte[] v){value = v;}
|
||||
public final void set(byte[] v){value = v;}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -246,8 +246,8 @@ public final class OutputPointer {
|
||||
/** Initializes with the value v. */
|
||||
public ByteBuffer(java.nio.ByteBuffer v){value = v;}
|
||||
/** Returns the current value. */
|
||||
public java.nio.ByteBuffer get(){return value;}
|
||||
public final java.nio.ByteBuffer get(){return value;}
|
||||
/** Sets the current value. */
|
||||
public void set(java.nio.ByteBuffer v){value = v;}
|
||||
public final void set(java.nio.ByteBuffer v){value = v;}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -65,7 +65,7 @@ public interface PrepareMultiCallback extends CallbackProxy {
|
||||
A PrepareMultiCallback impl which steps entirely through a result set,
|
||||
ignoring all non-error results.
|
||||
*/
|
||||
final class StepAll implements PrepareMultiCallback {
|
||||
public static final class StepAll implements PrepareMultiCallback {
|
||||
public StepAll(){}
|
||||
/**
|
||||
Calls sqlite3_step() on st until it returns something other than
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
** SQLTester framework.
|
||||
*/
|
||||
package org.sqlite.jni.capi;
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
@@ -30,7 +31,7 @@ enum ResultBufferMode {
|
||||
ESCAPED,
|
||||
//! Append output as-is
|
||||
ASIS
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
Modes to specify how to emit multi-row output from
|
||||
@@ -41,7 +42,7 @@ enum ResultRowMode {
|
||||
ONELINE,
|
||||
//! Add a newline between each result row.
|
||||
NEWLINE
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
Base exception type for test-related failures.
|
||||
@@ -277,7 +278,7 @@ public class SQLTester {
|
||||
}
|
||||
|
||||
private StringBuilder clearBuffer(StringBuilder b){
|
||||
b.setLength(0);
|
||||
b.setLength(0);;
|
||||
return b;
|
||||
}
|
||||
|
||||
@@ -333,7 +334,7 @@ public class SQLTester {
|
||||
return this;
|
||||
}
|
||||
|
||||
sqlite3 setCurrentDb(int n){
|
||||
sqlite3 setCurrentDb(int n) throws Exception{
|
||||
affirmDbId(n);
|
||||
iCurrentDb = n;
|
||||
return this.aDb[n];
|
||||
@@ -341,7 +342,7 @@ public class SQLTester {
|
||||
|
||||
sqlite3 getCurrentDb(){ return aDb[iCurrentDb]; }
|
||||
|
||||
sqlite3 getDbById(int id){
|
||||
sqlite3 getDbById(int id) throws Exception{
|
||||
return affirmDbId(id).aDb[id];
|
||||
}
|
||||
|
||||
@@ -362,7 +363,7 @@ public class SQLTester {
|
||||
}
|
||||
}
|
||||
|
||||
sqlite3 openDb(String name, boolean createIfNeeded) {
|
||||
sqlite3 openDb(String name, boolean createIfNeeded) throws DbException {
|
||||
closeDb();
|
||||
int flags = SQLITE_OPEN_READWRITE;
|
||||
if( createIfNeeded ) flags |= SQLITE_OPEN_CREATE;
|
||||
@@ -754,7 +755,7 @@ abstract class Command {
|
||||
fall in the inclusive range (min,max) then this function throws. Use
|
||||
a max value of -1 to mean unlimited.
|
||||
*/
|
||||
protected final void argcCheck(TestScript ts, String[] argv, int min, int max){
|
||||
protected final void argcCheck(TestScript ts, String[] argv, int min, int max) throws Exception{
|
||||
int argc = argv.length-1;
|
||||
if(argc<min || (max>=0 && argc>max)){
|
||||
if( min==max ){
|
||||
@@ -770,16 +771,16 @@ abstract class Command {
|
||||
/**
|
||||
Equivalent to argcCheck(argv,argc,argc).
|
||||
*/
|
||||
protected final void argcCheck(TestScript ts, String[] argv, int argc){
|
||||
protected final void argcCheck(TestScript ts, String[] argv, int argc) throws Exception{
|
||||
argcCheck(ts, argv, argc, argc);
|
||||
}
|
||||
}
|
||||
|
||||
//! --close command
|
||||
class CloseDbCommand extends Command {
|
||||
public void process(SQLTester t, TestScript ts, String[] argv){
|
||||
public void process(SQLTester t, TestScript ts, String[] argv) throws Exception{
|
||||
argcCheck(ts,argv,0,1);
|
||||
int id;
|
||||
Integer id;
|
||||
if(argv.length>1){
|
||||
String arg = argv[1];
|
||||
if("all".equals(arg)){
|
||||
@@ -800,7 +801,7 @@ class CloseDbCommand extends Command {
|
||||
class ColumnNamesCommand extends Command {
|
||||
public void process(
|
||||
SQLTester st, TestScript ts, String[] argv
|
||||
){
|
||||
) throws Exception{
|
||||
argcCheck(ts,argv,1);
|
||||
st.outputColumnNames( Integer.parseInt(argv[1])!=0 );
|
||||
}
|
||||
@@ -808,7 +809,7 @@ class ColumnNamesCommand extends Command {
|
||||
|
||||
//! --db command
|
||||
class DbCommand extends Command {
|
||||
public void process(SQLTester t, TestScript ts, String[] argv){
|
||||
public void process(SQLTester t, TestScript ts, String[] argv) throws Exception{
|
||||
argcCheck(ts,argv,1);
|
||||
t.setCurrentDb( Integer.parseInt(argv[1]) );
|
||||
}
|
||||
@@ -820,7 +821,7 @@ class GlobCommand extends Command {
|
||||
public GlobCommand(){}
|
||||
protected GlobCommand(boolean negate){ this.negate = negate; }
|
||||
|
||||
public void process(SQLTester t, TestScript ts, String[] argv){
|
||||
public void process(SQLTester t, TestScript ts, String[] argv) throws Exception{
|
||||
argcCheck(ts,argv,1,-1);
|
||||
t.incrementTestCounter();
|
||||
final String sql = t.takeInputBuffer();
|
||||
@@ -850,7 +851,7 @@ class JsonBlockCommand extends TableResultCommand {
|
||||
//! --new command
|
||||
class NewDbCommand extends OpenDbCommand {
|
||||
public NewDbCommand(){ super(true); }
|
||||
public void process(SQLTester t, TestScript ts, String[] argv){
|
||||
public void process(SQLTester t, TestScript ts, String[] argv) throws Exception{
|
||||
if(argv.length>1){
|
||||
Util.unlink(argv[1]);
|
||||
}
|
||||
@@ -866,7 +867,7 @@ class NoopCommand extends Command {
|
||||
this.verbose = verbose;
|
||||
}
|
||||
public NoopCommand(){}
|
||||
public void process(SQLTester t, TestScript ts, String[] argv){
|
||||
public void process(SQLTester t, TestScript ts, String[] argv) throws Exception{
|
||||
if( this.verbose ){
|
||||
t.outln("Skipping unhandled command: "+argv[0]);
|
||||
}
|
||||
@@ -884,7 +885,7 @@ class NotGlobCommand extends GlobCommand {
|
||||
class NullCommand extends Command {
|
||||
public void process(
|
||||
SQLTester st, TestScript ts, String[] argv
|
||||
){
|
||||
) throws Exception{
|
||||
argcCheck(ts,argv,1);
|
||||
st.setNullValue( argv[1] );
|
||||
}
|
||||
@@ -895,7 +896,7 @@ class OpenDbCommand extends Command {
|
||||
private boolean createIfNeeded = false;
|
||||
public OpenDbCommand(){}
|
||||
protected OpenDbCommand(boolean c){createIfNeeded = c;}
|
||||
public void process(SQLTester t, TestScript ts, String[] argv){
|
||||
public void process(SQLTester t, TestScript ts, String[] argv) throws Exception{
|
||||
argcCheck(ts,argv,1);
|
||||
t.openDb(argv[1], createIfNeeded);
|
||||
}
|
||||
@@ -905,7 +906,7 @@ class OpenDbCommand extends Command {
|
||||
class PrintCommand extends Command {
|
||||
public void process(
|
||||
SQLTester st, TestScript ts, String[] argv
|
||||
){
|
||||
) throws Exception{
|
||||
st.out(ts.getOutputPrefix(),": ");
|
||||
if( 1==argv.length ){
|
||||
st.out( st.getInputText() );
|
||||
@@ -920,7 +921,7 @@ class ResultCommand extends Command {
|
||||
private final ResultBufferMode bufferMode;
|
||||
protected ResultCommand(ResultBufferMode bm){ bufferMode = bm; }
|
||||
public ResultCommand(){ this(ResultBufferMode.ESCAPED); }
|
||||
public void process(SQLTester t, TestScript ts, String[] argv){
|
||||
public void process(SQLTester t, TestScript ts, String[] argv) throws Exception{
|
||||
argcCheck(ts,argv,0,-1);
|
||||
t.incrementTestCounter();
|
||||
final String sql = t.takeInputBuffer();
|
||||
@@ -938,7 +939,7 @@ class ResultCommand extends Command {
|
||||
|
||||
//! --run command
|
||||
class RunCommand extends Command {
|
||||
public void process(SQLTester t, TestScript ts, String[] argv){
|
||||
public void process(SQLTester t, TestScript ts, String[] argv) throws Exception{
|
||||
argcCheck(ts,argv,0,1);
|
||||
final sqlite3 db = (1==argv.length)
|
||||
? t.getCurrentDb() : t.getDbById( Integer.parseInt(argv[1]) );
|
||||
@@ -958,7 +959,7 @@ class TableResultCommand extends Command {
|
||||
private final boolean jsonMode;
|
||||
protected TableResultCommand(boolean jsonMode){ this.jsonMode = jsonMode; }
|
||||
public TableResultCommand(){ this(false); }
|
||||
public void process(SQLTester t, TestScript ts, String[] argv){
|
||||
public void process(SQLTester t, TestScript ts, String[] argv) throws Exception{
|
||||
argcCheck(ts,argv,0);
|
||||
t.incrementTestCounter();
|
||||
String body = ts.fetchCommandBody(t);
|
||||
@@ -1001,7 +1002,7 @@ class TableResultCommand extends Command {
|
||||
|
||||
//! --testcase command
|
||||
class TestCaseCommand extends Command {
|
||||
public void process(SQLTester t, TestScript ts, String[] argv){
|
||||
public void process(SQLTester t, TestScript ts, String[] argv) throws Exception{
|
||||
argcCheck(ts,argv,1);
|
||||
ts.setTestCaseName(argv[1]);
|
||||
t.clearResultBuffer();
|
||||
@@ -1011,7 +1012,7 @@ class TestCaseCommand extends Command {
|
||||
|
||||
//! --verbosity command
|
||||
class VerbosityCommand extends Command {
|
||||
public void process(SQLTester t, TestScript ts, String[] argv){
|
||||
public void process(SQLTester t, TestScript ts, String[] argv) throws Exception{
|
||||
argcCheck(ts,argv,1);
|
||||
ts.setVerbosity( Integer.parseInt(argv[1]) );
|
||||
}
|
||||
@@ -1019,7 +1020,7 @@ class VerbosityCommand extends Command {
|
||||
|
||||
class CommandDispatcher {
|
||||
|
||||
private static final java.util.Map<String,Command> commandMap =
|
||||
private static java.util.Map<String,Command> commandMap =
|
||||
new java.util.HashMap<>();
|
||||
|
||||
/**
|
||||
@@ -1243,7 +1244,7 @@ class TestScript {
|
||||
}
|
||||
cur.pos = i;
|
||||
final String rv = cur.sb.toString();
|
||||
if( i==cur.src.length && rv.isEmpty() ){
|
||||
if( i==cur.src.length && 0==rv.length() ){
|
||||
return null /* EOF */;
|
||||
}
|
||||
return rv;
|
||||
@@ -1363,7 +1364,7 @@ class TestScript {
|
||||
if( m.find() ){
|
||||
throw new IncompatibleDirective(this, m.group(1)+": "+m.group(3));
|
||||
}
|
||||
if( line.contains("\n|") ){
|
||||
if( line.indexOf("\n|")>=0 ){
|
||||
throw new IncompatibleDirective(this, "newline-pipe combination.");
|
||||
}
|
||||
return;
|
||||
|
||||
@@ -18,11 +18,11 @@ package org.sqlite.jni.capi;
|
||||
They are populated only via that interface.
|
||||
*/
|
||||
public final class TableColumnMetadata {
|
||||
final OutputPointer.Bool pNotNull = new OutputPointer.Bool();
|
||||
final OutputPointer.Bool pPrimaryKey = new OutputPointer.Bool();
|
||||
final OutputPointer.Bool pAutoinc = new OutputPointer.Bool();
|
||||
final OutputPointer.String pzCollSeq = new OutputPointer.String();
|
||||
final OutputPointer.String pzDataType = new OutputPointer.String();
|
||||
OutputPointer.Bool pNotNull = new OutputPointer.Bool();
|
||||
OutputPointer.Bool pPrimaryKey = new OutputPointer.Bool();
|
||||
OutputPointer.Bool pAutoinc = new OutputPointer.Bool();
|
||||
OutputPointer.String pzCollSeq = new OutputPointer.String();
|
||||
OutputPointer.String pzDataType = new OutputPointer.String();
|
||||
|
||||
public TableColumnMetadata(){
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.Future;
|
||||
|
||||
/**
|
||||
An annotation for Tester1 tests which we do not want to run in
|
||||
@@ -61,13 +62,13 @@ public class Tester1 implements Runnable {
|
||||
//! List of test*() methods to run.
|
||||
private static List<java.lang.reflect.Method> testMethods = null;
|
||||
//! List of exceptions collected by run()
|
||||
private static final List<Exception> listErrors = new ArrayList<>();
|
||||
private static List<Exception> listErrors = new ArrayList<>();
|
||||
private static final class Metrics {
|
||||
//! Number of times createNewDb() (or equivalent) is invoked.
|
||||
volatile int dbOpen = 0;
|
||||
}
|
||||
|
||||
private final Integer tId;
|
||||
private Integer tId;
|
||||
|
||||
Tester1(Integer id){
|
||||
tId = id;
|
||||
@@ -77,7 +78,7 @@ public class Tester1 implements Runnable {
|
||||
|
||||
public static synchronized void outln(){
|
||||
if( !quietMode ){
|
||||
System.out.println();
|
||||
System.out.println("");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -522,7 +523,7 @@ public class Tester1 implements Runnable {
|
||||
}
|
||||
sqlite3_finalize(stmt);
|
||||
affirm(3 == n);
|
||||
affirm("w😃rldhell🤩!🤩".contentEquals(sbuf));
|
||||
affirm("w😃rldhell🤩!🤩".equals(sbuf.toString()));
|
||||
|
||||
try( sqlite3_stmt stmt2 = prepare(db, "SELECT ?, ?") ){
|
||||
rc = sqlite3_bind_text(stmt2, 1, "");
|
||||
@@ -667,7 +668,7 @@ public class Tester1 implements Runnable {
|
||||
execSql(db, "CREATE TABLE t(a); INSERT INTO t(a) VALUES('a'),('b'),('c')");
|
||||
final ValueHolder<Integer> xDestroyCalled = new ValueHolder<>(0);
|
||||
final CollationCallback myCollation = new CollationCallback() {
|
||||
private final String myState =
|
||||
private String myState =
|
||||
"this is local state. There is much like it, but this is mine.";
|
||||
@Override
|
||||
// Reverse-sorts its inputs...
|
||||
@@ -815,9 +816,7 @@ public class Tester1 implements Runnable {
|
||||
};
|
||||
|
||||
// Register and use the function...
|
||||
int rc = sqlite3_create_function(db, "myfunc", -1,
|
||||
SQLITE_UTF8 | SQLITE_INNOCUOUS,
|
||||
func);
|
||||
int rc = sqlite3_create_function(db, "myfunc", -1, SQLITE_UTF8, func);
|
||||
affirm(0 == rc);
|
||||
affirm(0 == xFuncAccum.value);
|
||||
final sqlite3_stmt stmt = prepare(db, "SELECT myfunc(1,2,3)");
|
||||
@@ -848,7 +847,7 @@ public class Tester1 implements Runnable {
|
||||
SQLFunction funcAgg = new AggregateFunction<Integer>(){
|
||||
@Override public void xStep(sqlite3_context cx, sqlite3_value[] args){
|
||||
/** Throwing from here should emit loud noise on stdout or stderr
|
||||
but the exception is suppressed because we have no way to inform
|
||||
but the exception is supressed because we have no way to inform
|
||||
sqlite about it from these callbacks. */
|
||||
//throw new RuntimeException("Throwing from an xStep");
|
||||
}
|
||||
@@ -1851,7 +1850,7 @@ public class Tester1 implements Runnable {
|
||||
"; insert into t(a) values(1),(2),(3);",
|
||||
"select a from t;"
|
||||
};
|
||||
final List<sqlite3_stmt> liStmt = new ArrayList<>();
|
||||
final List<sqlite3_stmt> liStmt = new ArrayList<sqlite3_stmt>();
|
||||
final PrepareMultiCallback proxy = new PrepareMultiCallback.StepAll();
|
||||
final ValueHolder<String> toss = new ValueHolder<>(null);
|
||||
PrepareMultiCallback m = new PrepareMultiCallback() {
|
||||
@@ -1876,20 +1875,6 @@ public class Tester1 implements Runnable {
|
||||
sqlite3_close_v2(db);
|
||||
}
|
||||
|
||||
private void testSetErrmsg(){
|
||||
final sqlite3 db = createNewDb();
|
||||
|
||||
int rc = sqlite3_set_errmsg(db, SQLITE_RANGE, "nope");
|
||||
affirm( 0==rc );
|
||||
affirm( SQLITE_MISUSE == sqlite3_set_errmsg(null, 0, null) );
|
||||
affirm( "nope".equals(sqlite3_errmsg(db)) );
|
||||
affirm( SQLITE_RANGE == sqlite3_errcode(db) );
|
||||
rc = sqlite3_set_errmsg(db, 0, null);
|
||||
affirm( "not an error".equals(sqlite3_errmsg(db)) );
|
||||
affirm( 0 == sqlite3_errcode(db) );
|
||||
sqlite3_close_v2(db);
|
||||
}
|
||||
|
||||
/* Copy/paste/rename this to add new tests. */
|
||||
private void _testTemplate(){
|
||||
final sqlite3 db = createNewDb();
|
||||
@@ -1999,9 +1984,9 @@ public class Tester1 implements Runnable {
|
||||
-v: emit some developer-mode info at the end.
|
||||
*/
|
||||
public static void main(String[] args) throws Exception {
|
||||
int nThread = 1;
|
||||
Integer nThread = 1;
|
||||
boolean doSomethingForDev = false;
|
||||
int nRepeat = 1;
|
||||
Integer nRepeat = 1;
|
||||
boolean forceFail = false;
|
||||
boolean sqlLog = false;
|
||||
boolean configLog = false;
|
||||
@@ -2063,7 +2048,7 @@ public class Tester1 implements Runnable {
|
||||
final ConfigLogCallback log = new ConfigLogCallback() {
|
||||
@Override public void call(int code, String msg){
|
||||
outln("ConfigLogCallback: ",ResultCode.getEntryForInt(code),": ", msg);
|
||||
}
|
||||
};
|
||||
};
|
||||
int rc = sqlite3_config( log );
|
||||
affirm( 0==rc );
|
||||
|
||||
@@ -33,5 +33,5 @@ public interface XDestroyCallback {
|
||||
each individual reference, leading to memory corruption or a
|
||||
crash via duplicate free().
|
||||
*/
|
||||
void xDestroy();
|
||||
public void xDestroy();
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
** This file is part of the JNI bindings for the sqlite3 C API.
|
||||
*/
|
||||
package org.sqlite.jni.fts5;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import org.sqlite.jni.capi.*;
|
||||
import org.sqlite.jni.annotation.*;
|
||||
|
||||
@@ -23,7 +24,7 @@ public final class Fts5ExtensionApi extends NativePointerHolder<Fts5ExtensionApi
|
||||
private final int iVersion = 2;
|
||||
|
||||
/* Callback type for used by xQueryPhrase(). */
|
||||
public interface XQueryPhraseCallback {
|
||||
public static interface XQueryPhraseCallback {
|
||||
int call(Fts5ExtensionApi fapi, Fts5Context cx);
|
||||
}
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user