]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Latest upstream teaish. Most notably it adds the ability for the extension to specify...
authorstephan <stephan@noemail.net>
Wed, 16 Apr 2025 21:53:01 +0000 (21:53 +0000)
committerstephan <stephan@noemail.net>
Wed, 16 Apr 2025 21:53:01 +0000 (21:53 +0000)
FossilOrigin-Name: c86315e538f4d75161faa72673927cde8be080c983f04a98491d1add14615038

autoconf/tea/Makefile.in
autoconf/tea/autosetup/core.tcl
autoconf/tea/autosetup/tester.tcl
autoconf/tea/pkgIndex.tcl.in
autoconf/tea/teaish.tcl
autoconf/tea/teaish.tester.tcl.in
manifest
manifest.uuid

index eae30567e902ed2b6b687ffb3b3cf72436efcfc6..1eb22984ba4e2fbf9c325101083ab0bc508fda38 100644 (file)
@@ -38,7 +38,6 @@ tx.pkgName       = @TEAISH_PKGNAME@
 tx.version       = @TEAISH_VERSION@
 tx.libdir        = @TEAISH_LIBDIR_NAME@
 tx.loadPrefix    = @TEAISH_LOAD_PREFIX@
-#tx.testScript    = @TEAISH_TEST_TCL@
 tx.tcl           = @TEAISH_TCL@
 tx.makefile      = @TEAISH_MAKEFILE@
 tx.makefile.in   = @TEAISH_MAKEFILE_IN@
@@ -50,9 +49,9 @@ tx.dll           = $(tx.dll$(TCL_MAJOR_VERSION))
 tx.dir           = @TEAISH_DIR@
 
 teaish.dir           = @abs_top_srcdir@
-teaish.dir.autosetup = @TEAISH_AUTOSETUP_DIR@
+#teaish.dir.autosetup = @TEAISH_AUTOSETUP_DIR@
 teaish.makefile      = Makefile
-teaish.makefile.in   =  $(teaish.dir)/Makefile.in
+teaish.makefile.in   = $(teaish.dir)/Makefile.in
 teaish__auto.def     = $(teaish.dir)/auto.def
 
 #
@@ -156,13 +155,15 @@ tx.dist.files = @TEAISH_DIST_FILES@
 #
 teaish__cleanExtra =
 
-#
 # List of deps which may trigger an auto-reconfigure.
 #
 teaish__autogen.deps = \
   $(tx.makefile.in) $(teaish.makefile.in) \
-  $(tx.tcl) $(teaish.dir)/pkgIndex.tcl.in \
+  $(tx.tcl) \
+  @TEAISH_PKGINDEX_TCL_IN@ \
+  @TEAISH_MODULE_TEST_TCL@ \
   @AUTODEPS@
+
 #
 # Problem: when more than one target can invoke TEAISH_AUTORECONFIG,
 # we can get parallel reconfigures running. Thus, targets which
@@ -179,6 +180,16 @@ reconfigure:
 $(teaish.makefile): $(teaish__auto.def) $(teaish.makefile.in) \
   @AUTODEPS@
 
+@if TEAISH_TEST_TCL_IN
+#config.log: @TEAISH_TEST_TCL_IN@
+#@TEAISH_TEST_TCL_IN@:
+#@TEAISH_TEST_TCL@: @TEAISH_TEST_TCL_IN@
+@endif
+
+@TEAISH_TESTER_TCL_IN@:
+@TEAISH_TESTER_TCL@: @TEAISH_TESTER_TCL_IN@
+config.log: @TEAISH_TESTER_TCL@
+
 #
 # The rest of this makefile exists solely to support this brief
 # target: the extension shared lib.
@@ -208,7 +219,7 @@ tclsh: $(teaish.makefile) config.log
 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)
+test-prepre: $(tx.dll) @TEAISH_TESTER_TCL@
 test-pre: test-prepre
 test-core: test-pre
        $(TCLSH) @TEAISH_TESTER_TCL@ $(tx.tester.args)
@@ -218,7 +229,7 @@ test: test-post
 #
 # Cleanup rules...
 #
-.PHONY: clean-pre clean-core clean-post clean-extension
+#.PHONY: clean-pre clean-core clean-post clean-extension
 clean-extension: # this name is reserved for use by teaish.make
 clean-pre:
 clean-core: clean-pre
@@ -230,8 +241,25 @@ clean: clean-post
 distclean-extension: # this name is reserved for use by teaish.make
 distclean-pre: clean
 distclean-core: distclean-pre
-       rm -f Makefile pkgIndex.tcl teaish.make teaish.tester.tcl
+       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
 
@@ -279,8 +307,8 @@ uninstall-post: uninstall-core
 uninstall: uninstall-post
 
 Makefile: config.log $(teaish.makefile.in)
