Fossil SCM

After autosetup checks for the existence of tclsh in the PATH, it now checks whether it's at least version 8.6, because macOS is still shipping 8.5, despite it being nearly 6 years old. If we find an old tclsh, try to find the Homebrew tcl-tk package, and use that version instead. This is not a macOS or Homebrew specific change in principle: we can extend this logic for other systems to find their best Tcl/Tk version, as needed. On systems where autosetup is used, this only affects "make test". There are other uses of tclsh in this tree which may also benefit from our PATH discoveries, but this checkin doesn't update those. This checkin also doesn't try to address similar problems on other platforms, such as the "TCLSH = tclsh" line in Makefile.mingw.

wyoung 2018-09-02 20:33 trunk
Commit e449cb09c18004ed6034f2742ad0bf91dc19856fe76caf743f3608a78aa169ec
+1 -1
--- Makefile.in
+++ Makefile.in
@@ -34,11 +34,11 @@
3434
TCC = @CC@
3535
3636
#### Tcl shell for use in running the fossil testsuite. If you do not
3737
# care about testing the end result, this can be blank.
3838
#
39
-TCLSH = tclsh
39
+TCLSH = @TCLSH@
4040
4141
CFLAGS = @CFLAGS@
4242
LIB = @LDFLAGS@ @EXTRA_LDFLAGS@ @LIBS@
4343
BCCFLAGS = @CPPFLAGS@ $(CFLAGS)
4444
TCCFLAGS = @EXTRA_CFLAGS@ @CPPFLAGS@ $(CFLAGS) -DHAVE_AUTOCONFIG_H -D_HAVE_SQLITE_CONFIG_H
4545
--- Makefile.in
+++ Makefile.in
@@ -34,11 +34,11 @@
34 TCC = @CC@
35
36 #### Tcl shell for use in running the fossil testsuite. If you do not
37 # care about testing the end result, this can be blank.
38 #
39 TCLSH = tclsh
40
41 CFLAGS = @CFLAGS@
42 LIB = @LDFLAGS@ @EXTRA_LDFLAGS@ @LIBS@
43 BCCFLAGS = @CPPFLAGS@ $(CFLAGS)
44 TCCFLAGS = @EXTRA_CFLAGS@ @CPPFLAGS@ $(CFLAGS) -DHAVE_AUTOCONFIG_H -D_HAVE_SQLITE_CONFIG_H
45
--- Makefile.in
+++ Makefile.in
@@ -34,11 +34,11 @@
34 TCC = @CC@
35
36 #### Tcl shell for use in running the fossil testsuite. If you do not
37 # care about testing the end result, this can be blank.
38 #
39 TCLSH = @TCLSH@
40
41 CFLAGS = @CFLAGS@
42 LIB = @LDFLAGS@ @EXTRA_LDFLAGS@ @LIBS@
43 BCCFLAGS = @CPPFLAGS@ $(CFLAGS)
44 TCCFLAGS = @EXTRA_CFLAGS@ @CPPFLAGS@ $(CFLAGS) -DHAVE_AUTOCONFIG_H -D_HAVE_SQLITE_CONFIG_H
45
+25 -1
--- auto.def
+++ auto.def
@@ -33,12 +33,36 @@
3333
}
3434
3535
# Use pread/pwrite system calls in place of seek + read/write if possible
3636
define USE_PREAD [cc-check-functions pread]
3737
38
-# Find tclsh for the test suite. Can't yet use jimsh for this.
38
+# Find tclsh for the test suite. We can't use jimsh for this: the test
39
+# suite uses features of Tcl that Jim doesn't support.
3940
cc-check-progs tclsh
41
+set hbtd /usr/local/Cellar/tcl-tk
42
+if {[get-define TCLSH] != false} {
43
+ set v [exec /bin/sh -c "echo 'puts \$tcl_version' | tclsh"]
44
+ if {[expr $v >= 8.6]} {
45
+ msg-result "Found Tclsh version $v in the PATH."
46
+ define TCLSH tclsh
47
+ } elseif {[file isdirectory $hbtd]} {
48
+ # This is a macOS system with the Homebrew version of Tcl/Tk
49
+ # installed. Select the newest version. It won't normally be
50
+ # in the PATH to avoid shadowing /usr/bin/tclsh, and even if it
51
+ # were in the PATH, it's bad practice to put /usr/local/bin (the
52
+ # Homebrew default) ahead of /usr/bin, especially given that
53
+ # it's user-writeable by default with Homebrew. Thus, we can be
54
+ # pretty sure the only way to call it is with an absolute path.
55
+ set v [exec ls -tr $hbtd | tail -1]
56
+ set path "$hbtd/$v/bin/tclsh"
57
+ define TCLSH $path
58
+ msg-result "Using Homebrew Tcl/Tk version $path."
59
+ } else {
60
+ msg-result "WARNING: tclsh $v found; need >= 8.6 for 'make test'."
61
+ define TCLSH false ;# force "make test" failure via /usr/bin/false
62
+ }
63
+}
4064
4165
define EXTRA_CFLAGS "-Wall"
4266
define EXTRA_LDFLAGS ""
4367
define USE_SYSTEM_SQLITE 0
4468
define USE_LINENOISE 0
4569
--- auto.def
+++ auto.def
@@ -33,12 +33,36 @@
33 }
34
35 # Use pread/pwrite system calls in place of seek + read/write if possible
36 define USE_PREAD [cc-check-functions pread]
37
38 # Find tclsh for the test suite. Can't yet use jimsh for this.
 
