/usr/share/tcltk/tcllib1.19/tool/build.tcl is in tcllib 1.19-dfsg-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 | set here [file dirname [file normalize [file join [pwd] [info script]]]]
set version 0.7
set module [file tail $here]
set fout [open [file join $here [file tail $module].tcl] w]
dict set map %module% $module
dict set map %version% $version
puts $fout [string map $map {###
# Amalgamated package for %module%
# Do not edit directly, tweak the source in src/ and rerun
# build.tcl
###
package provide %module% %version%
namespace eval ::%module% {}
}]
if {$module ne "tool"} {
puts $fout [string map $map {::tool::module push %module%}]
}
# Track what files we have included so far
set loaded {}
# These files must be loaded in a particular order
foreach file {
core.tcl
uuid.tcl
ensemble.tcl
metaclass.tcl
option.tcl
event.tcl
pipeline.tcl
} {
lappend loaded $file
set fin [open [file join $here src $file] r]
puts $fout "###\n# START: [file tail $file]\n###"
puts $fout [read $fin]
close $fin
puts $fout "###\n# END: [file tail $file]\n###"
}
# These files can be loaded in any order
foreach file [glob [file join $here src *.tcl]] {
if {[file tail $file] in $loaded} continue
lappend loaded $file
set fin [open [file join $here src $file] r]
puts $fout "###\n# START: [file tail $file]\n###"
puts $fout [read $fin]
close $fin
puts $fout "###\n# END: [file tail $file]\n###"
}
# Provide some cleanup and our final package provide
puts $fout [string map $map {
namespace eval ::%module% {
namespace export *
}
}]
close $fout
###
# Build our pkgIndex.tcl file
###
set fout [open [file join $here pkgIndex.tcl] w]
puts $fout [string map $map {# Tcl package index file, version 1.1
# This file is generated by the "pkg_mkIndex" command
# and sourced either when an application starts up or
# by a "package unknown" script. It invokes the
# "package ifneeded" command to set up package-related
# information so that packages will be loaded automatically
# in response to "package require" commands. When this
# script is sourced, the variable $dir must contain the
# full path name of this file's directory.
if {![package vsatisfies [package provide Tcl] 8.6]} {return}
package ifneeded %module% %version% [list source [file join $dir %module%.tcl]]
}]
close $fout
|