diff options
author | stephan <stephan@noemail.net> | 2025-04-22 01:01:19 +0000 |
---|---|---|
committer | stephan <stephan@noemail.net> | 2025-04-22 01:01:19 +0000 |
commit | 204d787644733e528b039c60527a3559a3532c96 (patch) | |
tree | de20d0674c77592323ef09635e8a65cd056ed75c | |
parent | d2fd099570172fd82a31c5e2e57800d1fc79b68e (diff) | |
download | sqlite-204d787644733e528b039c60527a3559a3532c96.tar.gz sqlite-204d787644733e528b039c60527a3559a3532c96.zip |
Generic cleanups and fixes in the teaish build.
FossilOrigin-Name: 734823a5a8e073b511ebc3f37df3542c1bb734b9b1e1bd50ca3e9df12c4bb89e
-rw-r--r-- | autoconf/tea/Makefile.in | 4 | ||||
-rw-r--r-- | autoconf/tea/autosetup/core.tcl | 251 | ||||
-rw-r--r-- | autoconf/tea/autosetup/tester.tcl | 2 | ||||
-rw-r--r-- | autoconf/tea/pkgIndex.tcl.in | 6 | ||||
-rw-r--r-- | autoconf/tea/teaish.tcl | 6 | ||||
-rw-r--r-- | autoconf/tea/teaish.tester.tcl.in | 6 | ||||
-rw-r--r-- | autosetup/proj.tcl | 44 | ||||
-rw-r--r-- | manifest | 26 | ||||
-rw-r--r-- | manifest.uuid | 2 |
9 files changed, 215 insertions, 132 deletions
diff --git a/autoconf/tea/Makefile.in b/autoconf/tea/Makefile.in index 911717bc4..172e38195 100644 --- a/autoconf/tea/Makefile.in +++ b/autoconf/tea/Makefile.in @@ -320,8 +320,8 @@ dist.zip.dir = $(tx.name)-$(tx.version) dist.zip = $(dist.zip.dir).zip .PHONY: dist.zip dist.zip-core dist.zip-post #dist.zip-pre: -# We apparently can't add a pre-hook here, even if dist.zip-pre is -# .PHONY, else "make dist" rebuilds the archive each time it's run. +# 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)/$(dist.zip.dir) diff --git a/autoconf/tea/autosetup/core.tcl b/autoconf/tea/autosetup/core.tcl index 4c9aee4d6..14044e607 100644 --- a/autoconf/tea/autosetup/core.tcl +++ b/autoconf/tea/autosetup/core.tcl @@ -32,12 +32,14 @@ array set teaish__Config [proj-strip-hash-comments { debug-enabled 0 # # 0 = don't yet have extension's pkgindex - # 0x01 = teaish__find_extension found TEAISH_DIR/pkgIndex.tcl - # 0x02 = teaish__find_extension found srcdir/pkgIndex.tcl.in - # 0x04 = teaish__find_extension found TEAISH_DIR/pkgIndex.tcl (static file) - # 0x10 = teaish-pragma was called: behave as if 0x04 + # 0x01 = found TEAISH_DIR/pkgIndex.tcl.in + # 0x02 = found srcdir/pkgIndex.tcl.in + # 0x10 = found TEAISH_DIR/pkgIndex.tcl (static file) + # 0x20 = static-pkgIndex.tcl pragma: behave as if 0x10 + # + # Reminder: it's significant that the bottom 4 bits be + # cases where teaish manages ./pkgIndex.tcl. # - # This might no longer be needed. pkgindex-policy 0 # @@ -54,8 +56,9 @@ array set teaish__Config [proj-strip-hash-comments { -libDir TEAISH_LIBDIR_NAME -loadPrefix TEAISH_LOAD_PREFIX -version TEAISH_VERSION - -vsatisfies TEAISH_VSATISFIES_TCL + -vsatisfies TEAISH_VSATISFIES -options {} + -pragmas {} } # @@ -64,10 +67,20 @@ array set teaish__Config [proj-strip-hash-comments { queued-checks-pre {} queued-checks-post {} + # Whether or not "make dist" parts are enabled. They get enabled + # when building from an extension's dir, disabled when building + # elsewhere. + dist-enabled 1 }] set teaish__Config(core-dir) $::autosetup(libdir)/teaish # +# Array of info managed by teaish-pkginfo-get and friends. Has the +# same set of keys as $teaish__Config(pkginfo-f2d). +# +array set teaish__PkgInfo {} + +# # Runs {*}$args if $lvl is <= the current verbosity level, else it has # no side effects. # @@ -206,13 +219,13 @@ proc teaish-configure-core {} { -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]]} + [teaish-pkginfo-get -pkgName] \ + [teaish-pkginfo-get -version]] ""} -loadPrefix TEAISH_LOAD_PREFIX -e {string totitle [get-define TEAISH_PKGNAME ""]} - -vsatisfies TEAISH_VSATISFIES_TCL -v 8.5- + -vsatisfies TEAISH_VSATISFIES -v {{Tcl 8.5-}} } { set isDefOnly [expr {"-" eq $pflag}] - if {!$isDefOnly && [info exists ::teaish__Config($pflag)]} { + if {!$isDefOnly && [info exists ::teaish__PkgInfo($pflag)]} { continue; } set got [get-define $key "<nope>"] @@ -227,7 +240,7 @@ proc teaish-configure-core {} { #puts "***** defining default $pflag $key {$val} isDefOnly=$isDefOnly got=$got" define $key $val if {!$isDefOnly} { - set ::teaish__Config($pflag) $val + set ::teaish__PkgInfo($pflag) $val } } unset key type val @@ -270,7 +283,7 @@ proc teaish-configure-core {} { } proj-assert {1==$gotExt} "Else we cannot have gotten this far" - teaish__configure-phase1 + teaish__configure_phase1 } @@ -288,7 +301,7 @@ proc teaish-debug {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 {} { +proc teaish__configure_phase1 {} { msg-result \ [join [list "Configuring build of Tcl extension" \ [proj-bold [teaish-pkginfo-get -name] \ @@ -365,9 +378,11 @@ proc teaish__configure-phase1 {} { teaish-checks-run -post 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. + # 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. This part might + # be running in JimTcl, which can't load the being-configured + # extension. if {$::autosetup(istcl)} { # ^^^ this is a canonical Tcl, not JimTcl set vsat [get-define TEAISH_VSATISFIES_TCL ""] @@ -382,7 +397,6 @@ proc teaish__configure-phase1 {} { } } - if {[proj-looks-like-windows]} { # Without this, linking of an extension will not work on Cygwin or # Msys2. @@ -407,6 +421,14 @@ proc teaish__configure-phase1 {} { proj-assert {$tpi ne ""} \ "TEAISH_PKGINDEX_TCL should have been set up by now" teaish__verbose 1 msg-result "Using pkgIndex from $tpi" + if {0x0f & $::teaish__Config(pkgindex-policy)} { + # Don't leave stale pkgIndex.tcl laying around yet don't delete + # or overwrite a user-managed static pkgIndex.tcl. + file delete -force -- [get-define TEAISH_PKGINDEX_TCL] + proj-dot-ins-append [get-define TEAISH_PKGINDEX_TCL_IN] + } else { + teaish-dist-add [file tail $tpi] + } }}; # $::teaish__Config(pkgindex-policy) set dEx $::teaish__Config(teaish-dir) @@ -415,7 +437,34 @@ proc teaish__configure-phase1 {} { proj-dot-ins-append $dSrc/Makefile.in proj-dot-ins-append $dSrc/teaish.tester.tcl.in - define TEAISH_ENABLE_DIST [expr {![get-define TEAISH_OUT_OF_EXT_TREE]}] + apply {{} { + set vs [get-define TEAISH_VSATISFIES ""] + if {"" eq $vs} return + # Treat as a list-of-lists {{Tcl 8.5-} {Foo 1.0- -3.0} ...} and + # generate Tcl which will run package vsatisfies tests with that + # info. + set code {} + set n 0 + foreach pv $vs { + set n [llength $pv] + if {$n < 2} { + proj-error "-vsatisfies: {$pv} appears malformed. Whole list is: $vs" + } + set ifpv [list if \{ "!\[package vsatisfies \[package provide"] + lappend ifpv [lindex $pv 0] "\]" + for {set i 1} {$i < $n} {incr i} { + lappend ifpv [lindex $pv $i] + } + lappend ifpv "\] \} \{\n" + lappend ifpv \ + "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) proj-setup-autoreconfig TEAISH_AUTORECONFIG foreach f { @@ -424,15 +473,16 @@ proc teaish__configure-phase1 {} { TEAISH_SRC TEAISH_DIST_FILES } { + # Ensure that any of these lists are flattened define $f [join [get-define $f]] } - proj-remap-autoconf-dir-vars define TEAISH__DEFINES_MAP \ [teaish__dump_defs_to_list]; # injected into teaish.tester.tcl + proj-remap-autoconf-dir-vars 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__* TEAISH_MAKEFILE_CODE} \ + -none {TEAISH__* TEAISH_*_CODE} \ -str { BIN_* CC LD AR INSTALL LDFLAG* CFLAGS* *_LDFLAGS *_CFLAGS } \ @@ -765,6 +815,7 @@ If you are attempting an out-of-tree build, use set ::teaish__Config(teaish-dir) $dirExt set ::teaish__Config(blddir-is-extdir) \ [define TEAISH_ENABLE_DIST [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] }} @@ -824,8 +875,6 @@ If you are attempting an out-of-tree build, use # 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 {$dirExt ne $dirSrc @@ -833,17 +882,17 @@ If you are attempting an out-of-tree build, use # 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]} { # Assume it's a static file and use it. define TEAISH_PKGINDEX_TCL_IN "" define TEAISH_PKGINDEX_TCL $extPI apply $addDist $extPI - set piPolicy 0x04 + set piPolicy 0x10 } - + # Reminder: we have to delay removal of stale TEAISH_PKGINDEX_TCL + # and the proj-dot-ins-append of TEAISH_PKGINDEX_TCL_IN until much + # later in the process. set ::teaish__Config(pkgindex-policy) $piPolicy # Look for teaish.test.tcl[.in] @@ -991,6 +1040,9 @@ proc teaish-src-add {args} { # 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 } } @@ -1045,8 +1097,7 @@ proc teaish-make-add {args} { # proc teaish-make-config-header {filename} { make-config-header $filename \ - -bare {} \ - -none {HAVE_CFLAG_* LDFLAGS_* SH_*} \ + -none {HAVE_CFLAG_* LDFLAGS_* SH_* TEAISH__* TEAISH_*_CODE} \ -auto {SIZEOF_* HAVE_* TEAISH_* TCL_*} \ -none * proj-touch $filename; # help avoid frequent unnecessary auto-reconfig @@ -1266,7 +1317,7 @@ proc teaish__dump_defs_to_list {args} { } # -# @teaish-pragma ...flags +# @teaish__pragma ...flags # # Offers a way to tweak how teaish's core behaves in some cases, in # particular those which require changing how the core looks for an @@ -1276,47 +1327,40 @@ proc teaish__dump_defs_to_list {args} { # during initial loading of tclish.tcl (recall that most teaish APIs # cannot be used until [teaish-configure] is called). # -# --have-own-pkgIndex.tcl [L]: Tells teaish that ./pkgIndex.tcl is -# not a generated file, so it will not try to overwrite or delete -# it. +# static-pkgIndex.tcl [L]: Tells teaish that ./pkgIndex.tcl is not +# a generated file, so it will not try to overwrite or delete +# 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 +# from the generated Makefile. # # Emits a warning message for unknown arguments. # -proc teaish-pragma {args} { +proc teaish__pragma {args} { foreach arg $args { switch -exact -- $arg { - --have-own-pkgIndex.tcl { - set flist [list \ - [file join $::teaish__Config(teaish-dir) pkgIndex.tcl.in] \ - [file join $::teaish__Config(teaish-dir) pkgIndex.tcl]] - if {[proj-first-file-found $flist tpi]} { - if {[string match *.in $tpi]} { - define TEAISH_PKGINDEX_TCL_IN $tpi - teaish-dist-add [file tail $tpi] - define TEAISH_PKGINDEX_TCL [file rootname [file tail $pi]] - } else { - define TEAISH_PKGINDEX_TCL_IN "" - define TEAISH_PKGINDEX_TCL $tpi - teaish-dist-add [file tail $tpi] - } + static-pkgIndex.tcl { + set tpi [file join $::teaish__Config(teaish-dir) pkgIndex.tcl] + if {[file exists $tpi]} { + define TEAISH_PKGINDEX_TCL_IN "" + define TEAISH_PKGINDEX_TCL $tpi + set ::teaish__Config(pkgindex-policy) 0x20 } else { - proj-error "teaish-pragma $arg found no package-local pkgIndex.tcl\[.in]" + proj-error "$arg: found no package-local pkgIndex.tcl\[.in]" } - set ::teaish__Config(pkgindex-policy) 0x10 + } + + disable-dist { + define TEAISH_ENABLE_DIST 0 + set ::teaish__Config(dist-enabled) 0 } default { - proj-warn "Unknown [proj-current-scope] flag: $arg" + proj-error "Unknown flag: $arg" } } - -# --disable-dist [L]: disables the "dist" parts of the filtered -# Makefile. May be used during initial loading of teaish.tcl. -# -# --disable-dist { -# define TEAISH_ENABLE_DIST 0 -# } } } @@ -1334,31 +1378,43 @@ proc teaish-pragma {args} { # -libDir TEAISH_LIBDIR_NAME # -loadPrefix TEAISH_LOAD_PREFIX # -version TEAISH_VERSION -# -vsatisfies TEAISH_VSATISFIES_TCL +# -vsatisfies TEAISH_VSATISFIES # -options {...} optional [options-add] value # proc teaish-pkginfo-set {args} { set sentinel "<nope>" - set f2d $::teaish__Config(pkginfo-f2d) set flagDefs [list] - foreach {f d} $f2d { + foreach {f d} $::teaish__Config(pkginfo-f2d) { lappend flagDefs $f => $sentinel } proj-parse-simple-flags args flags $flagDefs if {[llength $args]} { proj-error -up "Too many (or unknown) arguments to [proj-current-scope]: $args" } - foreach {f d} $f2d { + foreach {f d} $::teaish__Config(pkginfo-f2d) { if {$sentinel ne [set v $flags($f)]} { switch -exact -- $f { -options { + proj-assert {"" eq $d} options-add $v } + -pragmas { + foreach p $v { + teaish__pragma $p + } + } + -vsatisfies { + if {1 == [llength $v] && 1 == [llength [lindex $v 0]]} { + # Transform X to {Tcl $X} + set v [list [join [list Tcl $v]]] + } + define $d $v + } default { define $d $v } } - set ::teaish__Config($f) $v + set ::teaish__PkgInfo($f) $v } } } @@ -1385,8 +1441,8 @@ proc teaish-pkginfo-get {args} { 0 { # Return a list of (-flag value) pairs lappend cases default {{ - if {[info exists ::teaish__Config($flag)]} { - lappend rv $flag $::teaish__Config($flag) + if {[info exists ::teaish__PkgInfo($flag)]} { + lappend rv $flag $::teaish__PkgInfo($flag) } else { lappend rv $flag [get-define $defName] } @@ -1398,8 +1454,8 @@ proc teaish-pkginfo-get {args} { if {[string match -* $arg]} { # Return the corresponding -flag's value lappend cases $arg {{ - if {[info exists ::teaish__Config($flag)]} { - return $::teaish__Config($flag) + if {[info exists ::teaish__PkgInfo($flag)]} { + return $::teaish__PkgInfo($flag) } else { return [get-define $defName] } @@ -1409,8 +1465,8 @@ proc teaish-pkginfo-get {args} { upvar $arg tgt array set tgt {} lappend cases default {{ - if {[info exists ::teaish__Config($flag)]} { - set tgt($flag) $::teaish__Config($flag) + if {[info exists ::teaish__PkgInfo($flag)]} { + set tgt($flag) $::teaish__PkgInfo($flag) } else { set tgt($flag) [get-define $defName] } @@ -1429,23 +1485,6 @@ proc teaish-pkginfo-get {args} { if {0 == $argc} { return $rv } } -#proc teaish-pget {flag} { -# teaish-pkginfo-get $flag -#} - -# -# @teaish-enable-dist ?yes? -# -# Explicitly enables or disables the "dist" rules in the default -# Makefile.in. This is equivalent to defining TEAISH_ENABLE_DIST -# to $yes (which must be 0 or 1). -# -# By default, dist creation is enabled. -# -proc teaish-enable-dist {{yes 1}} { - define TEAISH_ENABLE_DIST $yes -} - # # @teaish-checks-queue -pre|-post args... # @@ -1484,6 +1523,46 @@ proc teaish-checks-run {flag} { } # +# A general-purpose getter for various teaish state. Requires one +# flag, which determines its result value. Flags marked with [L] below +# are safe for using at load-time, before teaish-pkginfo-set is called +# +# -dir [L]: returns the extension's directory, which may differ from +# the teaish core dir or the build dir. +# +# -teaish-home [L]: the "home" dir of teaish itself, which may +# differ from the extension dir or build dir. +# +# -build-dir [L]: the build directory (typically the current working +# -dir). +# +# Any of the teaish-pkginfo-get/get flags: returns the same as +# teaish-pkginfo-get. Not safe for use until teaish-pkginfo-set has +# been called. +# +# Triggers an error if passed an unknown flag. +# +proc teaish-get {flag} { + switch -exact -- $flag { + -dir { + return $::teaish__Config(teaish-dir) + } + -teaish-home { + return $::autosetup(srcdir) + } + -build-dir { + return $::autosetup(builddir) + } + default { + if {[info exists ::teaish__PkgInfo($flag)]} { + return $::teaish__PkgInfo($flag) + } + } + } + proj-error "Unhandled flag: $flag" +} + +# # Handles --teaish-create-extension=TARGET-DIR # proc teaish__create_extension {dir} { @@ -1520,7 +1599,7 @@ proc teaish__create_extension {dir} { -version ${version} \ -loadPrefix $loadPrefix \ -libDir ${name}${version} - -vsatisfies 8.5- \ + -vsatisfies {{Tcl 8.5-}} \ -options { foo=1 => {Disable foo} } #proc teaish-options {} { diff --git a/autoconf/tea/autosetup/tester.tcl b/autoconf/tea/autosetup/tester.tcl index 199f64daf..863c058f2 100644 --- a/autoconf/tea/autosetup/tester.tcl +++ b/autoconf/tea/autosetup/tester.tcl @@ -29,6 +29,7 @@ # call). If $lvl would resolve to global scope "global scope" is # returned and if it would be negative then a string indicating such # is returned (as opposed to throwing an error). +# proc test-current-scope {{lvl 0}} { #uplevel [expr {$lvl + 1}] {lindex [info level 0] 0} set ilvl [info level] @@ -45,6 +46,7 @@ proc test-current-scope {{lvl 0}} { # @test-msg # # Emits all arugments to stdout. +# proc test-msg {args} { puts "$args" } diff --git a/autoconf/tea/pkgIndex.tcl.in b/autoconf/tea/pkgIndex.tcl.in index 6ed6bb68d..8c50b81cd 100644 --- a/autoconf/tea/pkgIndex.tcl.in +++ b/autoconf/tea/pkgIndex.tcl.in @@ -6,10 +6,8 @@ # 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@" -} +@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} { diff --git a/autoconf/tea/teaish.tcl b/autoconf/tea/teaish.tcl index eedd9bdaf..45f22ab5b 100644 --- a/autoconf/tea/teaish.tcl +++ b/autoconf/tea/teaish.tcl @@ -1,7 +1,7 @@ # Teaish configure script for the SQLite TCL extension apply {{} { - set version [proj-file-content -trim [get-define TEAISH_DIR]/../VERSION] + set version [proj-file-content -trim [teaish-get -dir]/../VERSION] proj-assert {[string match 3.*.* $version]} teaish-pkginfo-set \ -name sqlite \ @@ -9,7 +9,8 @@ apply {{} { -version $version \ -loadPrefix Sqlite3 \ -vsatisfies 8.6- \ - -libDir sqlite$version + -libDir sqlite$version \ + -pragmas {disable-dist} }} # @@ -69,7 +70,6 @@ proc teaish-options {} { # work needed for this extension. # proc teaish-configure {} { - teaish-enable-dist 0 use teaish/feature-tests set srcdir [get-define TEAISH_DIR] diff --git a/autoconf/tea/teaish.tester.tcl.in b/autoconf/tea/teaish.tester.tcl.in index 315d82350..ea4d2a066 100644 --- a/autoconf/tea/teaish.tester.tcl.in +++ b/autoconf/tea/teaish.tester.tcl.in @@ -5,10 +5,8 @@ # probably not edit it. # # This is the wrapper script invoked by teaish's "make test" recipe. -@if TEAISH_VSATISFIES_TCL -if {![package vsatisfies [package provide Tcl] @TEAISH_VSATISFIES_TCL@]} { - error "Package @TEAISH_PKGNAME@ @TEAISH_VERSION@ requires Tcl @TEAISH_VSATISFIES_TCL@" -} +@if TEAISH_VSATISFIES_CODE +@TEAISH_VSATISFIES_CODE@ @endif load [lindex $::argv 0] [lindex $::argv 1]; source [lindex $::argv 2]; # teaish/tester.tcl diff --git a/autosetup/proj.tcl b/autosetup/proj.tcl index 2e272a3b5..4c4d876f8 100644 --- a/autosetup/proj.tcl +++ b/autosetup/proj.tcl @@ -139,7 +139,7 @@ proc proj-assert {script {msg ""}} { if {"" eq $msg} { set msg $script } - proj-fatal "Assertion failed: $msg" + proj-fatal "Assertion failed in \[[proj-current-scope 1]\]: $msg" } } @@ -297,7 +297,7 @@ proc proj-search-for-header-dir {header args} { -dirs { set args [lassign $args - dirs] } -subdirs { set args [lassign $args - subdirs] } default { - proj-fatal "Unhandled argument: $args" + proj-error "Unhandled argument: $args" } } } @@ -2064,7 +2064,7 @@ proc proj-coalesce {args} { # -flag defaultValue {script} # # -flag => defaultValue -# -----^--^ (wiith spaces there!) +# -----^--^ (with spaces there!) # # Repeated for each flag. # @@ -2096,8 +2096,8 @@ proc proj-coalesce {args} { # This function assumes that each flag is unique, and using a flag # more than once behaves in a last-one-wins fashion. # -# Any $argv entries not described in $prototype are not treated -# as flags. +# Any argvName entries not described in $prototype are not treated as +# flags. # # Returns the number of flags it processed in $argvName. # @@ -2113,6 +2113,10 @@ proc proj-coalesce {args} { # After that $flags would contain {-foo 1 -bar {blah} -no-baz 2} # and $args would be {8 9 10}. # +# Potential TODOs: consider using lappend instead of set so that any +# given flag can be used more than once. Or add a syntax to indicate +# that. +# proc proj-parse-simple-flags {argvName tgtArrayName prototype} { upvar $argvName argv upvar $tgtArrayName tgt @@ -2121,26 +2125,28 @@ proc proj-parse-simple-flags {argvName tgtArrayName prototype} { array set consuming {} set n [llength $prototype] # Figure out what our flags are... - for {set i 0} {$i < $n} {} { + for {set i 0} {$i < $n} {incr i} { set k [lindex $prototype $i] #puts "**** #$i of $n k=$k" proj-assert {[string match -* $k]} \ - "Invalid flag value for [proj-current-scope]: $k" + "Invalid flag value: $k" set v "" set s "" - if {"=>" eq [lindex $prototype [expr {$i + 1}]]} { - incr i 2 - if {$i >= $n} { - proj-fatal "Missing argument for $k => flag" + switch -exact -- [lindex $prototype [expr {$i + 1}]] { + => { + incr i 2 + if {$i >= $n} { + proj-error "Missing argument for $k => flag" + } + set consuming($k) 1 + set v [lindex $prototype $i] + } + default { + set v [lindex $prototype [incr i]] + set s [lindex $prototype [incr i]] + set scripts($k) $s } - set consuming($k) 1 - set v [lindex $prototype $i] - } else { - set v [lindex $prototype [incr i]] - set s [lindex $prototype [incr i]] - set scripts($k) $s } - incr i #puts "**** #$i of $n k=$k v=$v s=$s" set dflt($k) $v } @@ -2160,7 +2166,7 @@ proc proj-parse-simple-flags {argvName tgtArrayName prototype} { } elseif {[info exists tgt($arg)]} { if {[info exists consuming($arg)]} { if {$i + 1 >= $n} { - proj-fatal "Missing argument for $arg flag" + proj-assert 0 {Cannot happen - bounds already checked} } set tgt($arg) [lindex $argv [incr i]] } elseif {"" eq $scripts($arg)} { @@ -1,5 +1,5 @@ -C Remove\san\sextra\sconditional\sthat\swas\sinserted\searlier\stoday\sand\swhich\nis\sunreachable. -D 2025-04-21T23:44:55.916 +C Generic\scleanups\sand\sfixes\sin\sthe\steaish\sbuild. +D 2025-04-22T01:01:19.374 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 41159d167c3b1a9bab7253f268d1ad1dc71ab8a9a6ccc9744a313aba40249a6a +F autoconf/tea/Makefile.in 88fc65f68618f7ab7d78bded67105d0787e5d71ab183f51d80a9bc5dce2478ab 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 dea4684df6c5765a8fa866b4a6d79c73ba413ad37bb7c70e1be3631cd9eb2831 +F autoconf/tea/autosetup/core.tcl 9b8415824dff052ce25ce9beed895357d6b7cd8ed1422c76ba9744c3d2f9e7c4 F autoconf/tea/autosetup/feature-tests.tcl 307cac35806817fc87bd0d92004364ee682c0e99f2ab505291500493ab6c7a5f -F autoconf/tea/autosetup/tester.tcl a201ef9e91dde182e73015d09f94a3c40dd534ce38642167ebfd5884801d1e5a +F autoconf/tea/autosetup/tester.tcl 236598490975a3c071ee753900f3775192b116cf0531c6c754d17e028ea3f880 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 a41b98633e184703136914e588638423047eae71244a30061ccd8edf92498436 -F autoconf/tea/teaish.tcl 2bc7ca287baa076daca513ff9342c00f499b1cceb8302a93d4a6231b00b52504 +F autoconf/tea/pkgIndex.tcl.in 14e8265862e8901a613ef50101f4f813a56f837a63f54e2431b9df0e9bc663a0 +F autoconf/tea/teaish.tcl c8e63cfb1b5cc5f688a90fea16c9bf8b0d6444dce62bd03f4abf7e8cdabf84ce F autoconf/tea/teaish.test.tcl cfe94e1fb79dd078f650295be59843d470125e0cc3a17a1414c1fb8d77f4aea6 -F autoconf/tea/teaish.tester.tcl.in 63059e35289ac663c7d0052e6c0089a309fee75225e86e4ec5b3d9f2c1d9290a +F autoconf/tea/teaish.tester.tcl.in 9251c1beb38c24f708a35d74f75a0a1686cc8761034f99d8092282ac10040976 F autosetup/LICENSE 41a26aebdd2cd185d1e2b210f71b7ce234496979f6b35aef2cbf6b80cbed4ce4 F autosetup/README.autosetup a78ff8c4a3d2636a4268736672a74bf14a82f42687fcf0631a70c516075c031e F autosetup/README.md f324bb9f9bf1cc787122034df53fbfdfed28ee2657e6652b763d992ab0d04829 @@ -51,7 +51,7 @@ F autosetup/cc.tcl c0fcc50ca91deff8741e449ddad05bcd08268bc31177e613a6343bbd1fd3e F autosetup/find_tclconfig.tcl e64886ffe3b982d4df42cd28ed91fe0b5940c2c5785e126c1821baf61bc86a7e F autosetup/jimsh0.c a57c16e65dcffc9c76e496757cb3f7fb47e01ecbd1631a0a5e01751fc856f049 F autosetup/pkg-config.tcl 4e635bf39022ff65e0d5434339dd41503ea48fc53822c9c5bde88b02d3d952ba -F autosetup/proj.tcl 11e46ff237ca96d07fd14fe96132f8e77fee6442d8baa2e808bbe95016583c56 +F autosetup/proj.tcl 3eb8e6c74002fc89a1543406039bc36a9347e6deda90fadd00a7436820d38014 F autosetup/sqlite-config.tcl bde169c42d5d5331485ae7785f5dd19ca1aa01315787e8306441c472ad4e4201 F autosetup/system.tcl 51d4be76cd9a9074704b584e5c9cbba616202c8468cf9ba8a4f8294a7ab1dba9 F configure 9a00b21dfd13757bbfb8d89b30660a89ec1f8f3a79402b8f9f9b6fc475c3303a x @@ -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 6538813cb89f6109727481e29633e2e98f98e0257c58695e3b53e8ce237d9195 -R f846b0d70084164be308ce186bb3a97a -U drh -Z 29505047856922d4c8d25e24a8f84ffb +P 5ea56af2d27611c5a8ea275316d21a02e70032f93243549ae776e9a89edc6229 +R d6b619df788366d9b93ebd1a1771f590 +U stephan +Z ae25c7334f797c5472e3ad844051b2c6 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index f8c99133e..dd72c4a44 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -5ea56af2d27611c5a8ea275316d21a02e70032f93243549ae776e9a89edc6229 +734823a5a8e073b511ebc3f37df3542c1bb734b9b1e1bd50ca3e9df12c4bb89e |