39 cc-check-progs tclsh
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
40
41 define EXTRA_CFLAGS "-Wall"
42 define EXTRA_LDFLAGS ""
43 define USE_SYSTEM_SQLITE 0
44 define USE_LINENOISE 0
45
--- auto.def
+++ auto.def
@@ -33,12 +33,36 @@
33 }
34
35 # Use pread/pwrite system calls in place of seek + read/write if possible
36 define USE_PREAD [cc-check-functions pread]
37
38 # Find tclsh for the test suite. We can't use jimsh for this: the test
39 # suite uses features of Tcl that Jim doesn't support.
40 cc-check-progs tclsh
41 set hbtd /usr/local/Cellar/tcl-tk
42 if {[get-define TCLSH] != false} {
43 set v [exec /bin/sh -c "echo 'puts \$tcl_version' | tclsh"]
44 if {[expr $v >= 8.6]} {
45 msg-result "Found Tclsh version $v in the PATH."
46 define TCLSH tclsh
47 } elseif {[file isdirectory $hbtd]} {
48 # This is a macOS system with the Homebrew version of Tcl/Tk
49 # installed. Select the newest version. It won't normally be
50 # in the PATH to avoid shadowing /usr/bin/tclsh, and even if it
51 # were in the PATH, it's bad practice to put /usr/local/bin (the
52 # Homebrew default) ahead of /usr/bin, especially given that
53 # it's user-writeable by default with Homebrew. Thus, we can be
54 # pretty sure the only way to call it is with an absolute path.
55 set v [exec ls -tr $hbtd | tail -1]
56 set path "$hbtd/$v/bin/tclsh"
57 define TCLSH $path
58 msg-result "Using Homebrew Tcl/Tk version $path."
59 } else {
60 msg-result "WARNING: tclsh $v found; need >= 8.6 for 'make test'."
61 define TCLSH false ;# force "make test" failure via /usr/bin/false
62 }
63 }
64
65 define EXTRA_CFLAGS "-Wall"
66 define EXTRA_LDFLAGS ""
67 define USE_SYSTEM_SQLITE 0
68 define USE_LINENOISE 0
69
--- test/tester.tcl
+++ test/tester.tcl
@@ -20,10 +20,14 @@
2020
# tclsh ../test/tester.tcl ../bld/fossil
2121
#
2222
# Where ../test/tester.tcl is the name of this file and ../bld/fossil
2323
# is the name of the executable to be tested.
2424
#
25
+
26
+# We use some things introduced in 8.6 such as lmap. auto.def should
27
+# have found us a suitable Tcl installation.
28
+package require Tcl 8.6
2529
2630
set testfiledir [file normalize [file dirname [info script]]]
2731
set testrundir [pwd]
2832
set testdir [file normalize [file dirname $argv0]]
2933
set fossilexe [file normalize [lindex $argv 0]]
3034
--- test/tester.tcl
+++ test/tester.tcl
@@ -20,10 +20,14 @@
20 # tclsh ../test/tester.tcl ../bld/fossil
21 #
22 # Where ../test/tester.tcl is the name of this file and ../bld/fossil
23 # is the name of the executable to be tested.
24 #
 
 
 
 
25
26 set testfiledir [file normalize [file dirname [info script]]]
27 set testrundir [pwd]
28 set testdir [file normalize [file dirname $argv0]]
29 set fossilexe [file normalize [lindex $argv 0]]
30
--- test/tester.tcl
+++ test/tester.tcl
@@ -20,10 +20,14 @@
20 # tclsh ../test/tester.tcl ../bld/fossil
21 #
22 # Where ../test/tester.tcl is the name of this file and ../bld/fossil
23 # is the name of the executable to be tested.
24 #
25
26 # We use some things introduced in 8.6 such as lmap. auto.def should
27 # have found us a suitable Tcl installation.
28 package require Tcl 8.6
29
30 set testfiledir [file normalize [file dirname [info script]]]
31 set testrundir [pwd]
32 set testdir [file normalize [file dirname $argv0]]
33 set fossilexe [file normalize [lindex $argv 0]]
34

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button