Skip to content

Commit

Permalink
Fix install of clock.tcl (#9)
Browse files Browse the repository at this point in the history
* workaround for lib/clock.tcl not yet existing during configure using lib_BINARIES in Makefile
* improve path searching for generated clock.tcl
* log error message on failure
* update to 8.6.709
* avoid overloading stubs terminology
  • Loading branch information
bovine authored Oct 14, 2021
1 parent 89dd77e commit 669d2f0
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/linux-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ jobs:
- name: runtime test
run: |
echo 'if {[catch {package require tclclockmod; clock format -now}]} {puts stderr "ERROR!"; exit 1} else {puts "OK."}' | tclsh
echo 'if {[catch {package require tclclockmod; clock format -now} catchResult]} {puts stderr "ERROR! $catchResult"; exit 1} else {puts "OK."}' | tclsh
- name: clean
run: |
Expand Down
4 changes: 2 additions & 2 deletions Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ PKG_HEADERS = @PKG_HEADERS@
PKG_LIB_FILE = @PKG_LIB_FILE@
PKG_STUB_LIB_FILE = @PKG_STUB_LIB_FILE@

lib_BINARIES = $(PKG_LIB_FILE)
lib_BINARIES = $(PKG_LIB_FILE) lib/clock.tcl
BINARIES = $(lib_BINARIES)

SHELL = @SHELL@
Expand Down Expand Up @@ -159,7 +159,7 @@ PKG_CFLAGS = @PKG_CFLAGS@
DEFS = @DEFS@ $(PKG_CFLAGS)

# Move pkgIndex.tcl to 'BINARIES' var if it is generated in the Makefile
CONFIG_CLEAN_FILES = Makefile pkgIndex.tcl
CONFIG_CLEAN_FILES = Makefile pkgIndex.tcl lib/clock.tcl
CLEANFILES = @CLEANFILES@

CPPFLAGS = @CPPFLAGS@
Expand Down
4 changes: 2 additions & 2 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ dnl to configure the system for the local environment.
# so you can encode the package version directly into the source files.
#-----------------------------------------------------------------------

AC_INIT([tclclockmod], [8.6.707])
AC_INIT([tclclockmod], [8.6.709])

#--------------------------------------------------------------------
# Call TEA_INIT as the first TEA_ macro to set up initial vars.
Expand Down Expand Up @@ -129,7 +129,7 @@ TEA_ADD_SOURCES([generic/tclClock.c \

#TEA_ADD_STUB_SOURCES([])

TEA_ADD_TCL_SOURCES([lib/clock.tcl.in])


#--------------------------------------------------------------------
# Add --with-tzpath flag to set zoneinfo directory
Expand Down
17 changes: 14 additions & 3 deletions lib/loader.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ proc ::clock args {
# first try from lib directory (like installed):
set lib [glob -nocomplain [file join $::tcl::clock::LibDir tclclockmod*[info sharedlibextension]]]
# second try find library from current directory (debug, release, platform etc.),
# hereafter in path relative current lib (like unistalled):
# hereafter in path relative current lib (like uninstalled):
if {![llength $lib]} {
foreach plib [list [pwd] [file dirname $::tcl::clock::LibDir]] {
# now from unix, win, Release:
Expand All @@ -33,8 +33,19 @@ proc ::clock args {
# load library:
load [lindex $lib 0]

# overload new tcl-clock stubs:
source [file join $::tcl::clock::LibDir clock.tcl]

# first try from the lib directory (like installed):
# second try to find in the same directory as the shared library.
set ensemble [glob -nocomplain [file join $::tcl::clock::LibDir clock.tcl] \
[file join [file dirname [lindex $lib 0]] clock.tcl] \
[file join [file dirname [lindex $lib 0]] lib/clock.tcl] \
]
if {![llength $ensemble]} {
error "tclclockmod ensemble file not found relative \"[pwd]\"."
}

# overload new tcl-clock ensemble file:
source [lindex $ensemble 0]

# and ensemble:
set cmdmap [dict create]
Expand Down

0 comments on commit 669d2f0

Please sign in to comment.