diff options
author | stephan <stephan@noemail.net> | 2025-04-27 06:01:26 +0000 |
---|---|---|
committer | stephan <stephan@noemail.net> | 2025-04-27 06:01:26 +0000 |
commit | c26cde3bfdfb7df5d8230d7426e8505f7edd166e (patch) | |
tree | 0825d88e1e946c38630f6849d8b08a3e6849e387 | |
parent | c49c7dad89ddbf39668abf4bf650ef434347346a (diff) | |
download | sqlite-c26cde3bfdfb7df5d8230d7426e8505f7edd166e.tar.gz sqlite-c26cde3bfdfb7df5d8230d7426e8505f7edd166e.zip |
proj.tcl: correct the auto-reconfigure rules to include any X=Y passed to configure. Improve handling of quoted CFLAGS.
FossilOrigin-Name: 7a2f4f319c90b768c6acc96671a3173c0ef0493180f3c4d5443f1ca03d92f6b4
-rw-r--r-- | autosetup/proj.tcl | 91 | ||||
-rw-r--r-- | manifest | 12 | ||||
-rw-r--r-- | manifest.uuid | 2 |
3 files changed, 52 insertions, 53 deletions
diff --git a/autosetup/proj.tcl b/autosetup/proj.tcl index 3ebb5f250..bdc593cd4 100644 --- a/autosetup/proj.tcl +++ b/autosetup/proj.tcl @@ -1760,7 +1760,7 @@ proc proj-validate-no-unresolved-ats {args} { } # -# @proj-first-found tgtVar fileList +# @proj-first-file-found tgtVar fileList # # 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 @@ -1783,19 +1783,10 @@ proc proj-first-file-found {tgtVar fileList} { # 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] - } + define $defName \ + [join [list \ + cd \"$::autosetup(builddir)\" \ + && [get-define AUTOREMAKE "error - missing @AUTOREMAKE@"]]] } # @@ -1813,21 +1804,22 @@ proc proj-define-append {defineName args} { } # -# @prod-define-amend ?-p|-prepend? ?-define? FLAG args... +# @prod-define-amend ?-p|-prepend? ?-d|-define? defineName args... # # A proxy for Autosetup's [define-append]. # -# Appends all non-empty $args to the define named by $FLAG unless. If +# Appends all non-empty $args to the define named by $defineName. If # one of (-p | -prepend) are used it instead prepends them, in their -# given order, to $FLAG. +# given order, to $defineName. # # If -define is used then each argument is assumed to be a [define]'d # flag and [get-define X ""] is used to fetch it. # -# Typically, -lXYZ flags need to be in "reverse" order, with each -lY -# resolving symbols for -lX's to its left. This order is largely -# historical, and not relevant on all environments, but it is -# technically correct and still relevant on some environments. +# Re. linker flags: typically, -lXYZ flags need to be in "reverse" +# order, with each -lY resolving symbols for -lX's to its left. This +# order is largely historical, and not relevant on all environments, +# but it is technically correct and still relevant on some +# environments. # # See: proj-append-to # @@ -1838,9 +1830,9 @@ proc proj-define-amend {args} { set xargs [list] foreach arg $args { switch -exact -- $arg { - -p - -prepend { set prepend 1 } - -d - -define { set isdefs 1 } "" {} + -p - -prepend { incr prepend } + -d - -define { incr isdefs } default { if {"" eq $defName} { set defName $arg @@ -1850,6 +1842,9 @@ proc proj-define-amend {args} { } } } + if {"" eq $defName} { + proj-error "Missing defineName argument in call from [proj-current-scope 1]" + } if {$isdefs} { set args $xargs set xargs [list] @@ -1871,47 +1866,51 @@ proc proj-define-amend {args} { } # -# @proj-define-to-cflag ?-list? defineName... +# @proj-define-to-cflag ?-list? ?-quote? ?-zero-undef? defineName... # -# Treat each argument as the name of a [define] -# and attempt to render it like a CFLAGS value: +# Treat each argument as the name of a [define] and renders it like a +# CFLAGS value in one of the following forms: # # -D$name -# -D$name=value +# -D$name=integer (strict integer matches only) +# '-D$name=value' (without -quote) +# '-D$name="value"' (with -quote) # -# If treats integers as numbers and everything else as a quoted +# It treats integers as numbers and everything else as a quoted # string, noting that it does not handle strings which themselves # contain quotes. # +# The -zero-undef flag causes no -D to be emitted for integer values +# of 0. +# # By default it returns the result as string of all -D... flags, # but if passed the -list flag it will return a list of the # individual CFLAGS. # proc proj-define-to-cflag {args} { set rv {} - set xargs {} - set returnList 0; - foreach arg $args { - switch -exact -- $arg { - -list {incr returnList} - default { - lappend xargs $arg - } - } + proj-parse-simple-flags args flags { + -list 0 {expr 1} + -quote 0 {expr 1} + -zero-undef 0 {expr 1} } - foreach d $xargs { + foreach d $args { set v [get-define $d ""] - set li [list -D${d}] - if {[string is integer -strict $v]} { - lappend li = $v - } elseif {"" eq $d} { + set li {} + if {"" eq $d} { + set v "-D${d}" + } elseif {[string is integer -strict $v]} { + if {!$flags(-zero-undef) || $v ne "0"} { + set v "-D${d}=$v" + } + } elseif {$flags(-quote)} { + set v "'-D${d}=\"$v\"'" } else { - lappend li = {"} $v {"} + set v "'-D${d}=$v'" } - lappend rv [join $li ""] + lappend rv $v } - if {$returnList} { return $rv } - return [join $rv] + expr {$flags(-list) ? $rv : [join $rv]} } @@ -1,5 +1,5 @@ -C autoconf/tea:\sthe\sdefault\svalue\sof\s--threadsafe=X\sis\snow\sbased\son\sa\spkgconfig\squery\susing\sthe\starget\stclsh,\swhich\sis\smuch\smore\sreliable\sthan\sgrepping\sTcl's\slinker\sflags.\sDoc\stouchups. -D 2025-04-27T04:21:27.214 +C proj.tcl:\scorrect\sthe\sauto-reconfigure\srules\sto\sinclude\sany\sX=Y\spassed\sto\sconfigure.\sImprove\shandling\sof\squoted\sCFLAGS. +D 2025-04-27T06:01:26.900 F .fossil-settings/binary-glob 61195414528fb3ea9693577e1980230d78a1f8b0a54c78cf1b9b24d0a409ed6a x F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea @@ -51,7 +51,7 @@ F autosetup/cc.tcl c0fcc50ca91deff8741e449ddad05bcd08268bc31177e613a6343bbd1fd3e F autosetup/find_tclconfig.tcl e64886ffe3b982d4df42cd28ed91fe0b5940c2c5785e126c1821baf61bc86a7e F autosetup/jimsh0.c 563b966c137a4ce3c9333e5196723b7ac0919140a9d7989eb440463cd855c367 F autosetup/pkg-config.tcl 4e635bf39022ff65e0d5434339dd41503ea48fc53822c9c5bde88b02d3d952ba -F autosetup/proj.tcl 7eff53437b4e0a5cc9215221487129ea8c53b89e8b651ee2d2713cdc6e1d0642 +F autosetup/proj.tcl d2c0c6da22b4b6e0da6d054851079477815f8acc265e718f16879f3e88ffd819 F autosetup/sqlite-config.tcl 54c88abadda1a42c6276186afcf6534e9bcb08350d96676c4ec08b99f2ada484 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 3e627d66ebdef8dfe41bd12a0474d1afca9f50051771774679d25bd1833e69ae -R 56906ec6bb47507a448b4eb61a665ed8 +P 4aeec30443b282f10353cdb9415fdce436287280f0f5d5d6b9917da831744898 +R d75d037808a96903ea777bfc48335881 U stephan -Z 6249b8349b5cb161fd945b7e77195de1 +Z 7e9da962d1e2273ff3dad52e3e71aeeb # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index ee89ce365..6428295eb 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -4aeec30443b282f10353cdb9415fdce436287280f0f5d5d6b9917da831744898 +7a2f4f319c90b768c6acc96671a3173c0ef0493180f3c4d5443f1ca03d92f6b4 |