0
0
mirror of https://github.com/sqlite/sqlite.git synced 2024-11-21 19:29:09 +01:00

Rename hwaci-error to the more descriptive hwaci-fatal. Use autosetup's file-isexec instead of [file executable] for portability. Remove the binary file lookup cache - unnecessary complexity. When searching for tools like tclsh, check under $prefix/bin before checking the $PATH. This seems like the right thing to do, but the fact that autosetup's file-search API's do not do that by default leaves some room for doubt about the wisdom of this change.

FossilOrigin-Name: 4d4423df8d14fb683bb89bebeac4b108a40847259a116fcb634b9e6594907026
This commit is contained in:
stephan 2024-10-22 03:12:11 +00:00
parent 31465666ff
commit f4ab0ad8ee
4 changed files with 76 additions and 56 deletions

View File

@ -263,7 +263,7 @@ if {".exe" eq [get-define TARGET_EXEEXT]} {
#########
# Programs needed
if {"" eq [hwaci-bin-define install]} {
msg-result "Cannot find install binary, so 'make install' will not work."
hwaci-warn "Cannot find install binary, so 'make install' will not work."
# Reminder: we historically have ./install-sh in the source tree.
# Can we not simply use that?
#
@ -449,9 +449,9 @@ proc hwaci-check-tcl {} {
if {"" ne $with_tclsh} {
if {![file isfile $with_tclsh]} {
hwaci-error "TCL shell $with_tclsh is not a file"
} elseif {![file executable $with_tclsh]} {
hwaci-error "TCL shell $with_tclsh is not executable"
hwaci-fatal "TCL shell $with_tclsh is not a file"
} elseif {![file-isexec $with_tclsh]} {
hwaci-fatal "TCL shell $with_tclsh is not executable"
} else {
define TCLSH_CMD $with_tclsh
puts "Using tclsh at \"$with_tclsh\""
@ -484,7 +484,7 @@ proc hwaci-check-tcl {} {
}
}
if {"" eq $cfg} {
hwaci-error "No tclConfig.sh found under ${with_tcl}"
hwaci-fatal "No tclConfig.sh found under ${with_tcl}"
}
} else {
# If we have not yet found a tclConfig.sh file, look in $libdir which is
@ -502,7 +502,7 @@ proc hwaci-check-tcl {} {
}
}
if {![file readable $cfg]} {
hwaci-error {
hwaci-fatal {
Cannot find a usable tclConfig.sh file.
Use --with-tcl=DIR to specify a directory where tclConfig.sh can be found.
SQLite does not use TCL internally, but TCL is required to build SQLite
@ -532,9 +532,9 @@ proc hwaci-check-tcl {} {
if {"" eq $with_tclsh} {
set with_tclsh [get-define TCL_EXEC_PREFIX]/bin/tclsh[get-define TCL_VERSION]
if {![file executable $with_tclsh]} {
if {![file-isexec $with_tclsh]} {
set with_tclsh2 [get-define TCL_EXEC_PREFIX]/bin/tclsh
if {![file executable $with_tclsh2]} {
if {![file-isexec $with_tclsh2]} {
hwaci-warn "Cannot find a usable tclsh as $with_tclsh or $with_tclsh2"
} else {
set with_tclsh $with_tclsh2
@ -572,7 +572,7 @@ proc hwaci-check-tcl {} {
}
define TCLLIBDIR $tcllibdir
define TCLLIB_RPATH $tclrpath
#hwaci-error "TCLLIB_RPATH = [get-define TCLLIB_RPATH]"
#hwaci-fatal "TCLLIB_RPATH = [get-define TCLLIB_RPATH]"
} else {
define TCLLIBDIR ""
define TCLLIB_RPATH ""
@ -617,16 +617,16 @@ if {[cc-check-functions realpath]} {
set tpre [get-define TCL_EXEC_PREFIX]
if {"" ne $tpre} {
set tv [get-define TCL_VERSION]
if {[file executable "${tpre}/bin/tclsh${tv}"]} {
if {[file-isexec "${tpre}/bin/tclsh${tv}"]} {
define TCLSH_CMD "${tpre}/bin/tclsh${tv}"
} elseif {[file executable "${tpre}/bin/tclsh"]} {
} elseif {[file-isexec "${tpre}/bin/tclsh"]} {
define TCLSH_CMD "${tpre}/bin/tclsh"
}
unset tv
}
unset tpre
if {"" eq [get-define TCLSH_CMD]} {
hwaci-error "Cannot find a tclsh to use for code generation."
hwaci-fatal "Cannot find a tclsh to use for code generation."
}
}
set cgtcl [get-define TCLSH_CMD]

View File

@ -41,15 +41,13 @@
# updating global state via feature tests.
########################################################################
array set hwaci-cache- {} ; # used for caching various results.
proc hwaci-warn {msg} {
puts "WARNING: $msg"
}
proc hwaci-notice {msg} {
puts "NOTICE: $msg"
}
proc hwaci-error {msg} {
proc hwaci-fatal {msg} {
user-error "ERROR: $msg"
}
@ -88,39 +86,52 @@ proc hwaci-check-function-in-lib {function libs {otherlibs {}}} {
}
########################################################################
# Looks for binary named $binName and `define`s $defName to that full
# path, or an empty string if not found. Returns the value it defines.
# This caches the result for a given $binName/$defName combination, so
# calls after the first for a given combination will always return the
# same result.
#
# If defName is empty then "BIN_X" is used, where X is the upper-case
# form of $binName with any '-' characters replaced with '_'.
proc hwaci-bin-define {binName {defName {}}} {
global hwaci-cache-
set cacheName "$binName:$defName"
set check {}
if {[info exists hwaci-cache-($cacheName)]} {
set check $hwaci-cache-($cacheName)
# If $v is true, [puts $msg] is called, else puts is not called.
#proc hwaci-maybe-verbose {v msg} {
# if {$v} {
# puts $msg
# }
#}
########################################################################
# Works similarly to autosetup's [find-executable-path $binName] but
# first checks for [get-define prefix]/bin/$binName. Returns the full
# path to the result or an empty string. If the first argument is -v
# then it emits info about its status, otherwise it works silently.
proc hwaci-find-executable-path {args} {
set binName $args
set verbose 0
if {[lindex $args 0] eq "-v"} {
set verbose 1
set binName [lrange $args 1 end]
}
if {$verbose} {
msg-checking "Looking for $binName ... "
if {"" ne $check} {
set lbl $check
if {"<not found>" eq $check} {
set lbl "not found"
set check ""
}
msg-result "(cached) $lbl"
return $check
}
set check [get-define prefix]/bin/$binName
if {"" eq $check || ![file-isexec $check]} {
set check [find-executable-path $binName]
}
if {$verbose} {
if {"" eq $check} {
msg-result "not found"
set hwaci-cache-($cacheName) "<not found>"
} else {
msg-result $check
set hwaci-cache-($cacheName) $check
}
}
return $check
}
########################################################################
# Uses [hwaci-find-executable-path $binName] to (verbosely) search for
# a binary, sets a define (see below) to the result, and returns the
# result (an empty string if not found).
#
# The define'd name is: if defName is empty then "BIN_X" is used,
# where X is the upper-case form of $binName with any '-' characters
# replaced with '_'.
proc hwaci-bin-define {binName {defName {}}} {
set check [hwaci-find-executable-path -v $binName]
if {"" eq $defName} {
set defName "BIN_[string toupper [string map {- _} $binName]]"
}
@ -129,16 +140,25 @@ proc hwaci-bin-define {binName {defName {}}} {
}
########################################################################
# Each argument is passed to cc-path-progs. If that function returns
# true, the full path to that binary is returned. If no matches are
# found, "" is returned.
# Looks for the first binary found of the names passed to this
# function. It first looks in [get-define prefix]/bin, then falls back
# to [cc-path-progs]. If a match is found, the full path to that
# binary is returned, else "" is returned.
#
# Despite using cc-path-progs to do the search, this function clears
# any define'd name that function stores for the result (because the
# caller has no sensible way of knowing which result it was unless
# they pass only a single argument).
proc hwaci-first-bin-of {args} {
set p [get-define prefix]/bin
foreach b $args {
set pb $p/$b
msg-checking "Checking for $pb ... "
if {[file-isexec $pb]} {
msg-result yes
return $pb
}
msg-result no
if {[cc-path-progs $b]} {
set u [string toupper $b]
set x [get-define $u]

View File

@ -1,5 +1,5 @@
C Bring\schecksymbols\starget\sup\sto\sdate\sand\sadd\sa\sTODO\sbased\son\sa\sfeature\srequest\sfrom\sthe\sforum.
D 2024-10-21T22:15:04.157
C Rename\shwaci-error\sto\sthe\smore\sdescriptive\shwaci-fatal.\sUse\sautosetup's\sfile-isexec\sinstead\sof\s[file\sexecutable]\sfor\sportability.\sRemove\sthe\sbinary\sfile\slookup\scache\s-\sunnecessary\scomplexity.\sWhen\ssearching\sfor\stools\slike\stclsh,\scheck\sunder\s$prefix/bin\sbefore\schecking\sthe\s$PATH.\sThis\sseems\slike\sthe\sright\sthing\sto\sdo,\sbut\sthe\sfact\sthat\sautosetup's\sfile-search\sAPI's\sdo\snot\sdo\sthat\sby\sdefault\sleaves\ssome\sroom\sfor\sdoubt\sabout\sthe\swisdom\sof\sthis\schange.
D 2024-10-22T03:12:11.011
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@ -14,7 +14,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 01ec2c4c8b77cd82d4e47a5ea32e10e8f70ed786f0afd229688f7863a22c77b9
F auto.def b4eaca56a2ad8911a848aa0f14dfe2e60f6358edbe1dc846e7f91295613cf2f4
F autoconf/INSTALL 83e4a25da9fd053c7b3665eaaaf7919707915903
F autoconf/Makefile.am adedc1324b6a87fdd1265ddd336d2fb7d4f36a0e77b86ea553ae7cc4ea239347
F autoconf/Makefile.fallback 22fe523eb36dfce31e0f6349f782eb084e86a5620b2b0b4f84a2d6133f53f5ac
@ -48,7 +48,7 @@ F autosetup/cc-lib.tcl 493c5935b5dd3bf9bd4eca89b07c8b1b1a9356d61783035144e21795f
F autosetup/cc-shared.tcl 4f024e94a47f427ba61de1739f6381ef0080210f9fae89112d5c1de1e5460d78
F autosetup/cc.tcl 7e2fe943ae9d45cf39e9f5b05b6230df8e719415edea5af06c30eb68680bde14
F autosetup/default.auto 5cdf016de2140e50f1db190a02039dc42fb390af1dda4cc4853e3042a9ef0e82
F autosetup/hwaci-common.tcl 83d6520660b17c00ae56e453c4a9e18ed37bae9a2a2a62db68ca49e2a454052a
F autosetup/hwaci-common.tcl 4a11759d8cd202cba850787c0b4861fff3924404700e211b6b669b15ad448a5e
F autosetup/jimsh0.c 1b5fe91fffcddbc29f2b16acb80f1650632ea2edbe8336b8155ef7b4c66f6d8d
F autosetup/pkg-config.tcl 4e635bf39022ff65e0d5434339dd41503ea48fc53822c9c5bde88b02d3d952ba
F autosetup/system.tcl 3a39d6e0b3bfba526fd39afe07c1d0d325e5a31925013a1ba7c671e1128e31bb
@ -2240,8 +2240,8 @@ F vsixtest/vsixtest.tcl 6195aba1f12a5e10efc2b8c0009532167be5e301abe5b31385638080
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
P 4de51c165ca4d0ad66f5dd7aa16fc82c673c6791b65990339134fb26b858ec33
R 4ba0a87f98ffeda9c845a486f8f418cb
P c00a03256b3f06411f93e690f875e9bc59a750aeea3ecf84bf8c8bec7c08b8ae
R 0bfab33c3e9fc3e64d010c7b8b0822a3
U stephan
Z ee571add5e230eaf56e3d8be4b067a81
Z 6a399f67a3c0dba538ebcc158b7d53df
# Remove this line to create a well-formed Fossil manifest.

View File

@ -1 +1 @@
c00a03256b3f06411f93e690f875e9bc59a750aeea3ecf84bf8c8bec7c08b8ae
4d4423df8d14fb683bb89bebeac4b108a40847259a116fcb634b9e6594907026