diff options
author | hypnotoad <yoda@etoyoc.com> | 2014-09-06 11:41:26 (GMT) |
---|---|---|
committer | hypnotoad <yoda@etoyoc.com> | 2014-09-06 11:41:26 (GMT) |
commit | 71e02d5298ef4a81b4aa0494ee1ba7d8f433391d (patch) | |
tree | 5999fe13d2c7f18ab8eb4ff55cb4fd7478bf5b9f /tools/mkVfs.tcl | |
parent | 0008ed9ea4c5bf8c010649489a28c86839ebdf0c (diff) | |
download | tcl-71e02d5298ef4a81b4aa0494ee1ba7d8f433391d.zip tcl-71e02d5298ef4a81b4aa0494ee1ba7d8f433391d.tar.gz tcl-71e02d5298ef4a81b4aa0494ee1ba7d8f433391d.tar.bz2 |
Created a designated bootloader for Tclkits under windows
On windows, tclkits build a private VFS instead of relying on make install
Added a tool to build the tcl kit's VFS, as well as index the bundled packages
Diffstat (limited to 'tools/mkVfs.tcl')
-rw-r--r-- | tools/mkVfs.tcl | 109 |
1 files changed, 109 insertions, 0 deletions
diff --git a/tools/mkVfs.tcl b/tools/mkVfs.tcl new file mode 100644 index 0000000..c7bf17b --- /dev/null +++ b/tools/mkVfs.tcl @@ -0,0 +1,109 @@ +proc cat fname {
+ set fname [open $fname r]
+ set data [read $fname]
+ close $fname
+ return $data
+}
+
+proc pkgIndexDir {root fout d1} {
+
+ puts [format {%*sIndexing %s} [expr {4 * [info level]}] {} \
+ [file tail $d1]]
+ set idx [string length $root]
+ foreach ftail [glob -directory $d1 -nocomplain -tails *] {
+ set f [file join $d1 $ftail]
+ if {[file isdirectory $f] && [string compare CVS $ftail]} {
+ pkgIndexDir $root $fout $f
+ } elseif {[file tail $f] eq "pkgIndex.tcl"} {
+ puts $fout "set dir \$HERE[string range $d1 $idx end]"
+ puts $fout [cat $f]
+ }
+ }
+}
+
+###
+# Script to build the VFS file system
+###
+proc copyDir {d1 d2} {
+
+ puts [format {%*sCreating %s} [expr {4 * [info level]}] {} \
+ [file tail $d2]]
+
+ file delete -force -- $d2
+ file mkdir $d2
+
+ foreach ftail [glob -directory $d1 -nocomplain -tails *] {
+ set f [file join $d1 $ftail]
+ if {[file isdirectory $f] && [string compare CVS $ftail]} {
+ copyDir $f [file join $d2 $ftail]
+ } elseif {[file isfile $f]} {
+ file copy -force $f [file join $d2 $ftail]
+ if {$::tcl_platform(platform) eq {unix}} {
+ file attributes [file join $d2 $ftail] -permissions 0644
+ } else {
+ file attributes [file join $d2 $ftail] -readonly 1
+ }
+ }
+ }
+
+ if {$::tcl_platform(platform) eq {unix}} {
+ file attributes $d2 -permissions 0755
+ } else {
+ file attributes $d2 -readonly 1
+ }
+}
+
+if {[llength $argv] < 3} {
+ puts "Usage: VFS_ROOT TCLSRC_ROOT PLATFORM"
+ exit 1
+}
+set TCL_SCRIPT_DIR [lindex $argv 0]
+set TCLSRC_ROOT [lindex $argv 1]
+set PLATFORM [lindex $argv 2]
+
+puts "Building [file tail $TCL_SCRIPT_DIR] for $PLATFORM"
+copyDir ${TCLSRC_ROOT}/library ${TCL_SCRIPT_DIR}
+
+if {$PLATFORM == "windows"} {
+ set ddedll [glob -nocomplain ${TCLSRC_ROOT}/win/tcldde*.dll]
+ puts "DDE DLL $ddedll"
+ if {$ddedll != {}} {
+ file copy $ddedll ${TCL_SCRIPT_DIR}/dde
+ }
+ set regdll [glob -nocomplain ${TCLSRC_ROOT}/win/tclreg*.dll]
+ puts "REG DLL $ddedll"
+ if {$regdll != {}} {
+ file copy $regdll ${TCL_SCRIPT_DIR}/reg
+ }
+} else {
+ # Remove the dde and reg package paths
+ file delete -force ${TCL_SCRIPT_DIR}/dde
+ file delete -force ${TCL_SCRIPT_DIR}/reg
+}
+
+# For the following packages, cat their pkgIndex files to tclIndex
+file attributes ${TCL_SCRIPT_DIR}/tclIndex -readonly 0
+set fout [open ${TCL_SCRIPT_DIR}/tclIndex a]
+puts $fout {#
+# MANIFEST OF INCLUDED PACKAGES
+#
+set HERE $dir
+}
+pkgIndexDir ${TCL_SCRIPT_DIR} $fout ${TCL_SCRIPT_DIR}
+close $fout
+exit 0
+puts $fout {
+# Save Tcl the trouble of hunting for these packages
+}
+set ddedll [glob -nocomplain ${TCLSRC_ROOT}/win/tcldde*.dll]
+puts "DDE DLL $ddedll"
+if {$ddedll != {}} {
+ puts $fout [cat ${TCL_SCRIPT_DIR}/dde/pkgIndex.tcl]
+}
+set regdll [glob -nocomplain ${TCLSRC_ROOT}/win/tclreg*.dll]
+puts "REG DLL $ddedll"
+if {$regdll != {}} {
+ puts $fout [cat ${TCL_SCRIPT_DIR}/reg/pkgIndex.tcl]
+}
+close $fout
+file attributes ${TCL_SCRIPT_DIR}/tclIndex -readonly 1
|