upload all files
This commit is contained in:
558
Modules/sqlite.include/tea/Makefile.in
Normal file
558
Modules/sqlite.include/tea/Makefile.in
Normal file
@@ -0,0 +1,558 @@
|
||||
all:
|
||||
#
|
||||
# Unless this file is named Makefile.in, you are probably looking
|
||||
# at an automatically generated/filtered copy and should probably not
|
||||
# edit it.
|
||||
#
|
||||
# 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).
|
||||
#
|
||||
|
||||
CC = @CC@
|
||||
INSTALL = @BIN_INSTALL@
|
||||
INSTALL.noexec = $(INSTALL) -m 0644
|
||||
|
||||
#
|
||||
# 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
|
||||
|
||||
@if TEAISH_DIST_NAME
|
||||
tx.name.dist = @TEAISH_DIST_NAME@
|
||||
@else
|
||||
tx.name.dist = $(teaish.name)
|
||||
@endif
|
||||
|
||||
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
|
||||
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
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@
|
||||
|
||||
|
||||
#
|
||||
# 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@
|
||||
|
||||
#
|
||||
# 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=1
|
||||
|
||||
#
|
||||
# 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@
|
||||
|
||||
#
|
||||
# Linker flags for linkhing a shared library.
|
||||
#
|
||||
LDFLAGS.shlib = @SH_LDFLAGS@
|
||||
|
||||
#
|
||||
# The following tx.XYZ vars may be populated/modified by teaish.tcl
|
||||
# and/or teaish.make.
|
||||
#
|
||||
|
||||
#
|
||||
# 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@
|
||||
|
||||
#
|
||||
# tx.CFLAGS is typically set by teaish.make, whereas TEAISH_CFLAGS
|
||||
# gets set up via the configure script.
|
||||
#
|
||||
tx.CFLAGS =
|
||||
|
||||
#
|
||||
# tx.LDFLAGS is typically set by teaish.make, whereas TEAISH_LDFLAGS
|
||||
# gets set up via the configure script.
|
||||
#
|
||||
tx.LDFLAGS =
|
||||
|
||||
#
|
||||
# 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@
|
||||
|
||||
#
|
||||
# The base name for a distribution tar/zip file.
|
||||
#
|
||||
tx.dist.basename = $(tx.name.dist)-$(tx.version)
|
||||
|
||||
# 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@
|
||||
|
||||
@if TEAISH_MAKEFILE_IN
|
||||
$(tx.makefile): $(tx.makefile.in)
|
||||
@endif
|
||||
|
||||
teaish.autoreconfig = \
|
||||
@TEAISH_AUTORECONFIG@
|
||||
|
||||
#
|
||||
# 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)
|
||||
|
||||
$(teaish.makefile): $(teaish__auto.def) $(teaish.makefile.in) \
|
||||
@AUTODEPS@
|
||||
|
||||
@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)
|
||||
|
||||
#
|
||||
# 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; \
|
||||
fi
|
||||
$(CC.dll)
|
||||
|
||||
all: $(tx.dll)
|
||||
@endif # TEAISH_ENABLE_DLL
|
||||
|
||||
tclsh: $(teaish.makefile) config.log
|
||||
@{ echo "#!/bin/sh"; echo 'exec $(TCLSH) "$$@"'; } > $@
|
||||
@chmod +x $@
|
||||
@echo "Created $@"
|
||||
|
||||
#
|
||||
# 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
|
||||
|
||||
#
|
||||
# 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
|
||||
|
||||
.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:
|
||||
|
||||
#
|
||||
# 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
|
||||
|
||||
@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
|
||||
94
Modules/sqlite.include/tea/README.txt
Normal file
94
Modules/sqlite.include/tea/README.txt
Normal file
@@ -0,0 +1,94 @@
|
||||
This is the SQLite extension for Tcl using something akin to
|
||||
the Tcl Extension Architecture (TEA). To build it:
|
||||
|
||||
./configure ...flags...
|
||||
|
||||
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
|
||||
canonical source code tarball. For Unix:
|
||||
|
||||
./configure --with-tclsh=$(TCLSH)
|
||||
make tclextension-install
|
||||
|
||||
For Windows:
|
||||
|
||||
nmake /f Makefile.msc tclextension-install TCLSH_CMD=$(TCLSH)
|
||||
|
||||
In both of the above, replace $(TCLSH) with the full pathname of
|
||||
of the tclsh that you want the SQLite extension to work with. See
|
||||
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?
|
||||
|
||||
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:
|
||||
|
||||
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.
|
||||
|
||||
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
|
||||
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:
|
||||
|
||||
$ cd sqlite-*-tea
|
||||
$ ./configure --with-tcl=/path/to/tcl/install/root
|
||||
$ make test
|
||||
$ 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.
|
||||
50
Modules/sqlite.include/tea/_teaish.tester.tcl.in
Normal file
50
Modules/sqlite.include/tea/_teaish.tester.tcl.in
Normal file
@@ -0,0 +1,50 @@
|
||||
# -*- 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
|
||||
8
Modules/sqlite.include/tea/auto.def
Normal file
8
Modules/sqlite.include/tea/auto.def
Normal file
@@ -0,0 +1,8 @@
|
||||
#/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
|
||||
20
Modules/sqlite.include/tea/configure
vendored
Normal file
20
Modules/sqlite.include/tea/configure
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
#!/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" \
|
||||
"$@"
|
||||
4221
Modules/sqlite.include/tea/generic/tclsqlite3.c
Normal file
4221
Modules/sqlite.include/tea/generic/tclsqlite3.c
Normal file
File diff suppressed because it is too large
Load Diff
6
Modules/sqlite.include/tea/license.terms
Normal file
6
Modules/sqlite.include/tea/license.terms
Normal file
@@ -0,0 +1,6 @@
|
||||
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.
|
||||
40
Modules/sqlite.include/tea/pkgIndex.tcl.in
Normal file
40
Modules/sqlite.include/tea/pkgIndex.tcl.in
Normal file
@@ -0,0 +1,40 @@
|
||||
# -*- tcl -*-
|
||||
# Tcl package index file
|
||||
#
|
||||
# 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]
|
||||
} 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]
|
||||
}
|
||||
569
Modules/sqlite.include/tea/teaish.tcl
Normal file
569
Modules/sqlite.include/tea/teaish.tcl
Normal file
@@ -0,0 +1,569 @@
|
||||
# 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
|
||||
}
|
||||
}
|
||||
14
Modules/sqlite.include/tea/teaish.test.tcl
Normal file
14
Modules/sqlite.include/tea/teaish.test.tcl
Normal file
@@ -0,0 +1,14 @@
|
||||
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} {}
|
||||
Reference in New Issue
Block a user