From: stephan Date: Sat, 5 Apr 2025 07:12:41 +0000 (+0000) Subject: Move the automatic reconfigure tcl code from sqlite-config.tcl to proj.tcl so that... X-Git-Tag: major-release~121 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=4d411659c4e9f9bc5230b48005132eabb718e7d2;p=thirdparty%2Fsqlite.git Move the automatic reconfigure tcl code from sqlite-config.tcl to proj.tcl so that the TEA bits can reuse it. FossilOrigin-Name: 52839db2fcdf37631d13c05165ecb551a89c05bd6836f62d62f8f0b7bbe6c6cd --- diff --git a/autosetup/proj.tcl b/autosetup/proj.tcl index 55ea3c4373..b582a1a59a 100644 --- a/autosetup/proj.tcl +++ b/autosetup/proj.tcl @@ -1504,7 +1504,7 @@ proc proj-tweak-default-env-dirs {} { } ######################################################################## -# @proj-dot-ins-append {file ?fileOut?}... +# @proj-dot-ins-append file ?fileOut? # # Queues up an autosetup [make-template]-style file to be processed # at a later time using [proj-dot-ins-process]. @@ -1514,22 +1514,22 @@ proc proj-tweak-default-env-dirs {} { # extension parts. # # See [proj-dot-ins-process] -proc proj-dot-ins-append {args} { +proc proj-dot-ins-append {fileIn {fileOut ""}} { set srcdir $::autosetup(srcdir) - foreach f ${args} { - if {1==[llength $f]} { - lappend f [file rootname [file tail $f]] - } - #puts "******* [proj-current-proc-name]: adding $f" - lappend ::proj_(dot-in-files) $f + if {"" eq $fileOut} { + lappend fileIn [file rootname [file tail $fileIn]] + } else { + lappend fileIn $fileOut } + #puts "******* [proj-current-proc-name]: adding $fileIn" + lappend ::proj_(dot-in-files) $fileIn } ######################################################################## # @proj-dot-ins-list # # Returns the current list of [proj-dot-ins-append]'d files, noting -# that each entry is a 2-element list. +# that each entry is a 2-element list of (input, output) file names. proc proj-dot-ins-list {} { return $::proj_(dot-in-files) } @@ -1577,3 +1577,40 @@ proc proj-validate-no-unresolved-ats {args} { } } } + +######################################################################## +# @proj-first-found fileList tgtVar +# +# Searches $fileList for an existing file. If one is found, its name is +# assigned to tgtVar and 1 is returned, else tgtVar is not modified +# and 0 is returned. +proc proj-first-file-found {fileList tgtVar} { + upvar $tgtVar tgt + foreach f $fileList { + if {[file exists $f]} { + set tgt $f + return 1 + } + } + return 0 +} + +######################################################################## +# Defines $defName to contain makefile recipe commands for re-running +# the configure script with its current set of $::argv flags. This +# can be used to automatically reconfigure. +proc proj-setup-autoreconfig {defName} { + set squote {{arg} { + # Wrap $arg in single-quotes if it looks like it might need that + # to avoid mis-handling as a shell argument. We assume that $arg + # will never contain any single-quote characters. + if {[string match {*[ &;$*"]*} $arg]} { return '$arg' } + return $arg + }} + define-append $defName cd [apply $squote $::autosetup(builddir)] \ + && [apply $squote $::autosetup(srcdir)/configure] + #{*}$::autosetup(argv) breaks with --flag='val with spaces', so... + foreach arg $::autosetup(argv) { + define-append $defName [apply $squote $arg] + } +} diff --git a/autosetup/sqlite-config.tcl b/autosetup/sqlite-config.tcl index b723a53c6d..0f8b670807 100644 --- a/autosetup/sqlite-config.tcl +++ b/autosetup/sqlite-config.tcl @@ -469,7 +469,7 @@ proc sqlite-configure-phase1 {buildMode} { } set ::sqliteConfig(msg-debug-enabled) [proj-val-truthy [get-env msg-debug 0]] proc-debug "msg-debug is enabled" - sqlite-autoreconfig + proj-setup-autoreconfig SQLITE_AUTORECONFIG proj-file-extensions if {".exe" eq [get-define TARGET_EXEEXT]} { define SQLITE_OS_UNIX 0 @@ -548,27 +548,6 @@ proc proc-debug {msg} { msg-debug "\[[proj-current-proc-name 1]\]: $msg" } -######################################################################## -# Sets up the SQLITE_AUTORECONFIG define. -proc sqlite-autoreconfig {} { - # SQLITE_AUTORECONFIG contains make target rules for re-running the - # configure script with the same arguments it was initially invoked - # with. This can be used to automatically reconfigure. - set squote {{arg} { - # Wrap $arg in single-quotes if it looks like it might need that - # to avoid mis-handling as a shell argument. We assume that $arg - # will never contain any single-quote characters. - if {[string match {*[ &;$*"]*} $arg]} { return '$arg' } - return $arg - }} - define-append SQLITE_AUTORECONFIG cd [apply $squote $::autosetup(builddir)] \ - && [apply $squote $::autosetup(srcdir)/configure] - #{*}$::autosetup(argv) breaks with --flag='val with spaces', so... - foreach arg $::autosetup(argv) { - define-append SQLITE_AUTORECONFIG [apply $squote $arg] - } -} - define OPT_FEATURE_FLAGS {} ; # -DSQLITE_OMIT/ENABLE flags. define OPT_SHELL {} ; # Feature-related CFLAGS for the sqlite3 CLI app ######################################################################## diff --git a/manifest b/manifest index e88ea04072..43d0de5fdf 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Refactor\sproj-make-from-dot-in\sand\sfriends\sto\sbe\smore\suseful\sand\sremove\ssome\sannoying\slimitations. -D 2025-04-05T02:59:37.477 +C Move\sthe\sautomatic\sreconfigure\stcl\scode\sfrom\ssqlite-config.tcl\sto\sproj.tcl\sso\sthat\sthe\sTEA\sbits\scan\sreuse\sit. +D 2025-04-05T07:12:41.735 F .fossil-settings/binary-glob 61195414528fb3ea9693577e1980230d78a1f8b0a54c78cf1b9b24d0a409ed6a x F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea @@ -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 b180256ed6ebf651c49afcbb9c53bd471865f86db68357c90e2fc5a62a6a318c -F autosetup/sqlite-config.tcl 397cc72249133f72b21337c0d51426ee1cbc4e48ab9b53aa1f0fca8870104d64 +F autosetup/proj.tcl 027847ee7b7bdd4733e303d5076a44034d76a65b468dcfafcba1b5fa7a8bb137 +F autosetup/sqlite-config.tcl c501e9ace3f7936a40a5b92e3f93dd616f5d30e555363dfe2ac4318bfccf7da5 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 6fb364c853be84c8d1f20497a2cae6e8f06a1d10ae364e3b011cadeaa3e0244b -R f77f5fd6c14452717ebb4784f39f44f1 +P 501ff84e1263e2b026b0ca5f043bcc912ea935229b625b113b7402955df20dd3 +R 6b214ec31a05839ac992b80f31178348 U stephan -Z e4146e4a510a3a048f586eec271c895c +Z d74082ee605e6d6207bfd34e76d865f3 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index d48122b9a7..faf9d776d1 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -501ff84e1263e2b026b0ca5f043bcc912ea935229b625b113b7402955df20dd3 +52839db2fcdf37631d13c05165ecb551a89c05bd6836f62d62f8f0b7bbe6c6cd