From: stephan Date: Sat, 5 Apr 2025 09:17:13 +0000 (+0000) Subject: Extend proj-dot-ins-append to provide a way to use it for the special-case emcc.sh... X-Git-Tag: major-release~119 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=8aaf23a15e49deb02c056ccfc13fc8ab32a2c59b;p=thirdparty%2Fsqlite.git Extend proj-dot-ins-append to provide a way to use it for the special-case emcc.sh.in handling. FossilOrigin-Name: 0e98bbddc7b5e39310a8bf345521d05fdbcc906e279c23aa24cf30489ceeeff8 --- diff --git a/autosetup/proj.tcl b/autosetup/proj.tcl index b77bfd13ed..bfbf4716a8 100644 --- a/autosetup/proj.tcl +++ b/autosetup/proj.tcl @@ -715,7 +715,7 @@ proc proj-make-from-dot-in {args} { lassign $args fIn fOut } if {"" eq $fOut} { - if {2==[llength $fIn]} { + if {[llength $fIn]>1} { lassign $fIn fIn fOut } else { set fOut [file rootname $fIn] @@ -1508,22 +1508,39 @@ proc proj-tweak-default-env-dirs {} { } ######################################################################## -# @proj-dot-ins-append file ?fileOut? +# @proj-dot-ins-append file ?fileOut ?postProcessScript?? # # Queues up an autosetup [make-template]-style file to be processed # at a later time using [proj-dot-ins-process]. # # $file is the input file. If $fileOut is empty then this function # derives $fileOut from $file, stripping both its directory and -# extension parts. -# -# See [proj-dot-ins-process] -proc proj-dot-ins-append {fileIn {fileOut ""}} { +# extension parts. i.e. it defaults to writing the output to the +# current directory (typically $::autosetup(builddir)). +# +# 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 +# names. This can be used, for example, to make the output file +# executable or perform validation on its. +# +# See [proj-dot-ins-process], [proj-dot-ins-list] +proc proj-dot-ins-append {fileIn args} { set srcdir $::autosetup(srcdir) - if {"" eq $fileOut} { - lappend fileIn [file rootname [file tail $fileIn]] - } else { - lappend fileIn $fileOut + switch -exact -- [llength $args] { + 0 { + lappend fileIn [file rootname [file tail $fileIn]] "" + } + 1 { + lappend fileIn [join $args] "" + } + 2 { + lappend fileIn {*}$args + } + default { + proj-fatal "Too many arguments: $fileIn $args" + } } #puts "******* [proj-current-proc-name]: adding $fileIn" lappend ::proj_(dot-in-files) $fileIn @@ -1533,7 +1550,8 @@ proc proj-dot-ins-append {fileIn {fileOut ""}} { # @proj-dot-ins-list # # Returns the current list of [proj-dot-ins-append]'d files, noting -# that each entry is a 2-element list of (input, output) file names. +# that each entry is a 3-element list of (inputFileName, +# outputFileName, postProcessScript). proc proj-dot-ins-list {} { return $::proj_(dot-in-files) } @@ -1557,10 +1575,13 @@ proc proj-dot-ins-process {args} { set flags "-touch" } foreach f $::proj_(dot-in-files) { - proj-assert {2==[llength $f]} - lassign $f fIn fOut + proj-assert {3==[llength $f]} + lassign $f fIn fOut fScript #puts "DOING $fIn ==> $fOut" proj-make-from-dot-in {*}$flags $fIn $fOut + if {"" ne $fScript} { + uplevel 1 "set fileIn $fIn; set fileOut $fOut; eval {$fScript}" + } } } diff --git a/autosetup/sqlite-config.tcl b/autosetup/sqlite-config.tcl index 0f8b670807..442039a780 100644 --- a/autosetup/sqlite-config.tcl +++ b/autosetup/sqlite-config.tcl @@ -490,7 +490,6 @@ proc sqlite-configure-phase1 {buildMode} { # may not) define HAVE_LFS. cc-check-lfs } - set srcdir $::autosetup(srcdir) proj-dot-ins-append $srcdir/Makefile.in if {[file exists $srcdir/sqlite3.pc.in]} { @@ -990,17 +989,10 @@ proc sqlite-handle-emsdk {} { # Maybe there's a copy in the path? proj-bin-define wasm-opt BIN_WASM_OPT } - # - # We would prefer to pass these to proj-dot-ins-append but that - # family of APIs cannot handle the output being in a dir other - # than the current one. Also, we need to chmod +x $emccSh, and we - # don't have a hook to do that with if we defer dot-in-processing - # it. - # - proj-make-from-dot-in $emccSh.in - proj-make-from-dot-in $extWasmConfig.in - catch {exec chmod u+x $emccSh} - proj-validate-no-unresolved-ats $emccSh $extWasmConfig + proj-dot-ins-append $emccSh.in $emccSh { + catch {exec chmod u+x $fileOut} + } + proj-dot-ins-append $extWasmConfig.in $extWasmConfig } else { define EMCC_WRAPPER "" file delete -force -- $emccSh $extWasmConfig @@ -1742,7 +1734,8 @@ proc sqlite-post-config-validation {} { # unexported/unused var or a typo. set srcdir $::autosetup(srcdir) foreach f [proj-dot-ins-list] { - proj-assert {2==[llength $f]} + proj-assert {3==[llength $f]} \ + "Expecting proj-dot-ins-list to be stored in 3-entry lists" proj-validate-no-unresolved-ats [lindex $f 1] } } diff --git a/manifest b/manifest index a39f7c24ec..1e1680a27b 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Add\sa\snote\sthat\sSQLite's\scopy\sof\sproj.tcl\scan\sbe\sconsidered\sthe\s"canonical\scopy"\sfor\spractical\spurposes.\sWe\snow\shave\sat\sleast\s3\scopies\sof\sit\sfloating\saround\sin\sother\strees. -D 2025-04-05T08:48:19.760 +C Extend\sproj-dot-ins-append\sto\sprovide\sa\sway\sto\suse\sit\sfor\sthe\sspecial-case\semcc.sh.in\shandling. +D 2025-04-05T09:17:13.814 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 620f7c4ea9517b20f2477c1357de1d685a3bac27d7762e800f3586ed18fa91d9 -F autosetup/sqlite-config.tcl c501e9ace3f7936a40a5b92e3f93dd616f5d30e555363dfe2ac4318bfccf7da5 +F autosetup/proj.tcl 06ba9f7841e848cdebef11fe61e6e959e3e379b974edadc5eac8a76fd6885bb5 +F autosetup/sqlite-config.tcl 26fd6bca350a88a92253afdf02ddea0fa1f304ff18325a41f30478f7c0f10175 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 52839db2fcdf37631d13c05165ecb551a89c05bd6836f62d62f8f0b7bbe6c6cd -R 31fcd20994c96960ddf59961361b0dbc +P 77d2c8e9ef9627c87c05beaf5615958628bd47c393c030ff6fcca607ba43e71f +R d9334314847b8a0fe15ac5b6a1be0397 U stephan -Z fc2ea1a5f7471ead1bcccb57866abdd9 +Z bdc59ba3033c2d6bc844a137c31a6274 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index c8fc46a856..46c931f0ce 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -77d2c8e9ef9627c87c05beaf5615958628bd47c393c030ff6fcca607ba43e71f +0e98bbddc7b5e39310a8bf345521d05fdbcc906e279c23aa24cf30489ceeeff8