From: stephan Date: Tue, 15 Apr 2025 02:02:36 +0000 (+0000) Subject: Further cleanups and code consolidation between teaish.tcl and sqlite-config.tcl... X-Git-Tag: major-release~91 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=56da8772bdd414e68cdb6b79ca6a761418e09e06;p=thirdparty%2Fsqlite.git Further cleanups and code consolidation between teaish.tcl and sqlite-config.tcl parts. FossilOrigin-Name: 07e9ceee51380ee25e580178fa82030be5d2b65d4f4b4dc86c94b21f7f04f291 --- diff --git a/autoconf/tea/autosetup/core.tcl b/autoconf/tea/autosetup/core.tcl index a4e74d8420..ad7e942e54 100644 --- a/autoconf/tea/autosetup/core.tcl +++ b/autoconf/tea/autosetup/core.tcl @@ -45,12 +45,6 @@ array set teaish__Config [proj-strip-hash-comments { # 0x10 = teaish-pragma was called: use their pkgIndex.tcl # pkgindex-policy 0 - - # - # A list of lists of Autosetup [options]-format --flags definitions. - # Append to this using [teaish-add-options]. - # - extra-options {} }] # @@ -110,7 +104,7 @@ proc teaish-configure-core {} { # # Set up the --flags... # - set opts [proj-strip-hash-comments { + proj-options-add [proj-strip-hash-comments { with-tcl:DIR => {Directory containing tclConfig.sh or a directory one level up from that, from which we can derive a directory containing tclConfig.sh.} @@ -154,23 +148,14 @@ proc teaish-configure-core {} { t-d teaish-debug => {Enable teaish-specific debug output} - }]; # $opts + }]; # main options. - # - # Create the full options list from: - # 1) $opts - # 2) [teaish-options], if defined - # 3) $::teaish__Config(exta-options) - # - set optLists [list $opts] if {[llength [info proc teaish-options]] > 0} { - # teaish-options is assumed to be imported via TEAISH_TCL. - lappend optLists [teaish-options] + # Add options defined by teaish-options, which is assumed to be + # imported via TEAISH_TCL. + proj-options-add [teaish-options] } - lappend optLists {*}$::teaish__Config(extra-options) - set opts [teaish-combine-option-lists {*}$optLists] - unset optLists - + set opts [proj-options-combine] #lappend opts teaish-debug => {x}; #testing dupe entry handling if {[catch {options $opts} msg xopts]} { # Workaround for @@ -992,40 +977,6 @@ proc teaish-feature-cache-check {{depth 0} tgtVar} { return 0 } -# @teach-add-options list -# -# Adds a list of options to the pending --flag processing. It must be -# in the format used by Autosetup's [options] function. -# -# This will have no effect if called from [teaish-configure], -# as the flags processing is done by the time that is called. -# -# This may be used from the top scope of teaish.tcl or from -# [teaish-options]. When used in conjunction with [teaish-options], -# [teaish-options] will appear first in the --help list. -# -proc teaish-add-options {list} { - lappend ::teaish__Config(extra-options) $list -} - -# @teash-combine-option-lists list1 ?...listN? -# -# Expects each argument to be a list of options compatible with -# autosetup's [options] function. This function concatenates the -# contents of each list into a new top-level list, stripping the outer -# list part of each argument. The intent is that teaish-options -# implementations can use this to combine multiple lists, e.g. from -# functions teaish-check-openssl-options. -proc teaish-combine-option-lists {args} { - set rv [list] - foreach e $args { - foreach x $e { - lappend rv $x - } - } - return $rv -} - ######################################################################## # Internal helper for teaish__defs-format_: returns a JSON-ish quoted # form of the given string-type values. It only performs the most diff --git a/autoconf/tea/autosetup/feature-tests.tcl b/autoconf/tea/autosetup/feature-tests.tcl index 5f045eae09..b2f9d84660 100644 --- a/autoconf/tea/autosetup/feature-tests.tcl +++ b/autoconf/tea/autosetup/feature-tests.tcl @@ -235,7 +235,7 @@ proc teaish-import-features {args} { if {$doOpt} { set n "teaish-check-${arg}-options" if {[llength [info proc $n]] > 0} { - teaish-add-options [$n] + proj-options-add [$n] } } } diff --git a/autoconf/tea/teaish.tcl b/autoconf/tea/teaish.tcl index ae4f6c7b7c..049f500020 100644 --- a/autoconf/tea/teaish.tcl +++ b/autoconf/tea/teaish.tcl @@ -103,7 +103,8 @@ proc teaish-configure {} { teaish-add-ldflags -lsqlite3 } - sqlite-check-common-system-deps + teaish-check-librt + teaish-check-libz sqlite-handle-threadsafe sqlite-handle-tempstore sqlite-handle-load-extension @@ -111,7 +112,6 @@ proc teaish-configure {} { sqlite-handle-icu sqlite-handle-common-feature-flags; # must be late in the process - teaish-add-cflags -define OPT_FEATURE_FLAGS }; # teaish-configure @@ -136,8 +136,13 @@ proc sqlite-affirm-have-math {featureName} { if {![msg-quiet proj-check-function-in-lib log m]} { user-error "Missing math APIs for $featureName" } - define LDFLAGS_MATH [get-define lib_log ""] + set lfl [get-define lib_log ""] undefine lib_log + if {"" ne $lfl} { + user-notice "Forcing requirement of $lfl for $featureName" + } + define LDFLAGS_MATH $lfl + teaish-prepend-ldflags $lfl } } @@ -215,13 +220,9 @@ proc sqlite-handle-common-feature-flags {} { } } - sqlite-finalize-feature-flags -} - -######################################################################### -# Remove duplicates from the final feature flag sets and show them to -# the user. -proc sqlite-finalize-feature-flags {} { + ######################################################################### + # Remove duplicates from the final feature flag sets and show them + # to the user. set oFF [get-define OPT_FEATURE_FLAGS] if {"" ne $oFF} { define OPT_FEATURE_FLAGS [lsort -unique $oFF] @@ -230,16 +231,8 @@ proc sqlite-finalize-feature-flags {} { if {[lsearch [get-define TARGET_DEBUG ""] -DSQLITE_DEBUG=1] > -1} { msg-result "Note: this is a debug build, so performance will suffer." } -} - -######################################################################## -# Run checks for system-level includes and libs which are common to -# both the canonical build and the "autoconf" bundle. -# -proc sqlite-check-common-system-deps {} { - teaish-check-librt - teaish-check-libz -} + teaish-add-cflags -define OPT_FEATURE_FLAGS +}; # sqlite-handle-common-feature-flags ######################################################################## # If --enable-threadsafe is set, this adds -DSQLITE_THREADSAFE=1 to diff --git a/autosetup/proj.tcl b/autosetup/proj.tcl index 296652279f..d64cc62186 100644 --- a/autosetup/proj.tcl +++ b/autosetup/proj.tcl @@ -55,9 +55,10 @@ # @section Project Helper APIs ######################################################################## -# $proj_ is an internal-use-only array for storing whatever generic +# $proj__Config is an internal-use-only array for storing whatever generic # internal stuff we need stored. -array set proj_ {} +array set proj__Config { +} # # List of dot-in files to filter in the final stages of # configuration. Some configuration steps may append to this. Each @@ -67,8 +68,15 @@ array set proj_ {} # # See: proj-dot-ins-append and proj-dot-ins-process # -set proj_(dot-in-files) [list] -set proj_(isatty) [isatty? stdout] +set proj__Config(dot-in-files) [list] +set proj__Config(isatty) [isatty? stdout] +# +# A list of lists of Autosetup [options]-format --flags definitions. +# Append to this using [proj-options-add] and use +# [proj-options-combine] to merge them into a single list for passing +# to [options]. +# +set proj__Config(extra-options} {} ######################################################################## # @proj-warn msg @@ -118,7 +126,7 @@ proc proj-assert {script {msg ""}} { # ANSI escape sequences then this returns $str wrapped in a sequence # to bold that text, else it returns $str as-is. proc proj-bold {args} { - if {$::autosetup(iswin) || !$::proj_(isatty)} { + if {$::autosetup(iswin) || !$::proj__Config(isatty)} { return $str } return "\033\[1m${args}\033\[0m" @@ -1147,16 +1155,16 @@ proc proj-quote-str_ {value} { ######################################################################## # An internal impl detail of proj-dump-defs-json. Requires a data # type specifier, as used by make-config-header, and a value. Returns -# the formatted value or the value $::proj_(defs-skip) if the caller +# the formatted value or the value $::proj__Config(defs-skip) if the caller # should skip emitting that value. -set proj_(defs-skip) "-proj-defs-format_ sentinel" +set proj__Config(defs-skip) "-proj-defs-format_ sentinel" proc proj-defs-format_ {type value} { switch -exact -- $type { -bare { # Just output the value unchanged } -none { - set value $::proj_(defs-skip) + set value $::proj__Config(defs-skip) } -str { set value [proj-quote-str_ $value] @@ -1171,14 +1179,14 @@ proc proj-defs-format_ {type value} { set ar {} foreach v $value { set v [proj-defs-format_ -auto $v] - if {$::proj_(defs-skip) ne $v} { + if {$::proj__Config(defs-skip) ne $v} { lappend ar $v } } set value "\[ [join $ar {, }] \]" } "" { - set value $::proj_(defs-skip) + set value $::proj__Config(defs-skip) } default { proj-fatal "Unknown type in proj-dump-defs-json: $type" @@ -1224,7 +1232,7 @@ proc proj-dump-defs-json {file args} { foreach n [lsort [dict keys [all-defines]]] { set type [proj-defs-type_ $n $args] set value [proj-defs-format_ $type [get-define $n]] - if {$::proj_(defs-skip) ne $value} { + if {$::proj__Config(defs-skip) ne $value} { lappend lines "\"$n\": ${value}" } } @@ -1564,7 +1572,7 @@ proc proj-dot-ins-append {fileIn args} { } } #puts "******* [proj-current-scope]: adding $fileIn" - lappend ::proj_(dot-in-files) $fileIn + lappend ::proj__Config(dot-in-files) $fileIn } ######################################################################## @@ -1574,7 +1582,7 @@ proc proj-dot-ins-append {fileIn args} { # that each entry is a 3-element list of (inputFileName, # outputFileName, postProcessScript). proc proj-dot-ins-list {} { - return $::proj_(dot-in-files) + return $::proj__Config(dot-in-files) } ######################################################################## @@ -1610,7 +1618,7 @@ proc proj-dot-ins-process {args} { default break } } - foreach f $::proj_(dot-in-files) { + foreach f $::proj__Config(dot-in-files) { proj-assert {3==[llength $f]} \ "Expecting proj-dot-ins-list to be stored in 3-entry lists" lassign $f fIn fOut fScript @@ -1624,7 +1632,7 @@ proc proj-dot-ins-process {args} { } } if {$clear} { - set ::proj_(dot-in-files) [list] + set ::proj__Config(dot-in-files) [list] } } @@ -1747,6 +1755,7 @@ proc proj-define-amend {defName args} { lappend xargs [get-define $arg ""] } } + set args $xargs if {$prepend} { lappend args {*}[get-define $defName ""] @@ -1755,3 +1764,34 @@ proc proj-define-amend {defName args} { proj-define-append $defName {*}$args } } + +# @proj-options-add list +# +# Adds a list of options to the pending --flag processing. It must be +# in the format used by Autosetup's [options] function. +# +# This will have no useful effect if called from after [options] +# is called. +proc proj-options-add {list} { + lappend ::proj__Config(extra-options) $list +} + +# @proj-options-combine list1 ?...listN? +# +# Expects each argument to be a list of options compatible with +# autosetup's [options] function. This function concatenates the +# contents of each list into a new top-level list, stripping the outer +# list part of each argument, and returning that list +# +# If passed no arguments, it uses the list generated by calls to +# [proj-options-add]. +proc proj-options-combine {args} { + set rv [list] + if {0 == [llength $args]} { + set args $::proj__Config(extra-options) + } + foreach e $args { + lappend rv {*}$e + } + return $rv +} diff --git a/autosetup/sqlite-config.tcl b/autosetup/sqlite-config.tcl index 3042b7bedb..1bd5a184ee 100644 --- a/autosetup/sqlite-config.tcl +++ b/autosetup/sqlite-config.tcl @@ -425,17 +425,14 @@ proc sqlite-configure {buildMode configScript} { } # Filter allFlags to create the set of [options] legal for this build - set opts {} - foreach {group XY} [subst -nobackslashes -nocommands \ - [proj-strip-hash-comments $allFlags]] { + foreach {group XY} [subst -nobackslashes -nocommands $allFlags] { foreach {X Y} $XY { if { $buildMode in $X || "*" in $X } { - foreach y $Y { - lappend opts $y - } + proj-options-add $Y } } } + set opts [proj-options-combine] #lappend opts "soname:=duplicateEntry => {x}"; #just testing if {[catch {options $opts} msg xopts]} { # Workaround for @@ -585,8 +582,12 @@ proc sqlite-affirm-have-math {featureName} { if {![msg-quiet proj-check-function-in-lib log m]} { user-error "Missing math APIs for $featureName" } - define LDFLAGS_MATH [get-define lib_log ""] + set lfl [get-define lib_log ""] undefine lib_log + if {"" ne $lfl} { + user-notice "Forcing requirement of $lfl for $featureName" + } + define LDFLAGS_MATH $lfl } } diff --git a/manifest b/manifest index 3f476d195e..7e007c9d1a 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Slight\ssimplifications\sin\sthe\steaish\sbuild. -D 2025-04-15T00:47:31.233 +C Further\scleanups\sand\scode\sconsolidation\sbetween\steaish.tcl\sand\ssqlite-config.tcl\sparts. +D 2025-04-15T02:02:36.015 F .fossil-settings/binary-glob 61195414528fb3ea9693577e1980230d78a1f8b0a54c78cf1b9b24d0a409ed6a x F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea @@ -26,14 +26,14 @@ F autoconf/tea/Makefile.in 2a90dfab1e95cb3ec610429c78d88d4a7d26beb080ad45ff6a059 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 3c012cc4b956c9aa867cedc6b9903c095c536de4a48d2acc43933ee3727446a2 -F autoconf/tea/autosetup/feature-tests.tcl 33202bd04d73f706fb7c7efad6866f45a9db0521748f7986506227a2fc48cd22 +F autoconf/tea/autosetup/core.tcl 87051761ee1bb11df381751e656f3d86feac3f281e539ec4442ffc4c2758f2f8 +F autoconf/tea/autosetup/feature-tests.tcl f594efeb43fe1d83599367ac388082a1d47be28322591a1d9d29214039df2094 F autoconf/tea/autosetup/tester.tcl d94aa9d51d2a22062e61db97310c2502ca0df50ca87108482c3bccf8f41db127 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 be716d0d4ecf71672c1977b6c62bd473d09033c6d6a9f3171c36838644d4f81d +F autoconf/tea/teaish.tcl 2661246d497e263ed05f436421758c5035ad1fc3a1c7484f6484844b61281913 F autoconf/tea/teaish.test.tcl cfe94e1fb79dd078f650295be59843d470125e0cc3a17a1414c1fb8d77f4aea6 F autoconf/tea/teaish.tester.tcl.in 743fd0fe1e667f82fd8fc3ebe0a5c77763e4dbed7bbc8605a9d4b1d0663dac78 F autosetup/LICENSE 41a26aebdd2cd185d1e2b210f71b7ce234496979f6b35aef2cbf6b80cbed4ce4 @@ -51,8 +51,8 @@ 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 9de1b0fbc76dd22d447cd10c7a5f07c8aafef258a87c52c67687fb1e91fc3d58 -F autosetup/sqlite-config.tcl 3f771754b89ae10379bb5d9d48d80921568345618f8f37d4a62a8e1fd9cd916c +F autosetup/proj.tcl 4902c308f0b8fe8d734247f38253aa0cf46fee63834074b2b0ff90d092b4add0 +F autosetup/sqlite-config.tcl d4e888fc94e677e3820fea998747c94b8dcc4ff346a14253bf7f5344f526ceef 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 921c5ea76925be911222ac5f2887b8a967ff47b1aa43e196231e6168a3f9cb88 -R ad57ad0cbc680b95f0767a618309fa99 +P 6b2d0e09e4806b5731764192782ec7e1ad595c529202a684d23bcfe2fae559d7 +R 459786ce4af7bd9d29b2d98508f1ac93 U stephan -Z 7b2b40b6cb214032eb81bf29106563a7 +Z 6395a8a08ae56770c6a7b258189df8f5 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 577271d26e..d7ed4d8e80 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -6b2d0e09e4806b5731764192782ec7e1ad595c529202a684d23bcfe2fae559d7 +07e9ceee51380ee25e580178fa82030be5d2b65d4f4b4dc86c94b21f7f04f291