-@if TEAISH_MAKEFILE
-$(tx.makefile): config.log
+@if TEAISH_MAKEFILE_IN
+config.log: @TEAISH_MAKEFILE_IN@
 @endif
 
 #
@@ -354,9 +382,8 @@ dist:
 @endif
 @endif #TEAISH_ENABLE_DIST
 
-@if TEAISH_MAKEFILE
 #
-# tx.makefile defines any extension-specific state this file
+# TEAISH_MAKEFILE[_IN] defines any extension-specific state this file
 # needs.
 #
 # It must set the following vars if they're not already accounted for
@@ -377,15 +404,32 @@ dist:
 #
 # 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 import it into here. That skips its teaish-specific
+# validation though. Hmm.
+#
+#@if TEAISH_MAKEFILE_IN
+## TEAISH_MAKEFILE_IN ==>
+#Makefile: @TEAISH_MAKEFILE_IN@
+#@include @TEAISH_MAKEFILE_IN@
+#@endif
+#@if !TEAISH_MAKEFILE_IN
+@if TEAISH_MAKEFILE
+# TEAISH_MAKEFILE ==>
+Makefile: @TEAISH_MAKEFILE@
 @include @TEAISH_MAKEFILE@
 @endif #TEAISH_MAKEFILE
+#@endif #!TEAISH_MAKEFILE_IN
 
-@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-add-make] to incrementally build up this
 # content.
 #
+@if TEAISH_MAKEFILE_CODE
+# TEAISH_MAKEFILE_CODE ==>
+Makefile: @TEAISH_TCL@
 @TEAISH_MAKEFILE_CODE@
 @endif #TEAISH_MAKEFILE_CODE
index e3f71f1edeb68fa493ca694411609c351986db31..57d9246c7bf6b0628bfbffed9da1f03f1ee23a67 100644 (file)
@@ -48,6 +48,7 @@ array set teaish__Config [proj-strip-hash-comments {
   pkgindex-policy 0
 }]
 set teaish__Config(core-dir) $::autosetup(libdir)/teaish
+
 #
 # Returns true if any arg in $::argv matches any of the given globs,
 # else returns false.
@@ -82,6 +83,7 @@ proc teaish-configure-core {} {
     TEAISH_CFLAGS ""
     TEAISH_LDFLAGS ""
     TEAISH_SRC ""
+    TEAISH_VSATISFIES_TCL "8.5"
   } {
     define $f $v
   }
@@ -192,15 +194,20 @@ proc teaish-configure-core {} {
 }
 
 
-########################################################################
+#
 # Internal config-time debugging output routine. It is not legal to
 # call this from the global scope.
+#
 proc teaish-debug {msg} {
   if {$::teaish__Config(debug-enabled)} {
     puts stderr [proj-bold "** DEBUG: \[[proj-current-scope 1]\]: $msg"]
   }
 }
 
