install-test: install-core
@echo "Post-install test of [package require $(tx.name.pkg) $(tx.version)]..."; \
if echo \
- 'set c 0;' \
- 'if {[catch {package require $(tx.name.pkg) $(tx.version)}]} {incr c};' \
+ 'set c 0; ' \
+ '@TEAISH_POSTINST_PREREQUIRE@' \
+ 'if {[catch {package require $(tx.name.pkg) $(tx.version)}]} {incr c};' \
'exit $$c' \
| $(TCLSH) ; then \
echo "passed"; \
# Set up some default values if the extension did not set them.
# This must happen _after_ it's sourced but before
# teaish-configure is called.
- teaish__f2d_array f2d
+ array set f2d $::teaish__Config(pkginfo-f2d)
foreach {pflag key type val} {
- TEAISH_CFLAGS -v ""
- TEAISH_LDFLAGS -v ""
#
proc teaish-debug {msg} {
if {$::teaish__Config(debug-enabled)} {
- puts stderr [proj-bold "** DEBUG: \[[proj-current-scope 1]\]: $msg"]
+ puts stderr [proj-bold "** DEBUG: \[[proj-scope 1]\]: $msg"]
}
}
}
}
msg-result "Using Tcl [get-define TCL_VERSION] from [get-define TCL_PREFIX]."
+ teaish__tcl_platform_quirks
}; # teaish__check_tcl
+#
+# Perform last-minute platform-specific tweaks to account for quirks.
+#
+proc teaish__tcl_platform_quirks {} {
+ define TEAISH_POSTINST_PREREQUIRE ""
+ switch -glob -- [get-define host] {
+ *-haiku {
+ # Haiku's default TCLLIBDIR is "all wrong": it points to a
+ # read-only virtual filesystem mount-point. We bend it back to
+ # fit under $TCL_PACKAGE_PATH here.
+ foreach {k d} {
+ vj TCL_MAJOR_VERSION
+ vn TCL_MINOR_VERSION
+ pp TCL_PACKAGE_PATH
+ ld TCLLIBDIR
+ } {
+ set $k [get-define $d]
+ }
+ if {[string match /packages/* $ld]} {
+ set old $ld
+ set tail [file tail $ld]
+ if {8 == $vj} {
+ set ld "${pp}/tcl${vj}.${vn}/${tail}"
+ } else {
+ proj-assert {9 == $vj}
+ set ld "${pp}/${tail}"
+ }
+ define TCLLIBDIR $ld
+ # [load foo.so], without a directory part, does not work via
+ # automated tests on Haiku (but works when run
+ # manually). Similarly, the post-install [package require ...]
+ # test fails, presumably for a similar reason. We work around
+ # the former in teaish.tester.tcl.in. We work around the
+ # latter by amending the post-install check's ::auto_path (in
+ # Makefile.in). This code MUST NOT contain any single-quotes.
+ define TEAISH_POSTINST_PREREQUIRE \
+ [join [list set ::auto_path \
+ \[ linsert \$::auto_path 0 $ld \] \; \
+ ]]
+ proj-indented-notice [subst -nocommands -nobackslashes {
+ Haiku users take note: patching target installation dir to match
+ Tcl's home because Haiku's is not writable.
+
+ Original : $old
+ Substitute: $ld
+ }]
+ }
+ }
+ }
+}; # teaish__tcl_platform_quirks
+
#
# Searches $::argv and/or the build dir and/or the source dir for
# teaish.tcl and friends. Fails if it cannot find teaish.tcl or if
#}
#
-# @teash-append-make args...
+# @teash-make-add args...
#
# Appends makefile code to the TEAISH_MAKEFILE_CODE define. Each
# arg may be any of:
}
}
teaish-make-add \
- "# [proj-current-scope 1] -> [proj-current-scope] $o $src" -nl \
+ "# [proj-scope 1] -> [proj-scope] $o $src" -nl \
"$o: $src $::teaish__Config(teaish.tcl)"
if {[info exists flags(-deps)]} {
teaish-make-add " " [join $flags(-deps)]
}
}
set rule [teaish__cleanup_rule $tgt]
- teaish-make-add "# [proj-current-scope 1] -> [proj-current-scope]: [join $args]\n"
+ teaish-make-add "# [proj-scope 1] -> [proj-scope]: [join $args]\n"
teaish-make-add "${rule}:\n\trm ${rmflags}"
foreach a $args {
teaish-make-add " \"$a\""
}
lassign $args msg script
if {"" eq $msg} {
- set msg [proj-current-scope 1]
+ set msg [proj-scope 1]
}
msg-checking "${msg} ... "
if {[teaish-feature-cache-check 1 check]} {
default {
proj-error \
"Unknown [project-current-scope] -type ($type) called from" \
- [proj-current-scope 1]
+ [proj-scope 1]
}
}
return $value
}
proj-parse-simple-flags args flags $flagDefs
if {[llength $args]} {
- proj-error -up "Too many (or unknown) arguments to [proj-current-scope]: $args"
+ proj-error -up "Too many (or unknown) arguments to [proj-scope]: $args"
}
foreach {f d} $::teaish__Config(pkginfo-f2d) {
if {$sentinel eq [set v $flags($f)]} continue
}
default {
- proj-error "invalid arg count from [proj-current-scope 1]"
+ proj-error "invalid arg count from [proj-scope 1]"
}
}
- set cases [join $cases]
foreach {flag defName} $::teaish__Config(pkginfo-f2d) {
- switch -exact -- $flag $cases
+ switch -exact -- $flag [join $cases]
}
if {0 == $argc} { return $rv }
}
proj-error "Unhandled flag: $flag"
}
-array set ::teaish__PkgInfoF2D $::teaish__Config(pkginfo-f2d)
-proc teaish__f2d_array {tgtArrayName} {
- upvar $tgtArrayName tgt
- set tgt $::teaish__PkgInfoF2D
-}
-
#
# Handles --teaish-create-extension=TARGET-DIR
#
#
if {$flags(-run) && "" ne $pk} {
proj-error "Cannot use both -run and $pk" \
- " (called from [proj-current-scope 1])"
+ " (called from [proj-scope 1])"
}
foreach arg $args {
@TEAISH_VSATISFIES_CODE@
@endif
if {[llength [lindex $::argv 0]] > 0} {
- load [lindex $::argv 0] [lindex $::argv 1];
+ load [file normalize [lindex $::argv 0]] [lindex $::argv 1];
+ # ----^^^^^^^ needed on Haiku when argv 0 is just a filename, else
+ # load cannot find the file.
}
source -encoding utf-8 [lindex $::argv 2]; # teaish/tester.tcl
@if TEAISH_PKGINIT_TCL
#
# ----- @module proj.tcl -----
-# @section Project Helper APIs
+# @section Project-agnostic Helper APIs
#
#
#
proc proj-warn {args} {
show-notices
- puts stderr [join [list "WARNING: \[[proj-current-scope 1]\]: " {*}$args] " "]
+ puts stderr [join [list "WARNING: \[[proj-scope 1]\]: " {*}$args] " "]
}
#
set args [lassign $args -]
incr lvl
}
- puts stderr [join [list "FATAL: \[[proj-current-scope $lvl]]: " {*}$args]]
+ puts stderr [join [list "FATAL: \[[proj-scope $lvl]]: " {*}$args]]
exit 1
}
set args [lassign $args -]
incr lvl
}
- error [join [list "\[[proj-current-scope $lvl]]:" {*}$args]]
+ error [join [list "\[[proj-scope $lvl]]:" {*}$args]]
}
#
# @proj-assert script ?message?
#
-# Kind of like a C assert: if uplevel (eval) of [expr {$script}] is
-# false, a fatal error is triggered. The error message, by default,
-# includes the body of the failed assertion, but if $msg is set then
-# that is used instead.
+# Kind of like a C assert: if uplevel of [list expr $script] is false,
+# a fatal error is triggered. The error message, by default, includes
+# the body of the failed assertion, but if $msg is set then that is
+# used instead.
#
proc proj-assert {script {msg ""}} {
if {1 == [get-env proj-assert 0]} {
msg-result [proj-bold "asserting: $script"]
}
- set x "expr \{ $script \}"
- if {![uplevel 1 $x]} {
+ if {![uplevel 1 [list expr $script]]} {
if {"" eq $msg} {
set msg $script
}
- proj-fatal "Assertion failed in \[[proj-current-scope 1]\]: $msg"
+ proj-fatal "Assertion failed in \[[proj-scope 1]\]: $msg"
}
}
# Returns 1 if cross-compiling, else 0.
#
proc proj-is-cross-compiling {} {
- return [expr {[get-define host] ne [get-define build]}]
+ expr {[get-define host] ne [get-define build]}
}
#
default { lappend rv $f }
}
}
- return [join $rv " "]
+ join $rv " "
}
#
set rc ""
foreach b $args {
set u [string toupper $b]
- # Note that cc-path-progs defines $u to false if it finds no match.
+ # Note that cc-path-progs defines $u to "false" if it finds no
+ # match.
if {[cc-path-progs $b]} {
set rc [get-define $u]
}
# @proj-opt-define-bool ?-v? optName defName ?descr?
#
# Checks [proj-opt-truthy $optName] and calls [define $defName X]
-# where X is 0 for false and 1 for true. descr is an optional
+# where X is 0 for false and 1 for true. $descr is an optional
# [msg-checking] argument which defaults to $defName. Returns X.
#
# If args[0] is -v then the boolean semantics are inverted: if
proc proj-opt-define-bool {args} {
set invert 0
if {[lindex $args 0] eq "-v"} {
- set invert 1
+ incr invert
lassign $args - optName defName descr
} else {
lassign $args optName defName descr
#puts "optName=$optName defName=$defName descr=$descr"
set rc 0
msg-checking "[join $descr] ... "
- if {[proj-opt-truthy $optName]} {
- if {0 eq $invert} {
- set rc 1
- } else {
- set rc 0
- }
- } elseif {0 ne $invert} {
- set rc 1
+ set rc [proj-opt-truthy $optName]
+ if {$invert} {
+ set rc [expr {!$rc}]
}
msg-result $rc
define $defName $rc
# that [opt-value canonical] will return X if --alias=X is passed to
# configure.
#
-# That said: autosetup's [opt-src] does support alias forms, but it
+# That said: autosetup's [opt-str] does support alias forms, but it
# requires that the caller know all possible aliases. It's simpler, in
# terms of options handling, if there's only a single canonical name
# which each down-stream call of [opt-...] has to know.
# If none of those are set, $dflt is returned.
#
proc proj-get-env {var {dflt ""}} {
- return [get-env $var [proj-env-file $var $dflt]]
+ get-env $var [proj-env-file $var $dflt]
}
#
-# @proj-current-scope ?lvl?
+# @proj-scope ?lvl?
#
# Returns the name of the _calling_ proc from ($lvl + 1) levels up the
# call stack (where the caller's level will be 1 up from _this_
# returned and if it would be negative then a string indicating such
# is returned (as opposed to throwing an error).
#
-proc proj-current-scope {{lvl 0}} {
+proc proj-scope {{lvl 0}} {
#uplevel [expr {$lvl + 1}] {lindex [info level 0] 0}
set ilvl [info level]
set offset [expr {$ilvl - $lvl - 1}]
}
}
+#
+# Deprecated name of [proj-scope].
+#
+proc proj-current-scope {{lvl 0}} {
+ puts stderr \
+ "Deprecated proj-current-scope called from [proj-scope 1]. Use proj-scope instead."
+ proj-scope [incr lvl]
+}
+
#
# Converts parts of tclConfig.sh to autosetup [define]s.
#
TCL_VERSION
TCL_MAJOR_VERSION
TCL_MINOR_VERSION
+ TCL_PACKAGE_PATH
TCL_PATCH_LEVEL
TCL_SHLIB_SUFFIX
}
lappend shBody "exit"
set shBody [join $shBody "\n"]
#puts "shBody=$shBody\n"; exit
- if {0} {
- # This doesn't work but would be preferable to using a temp file...
- set fd [open "| sh" "rw"]
- #puts "fd = $fd"; exit
- puts $fd $shBody
- #flush $fd; # "bad file descriptor"? Without flush, [read] blocks
- set rd [read $fd]
- close $fd
- puts "rd=$rd"; exit 1
- eval $rd
- } else {
- set shName ".tclConfigSh.tcl"
- proj-file-write $shName $shBody
- catch {
- eval [exec sh $shName $tclConfigSh]
- expr 1
- } rc xopts
- file delete -force $shName
- return {*}$xopts $rc
- }
+ eval [exec echo $shBody | sh]
}
#
proj-fatal "Too many arguments: $fileIn $args"
}
}
- #puts "******* [proj-current-scope]: adding $fileIn"
+ #puts "******* [proj-scope]: adding $fileIn"
lappend ::proj__Config(dot-in-files) $fileIn
}
-validate 0 {expr 1}
}
if {[llength $args] > 0} {
- error "Invalid argument to [proj-current-scope]: $args"
+ error "Invalid argument to [proj-scope]: $args"
}
foreach f $::proj__Config(dot-in-files) {
proj-assert {3==[llength $f]} \
}
}
if {"" eq $defName} {
- proj-error "Missing defineName argument in call from [proj-current-scope 1]"
+ proj-error "Missing defineName argument in call from [proj-scope 1]"
}
if {$isdefs} {
set args $xargs
# Returns a cache key for the given argument:
#
# integer: relative call stack levels to get the scope name of for
-# use as a key. [proj-current-scope [expr {1 + $arg + addLevel}]] is
+# use as a key. [proj-scope [expr {1 + $arg + addLevel}]] is
# then used to generate the key. i.e. the default of 0 uses the
# calling scope's name as the key.
#
proc proj-cache-key {{addLevel 0} arg} {
if {"-" eq $arg} {set arg 0}
if {[string is integer -strict $arg]} {
- return [proj-current-scope [expr {$arg + $addLevel + 1}]]
+ return [proj-scope [expr {$arg + $addLevel + 1}]]
}
return $arg
}
# the debug message. It is not legal to call this from the global
# scope.
proc proc-debug {msg} {
- msg-debug "\[[proj-current-scope 1]\]: $msg"
+ msg-debug "\[[proj-scope 1]\]: $msg"
}
define OPT_FEATURE_FLAGS {} ; # -DSQLITE_OMIT/ENABLE flags.
-C Remove\sthe\srun-fuzzcheck\smakefile\stargets,\ssince\stestrunner\snow\naccomplishes\sthat\sfor\sus,\sand\sdoes\sa\sbetter\sjob\sof\sit.
-D 2025-04-29T16:30:58.194
+C Upstream\steaish\sfor\sa\stcl\sportability\sfix\son\sHaiku\sand\sa\smuch\snicer\simpl\sof\sproj-tclConfig-sh-to-autosetup.
+D 2025-04-29T17:30:51.828
F .fossil-settings/binary-glob 61195414528fb3ea9693577e1980230d78a1f8b0a54c78cf1b9b24d0a409ed6a x
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F autoconf/README.first f1d3876e9a7852c22f275a6f06814e64934cecbc0b5b9617d64849094c1fd136
F autoconf/README.txt b749816b8452b3af994dc6d607394bef3df1736d7e09359f1087de8439a52807
F autoconf/auto.def 3d994f3a9cc9b712dbce92a5708570ddcf3b988141b6eb738f2ed16127a9f0ac
-F autoconf/tea/Makefile.in 6aebb3d820c8aab94f7599e8594d5f2ecea63894d08f36ba4141040b322042bc
+F autoconf/tea/Makefile.in 8c00e2ed350754d6b45681318ed7e4578aed8ad732abcac0593c1b10dc29e5a6
F autoconf/tea/README.txt 656d4686c509d375f5988ff3deda94f65fe6cd8358cd55d1f1dcc7b6e2ff73aa
F autoconf/tea/auto.def ce95b9450e2fa4ba5dc857e208fe10f4e6f2d737796ac3278aee6079db417529
F autoconf/tea/autosetup/README.txt b40071e6f8506500a2f7f71d5fc69e0bf87b9d7678dd9da1e5b4d0acbf40b1ca
-F autoconf/tea/autosetup/core.tcl f0eebd4aa416df44f0c22f7be1a2b5b05e8fe4f64e53b0d06a21f328963c5109
-F autoconf/tea/autosetup/feature-tests.tcl 307cac35806817fc87bd0d92004364ee682c0e99f2ab505291500493ab6c7a5f
+F autoconf/tea/autosetup/core.tcl 7d942639871111e2fcef571c9d5a6e2dc75972eb214cf814a6b99f1e2b25182f
+F autoconf/tea/autosetup/feature-tests.tcl 18194fb79a24d30e5bbdeab40999616f39278b53a27525349ded033af2fd73be
F autoconf/tea/autosetup/tester.tcl c293695a0ab5d9e8d0ceeb0ee422f90e8a6aa9f0c7c51acd0b6d9f09d8edfed3
F autoconf/tea/configure d0b12b984edca6030d1976375b80157ac78b5b90a5b4f0dcee39357f63f4a80b x
F autoconf/tea/doc/sqlite3.n 9a97f4f717ceab73004ea412af7960625c1cb24b5c25e4ae4c8b5d8fa4300f4e
F autoconf/tea/pkgIndex.tcl.in e07da6b94561f4aa382bab65b1ccceb04701b97bf59d007c1d1f20a222b22d07
F autoconf/tea/teaish.tcl 8e124f33cbaf9309f3e49be4e7018a03b8f3a52f8c8d9e1e5419f4f7b0eae59e
F autoconf/tea/teaish.test.tcl cfe94e1fb79dd078f650295be59843d470125e0cc3a17a1414c1fb8d77f4aea6
-F autoconf/tea/teaish.tester.tcl.in 0d048e5569ad9bbaffbe5123c2084f9084d424a7719d06f5ca941caafbcca320
+F autoconf/tea/teaish.tester.tcl.in 31ac5b7b1e226b7e1bfc6b578a6c1a51550306ef7afae5949eec046df006ca7d
F autosetup/LICENSE 41a26aebdd2cd185d1e2b210f71b7ce234496979f6b35aef2cbf6b80cbed4ce4
F autosetup/README.autosetup a78ff8c4a3d2636a4268736672a74bf14a82f42687fcf0631a70c516075c031e
F autosetup/README.md f324bb9f9bf1cc787122034df53fbfdfed28ee2657e6652b763d992ab0d04829
F autosetup/find_tclconfig.tcl e64886ffe3b982d4df42cd28ed91fe0b5940c2c5785e126c1821baf61bc86a7e
F autosetup/jimsh0.c 563b966c137a4ce3c9333e5196723b7ac0919140a9d7989eb440463cd855c367
F autosetup/pkg-config.tcl 4e635bf39022ff65e0d5434339dd41503ea48fc53822c9c5bde88b02d3d952ba
-F autosetup/proj.tcl 4deaa5bba71390367a55fe4f0dbdc0e0ddbefb5c24a0ee4a5a54bbf288a3285d
-F autosetup/sqlite-config.tcl 54c88abadda1a42c6276186afcf6534e9bcb08350d96676c4ec08b99f2ada484
+F autosetup/proj.tcl 0287234d817e800ab0e10d46bf98545ba5762edd69e5dd0e2902029a7e6c3555
+F autosetup/sqlite-config.tcl 7ff986f6c3951f3aec5608522cbf772d8d04a0d26cc894289e2ca4836e018719
F autosetup/system.tcl 51d4be76cd9a9074704b584e5c9cbba616202c8468cf9ba8a4f8294a7ab1dba9
F configure 9a00b21dfd13757bbfb8d89b30660a89ec1f8f3a79402b8f9f9b6fc475c3303a x
F contrib/sqlitecon.tcl eb4c6578e08dd353263958da0dc620f8400b869a50d06e271ab0be85a51a08d3
F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7
F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139
F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
-P 6fb84156a262ff89d1a2d1df6fbfac4c1a43fb55b9d15205508662e2c9b0894f
-R a1c49ae42fb2300a145738dcc51e2b94
-U drh
-Z 2ea0a9b0d47db806738daf27dc577757
+P 3ffd867ed31cd0779aa92b5e8b71592a8e7224977f9da8e5d6793a78bbb80070
+R 83f48c22e5e2f14e3dc7e22807086c00
+U stephan
+Z fd9d0c6c436c24b0f01cb0cb367bf38e
# Remove this line to create a well-formed Fossil manifest.
-3ffd867ed31cd0779aa92b5e8b71592a8e7224977f9da8e5d6793a78bbb80070
+ca0d30a43b3dfb95dd6b491f592031a053b0b5e95361ffe01ec8bd56d5e2d110