Clean up and add docs to the TCL vetting steps. Make warning and error messages bold if stdout isatty.

FossilOrigin-Name: 47157dcf9ec6b52b37578bcd5dc5ace8c36e62c8ca2625c94252c15db784b115
This commit is contained in:
stephan 2024-10-30 05:07:18 +00:00
parent 55865c47a7
commit 7d7e82c9b1
4 changed files with 88 additions and 73 deletions

136
auto.def
View File

@ -147,8 +147,20 @@ set flags {
all => {Enable FTS4, FTS5, Geopoly, RTree, Sessions}
# </lib-feature>
# <tcl>
# --with-tcl=DIR may be either a dir containing tclConfig.sh or a
# dir one level up from that from which we can derive a dir
# containing tclConfig.sh.
with-tcl:DIR => {Root of path containing tclConfig.sh}
# If --with-tclsh=X given, it is used for (A) trying to find
# tclConfig.sh and (B) all TCL-based code generation. Warning: if
# its containing dir has multiple tclsh versions, it may select the
# wrong tclConfig.sh!
with-tclsh:PATH => {Full pathname of tclsh to use}
with-tcl:DIR => {Directory containing tclConfig.sh}
# --disable-tcl only disables building of the SQLite TCL extension,
# not the requirement for TCL. This tree requires TCL for code
# generation but can use the in-tree copy of autosetup/jimsh0.c for
# that. The SQLite TCL extension and, by extension, the test code
# require a canonical tclsh.
tcl=1 => {Disable components which require TCL-dev}
# <tcl>
# <line-editing>
@ -159,7 +171,7 @@ set flags {
with-readline-ldflags:=auto
=> {Readline LDFLAGS, e.g. -lreadline -lncurses}
# --with-readline-inc is a backwards-compatible alias for
# --with-readline-cflags
# --with-readline-cflags.
with-readline-inc:
with-readline-cflags:=auto
=> {Readline CFLAGS, e.g. -I/path/to/includes}
@ -441,31 +453,36 @@ proj-if-opt-truthy with-debug {
# be empty - this tree requires TCL to generated numerous
# components.
#
define TCLSH_CMD false ; # Significant is that it exits with non-0
define HAVE_TCL 0 ; # Will be enabled via --tcl or a successful search
proc sqlite-check-tcl {} {
# TODO: document the steps this is taking.
define TCLSH_CMD false ; # Significant is that it exits with non-0
define HAVE_TCL 0 ; # Will be enabled via --tcl or a successful search
define TCLLIBDIR "" ; # Installation dir for TCL extension lib
define TCLLIB_RPATH "" ; # rpath for TCL extension lib
define TCL_CONFIG_SH ""; # full path to tclConfig.sh
if {![opt-bool tcl]} {
msg-result "TCL disabled via --disable-tcl"
define HAVE_TCL 0
msg-result "TCL disabled via --disable-tcl. Will not be able to run tests."
return
}
# TODO: document the steps this is taking.
global top_srcdir
msg-result "Checking for a suitable tcl... "
set optTcl [proj-opt-truthy tcl]
set use_tcl $optTcl
proj-assert {proj-opt-truthy tcl}
set use_tcl 1
set with_tclsh [opt-val with-tclsh]
set with_tcl [opt-val with-tcl]
msg-debug "sqlite-check-tcl: use_tcl ${use_tcl}"
msg-debug "sqlite-check-tcl: with_tclsh=${with_tclsh}"
msg-debug "sqlite-check-tcl: with_tcl=$with_tcl"
if {"" eq $with_tclsh && "" eq $with_tcl} {
# If neither --with-tclsh nor --with-tcl are provided, try to find
# a workable tclsh.
set with_tclsh [proj-first-bin-of tclsh9.0 tclsh8.6 tclsh]
msg-debug "sqlite-check-tcl: with_tclsh=${with_tclsh}"
}
if {"" ne $with_tclsh} {
# --with-tclsh was provided. Validate it and use it to trump any
# value passed via --with-tcl=DIR.
if {![file isfile $with_tclsh]} {
proj-fatal "TCL shell $with_tclsh is not a file"
} elseif {![file-isexec $with_tclsh]} {
@ -474,16 +491,14 @@ proc sqlite-check-tcl {} {
define TCLSH_CMD $with_tclsh
#msg-result "Using tclsh: $with_tclsh"
}
if {$use_tcl} {
if {[catch {exec $with_tclsh $top_srcdir/tool/find_tclconfig.tcl} result] == 0} {
set with_tcl $result
}
if {"" ne $with_tcl && [file isdir $with_tcl]} {
msg-result "$with_tclsh recommends the tclConfig.sh from $with_tcl"
} else {
proj-warn "$with_tclsh is unable to recommand a tclConfig.sh"
set use_tcl 0
}
if {[catch {exec $with_tclsh $top_srcdir/tool/find_tclconfig.tcl} result] == 0} {
set with_tcl $result
}
if {"" ne $with_tcl && [file isdir $with_tcl]} {
msg-result "$with_tclsh recommends the tclConfig.sh from $with_tcl"
} else {
proj-warn "$with_tclsh is unable to recommand a tclConfig.sh"
set use_tcl 0
}
}
@ -492,6 +507,7 @@ proc sqlite-check-tcl {} {
while {1} {
if {$use_tcl} {
if {"" ne $with_tcl} {
# Ensure that we can find tclConfig.sh under ${with_tcl}/...
if {[file readable "${with_tcl}/tclConfig.sh"]} {
set cfg "${with_tcl}/tclConfig.sh"
} else {
@ -506,9 +522,10 @@ proc sqlite-check-tcl {} {
proj-fatal "No tclConfig.sh found under ${with_tcl}"
}
} else {
# If we have not yet found a tclConfig.sh file, look in $libdir which is
# set automatically by autosetup or by the --prefix command-line option.
# See https://sqlite.org/forum/forumpost/e04e693439a22457
# If we have not yet found a tclConfig.sh file, look in
# $libdir which is set automatically by autosetup or by the
# --prefix command-line option. See
# https://sqlite.org/forum/forumpost/e04e693439a22457
set libdir [get-define libdir]
if {[file readable "${libdir}/tclConfig.sh"]} {
set cfg "${libdir}/tclConfig.sh"
@ -531,8 +548,6 @@ proc sqlite-check-tcl {} {
}
}
msg-result "Using tclConfig.sh: $cfg"
} elseif {!$optTcl} {
proj-warn "Unable to run tests because of --disable-tcl"
} else {
proj-warn "Unable to run tests because no tclConfig.sh file could be located"
}
@ -540,15 +555,14 @@ proc sqlite-check-tcl {} {
}
define TCL_CONFIG_SH $cfg
# The historical configure.ac sources tclConfig.sh so that it can
# use the several TCL_... env vars. We obviously cannot do that from
# TCL, so we apply a level of indirection which sources that script
# then emits the pieces we're interested in as TCL code. If the
# Export a subset of tclConfig.sh to the current TCL-space. If the
# config is not available, this emits empty-string entries for the
# various options we're interested in.
eval [exec "${top_srcdir}/tool/tclConfigShToTcl.sh" "[get-define TCL_CONFIG_SH]"]
eval [exec "${top_srcdir}/tool/tclConfigShToTcl.sh" "$cfg"]
if {"" eq $with_tclsh} {
proj-assert {expr {$cfg ne ""}}
proj-assert {expr {"" ne [get-define TCL_EXEC_PREFIX]}}
set with_tclsh [get-define TCL_EXEC_PREFIX]/bin/tclsh[get-define TCL_VERSION]
if {![file-isexec $with_tclsh]} {
set with_tclsh2 [get-define TCL_EXEC_PREFIX]/bin/tclsh
@ -560,49 +574,47 @@ proc sqlite-check-tcl {} {
}
}
define TCLSH_CMD $with_tclsh
if {1} {
proj-assert {expr {( $cfg eq "" && 0 == $use_tcl ) \
|| ( $cfg ne "" && 1 == $use_tcl )}}
if {$use_tcl} {
# Set up the TCLLIBDIR and TCLLIB_RPATH
#
# 2024-10-28: calculation of TCLLIBDIR is now done via the shell
# in the main.mk (search it for T.tcllibdir) so that
# static/hand-written makefiles which import main.mk do not have
# to define that before importing main.mk. Even so, we export
# TCLLIBDIR from here for the benefit of users who want to provide
# TCLLIBDIR from here for the benefit of those who want to provide
# it at configure-time and have it "stick", without having to
# provide it on each make invocation or set it in their
# environment.
if {$use_tcl} {
# Set up the TCLLIBDIR and TCLLIB_RPATH
set tcllibdir [get-env TCLLIBDIR ""]
if {"" eq $tcllibdir} {
if {[catch {exec echo "puts stdout \$auto_path" | "$with_tclsh"} result] == 0} {
foreach i $result {
if {[file isdir $i]} {
set tcllibdir $i/sqlite3
break
}
set tcllibdir [get-env TCLLIBDIR ""]
if {"" eq $tcllibdir} {
# Attempt to extract TCLLIBDIR from TCL's $auto_path
if {[catch {exec echo "puts stdout \$auto_path" | "$with_tclsh"} result] == 0} {
foreach i $result {
if {[file isdir $i]} {
set tcllibdir $i/sqlite3
break
}
} else {
proj-warn "Cannot determine TCLLIBDIR"
}
} else {
proj-warn "Cannot determine TCLLIBDIR"
}
set tclrpath ""
if {"" ne $tcllibdir} {
set rp [get-define SH_LINKRPATH]
set tclrpath [string map [list "%s" $tcllibdir] $rp]
# Reminder: tclConfig.sh has TCL_LD_SEARCH_FLAGS to set the
# rpath but (A) it includes an unexpand var ref to
# ${LIB_RUNTIME_DIR}, which must be set in the makefile and (B)
# that flag is inherently compiler-dependent so it's not as
# portable as tclConfig.sh assumes. We'll instead use the rpath
# flag which autosetup determines for the current compiler.
}
define TCLLIBDIR $tcllibdir
define TCLLIB_RPATH $tclrpath
#msg-debug "TCLLIB_RPATH = [get-define TCLLIB_RPATH]"
} else {
define TCLLIBDIR ""
define TCLLIB_RPATH ""
}
set tclrpath ""
if {"" ne $tcllibdir} {
set rp [get-define SH_LINKRPATH]
set tclrpath [string map [list "%s" $tcllibdir] $rp]
# Reminder: tclConfig.sh has TCL_LD_SEARCH_FLAGS to set the
# rpath but (A) it includes an unexpand var ref to
# ${LIB_RUNTIME_DIR}, which must be set in the makefile and (B)
# that flag is inherently compiler-dependent so it's not as
# portable as tclConfig.sh assumes. We'll instead use the rpath
# flag which autosetup determines for the current compiler.
}
define TCLLIBDIR $tcllibdir
define TCLLIB_RPATH $tclrpath
#msg-debug "TCLLIB_RPATH = [get-define TCLLIB_RPATH]"
}; # find TCLLIBDIR
if {[file exists $with_tclsh]} {

View File

@ -51,11 +51,11 @@ array set proj_ {}
set proj_(isatty) [isatty? stdout]
proc proj-warn {msg} {
puts stderr "WARNING: $msg"
puts stderr [proj-bold "WARNING: $msg"]
}
proc proj-fatal {msg} {
show-notices
puts stderr "ERROR: $msg"
puts stderr [proj-bold "ERROR: $msg"]
exit 1
}
@ -63,8 +63,11 @@ proc proj-fatal {msg} {
# Kind of like a C assert if uplevel (eval) of $script is false,
# triggers a fatal error.
proc proj-assert {script} {
if {1 == [get-env proj-assert 0]} {
msg-result [proj-bold "asserting: [string trim $script]"]
}
if {![uplevel 1 $script]} {
proj-fatal "Affirmation failed: $script"
proj-fatal "Assertion failed: $script"
}
}

View File

@ -1,5 +1,5 @@
C Remove\saccommodation\sof\sthe\slegacy-named\sshared\slibraries\sfrom\sthe\sinstallation\srules,\sper\sdiscussion.\sRename\sinstall-includes\sto\sinstall-headers.\sQuote\sinstallation\starget\sdir\snames\s"just\sin\scase".
D 2024-10-30T04:07:16.329
C Clean\sup\sand\sadd\sdocs\sto\sthe\sTCL\svetting\ssteps.\sMake\swarning\sand\serror\smessages\sbold\sif\sstdout\sisatty.
D 2024-10-30T05:07:18.996
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md c5b4009dca54d127d2d6033c22fd9cc34f53bedb6ef12c7cbaa468381c74ab28
@ -13,7 +13,7 @@ F art/icon-80x90.gif 65509ce3e5f86a9cd64fe7fca2d23954199f31fe44c1e09e208c80fb83d
F art/sqlite370.eps aa97a671332b432a54e1d74ff5e8775be34200c2
F art/sqlite370.ico af56c1d00fee7cd4753e8631ed60703ed0fc6e90
F art/sqlite370.jpg d512473dae7e378a67e28ff96a34da7cb331def2
F auto.def c0c87d0df83cd73540fbc84333155b50ac58dbea64d414a05fe4123a5a2644c1
F auto.def 246f9d5fd2db744fd8670e2fc02ac2986501bc0fb96041bbe5891b80238e0be9
F autoconf/INSTALL 83e4a25da9fd053c7b3665eaaaf7919707915903
F autoconf/Makefile.am adedc1324b6a87fdd1265ddd336d2fb7d4f36a0e77b86ea553ae7cc4ea239347
F autoconf/Makefile.fallback 22fe523eb36dfce31e0f6349f782eb084e86a5620b2b0b4f84a2d6133f53f5ac
@ -49,7 +49,7 @@ F autosetup/cc.tcl 7e2fe943ae9d45cf39e9f5b05b6230df8e719415edea5af06c30eb68680bd
F autosetup/default.auto 5cdf016de2140e50f1db190a02039dc42fb390af1dda4cc4853e3042a9ef0e82
F autosetup/jimsh0.c 27ea5f221359ef6c58780fc6c185aadbf8d3bee9a021331a3e5de0eba0dc6de6
F autosetup/pkg-config.tcl 4e635bf39022ff65e0d5434339dd41503ea48fc53822c9c5bde88b02d3d952ba
F autosetup/proj.tcl c37063118b4c2556bd6e9c1b1b6a96e325415ea5ff0b6c56921aed6165ccd332
F autosetup/proj.tcl fa96b17f000042f467239f2ef3e7a33d4787bc0fb5db4e69bd5bf1e55bb380f4
F autosetup/system.tcl 3a39d6e0b3bfba526fd39afe07c1d0d325e5a31925013a1ba7c671e1128e31bb
F autosetup/tmake.auto eaebc74ad538dfdd3c817c27eefc31930c20510c4f3a3704071f6cb0629ed71f
F autosetup/tmake.tcl a275793ec1b6f8708179af0acef1f6f10d46c2920739743f7a8720c6d700c7a9
@ -2198,8 +2198,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 6f86ff2e8c190e83c15dab532660a2a0c359621d1fcce4e6852e56ac6b7f71e3
R a4ac118514215cff67837ab2e030efc3
P 80584e165e4652e76cc3188befcee814f168298486743940bcf46696043686a0
R 9bc2e5e8de07dc365525bf3b51622805
U stephan
Z c62cc911a577bebb7f954fde1bfa7f5c
Z f36698e72a5599d183442b07666428fe
# Remove this line to create a well-formed Fossil manifest.

View File

@ -1 +1 @@
80584e165e4652e76cc3188befcee814f168298486743940bcf46696043686a0
47157dcf9ec6b52b37578bcd5dc5ace8c36e62c8ca2625c94252c15db784b115