+#
+# Runs "phase 1" of the configuration, immediately after processing
+# --flags. This is what will import the client-defined teaish.tcl.
+#
 proc teaish__configure-phase1 {} {
   # Set up some default values if the user did not set them.
   foreach {key val} [list \
@@ -215,8 +222,13 @@ proc teaish__configure-phase1 {} {
   # Do it again for vars which rely on defaults derived from other
   # vars.
   foreach {key val} [list \
-                       TEAISH_LIBDIR_NAME [get-define TEAISH_PKGNAME ""] \
-                       TEAISH_LOAD_PREFIX [string totitle [get-define TEAISH_PKGNAME ""]] \
+                       TEAISH_LIBDIR_NAME \
+                       [join [list \
+                                [get-define TEAISH_PKGNAME ""] \
+                                [get-define TEAISH_VERSION ""]] \
+                          "" ] \
+                       TEAISH_LOAD_PREFIX [string totitle \
+                                             [get-define TEAISH_PKGNAME ""]] \
                        TEAISH_PKGNAME [get-define TEAISH_NAME]] {
     if {"<nope>" eq [get-define $key "<nope>"]} {
       #puts "***** defining default $key $val"
@@ -230,8 +242,8 @@ proc teaish__configure-phase1 {} {
   uplevel 1 {
     use cc cc-db cc-shared cc-lib; # pkg-config
   }
-  teaish__check-tcl
-  teaish__check-common-bins
+  teaish__check_tcl
+  teaish__check_common_bins
   apply {{} {
     #
     # If --prefix or --exec-prefix are _not_ provided, use their
@@ -291,6 +303,25 @@ proc teaish__configure-phase1 {} {
     teaish-configure
   }
 
+  if {0} {
+    # Reminder: we cannot do a TEAISH_VSATISFIES_TCL check like the following
+    # from here because _this_ tcl instance is very possibly not the one
+    # which will be hosting the extension.
+    if {$::autosetup(istcl)} {
+      # ^^^ this is a canonical Tcl, not JimTcl
+      set vsat [get-define TEAISH_VSATISFIES_TCL ""]
+      if {$vsat ne ""
+          && ![package vsatisfies [package provide Tcl] $vsat]} {
+        error [join [list "Tcl package vsatisfies failed for" \
+                       [get-define TEAISH_NAME] \
+                       [get-define TEAISH_VERSION] \
+                       ": expecting vsatisfies to match ($vsat)"]]
+      }
+      unset vsat
+    }
+  }
+
+
   if {[proj-looks-like-windows]} {
     # Without this, linking of an extension will not work on Cygwin or
     # Msys2.
@@ -300,10 +331,6 @@ proc teaish__configure-phase1 {} {
 
   #define AS_LIBDIR $::autosetup(libdir)
   define TEAISH_MODULE_TEST_TCL $::teaish__Config(core-dir)/tester.tcl
-  teaish__configure-finalize
-}
-
-proc teaish__configure-finalize {} {
 
   apply {{} {
     #
@@ -323,10 +350,9 @@ proc teaish__configure-finalize {} {
 
   set dEx $::teaish__Config(teaish-dir)
   set dSrc $::autosetup(srcdir)
+
   proj-dot-ins-append $dSrc/Makefile.in
   proj-dot-ins-append $dSrc/teaish.tester.tcl.in
-  define TEAISH_TESTER_TCL_IN $dEx/teaish.tester.tcl.in
-  define TEAISH_TESTER_TCL teaish.tester.tcl
 
   if {[get-define TEAISH_OUT_OF_EXT_TREE]} {
     define TEAISH_ENABLE_DIST 0
@@ -349,10 +375,11 @@ proc teaish__configure-finalize {} {
   proj-dot-ins-process -validate; # do not [define] after this point
   proj-if-opt-truthy teaish-dump-defines {
     make-config-header config.defines.txt \
-      -none {TEAISH__*} \
-      -str {BIN_* CC LD AR INSTALL LDFLAG*} \
+      -none {TEAISH__* TEAISH_MAKEFILE_CODE} \
+      -str {
+        BIN_* CC LD AR INSTALL LDFLAG* CFLAGS* *_LDFLAGS *_CFLAGS
+      } \
       -bare {HAVE_*} \
-      -str {TEAISH_DIST_FILES} \
       -auto {*}
   }
 
@@ -371,10 +398,10 @@ proc teaish__configure-finalize {} {
   #proj-file-write $::autosetup(builddir)/.configured ""
 }
 
-
-########################################################################
+#
 # Run checks for required binaries.
-proc teaish__check-common-bins {} {
+#
+proc teaish__check_common_bins {} {
   if {"" eq [proj-bin-define install]} {
     proj-warn "Cannot find install binary, so 'make install' will not work."
     define BIN_INSTALL false
@@ -387,10 +414,10 @@ proc teaish__check-common-bins {} {
   }
 }
 
-########################################################################
+#
 # TCL...
 #
-# teaish__check-tcl performs most of the --with-tcl and --with-tclsh
+# teaish__check_tcl performs most of the --with-tcl and --with-tclsh
 # handling. Some related bits and pieces are performed before and
 # after that function is called.
 #
@@ -403,7 +430,7 @@ proc teaish__check-common-bins {} {
 #  - TCLLIBDIR is the dir to which the extension library gets
 #  - installed.
 #
-proc teaish__check-tcl {} {
+proc teaish__check_tcl {} {
   define TCLSH_CMD false ; # Significant is that it exits with non-0
   define TCLLIBDIR ""    ; # Installation dir for TCL extension lib
   define TCL_CONFIG_SH ""; # full path to tclConfig.sh
@@ -728,35 +755,32 @@ If you are attempting an out-of-tree build, use
     }
     apply $addDist $extI
     msg-result "Extension post-load init = $extI"
-    define TEAISH_PKGINIT_TCL_TAIL [file tail [get-define TEAISH_PKGINIT_TCL]]; # for use in pkgIndex.tcl
+    define TEAISH_PKGINIT_TCL_TAIL \
+      [file tail [get-define TEAISH_PKGINIT_TCL]]; # for use in pkgIndex.tcl.in
   }
 
   # Look for pkgIndex.tcl[.in]...
   set piPolicy 0
   if {[proj-first-file-found $dirExt/pkgIndex.tcl.in extPI]} {
-    # If $dirExt/pkgIndex.tcl.in exists, generate ./pkgIndex.tcl from
-    # it.
+    # Generate ./pkgIndex.tcl from it.
     define TEAISH_PKGINDEX_TCL_IN $extPI
     define TEAISH_PKGINDEX_TCL [file rootname [file tail $extPI]]
     proj-dot-ins-append $extPI
     file delete -force -- [get-define TEAISH_PKGINDEX_TCL]
     apply $addDist $extPI
     set piPolicy 0x01
-  } elseif {![expr {$dirExt eq $dirSrc}]
+  } elseif {$dirExt ne $dirSrc
             && [proj-first-file-found $dirSrc/pkgIndex.tcl.in extPI]} {
-    # If $dirSrc/pkgIndex.tcl.in exists, generate ./pkgIndex.tcl from
-    # it.
+    # Generate ./pkgIndex.tcl from it.
     define TEAISH_PKGINDEX_TCL_IN $extPI
     define TEAISH_PKGINDEX_TCL [file rootname [file tail $extPI]]
     proj-dot-ins-append $extPI
     file delete -force -- [get-define TEAISH_PKGINDEX_TCL]
     set piPolicy 0x02
   } elseif {[proj-first-file-found $dirExt/pkgIndex.tcl extPI]} {
-    # if TEAISH_DIR/pkgIndex.tcl exists, assume it's a static file
-    # and use it.
+    # Assume it's a static file and use it.
     define TEAISH_PKGINDEX_TCL_IN ""
     define TEAISH_PKGINDEX_TCL $extPI
-    proj-dot-ins-append $extPI
     apply $addDist $extPI
     set piPolicy 0x04
   }
@@ -764,30 +788,46 @@ If you are attempting an out-of-tree build, use
   set ::teaish__Config(pkgindex-policy) $piPolicy
 
   # Look for teaish.test.tcl[.in]
-  apply {{addDist} {
-    set tdir $::teaish__Config(teaish-dir)
-    proj-assert {"" ne $tdir}
-    set flist [list $tdir/teaish.test.tcl.in $tdir/teaish.test.tcl]
-    if {[proj-first-file-found $flist ttt]} {
-      set tail [file tail $ttt]
-      set xt [file rootname $tail]
-      if {[string match *.in $ttt]} {
-        # Generate teaish.test.tcl from $ttt
-        file delete -force -- $xt; # ensure no stale copy is used
-        define TEAISH_TEST_TCL $xt
-        define TEAISH_TEST_TCL_IN $ttt
-        proj-dot-ins-append $ttt $xt
-        apply $addDist $tail
-      } else {
-        define TEAISH_TEST_TCL $ttt
-        define TEAISH_TEST_TCL_IN ""
-        apply $addDist $xt
-      }
+  proj-assert {"" ne $dirExt}
+  set flist [list $dirExt/teaish.test.tcl.in $dirExt/teaish.test.tcl]
+  if {[proj-first-file-found $flist ttt]} {
+    if {[string match *.in $ttt]} {
+      # Generate teaish.test.tcl from $ttt
+      set xt [file rootname [file tail $ttt]]
+      file delete -force -- $xt; # ensure no stale copy is used
+      define TEAISH_TEST_TCL $xt
+      define TEAISH_TEST_TCL_IN $ttt
+      proj-dot-ins-append $ttt $xt
     } else {
-      define TEAISH_TEST_TCL ""
+      define TEAISH_TEST_TCL $ttt
       define TEAISH_TEST_TCL_IN ""
     }
-  }} $addDist
+    apply $addDist $ttt
+  } else {
+    define TEAISH_TEST_TCL ""
+    define TEAISH_TEST_TCL_IN ""
+  }
+
+  # Look for teaish.tester.tcl[.in]
+  set flist [list $dirExt/teaish.tester.tcl.in $dirSrc/teaish.tester.tcl.in]
+  if {[proj-first-file-found $flist ttt]} {
+    # Generate teaish.test.tcl from $ttt
+    set xt [file rootname [file tail $ttt]]
+    file delete -force -- $xt; # ensure no stale copy is used
+    define TEAISH_TESTER_TCL $xt
+    define TEAISH_TESTER_TCL_IN $ttt
+    proj-dot-ins-append $ttt $xt
+    if {[lindex $flist 0] eq $ttt} {
+      apply $addDist $ttt
+    }
+  } else {
+    set ttt [file join $dirSrc teaish.tester.tcl.in]
+    set xt [file rootname [file tail $ttt]]
+    proj-dot-ins-append $ttt $xt
+    define TEAISH_TESTER_TCL $xt
+    define TEAISH_TESTER_TCL_IN $ttt
+  }
+  unset flist xt ttt
 
   # TEAISH_OUT_OF_EXT_TREE = 1 if we're building from a dir other
   # than the extension's home dir.
@@ -801,6 +841,7 @@ If you are attempting an out-of-tree build, use
 # @teaish-add-cflags ?-p|prepend? ?-define? cflags...
 #
 # Equivalent to [proj-define-amend TEAISH_CFLAGS {*}$args].
+#
 proc teaish-add-cflags {args} {
   proj-define-amend TEAISH_CFLAGS {*}$args
 }
@@ -825,6 +866,7 @@ proc teaish-define-to-cflag {args} {
 # technically correct and still relevant on some environments.
 #
 # See: teaish-prepend-ldflags
+#
 proc teaish-add-ldflags {args} {
   proj-define-amend TEAISH_LDFLAGS {*}$args
 }
@@ -832,6 +874,7 @@ proc teaish-add-ldflags {args} {
 # @teaish-prepend-ldflags args...
 #
 # Functionally equivalent to [teaish-add-ldflags -p {*}$args]
+#
 proc teaish-prepend-ldflags {args} {
   teaish-add-ldflags -p {*}$args
 }
@@ -848,6 +891,7 @@ proc teaish-prepend-ldflags {args} {
 # 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-add-src {args} {
   set i 0
   proj-parse-simple-flags args flags {
@@ -879,6 +923,7 @@ proc teaish-add-src {args} {
 #
 # It is not legal to call this until TEAISH_DIR has been reliably set
 # (via teaish__find_extension).
+#
 proc teaish-add-dist {args} {
   if {$::teaish__Config(blddir-is-extdir)} {
     proj-define-amend TEAISH_DIST_FILES {*}$args
@@ -930,6 +975,7 @@ proc teaish-add-make {args} {
 # The exported file is then passed to [proj-touch] because, in
 # practice, that's sometimes necessary to avoid build dependency
 # issues.
+#
 proc teaish-make-config-header {filename} {
   make-config-header $filename \
     -bare {} \
@@ -943,6 +989,7 @@ proc teaish-make-config-header {filename} {
 #
 # Sets a feature-check cache entry with the given key.
 # See proj-cache-set for the key's semantics.
+#
 proc teaish-feature-cache-set {{key 0} val} {
   proj-cache-set $key 1 $val
 }
@@ -957,6 +1004,7 @@ proc teaish-feature-cache-set {{key 0} val} {
 # "" and returns 0.
 #
 # See proj-cache-check for $key's semantics.
+#
 proc teaish-feature-cache-check {{key 0} tgtVar} {
   upvar $tgtVar tgt
   proj-cache-check $key 1 tgt
@@ -982,6 +1030,7 @@ proc teaish-feature-cache-check {{key 0} tgtVar} {
 #
 #   -nostatus = do not emit "ok" or "no" at the end. This presumes
 #    that the caller will emit at least one newline before turning.
+#
 proc teaish-check-cached {args} {
   proj-parse-simple-flags args flags {
     -nostatus 0 {expr 1}
@@ -1016,21 +1065,28 @@ proc teaish-check-cached {args} {
   }
 }
 
-########################################################################
+#
 # Internal helper for teaish__defs_format_: returns a JSON-ish quoted
-# form of the given string-type values. It only performs the most
-# basic of escaping. The input must not contain any control
-# characters.
-proc teaish__quote_str {value} {
+# form of the given string-type values.
+#
+# If $asList is true then the return value is in {$value} form.  If
+# $asList is false it only performs the most basic of escaping and
+# the input must not contain any control characters.
+#
+proc teaish__quote_str {asList value} {
+  if {$asList} {
+    return [join [list "\{" $value "\}"] ""]
+  }
   return \"[string map [list \\ \\\\ \" \\\"] $value]\"
 }
 
-########################################################################
-# Internal helper for teaish__dump_defs_to_list. Expects to be passed a
-# [define] name and the variadic $args which are passed to
-# teaish__dump_defs_to_list.. If it finds a pattern match for the given
-# $name in the various $args, it returns the type flag for that $name,
-# e.g. "-str" or "-bare", else returns an empty string.
+#
+# Internal helper for teaish__dump_defs_to_list. Expects to be passed
+# a name and the variadic $args which are passed to
+# teaish__dump_defs_to_list.. If it finds a pattern match for the
+# given $name in the various $args, it returns the type flag for that
+# $name, e.g. "-str" or "-bare", else returns an empty string.
+#
 proc teaish__defs_type {name spec} {
   foreach {type patterns} $spec {
     foreach pattern $patterns {
@@ -1042,11 +1098,25 @@ proc teaish__defs_type {name spec} {
   return ""
 }
 
-########################################################################
+#
 # An internal impl detail. Requires a data type specifier, as used by
 # make-config-header, and a value. Returns the formatted value or the
 # value $::teaish__Config(defs-skip) if the caller should skip
 # emitting that value.
+#
+# In addition to -str, -auto, etc., as defined by make-config-header,
+# it supports:
+#
+#  -list {...} will cause non-integer values to be quoted in {...}
+#  instead of quotes.
+#
+#  -autolist {...} works like -auto {...} except that it falls back to
+#   -list {...} type instead of -str {...} style for non-integers.
+#
+#  -array {...} emits the output in something which, for conservative
+#   inputs, will be a valid JSON array. It can only handle relatively
+#   simple values with no control characters in them.
+#
 set teaish__Config(defs-skip) "-teaish__defs_format sentinel"
 proc teaish__defs_format {type value} {
   switch -exact -- $type {
@@ -1057,14 +1127,22 @@ proc teaish__defs_format {type value} {
       set value $::teaish__Config(defs-skip)
     }
     -str {
-      set value [teaish__quote_str_ $value]
+      set value [teaish__quote_str 0 $value]
     }
     -auto {
       # Automatically determine the type
       if {![string is integer -strict $value]} {
-        set value [teaish__quote_str $value]
+        set value [teaish__quote_str 0 $value]
+      }
+    }
+    -autolist {
+      if {![string is integer -strict $value]} {
+        set value [teaish__quote_str 1 $value]
       }
     }
+    -list {
+      set value [teaish__quote_str 1 $value]
+    }
     -array {
       set ar {}
       foreach v $value {
@@ -1079,7 +1157,9 @@ proc teaish__defs_format {type value} {
       set value $::teaish__Config(defs-skip)
     }
     default {
-      proj-fatal "Unknown type in [proj-current-scope 1]: $type"
+      proj-fatal \
+        "Unknown [project-current-scope] -type ($type) called from" \
+        [proj-current-scope 1]
     }
   }
   return $value
@@ -1087,7 +1167,7 @@ proc teaish__defs_format {type value} {
 
 #
 # Returns Tcl code in the form of code which evaluates to a list of
-# configure-time DEFINEs in the form {key val key2 val...}. It will
+# configure-time DEFINEs in the form {key val key2 val...}. It may
 # misbehave for values which are not numeric or simple strings.
 #
 proc teaish__dump_defs_to_list {args} {
@@ -1098,11 +1178,12 @@ proc teaish__dump_defs_to_list {args} {
     -none {
       TEAISH__*
       TEAISH_MAKEFILE_CODE
-      TEAISH_AUTORECONFIGURE
       AM_* AS_*
     } \
-    -bare {SIZEOF_* HAVE_DECL_*} \
-    -auto *
+    -auto {
+      SIZEOF_* HAVE_*
+    } \
+    -autolist *
   foreach n [lsort [dict keys [all-defines]]] {
     set type [teaish__defs_type $n $args]
     set value [teaish__defs_format $type [get-define $n]]
@@ -1114,6 +1195,7 @@ proc teaish__dump_defs_to_list {args} {
   return [join $lines "\n"]
 }
 
+#
 # @teaish-pragma ...flags
 #
 # Offers a way to tweak how teaish's core behaves in some cases, in
@@ -1129,6 +1211,7 @@ proc teaish__dump_defs_to_list {args} {
 #    it.
 #
 # Emits a warning message for unknown arguments.
+#
 proc teaish-pragma {args} {
   foreach arg $args {
     switch -exact -- $arg {
@@ -1167,7 +1250,7 @@ proc teaish-pragma {args} {
   }
 }
 
-
+#
 # @teaish-enable-dist ?yes?
 #
 # Explicitly enables or disables the "dist" rules in the default
@@ -1215,9 +1298,16 @@ proc teaish__create_extension {dir} {
   set content "define TEAISH_NAME ${name}
 define TEAISH_VERSION ${version}
 # define TEAISH_PKGNAME ${pkgName}
-# define TEAISH_LIBDIR_NAME ${name}
-define TEAISH_LOAD_PREFIX ${loadPrefix}
-proc teaish-options {} {}
+# define TEAISH_LIBDIR_NAME ${name}${version}
+# define TEAISH_LOAD_PREFIX ${loadPrefix}
+proc teaish-options {} {
+  # Return a list and/or use [options-add] to add new
+  # configure flags. This is called before teaish's
+  # bootstrapping is finished, so only teaish-*
+  # APIs which are explicitly noted as being safe
+  # early on may be used here. Any autosetup-related
+  # APIs may be used here.
+}
 proc teaish-configure {} {
   set d \[get-define TEAISH_DIR]
   teaish-add-src \$d/teaish.c
index d0d8024474e065cac57c73c835321ea4cc6dae38..d48d7af44ab3fc3caedd6e326ed149de1116d886 100644 (file)
@@ -61,10 +61,10 @@ proc test-warn {args} {
 #
 # Triggers a test-failed error with a string describing the calling
 # scope and the provided message.
-proc test-fail {msg} {
+proc test-fail {args} {
   #puts stderr "ERROR: \[[test-current-scope 1]]: $msg"
   #exit 1
-  error "FAIL: \[[test-current-scope 1]]: $msg"
+  error "FAIL: \[[test-current-scope 1]]: $args"
 }
 
 # Internal impl for assert-likes. Should not be called directly by
@@ -129,7 +129,9 @@ proc test-catch {cmd args} {
   return 0
 }
 
-array set teaish__BuildFlags {}
+if {![array exists ::teaish__BuildFlags]} {
+  array set ::teaish__BuildFlags {}
+}
 
 # @teaish-build-flag2 flag tgtVar ?dflt?
 #
index fe07e10016f82b9aaa6b7ab0f961e9cc2b952793..93fbe0ead19f3372b57ffce6cb878203494a01b8 100644 (file)
@@ -1,19 +1,27 @@
 # -*- tcl -*-
-# Automatically generated - do not edit
 # 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_TCL
+if {![package vsatisfies [package provide Tcl] @TEAISH_VSATISFIES_TCL@]} {
+  error "Package @TEAISH_PKGNAME@ @TEAISH_VERSION@ requires Tcl @TEAISH_VSATISFIES_TCL@"
+}
+@endif
 if {[package vsatisfies [package provide Tcl] 9.0-]} {
   package ifneeded @TEAISH_PKGNAME@ @TEAISH_VERSION@ [list apply {{dir} {
     load [file join $dir @TEAISH_DLL9@] @TEAISH_LOAD_PREFIX@
 @if TEAISH_PKGINIT_TCL_TAIL
-    set initScript [file join $dir [file tail @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 {
-  if {![package vsatisfies [package provide Tcl] 8.5]} {return}
   package ifneeded @TEAISH_PKGNAME@ @TEAISH_VERSION@ [list apply {{dir} {
     if {[string tolower [file extension @TEAISH_DLL8@]] in [list .dll .dylib .so]} {
       load [file join $dir @TEAISH_DLL8@] @TEAISH_LOAD_PREFIX@
@@ -21,7 +29,7 @@ if {[package vsatisfies [package provide Tcl] 9.0-]} {
       load {} @TEAISH_LOAD_PREFIX@
     }
 @if TEAISH_PKGINIT_TCL_TAIL
-    set initScript [file join $dir [file tail @TEAISH_PKGINIT_TCL_TAIL@]]
+    set initScript [file join $dir @TEAISH_PKGINIT_TCL_TAIL@]
     if {[file exists $initScript]} {
       source -encoding utf-8 $initScript
     }
index 110760084582376f5d1a6c69bb9f8a51d613c3c0..7d8490edf88727a9f1f84e95a952f48036ca6d07 100644 (file)
@@ -3,6 +3,7 @@
 define TEAISH_NAME sqlite; # name used in dist tarballs and as the libdir prefix
 define TEAISH_PKGNAME sqlite3; # name for purposes of Tcl_PkgProvide()
 define TEAISH_LOAD_PREFIX Sqlite3; # 2nd arg to [load]
+define TEAISH_VSATISFIES_TCL 8.6-; # builds with 8.5 but some tests fail
 define TEAISH_VERSION [proj-file-content -trim [get-define TEAISH_DIR]/../VERSION]
 proj-assert {[string match 3.*.* [get-define TEAISH_VERSION]]}
 define TEAISH_LIBDIR_NAME \
index c2ff76476aa9a37ea916f29abede50702dd934f7..315d82350bbeeb89e249f65758e528d01043c72f 100644 (file)
@@ -1,13 +1,33 @@
 # -*- tcl -*-
-# Automatically generated - do not edit
+#
+# 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.
-load [lindex $::argv 0] [lindex $::argv 1]; source [lindex $::argv 2]
+@if TEAISH_VSATISFIES_TCL
+if {![package vsatisfies [package provide Tcl] @TEAISH_VSATISFIES_TCL@]} {
+  error "Package @TEAISH_PKGNAME@ @TEAISH_VERSION@ requires Tcl @TEAISH_VSATISFIES_TCL@"
+}
+@endif
+load [lindex $::argv 0] [lindex $::argv 1];
+source [lindex $::argv 2]; # teaish/tester.tcl
 @if TEAISH_PKGINIT_TCL
-apply {{} {set dir [file dirname $::argv0]; source @TEAISH_PKGINIT_TCL@}}
+apply {{file} {
+  set dir [file dirname $::argv0]
+  source $file
+}} [join {@TEAISH_PKGINIT_TCL@}]
 @endif
 @if TEAISH_TEST_TCL
-source @TEAISH_TEST_TCL@
-@else
-puts "Extension successfully loaded"
+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 $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
index c3377dc0b2a00ecbb66433e23b1e6fad8fb92828..efe02e2ab9179700a340685baa7be07ceed24ce0 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Update\sdoc/tcl-extension-testing.md\sfor\sUnix\ssystems,\sconsolidating\sthe\sTcl\s8.x\sand\s9.x\ssections.
-D 2025-04-16T17:47:16.773
+C Latest\supstream\steaish.\sMost\snotably\sit\sadds\sthe\sability\sfor\sthe\sextension\sto\sspecify\sa\sminimum\sTcl\sversion,\sand\sthis\sbuild\snow\senforces\sa\sminimum\sTcl\sof\s8.6.
+D 2025-04-16T21:53:01.406
 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 2a90dfab1e95cb3ec610429c78d88d4a7d26beb080ad45ff6a05928b901e8309
+F autoconf/tea/Makefile.in 2f716371a21f2d2ad1244c932f9ba12c083c9b4bd066590a51cb20c08f8b7ca6
 F autoconf/tea/README.txt 656d4686c509d375f5988ff3deda94f65fe6cd8358cd55d1f1dcc7b6e2ff73aa
 F autoconf/tea/auto.def 81e2617cfb90d53c19b53b3ec632cd2893bf32f2e5dd272b1116fadf2ea86c2d
 F autoconf/tea/autosetup/README.txt b40071e6f8506500a2f7f71d5fc69e0bf87b9d7678dd9da1e5b4d0acbf40b1ca
-F autoconf/tea/autosetup/core.tcl 4b828c8c77bfe7c94c7331d6dbb9efd1077160343867b4bee6d83c9977a11b6c
+F autoconf/tea/autosetup/core.tcl 94b4f452606f75249aba667e4a4a577112a181112c24201856c8dbef8424f134
 F autoconf/tea/autosetup/feature-tests.tcl 3ccf2fd1cad368c7ed958a869d8b915fada7f164a6b382c7381540c4892476f8
-F autoconf/tea/autosetup/tester.tcl d94aa9d51d2a22062e61db97310c2502ca0df50ca87108482c3bccf8f41db127
+F autoconf/tea/autosetup/tester.tcl 610b158c12112bfcbfe3a0eb18cacaccd914241a37a7a38a7fdd73822b7b3cab
 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 2c99a64a0eff5dc2ad8e9657bb564fae2dbdfdb6b77a4c49b4387bd5a25c42ef
-F autoconf/tea/teaish.tcl dbed8b4cc299e459c6d221262f884bdb27029bdb218e0590ededbe65bb926284
+F autoconf/tea/pkgIndex.tcl.in dc80c325c47095f278c7b4cf0784382fa0048cde44836bbd778aea0c7e23ed1a
+F autoconf/tea/teaish.tcl ee22d09a97dfcf77762942aea5b1b838a284a4a36b124064f1209e241bef6e7e
 F autoconf/tea/teaish.test.tcl cfe94e1fb79dd078f650295be59843d470125e0cc3a17a1414c1fb8d77f4aea6
-F autoconf/tea/teaish.tester.tcl.in 743fd0fe1e667f82fd8fc3ebe0a5c77763e4dbed7bbc8605a9d4b1d0663dac78
+F autoconf/tea/teaish.tester.tcl.in 63059e35289ac663c7d0052e6c0089a309fee75225e86e4ec5b3d9f2c1d9290a
 F autosetup/LICENSE 41a26aebdd2cd185d1e2b210f71b7ce234496979f6b35aef2cbf6b80cbed4ce4
 F autosetup/README.autosetup a78ff8c4a3d2636a4268736672a74bf14a82f42687fcf0631a70c516075c031e
 F autosetup/README.md f324bb9f9bf1cc787122034df53fbfdfed28ee2657e6652b763d992ab0d04829
@@ -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 84e698f38429c142caaa66ac086410f2035691b2ad39ad2fc4e0ebc31dd58a5b
-R 10019481ad9fb3b387e600d039fce87e
+P c4c5dcb79c57f6e38cfe9b68b00e60e42d03ef30aeaefc5bf9dafed994849e1d
+R 1aafbce6cec55668ed932a92db582aa3
 U stephan
-Z 32c947866489f54b1e21c649b883e5ef
+Z da0b8bd6f0a90b2d384ef615e8494fec
 # Remove this line to create a well-formed Fossil manifest.
index fbdd7c571b375996e7f64aa30feead0e13a92192..e48f2d6fc240d4db4cc9fdfa0bc0c9bf5a580d8d 100644 (file)
@@ -1 +1 @@
-c4c5dcb79c57f6e38cfe9b68b00e60e42d03ef30aeaefc5bf9dafed994849e1d
+c86315e538f4d75161faa72673927cde8be080c983f04a98491d1add14615038