aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorstephan <stephan@noemail.net>2025-04-23 14:54:13 +0000
committerstephan <stephan@noemail.net>2025-04-23 14:54:13 +0000
commitd3b39b18d09df4c780e72190f68d11b776bcc4a7 (patch)
tree5c06ece93b3af11184daa3c645a0cd2d88216b70
parent37f22ff75e37eab11c1fd8b04a8b59e75d655ef2 (diff)
downloadsqlite-d3b39b18d09df4c780e72190f68d11b776bcc4a7.tar.gz
sqlite-d3b39b18d09df4c780e72190f68d11b776bcc4a7.zip
Upstream teaish fixes and improvements.
FossilOrigin-Name: 235ea2c0e1823fe4324c3890069a9131ebb6de14e55eb56c0e9f42a7e491a699
-rw-r--r--autoconf/tea/Makefile.in42
-rw-r--r--autoconf/tea/auto.def5
-rw-r--r--autoconf/tea/autosetup/core.tcl291
-rw-r--r--autoconf/tea/autosetup/tester.tcl16
-rw-r--r--autoconf/tea/pkgIndex.tcl.in4
-rw-r--r--autoconf/tea/teaish.tcl22
-rw-r--r--autoconf/tea/teaish.tester.tcl.in12
-rw-r--r--autosetup/proj.tcl46
-rw-r--r--autosetup/sqlite-config.tcl2
-rw-r--r--manifest30
-rw-r--r--manifest.uuid2
11 files changed, 317 insertions, 155 deletions
diff --git a/autoconf/tea/Makefile.in b/autoconf/tea/Makefile.in
index 172e38195..60c8761d6 100644
--- a/autoconf/tea/Makefile.in
+++ b/autoconf/tea/Makefile.in
@@ -46,7 +46,7 @@ tx.dll9.basename = @TEAISH_DLL9_BASENAME@
tx.dll8 = @TEAISH_DLL8@
tx.dll9 = @TEAISH_DLL9@
tx.dll = $(tx.dll$(TCL_MAJOR_VERSION))
-tx.dir = @TEAISH_DIR@
+tx.dir = @TEAISH_EXT_DIR@
teaish.dir = @abs_top_srcdir@
#teaish.dir.autosetup = @TEAISH_AUTOSETUP_DIR@
@@ -123,7 +123,7 @@ LDFLAGS.configure = @SH_LDFLAGS@ @TEAISH_LDFLAGS@ @LDFLAGS@ $(TCL_STUB_LIB_SPEC)
# sources passed to [teaish-src-add], but may also be appended to
# by teaish.make.
#
-tx.src =@TEAISH_SRC@
+tx.src =@TEAISH_EXT_SRC@
#
# tx.CFLAGS is typically set by teaish.make, whereas TEAISH_CFLAGS
@@ -161,7 +161,6 @@ teaish__autogen.deps = \
$(tx.makefile.in) $(teaish.makefile.in) \
$(tx.tcl) \
@TEAISH_PKGINDEX_TCL_IN@ \
- @TEAISH_MODULE_TEST_TCL@ \
@AUTODEPS@
#
@@ -184,6 +183,7 @@ $(teaish.makefile): $(teaish__auto.def) $(teaish.makefile.in) \
@TEAISH_TESTER_TCL@: @TEAISH_TESTER_TCL_IN@
config.log: @TEAISH_TESTER_TCL@
+@if TEAISH_ENABLE_DLL
#
# The rest of this makefile exists solely to support this brief
# target: the extension shared lib.
@@ -193,6 +193,7 @@ $(tx.dll): $(tx.src) config.log
$(tx.src) $(LDFLAGS.configure) $(LDFLAGS) $(tx.LDFLAGS)
all: $(tx.dll)
+@endif # TEAISH_ENABLE_DLL
tclsh: $(teaish.makefile) config.log
@{ echo "#!/bin/sh"; echo 'exec $(TCLSH) "$$@"'; } > $@
@@ -200,23 +201,24 @@ tclsh: $(teaish.makefile) config.log
@echo "Created $@"
#
-# If the extension includes teaish.test.tcl then provide a "test"
-# target which which runs that script, passing it (1) the full path to
-# extension's DLL (which also provides the script with a way to get
-# the test directory) and (2) a script of test utility code intended for
-# sourcing by the client.
+# Run the generated test script.
#
-# If the extension has no test script, add a small one which
-# simply loads the DLL and success if it can.
-#
-#
-tx.tester.args = $(tx.dll) $(tx.loadPrefix) @TEAISH_MODULE_TEST_TCL@
-.PHONY: test-pre test-core test test-post test-extension
-test-extension: # this name is reserved for use by teaish.make
-test-prepre: $(tx.dll) @TEAISH_TESTER_TCL@
+.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
+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@
+test-prepre: @TEAISH_TESTER_TCL@
test-pre: test-prepre
test-core: test-pre
- $(TCLSH) @TEAISH_TESTER_TCL@ $(tx.tester.args)
+ $(TCLSH) $(test-core.args)
test-post: test-core
test: test-post
@@ -367,12 +369,12 @@ undist-tgz:
rm -f $(dist.tgz)
undist: undist-tgz
@endif #BIN_TAR
-@else
+@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_DIR@" 1>&2; exit 1
+ echo "In this case: @TEAISH_EXT_DIR@" 1>&2; exit 1
@endif
@endif #TEAISH_ENABLE_DIST
@@ -386,7 +388,7 @@ dist:
# - 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_SRC or pass them to [teaish-src-add].
+# [define] TEAISH_EXT_SRC or pass them to [teaish-src-add].
#
# It may optionally set the following vars:
#
diff --git a/autoconf/tea/auto.def b/autoconf/tea/auto.def
index 861257cce..7170b3d1f 100644
--- a/autoconf/tea/auto.def
+++ b/autoconf/tea/auto.def
@@ -1,7 +1,8 @@
#/do/not/tclsh
# ^^^ help out editors which guess this file's content type.
#
-# Main configure script entry point for the "TEA-via-autosetup"
-# framework.
+# 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
diff --git a/autoconf/tea/autosetup/core.tcl b/autoconf/tea/autosetup/core.tcl
index 14044e607..9ef0178e2 100644
--- a/autoconf/tea/autosetup/core.tcl
+++ b/autoconf/tea/autosetup/core.tcl
@@ -23,18 +23,22 @@
use proj
-define TEAISH_CORE_VERSION 0.1-beta
-
#
# API-internal settings and shared state.
array set teaish__Config [proj-strip-hash-comments {
+ #
+ # Teaish's version number, not to be confused with
+ # teaish__PkgInfo(-version).
+ #
+ version 0.1-beta
+
# set to 1 to enable some internal debugging output
debug-enabled 0
#
# 0 = don't yet have extension's pkgindex
- # 0x01 = found TEAISH_DIR/pkgIndex.tcl.in
+ # 0x01 = found TEAISH_EXT_DIR/pkgIndex.tcl.in
# 0x02 = found srcdir/pkgIndex.tcl.in
- # 0x10 = found TEAISH_DIR/pkgIndex.tcl (static file)
+ # 0x10 = found TEAISH_EXT_DIR/pkgIndex.tcl (static file)
# 0x20 = static-pkgIndex.tcl pragma: behave as if 0x10
#
# Reminder: it's significant that the bottom 4 bits be
@@ -53,9 +57,9 @@ array set teaish__Config [proj-strip-hash-comments {
pkginfo-f2d {
-name TEAISH_NAME
-pkgName TEAISH_PKGNAME
+ -version TEAISH_VERSION
-libDir TEAISH_LIBDIR_NAME
-loadPrefix TEAISH_LOAD_PREFIX
- -version TEAISH_VERSION
-vsatisfies TEAISH_VSATISFIES
-options {}
-pragmas {}
@@ -71,6 +75,24 @@ array set teaish__Config [proj-strip-hash-comments {
# when building from an extension's dir, disabled when building
# elsewhere.
dist-enabled 1
+
+ # By default we enable compilation of a native extension but if the
+ # extension has no native code or the user wants to take that over
+ # via teaish.make.in or provide a script-only extension, we will
+ # elide the default compilation rules if this is 0.
+ dll-enabled 1
+
+ # Files to include in the "make dist" bundle.
+ dist-files {}
+
+ # List of source files for the extension.
+ extension-src {}
+
+ # Path to the teaish.tcl file.
+ teaish.tcl {}
+
+ # Dir where teaish.tcl is found.
+ extension-dir {}
}]
set teaish__Config(core-dir) $::autosetup(libdir)/teaish
@@ -116,7 +138,7 @@ if {[teaish-argv-has --teaish-verbose --t-v]} {
msg-quiet use system ; # Outputs "Host System" and "Build System" lines
if {"--help" ni $::argv} {
- teaish__verbose 1 msg-result "TEA(ish) Version = [get-define TEAISH_CORE_VERSION]"
+ teaish__verbose 1 msg-result "TEA(ish) Version = $::teaish__Config(version)"
teaish__verbose 1 msg-result "Source dir = $::autosetup(srcdir)"
teaish__verbose 1 msg-result "Build dir = $::autosetup(builddir)"
}
@@ -194,16 +216,15 @@ proc teaish-configure-core {} {
}]; # main options.
if {$gotExt} {
- set ttcl [get-define TEAISH_TCL]
- proj-assert {[file exists $ttcl]} "Expecting to have found teaish.tcl by now"
- uplevel 1 [list source $ttcl]
proj-assert {"" ne [teaish-pkginfo-get -name]}
- unset ttcl
+ proj-assert {[file exists $::teaish__Config(teaish.tcl)]} \
+ "Expecting to have found teaish.tcl by now"
+ uplevel 1 [list source $::teaish__Config(teaish.tcl)]
# Set up some default values if the extension did not set them.
- # This must happen _after_ it's sourced.
+ # This must happen _after_ it's sourced but before
+ # teaish-configure is called.
foreach {pflag key type val} {
- TEAISH_CFLAGS -v ""
- - TEAISH_DIST_FILES -v ""
- TEAISH_LDFLAGS -v ""
- TEAISH_MAKEFILE -v ""
- TEAISH_MAKEFILE_CODE -v ""
@@ -212,16 +233,19 @@ proc teaish-configure-core {} {
- TEAISH_PKGINDEX_TCL_IN -v ""
- TEAISH_PKGINIT_TCL -v ""
- TEAISH_PKGINIT_TCL_IN -v ""
- - TEAISH_SRC -v ""
- TEAISH_TEST_TCL -v ""
- TEAISH_TEST_TCL_IN -v ""
- -version TEAISH_VERSION -v 0.0.0
- -pkgName TEAISH_PKGNAME -e {teaish-pkginfo-get -name}
- -libDir TEAISH_LIBDIR_NAME -e {join [list \
- [teaish-pkginfo-get -pkgName] \
- [teaish-pkginfo-get -version]] ""}
- -loadPrefix TEAISH_LOAD_PREFIX -e {string totitle [get-define TEAISH_PKGNAME ""]}
+ -version TEAISH_VERSION -v 0.0.0
+ -pkgName TEAISH_PKGNAME -e {teaish-pkginfo-get -name}
+ -libDir TEAISH_LIBDIR_NAME -e {
+ join [list \
+ [teaish-pkginfo-get -pkgName] \
+ [teaish-pkginfo-get -version]] ""
+ }
+ -loadPrefix TEAISH_LOAD_PREFIX -e {
+ string totitle [teaish-get -pkgName]
+ }
-vsatisfies TEAISH_VSATISFIES -v {{Tcl 8.5-}}
} {
set isDefOnly [expr {"-" eq $pflag}]
@@ -243,12 +267,12 @@ proc teaish-configure-core {} {
set ::teaish__PkgInfo($pflag) $val
}
}
- unset key type val
+ unset isDefOnly pflag key type val
}; # sourcing extension's teaish.tcl
if {[llength [info proc teaish-options]] > 0} {
# Add options defined by teaish-options, which is assumed to be
- # imported via TEAISH_TCL.
+ # imported via [teaish-get -teaish-tcl].
set o [teaish-options]
if {"" ne $o} {
options-add $o
@@ -372,7 +396,7 @@ proc teaish__configure_phase1 {} {
teaish-checks-run -pre
if {[llength [info proc teaish-configure]] > 0} {
# teaish-configure is assumed to be imported via
- # TEAISH_TCL
+ # teaish.tcl
teaish-configure
}
teaish-checks-run -post
@@ -405,7 +429,7 @@ proc teaish__configure_phase1 {} {
}
#define AS_LIBDIR $::autosetup(libdir)
- define TEAISH_MODULE_TEST_TCL $::teaish__Config(core-dir)/tester.tcl
+ define TEAISH_TESTUTIL_TCL $::teaish__Config(core-dir)/tester.tcl
apply {{} {
#
@@ -431,7 +455,7 @@ proc teaish__configure_phase1 {} {
}
}}; # $::teaish__Config(pkgindex-policy)
- set dEx $::teaish__Config(teaish-dir)
+ set dEx $::teaish__Config(extension-dir)
set dSrc $::autosetup(srcdir)
proj-dot-ins-append $dSrc/Makefile.in
@@ -457,21 +481,24 @@ proc teaish__configure_phase1 {} {
}
lappend ifpv "\] \} \{\n"
lappend ifpv \
- "error \{Package $::teaish__PkgInfo(-name) $::teaish__PkgInfo(-version) requires $pv\}" \
- "\n\}"
+ "error \{Package $::teaish__PkgInfo(-name) $::teaish__PkgInfo(-version) requires $pv\}\n" \
+ "\}"
lappend code [join $ifpv]
}
define TEAISH_VSATISFIES_CODE [join $code "\n"]
}}
- define TEAISH_ENABLE_DIST $::teaish__Config(dist-enabled)
- define TEAISH_AUTOSETUP_DIR $::teaish__Config(core-dir)
+ define TEAISH_ENABLE_DIST $::teaish__Config(dist-enabled)
+ define TEAISH_ENABLE_DLL $::teaish__Config(dll-enabled)
+ define TEAISH_AUTOSETUP_DIR $::teaish__Config(core-dir)
+ define TEAISH_TCL $::teaish__Config(teaish.tcl)
+ define TEAISH_DIST_FILES [join $::teaish__Config(dist-files)]
+ define TEAISH_EXT_DIR [join $::teaish__Config(extension-dir)]
+ define TEAISH_EXT_SRC [join $::teaish__Config(extension-src)]
proj-setup-autoreconfig TEAISH_AUTORECONFIG
foreach f {
TEAISH_CFLAGS
TEAISH_LDFLAGS
- TEAISH_SRC
- TEAISH_DIST_FILES
} {
# Ensure that any of these lists are flattened
define $f [join [get-define $f]]
@@ -716,7 +743,7 @@ proc teaish__check_tcl {} {
# This does not _load_ the extension, it simply locates the files
# which make up an extension.
#
-# This sets up lots of defines, e.g. TEAISH_DIR.
+# This sets up lots of defines, e.g. TEAISH_EXT_DIR.
#
proc teaish__find_extension {} {
@@ -760,8 +787,7 @@ proc teaish__find_extension {} {
proj-error "--teaish-extension-dir value is not a directory: $extD"
}
set extT [apply $lambdaMT 1 teaish.tcl $extD]
- define TEAISH_DIR $extD
- set ::teaish__Config(teaish-dir) $extD
+ set ::teaish__Config(extension-dir) $extD
}
--help {
incr gotHelpArg
@@ -774,7 +800,7 @@ proc teaish__find_extension {} {
set ::argv $largv
set dirExt [proj-coalesce \
- [get-define TEAISH_DIR ""] \
+ $::teaish__Config(extension-dir) \
$dirBld]; # dir with the extension
#
# teaish.tcl is a TCL script which implements various
@@ -803,7 +829,7 @@ If you are attempting an out-of-tree build, use
if {![file readable $extT]} {
proj-error "extension tcl file is not readable: $extT"
}
- define TEAISH_TCL $extT
+ set ::teaish__Config(teaish.tcl) $extT
if {"" eq $dirExt} {
# If this wasn't set via --teaish-extension-dir then derive it from
@@ -811,17 +837,17 @@ If you are attempting an out-of-tree build, use
#puts "extT=$extT dirExt=$dirExt"
set dirExt [file dirname $extT]
}
- define TEAISH_DIR $dirExt
- set ::teaish__Config(teaish-dir) $dirExt
- set ::teaish__Config(blddir-is-extdir) \
- [define TEAISH_ENABLE_DIST [expr {$dirBld eq $dirExt}]]
+
+ set ::teaish__Config(extension-dir) $dirExt
+ set ::teaish__Config(blddir-is-extdir) [expr {$dirBld eq $dirExt}]
set ::teaish__Config(dist-enabled) $::teaish__Config(blddir-is-extdir); # may change later
+
set addDist {{file} {
teaish-dist-add [file tail $file]
}}
apply $addDist $extT
- teaish__verbose 1 msg-result "Extension dir = [get-define TEAISH_DIR]"
+ teaish__verbose 1 msg-result "Extension dir = [teaish-get -dir]"
teaish__verbose 1 msg-result "Extension config = $extT"
teaish-pkginfo-set -name [file tail [file dirname $extT]]
@@ -939,10 +965,9 @@ If you are attempting an out-of-tree build, use
# TEAISH_OUT_OF_EXT_TREE = 1 if we're building from a dir other
# than the extension's home dir.
- set dteaish [file-normalize [get-define TEAISH_DIR]]
define TEAISH_OUT_OF_EXT_TREE \
- [expr {[file-normalize $::autosetup(builddir)] ne $dteaish}]
-
+ [expr {[file-normalize $::autosetup(builddir)] ne \
+ [file-normalize $::teaish__Config(extension-dir)]}]
return 1
}; # teaish__find_extension
@@ -994,56 +1019,57 @@ proc teaish-ldflags-prepend {args} {
#
# @teaish-src-add ?-dist? ?-dir? src-files...
#
-# Appends all non-empty $args to TEAISH_SRC.
+# Appends all non-empty $args to the project's list of C/C++ source
+# files.
#
# If passed -dist then it also passes each filename, as-is, to
# [teaish-dist-add].
#
-# If passed -dir then each src-file has the TEAISH_DIR prepended to
-# it for before they're added to TEAISH_SRC. As often as not, that
-# will be the desired behavior so that out-of-tree builds can find the
+# If passed -dir then each src-file has [teaish-get -dir] prepended to
+# it for before they're added to the list. As often as not, that will
+# be the desired behavior so that out-of-tree builds can find the
# sources, but there are cases where it's not desired (e.g. when using
# a source file from outside of the extension's dir).
#
proc teaish-src-add {args} {
set i 0
proj-parse-simple-flags args flags {
- -dist 0 {return 1}
- -dir 0 {return 1}
+ -dist 0 {expr 1}
+ -dir 0 {expr 1}
}
if {$flags(-dist)} {
teaish-dist-add {*}$args
}
if {$flags(-dir)} {
set xargs {}
- set d [get-define TEAISH_DIR]
foreach arg $args {
if {"" ne $arg} {
- lappend xargs [file join $d $arg]
+ lappend xargs [file join $::teaish__Config(extension-dir) $arg]
}
}
set args $xargs
}
- proj-define-append TEAISH_SRC {*}$args
+ lappend ::teaish__Config(extension-src) {*}$args
}
#
# @teaish-dist-add files-or-dirs...
#
-# Equivalent to [proj-define-apend TEAISH_DIST_FILES ...].
+# Adds the given files to the list of files to include with the "make
+# dist" rules.
#
# This is a no-op when the current build is not in the extension's
# directory, as dist support is disabled in out-of-tree builds.
#
-# It is not legal to call this until TEAISH_DIR has been reliably set
-# (via teaish__find_extension).
+# It is not legal to call this until [teaish-get -dir] has been
+# reliably set (via teaish__find_extension).
#
proc teaish-dist-add {args} {
if {$::teaish__Config(blddir-is-extdir)} {
# ^^^ reminder: we ignore $::teaish__Config(dist-enabled) here
# because the client might want to implement their own dist
# rules.
- proj-define-amend TEAISH_DIST_FILES {*}$args
+ lappend ::teaish__Config(dist-files) {*}$args
}
}
@@ -1332,7 +1358,10 @@ proc teaish__dump_defs_to_list {args} {
# it. Errors out if it does not find pkgIndex.tcl in the
# extension's dir.
#
-# disable-dist [L]: tells teaish to elide the 'make dist' recipe
+# no-dist [L]: tells teaish to elide the 'make dist' recipe
+# from the generated Makefile.
+#
+# no-dll [L]: tells teaish to elide the DLL-building recipe
# from the generated Makefile.
#
# Emits a warning message for unknown arguments.
@@ -1342,7 +1371,7 @@ proc teaish__pragma {args} {
switch -exact -- $arg {
static-pkgIndex.tcl {
- set tpi [file join $::teaish__Config(teaish-dir) pkgIndex.tcl]
+ set tpi [file join $::teaish__Config(extension-dir) pkgIndex.tcl]
if {[file exists $tpi]} {
define TEAISH_PKGINDEX_TCL_IN ""
define TEAISH_PKGINDEX_TCL $tpi
@@ -1352,11 +1381,14 @@ proc teaish__pragma {args} {
}
}
- disable-dist {
- define TEAISH_ENABLE_DIST 0
+ no-dist {
set ::teaish__Config(dist-enabled) 0
}
+ no-dll {
+ set ::teaish__Config(dll-enabled) 0
+ }
+
default {
proj-error "Unknown flag: $arg"
}
@@ -1367,21 +1399,121 @@ proc teaish__pragma {args} {
#
# @teaish-pkginfo-set ...flags
#
-# The preferred way to set up the initial package state. Used like:
+# The way to set up the initial package state. Used like:
#
# teaish-pkginfo-set -name foo -version 0.1.2
#
-# Where each flag corresponds to one piece of extension package info.
-#
-# -name TEAISH_NAME
-# -pkgName TEAISH_PKGNAME
-# -libDir TEAISH_LIBDIR_NAME
-# -loadPrefix TEAISH_LOAD_PREFIX
-# -version TEAISH_VERSION
-# -vsatisfies TEAISH_VSATISFIES
-# -options {...} optional [options-add] value
-#
+# Or:
+#
+# teaish-pkginfo-set ?-vars|-subst? {-name foo -version 0.1.2}
+#
+# The latter may be easier to write for a multi-line invocation.
+# Passing the -vars flag tells it to perform a [subst] of (only)
+# variables in the {...} part from the calling scope. The -subst flag
+# will cause is to [subst] the {...} with command substitution as well
+# (but no backslash substitution).
+#
+# Each pkginfo flag corresponds to one piece of extension package
+# info. Teaish provides usable default values for all of these flags,
+# but at least the -name and -version should be set by clients.
+# e.g. the default -name is the directory name the extension lives in,
+# which may change (e.g. when building it from a "make dist" bundle).
+#
+# The flags:
+#
+# -name theName: The extension's name. It defaults to the name of the
+# directory containing the extension. (In TEA this would be the
+# PACKAGE_NAME, not to be confused with...)
+#
+# -pkgName pkg-provide-name: The extension's name for purposes of
+# Tcl_PkgProvide(), [package require], and friends. It defaults to
+# the `-name`, and is normally the same, but some projects (like
+# SQLite) have a different name here than they do in their
+# historical TEA PACKAGE_NAME.
+#
+# -version version: The extension's package version. Defaults to
+# 0.0.0.
+#
+# -libDir dirName: The base name of the directory into which this
+# extension should be installed. It defaults to a concatenation of
+# `-pkgName` and `-version`.
+#
+# -loadPrefix prefix: For use as the second argument passed to
+# Tcl's `load` command in the package-loading process. It defaults
+# to title-cased `-pkgName` because Tcl's `load` plugin system
+# expects it in that form.
+#
+# -options {...}: If provided, it must be a list compatible with
+# Autosetup's `options-add` function. These can also be set up via
+# `teaish-options`.
+#
+# -vsatisfies {{...} ...}: Expects a list-of-lists of conditions
+# for Tcl's `package vsatisfies` command: each list entry is a
+# sub-list of `{PkgName Condition...}`. Teaish inserts those
+# checks via its default pkgIndex.tcl.in and teaish.tester.tcl.in
+# templates to verify that the system's package dependencies meet
+# these requirements. The default value is `{{Tcl 8.5-}}` (recall
+# that it's a list-of-lists), as 8.5 is the minimum Tcl version
+# teaish will run on, but some extensions may require newer
+# versions or dependencies on other packages. As a special case,
+# if `-vsatisfies` is given a single token, e.g. `8.6-`, then it
+# is transformed into `{Tcl $thatToken}`, i.e. it checks the Tcl
+# version which the package is being run with. If given multiple
+# lists, each `package provides` check is run in the given
+# order. Failure to meet a `vsatisfies` condition triggers an
+# error.
+#
+# -pragmas {...} A list of infrequently-needed lower-level
+# directives which can influence teaish, including:
+#
+# static-pkgIndex.tcl: tells teaish that the client manages their
+# own pkgIndex.tcl, so that teaish won't try to overwrite it
+# using a template.
+#
+# no-dist: tells teaish to elide the "make dist" recipe from the
+# makefile so that the client can implement it.
+#
+# no-dll: tells teaish to elide the makefile rules which build
+# the DLL, as well as any templated test script and pkgIndex.tcl
+# references to them. The intent here is to (A) support
+# client-defined build rules for the DLL and (B) eventually
+# support script-only extensions.
+#
+# Unsupported flags or pragmas will trigger an error.
proc teaish-pkginfo-set {args} {
+ set doVars 0
+ set doCommands 0
+ set xargs $args
+ foreach arg $args {
+ switch -exact -- $arg {
+ -vars {
+ incr doVars
+ set xargs [lassign $xargs -]
+ }
+ -subst {
+ incr doVars
+ incr doCommands
+ set xargs [lassign $xargs -]
+ }
+ default {
+ break
+ }
+ }
+ }
+ set args $xargs
+ unset xargs
+ if {1 == [llength $args] && [llength [lindex $args 0]] > 1} {
+ # Transform a single {...} arg into the canonical call form
+ set a [list {*}[lindex $args 0]]
+ if {$doVars || $doCommands} {
+ set sflags -nobackslashes
+ if {!$doCommands} {
+ lappend sflags -nocommands
+ }
+ set a [uplevel 1 [list subst {*}$sflags $a]]
+ }
+ set args $a
+ }
set sentinel "<nope>"
set flagDefs [list]
foreach {f d} $::teaish__Config(pkginfo-f2d) {
@@ -1545,7 +1677,7 @@ proc teaish-checks-run {flag} {
proc teaish-get {flag} {
switch -exact -- $flag {
-dir {
- return $::teaish__Config(teaish-dir)
+ return $::teaish__Config(extension-dir)
}
-teaish-home {
return $::autosetup(srcdir)
@@ -1553,6 +1685,9 @@ proc teaish-get {flag} {
-build-dir {
return $::autosetup(builddir)
}
+ -teaish.tcl {
+ return $::teaish__Config(teaish.tcl)
+ }
default {
if {[info exists ::teaish__PkgInfo($flag)]} {
return $::teaish__PkgInfo($flag)
@@ -1610,15 +1745,15 @@ proc teaish__create_extension {dir} {
# early on may be used here. Any autosetup-related
# APIs may be used here.
#
- # Return an empty string if there are no options to add
- # or if they are added using \[options-add\].
+ # Return an empty string if there are no options to
+ # add or if they are added using \[options-add\].
+ #
+ # If there are no options to add, this proc need
+ # not be defined.
#}
proc teaish-configure {} {
- set d \[get-define TEAISH_DIR\]
- teaish-src-add \$d/teaish.c
- teaish-dist-add teaish.c
-
+ teaish-src-add -dir -dist teaish.c
# TODO: your code goes here..
}
"
diff --git a/autoconf/tea/autosetup/tester.tcl b/autoconf/tea/autosetup/tester.tcl
index 863c058f2..5f5e1f155 100644
--- a/autoconf/tea/autosetup/tester.tcl
+++ b/autoconf/tea/autosetup/tester.tcl
@@ -144,7 +144,11 @@ if {![array exists ::teaish__BuildFlags]} {
}
#
-# @teaish-build-flag2 flag tgtVar ?dflt?
+# @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
@@ -154,15 +158,11 @@ if {![array exists ::teaish__BuildFlags]} {
# an external script have populated its internal state, which is
# normally handled via teaish.tester.tcl.in.
#
-# 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 #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-flag2 {flag tgtVar {dflt ""}} {
+proc teaish-build-flag3 {flag tgtVar {dflt ""}} {
upvar $tgtVar tgt
if {[info exists ::teaish__BuildFlags($flag)]} {
set tgt $::teaish__BuildFlags($flag)
@@ -179,12 +179,12 @@ proc teaish-build-flag2 {flag tgtVar {dflt ""}} {
#
# @teaish-build-flag flag ?dflt?
#
-# Convenience form of teaish-build-flag2 which returns the
+# 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-flag2 $flag tgt $dflt
+ teaish-build-flag3 $flag tgt $dflt
return $tgt
}
diff --git a/autoconf/tea/pkgIndex.tcl.in b/autoconf/tea/pkgIndex.tcl.in
index 8c50b81cd..c93fcc685 100644
--- a/autoconf/tea/pkgIndex.tcl.in
+++ b/autoconf/tea/pkgIndex.tcl.in
@@ -11,7 +11,9 @@
@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]} {
@@ -21,11 +23,13 @@ if {[package vsatisfies [package provide Tcl] 9.0-]} {
}} $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]} {
diff --git a/autoconf/tea/teaish.tcl b/autoconf/tea/teaish.tcl
index 45f22ab5b..53228cb91 100644
--- a/autoconf/tea/teaish.tcl
+++ b/autoconf/tea/teaish.tcl
@@ -3,14 +3,15 @@
apply {{} {
set version [proj-file-content -trim [teaish-get -dir]/../VERSION]
proj-assert {[string match 3.*.* $version]}
- teaish-pkginfo-set \
- -name sqlite \
- -pkgName sqlite3 \
- -version $version \
- -loadPrefix Sqlite3 \
- -vsatisfies 8.6- \
- -libDir sqlite$version \
- -pragmas {disable-dist}
+ teaish-pkginfo-set -vars {
+ -name sqlite
+ -pkgName sqlite3
+ -version $version
+ -loadPrefix Sqlite3
+ -vsatisfies 8.6-
+ -libDir sqlite$version
+ -pragmas {no-dist}
+ }
}}
#
@@ -72,9 +73,8 @@ proc teaish-options {} {
proc teaish-configure {} {
use teaish/feature-tests
- set srcdir [get-define TEAISH_DIR]
+ set srcdir [teaish-get -dir]
teaish-src-add -dist -dir generic/tclsqlite3.c
- teaish-cflags-add -I${srcdir}/..
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]
@@ -103,6 +103,8 @@ proc teaish-configure {} {
msg-result "Using system-level sqlite3."
teaish-cflags-add -DUSE_SYSTEM_SQLITE
teaish-ldflags-add -lsqlite3
+ } else {
+ teaish-cflags-add -I${srcdir}/..
}
teaish-check-librt
diff --git a/autoconf/tea/teaish.tester.tcl.in b/autoconf/tea/teaish.tester.tcl.in
index ea4d2a066..8f1362a75 100644
--- a/autoconf/tea/teaish.tester.tcl.in
+++ b/autoconf/tea/teaish.tester.tcl.in
@@ -5,10 +5,20 @@
# 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
-load [lindex $::argv 0] [lindex $::argv 1];
+if {[llength [lindex $::argv 0]] > 0} {
+ load [lindex $::argv 0] [lindex $::argv 1];
+}
source [lindex $::argv 2]; # teaish/tester.tcl
@if TEAISH_PKGINIT_TCL
apply {{file} {
diff --git a/autosetup/proj.tcl b/autosetup/proj.tcl
index 4c4d876f8..1ccc63280 100644
--- a/autosetup/proj.tcl
+++ b/autosetup/proj.tcl
@@ -8,7 +8,13 @@
# * May you find forgiveness for yourself and forgive others.
# * May you share freely, never taking more than you give.
#
-########################################################################
+
+#
+# ----- @module proj.tcl -----
+# @section Project Helper APIs
+#
+
+#
# Routines for Steve Bennett's autosetup which are common to trees
# managed in and around the umbrella of the SQLite project.
#
@@ -25,13 +31,12 @@
# noted here only as an indication that there are no licensing issues
# despite this code having a handful of near-twins running around a
# handful of third-party source trees.
-########################################################################
#
# Design notes:
#
-# - Symbols with a suffix of _ are intended for internal use within
+# - Symbols with _ separators are intended for internal use within
# this file, and are not part of the API which auto.def files should
-# rely on.
+# rely on. Symbols with - separators are public APIs.
#
# - By and large, autosetup prefers to update global state with the
# results of feature checks, e.g. whether the compiler supports flag
@@ -49,10 +54,7 @@
# test, downstream tests may not like the $prefix/lib path added by
# the rpath test. To avoid such problems, we avoid (intentionally)
# updating global state via feature tests.
-########################################################################
-
-# ----- @module proj.tcl -----
-# @section Project Helper APIs
+#
#
# $proj__Config is an internal-use-only array for storing whatever generic
@@ -1427,11 +1429,11 @@ proc proj-which-linenoise {dotH} {
# manner unless they are explicitly overridden at configure-time, in
# which case those overrides takes precedence.
#
-# Each --XYZdir flag which is explicitly passed to configure is
-# exported as-is, as are those which default to some top-level system
-# directory, e.g. /etc or /var. All which derive from either $prefix
-# or $exec_prefix are exported in the form of a Makefile var
-# reference, e.g. libdir=${exec_prefix}/lib. Ergo, if
+# Each autoconf-relvant --XYZ flag which is explicitly passed to
+# configure is exported as-is, as are those which default to some
+# top-level system directory, e.g. /etc or /var. All which derive
+# from either $prefix or $exec_prefix are exported in the form of a
+# Makefile var reference, e.g. libdir=${exec_prefix}/lib. Ergo, if
# --exec-prefix=FOO is passed to configure, libdir will still derive,
# at make-time, from whatever exec_prefix is passed to make, and will
# use FOO if exec_prefix is not overridden at make-time. Without this
@@ -1467,7 +1469,7 @@ proc proj-remap-autoconf-dir-vars {} {
}
# Maintenance reminder: the [join] call is to avoid {braces}
# around the output when someone passes in,
- # e.g. --libdir=\${prefix}/foo/bar. The Debian package build
+ # e.g. --libdir=\${prefix}/foo/bar. Debian's SQLite package build
# script does that.
}
}
@@ -1526,7 +1528,6 @@ proc proj-current-scope {{lvl 0}} {
}
}
-
#
# Converts parts of tclConfig.sh to autosetup [define]s.
#
@@ -1568,7 +1569,7 @@ proc proj-tclConfig-sh-to-autosetup {tclConfigSh} {
set fd [open "| sh" "rw"]
#puts "fd = $fd"; exit
puts $fd $shBody
- flush $fd
+ #flush $fd; # "bad file descriptor"? Without flush, [read] blocks
set rd [read $fd]
close $fd
puts "rd=$rd"; exit 1
@@ -1576,8 +1577,12 @@ proc proj-tclConfig-sh-to-autosetup {tclConfigSh} {
} else {
set shName ".tclConfigSh.tcl"
proj-file-write $shName $shBody
- eval [exec sh $shName $tclConfigSh]
+ catch {
+ eval [exec sh $shName $tclConfigSh]
+ expr 1
+ } rc xopts
file delete -force $shName
+ return {*}$xopts $rc
}
}
@@ -1635,7 +1640,7 @@ proc proj-tweak-default-env-dirs {} {
# If $postProcessScript is not empty then, during
# [proj-dot-ins-process], it will be eval'd immediately after
# processing the file. In the context of that script, the vars
-# $fileIn and $fileOut will be set to the input and output file
+# $dotInsIn and $dotInsOut will be set to the input and output file
# names. This can be used, for example, to make the output file
# executable or perform validation on its contents.
#
@@ -1713,7 +1718,10 @@ proc proj-dot-ins-process {args} {
proj-validate-no-unresolved-ats $fOut
}
if {"" ne $fScript} {
- uplevel 1 "set fileIn $fIn; set fileOut $fOut; eval {$fScript}"
+ uplevel 1 [join [list set dotInsIn $fIn \; \
+ set dotInsOut $fOut \; \
+ eval \{${fScript}\} \; \
+ unset dotInsIn dotInsOut]]
}
}
if {$flags(-clear)} {
diff --git a/autosetup/sqlite-config.tcl b/autosetup/sqlite-config.tcl
index 3f7d174d7..74d5b7931 100644
--- a/autosetup/sqlite-config.tcl
+++ b/autosetup/sqlite-config.tcl
@@ -994,7 +994,7 @@ proc sqlite-handle-emsdk {} {
proj-bin-define wasm-opt BIN_WASM_OPT
}
proj-dot-ins-append $emccSh.in $emccSh {
- catch {exec chmod u+x $fileOut}
+ catch {exec chmod u+x $dotInsOut}
}
proj-dot-ins-append $extWasmConfig.in $extWasmConfig
} else {
diff --git a/manifest b/manifest
index 73a3ec1ae..0f9f59a7b 100644
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Fix\sa\sproblem\sin\sthe\sfts5matchinfo.test\sfile\sthat\sprevented\sit\sfrom\nworking\son\sMac.
-D 2025-04-22T18:45:40.700
+C Upstream\steaish\sfixes\sand\simprovements.
+D 2025-04-23T14:54:13.759
F .fossil-settings/binary-glob 61195414528fb3ea9693577e1980230d78a1f8b0a54c78cf1b9b24d0a409ed6a x
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
@@ -22,20 +22,20 @@ F autoconf/Makefile.msc 5bc67d3912444c40c6f96d003e5c90663e51abb83d204a520110b1b2
F autoconf/README.first f1d3876e9a7852c22f275a6f06814e64934cecbc0b5b9617d64849094c1fd136
F autoconf/README.txt b749816b8452b3af994dc6d607394bef3df1736d7e09359f1087de8439a52807
F autoconf/auto.def 3d994f3a9cc9b712dbce92a5708570ddcf3b988141b6eb738f2ed16127a9f0ac
-F autoconf/tea/Makefile.in 88fc65f68618f7ab7d78bded67105d0787e5d71ab183f51d80a9bc5dce2478ab
+F autoconf/tea/Makefile.in bb66da485861af82a45e7c135fcf89270f5c0989dbfbb17912c745440b2f9c6c
F autoconf/tea/README.txt 656d4686c509d375f5988ff3deda94f65fe6cd8358cd55d1f1dcc7b6e2ff73aa
-F autoconf/tea/auto.def 81e2617cfb90d53c19b53b3ec632cd2893bf32f2e5dd272b1116fadf2ea86c2d
+F autoconf/tea/auto.def ce95b9450e2fa4ba5dc857e208fe10f4e6f2d737796ac3278aee6079db417529
F autoconf/tea/autosetup/README.txt b40071e6f8506500a2f7f71d5fc69e0bf87b9d7678dd9da1e5b4d0acbf40b1ca
-F autoconf/tea/autosetup/core.tcl 9b8415824dff052ce25ce9beed895357d6b7cd8ed1422c76ba9744c3d2f9e7c4
+F autoconf/tea/autosetup/core.tcl b230b6a6d711c162ead7249c771bfb730b7c413b38ceb6832f92baab8d2e62a5
F autoconf/tea/autosetup/feature-tests.tcl 307cac35806817fc87bd0d92004364ee682c0e99f2ab505291500493ab6c7a5f
-F autoconf/tea/autosetup/tester.tcl 236598490975a3c071ee753900f3775192b116cf0531c6c754d17e028ea3f880
+F autoconf/tea/autosetup/tester.tcl 93cff35afc5cabc8f855fad114fae58b435fa47cbab5f8cbd4dc694ff0c26107
F autoconf/tea/configure d0b12b984edca6030d1976375b80157ac78b5b90a5b4f0dcee39357f63f4a80b x
F autoconf/tea/doc/sqlite3.n 9a97f4f717ceab73004ea412af7960625c1cb24b5c25e4ae4c8b5d8fa4300f4e
F autoconf/tea/license.terms 13bd403c9610fd2b76ece0ab50c4c5eda933d523
-F autoconf/tea/pkgIndex.tcl.in 14e8265862e8901a613ef50101f4f813a56f837a63f54e2431b9df0e9bc663a0
-F autoconf/tea/teaish.tcl c8e63cfb1b5cc5f688a90fea16c9bf8b0d6444dce62bd03f4abf7e8cdabf84ce
+F autoconf/tea/pkgIndex.tcl.in e07da6b94561f4aa382bab65b1ccceb04701b97bf59d007c1d1f20a222b22d07
+F autoconf/tea/teaish.tcl 9abc575ff3106c60ec0924a558d45dd58f7b4cd07373f87372df1988611b7d8c
F autoconf/tea/teaish.test.tcl cfe94e1fb79dd078f650295be59843d470125e0cc3a17a1414c1fb8d77f4aea6
-F autoconf/tea/teaish.tester.tcl.in 9251c1beb38c24f708a35d74f75a0a1686cc8761034f99d8092282ac10040976
+F autoconf/tea/teaish.tester.tcl.in 430c3514633f6de0a9527f52ff7d251febacf839a91d45c04b10a70388bcaee2
F autosetup/LICENSE 41a26aebdd2cd185d1e2b210f71b7ce234496979f6b35aef2cbf6b80cbed4ce4
F autosetup/README.autosetup a78ff8c4a3d2636a4268736672a74bf14a82f42687fcf0631a70c516075c031e
F autosetup/README.md f324bb9f9bf1cc787122034df53fbfdfed28ee2657e6652b763d992ab0d04829
@@ -51,8 +51,8 @@ F autosetup/cc.tcl c0fcc50ca91deff8741e449ddad05bcd08268bc31177e613a6343bbd1fd3e
F autosetup/find_tclconfig.tcl e64886ffe3b982d4df42cd28ed91fe0b5940c2c5785e126c1821baf61bc86a7e
F autosetup/jimsh0.c 563b966c137a4ce3c9333e5196723b7ac0919140a9d7989eb440463cd855c367
F autosetup/pkg-config.tcl 4e635bf39022ff65e0d5434339dd41503ea48fc53822c9c5bde88b02d3d952ba
-F autosetup/proj.tcl 3eb8e6c74002fc89a1543406039bc36a9347e6deda90fadd00a7436820d38014
-F autosetup/sqlite-config.tcl bde169c42d5d5331485ae7785f5dd19ca1aa01315787e8306441c472ad4e4201
+F autosetup/proj.tcl 38999aca5258e59fc6e7d4d5964c395b74bb5dc7865479bd98cee4dca71e61ba
+F autosetup/sqlite-config.tcl 54c88abadda1a42c6276186afcf6534e9bcb08350d96676c4ec08b99f2ada484
F autosetup/system.tcl 51d4be76cd9a9074704b584e5c9cbba616202c8468cf9ba8a4f8294a7ab1dba9
F configure 9a00b21dfd13757bbfb8d89b30660a89ec1f8f3a79402b8f9f9b6fc475c3303a x
F contrib/sqlitecon.tcl eb4c6578e08dd353263958da0dc620f8400b869a50d06e271ab0be85a51a08d3
@@ -2216,8 +2216,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350
F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7
F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139
F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
-P b6c5516940851bd17706435148253325d1b912a44ae138d2b8ca33e5167418c7
-R 9218ccd8b518b209e6a20d61b383e872
-U drh
-Z f58d140defc6379d7662d9d02b260125
+P 5a411c609ba0ee17b1ce5bd0b40b9ded92d76f35933f92b2e02a58a3f169c715
+R b0c338fe00382bfb412fdd47cce333a1
+U stephan
+Z eee13aa4761e9cdaf3c2c73939710886
# Remove this line to create a well-formed Fossil manifest.
diff --git a/manifest.uuid b/manifest.uuid
index 357f794a7..3bf8bc9ec 100644
--- a/manifest.uuid
+++ b/manifest.uuid
@@ -1 +1 @@
-5a411c609ba0ee17b1ce5bd0b40b9ded92d76f35933f92b2e02a58a3f169c715
+235ea2c0e1823fe4324c3890069a9131ebb6de14e55eb56c0e9f42a7e491a699