Index: pkgIndex.tcl.in ================================================================== --- pkgIndex.tcl.in +++ pkgIndex.tcl.in @@ -1,25 +1,32 @@ # -*- tcl -*- # Tcl package index file, version 1.1 # if {[package vsatisfies [package provide Tcl] 9.0-]} { - package ifneeded @PACKAGE_NAME@ @PACKAGE_VERSION@ \ - [list load [file join $dir @PKG_LIB_FILE9@] [string totitle @PACKAGE_NAME@]] - set initScript [file join $dir @PACKAGE_NAME@.tcl] - if {[file exists $initScript]} { - source -encoding utf-8 $initScript - } + package ifneeded @PACKAGE_NAME@ @PACKAGE_VERSION@ [list apply {{dir} { + # Load library + load [file join $dir @PKG_LIB_FILE9@] [string totitle @PACKAGE_NAME@] + + # Source init file + set initScript [file join $dir @PACKAGE_NAME@.tcl] + if {[file exists $initScript]} { + source -encoding utf-8 $initScript + } + }} $dir] } else { if {![package vsatisfies [package provide Tcl] 8.5]} {return} package ifneeded @PACKAGE_NAME@ @PACKAGE_VERSION@ [list apply {{dir} { + # Load library if {[string tolower [file extension @PKG_LIB_FILE8@]] in [list .dll .dylib .so]} { # Load dynamic library load [file join $dir @PKG_LIB_FILE8@] [string totitle @PACKAGE_NAME@] } else { # Static library load {} [string totitle @PACKAGE_NAME@] } + + # Source init file set initScript [file join $dir @PACKAGE_NAME@.tcl] if {[file exists $initScript]} { source -encoding utf-8 $initScript } }} $dir]