Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | Re-jiggered the package indexer to handle TM files and to do a better balance of including code in the master pkgIndex.tcl file vs farming out the processing to package directory pkgIndex.tcl files. (Keeping the processing local really speeds up load time for VFS's) |
|---|---|
| Timelines: | family | ancestors | descendants | both | gort |
| Files: | files | file ages | folders |
| SHA1: |
4da2fe27db1ff6c75decb023ef0ae79e |
| User & Date: | hypnotoad 2016-02-27 16:39:42 |
Context
|
2016-02-29
| ||
| 23:24 | The toadkit.rc file now builds in the local project's build directory, allowing scripts to leverage what the kitbuild discovered/built Moved all of the odie specific config data to a specific section which is now only consulted if a project.rc is not present. Reimplemented the build project in stages, with rules at the top to determine which stage needs to run when. All paths referenced by the KIT are stored in the KIT array check-in: 427a4ac4ce user: hypnotoad tags: gort | |
|
2016-02-27
| ||
| 16:39 | Re-jiggered the package indexer to handle TM files and to do a better balance of including code in the master pkgIndex.tcl file vs farming out the processing to package directory pkgIndex.tcl files. (Keeping the processing local really speeds up load time for VFS's) check-in: 4da2fe27db user: hypnotoad tags: gort | |
|
2016-02-23
| ||
| 17:52 | Pass the STATIC_BUILD flag to the rc file build by windres to ensure the executable build a standalone set of the resources needed for Tk.dll on Windows Having a problem with GORT at the moment, so for now also download and maintain sherpa. Revert to using sherpa for package management Remove the static build of Tcl, no longer required. (The kit builder does its own now) check-in: 9b2600638a user: hypnotoad tags: gort | |
Changes
Changes to build.tcl.
| ︙ | ︙ | |||
41 42 43 44 45 46 47 |
###
# topic: 2e481bd24d970304a1dd0acad3d75198b56c122e
###
proc ::practcl::_istm name {
return [string match *.tm $name]
}
| > > > > > | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | > > | > | > > > > | | | > < < < < < < < | > > | < < | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | < | < < | | | < | < < < < < < < < < < < < < < < < < < | 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 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 |
###
# topic: 2e481bd24d970304a1dd0acad3d75198b56c122e
###
proc ::practcl::_istm name {
return [string match *.tm $name]
}
###
# Return true if the pkgindex file contains
# any statement other than "package ifneeded"
# and/or if any package ifneeded loads a DLL
###
proc ::practcl::_pkgindex_directory {path} {
set buffer {}
set pkgidxfile [file join $path pkgIndex.tcl]
if {![file exists $pkgidxfile]} {
# No pkgIndex file, read the source
foreach file [glob -nocomplain $path/*.tm] {
set file [file normalize $file]
set fname [file rootname [file tail $file]]
###
# We used to be able to ... Assume the package is correct in the filename
# No hunt for a "package provides"
###
set package [lindex [split $fname -] 0]
set version [lindex [split $fname -] 1]
###
# Read the file, and override assumptions as needed
###
set fin [open $file r]
set dat [read $fin]
close $fin
# Look for a teapot style Package statement
foreach line [split $dat \n] {
set line [string trim $line]
if { [string range $line 0 9] != "# Package " } continue
set package [lindex $line 2]
set version [lindex $line 3]
break
}
# Look for a package provide statement
foreach line [split $dat \n] {
set line [string trim $line]
if { [string range $line 0 14] != "package provide" } continue
set package [lindex $line 2]
set version [lindex $line 3]
break
}
append buffer "package ifneeded $package $version \[list source \[file join \$dir [file tail $file]\]\]" \n
}
foreach file [glob -nocomplain $path/*.tcl] {
#set file [file normalize $file]
#if { $file == [file join $base tcl8.6 package.tcl] } continue
#if { $file == [file join $base packages.tcl] } continue
#if { $file == [file join $base main.tcl] } continue
if { [file tail $file] == "version_info.tcl" } continue
set fin [open $file r]
set dat [read $fin]
close $fin
if {![regexp "package provide" $dat]} continue
set fname [file rootname [file tail $file]]
set thisline {}
foreach line [split $dat \n] {
append thisline \n $line
if {![info complete $thisline]} continue
set thisline [string trim $thisline]
if { [string range $thisline 0 14] != "package provide" } continue
set package [lindex $thisline 2]
set version [lindex $thisline 3]
append buffer "package ifneeded $package $version \[list source \[file join \$dir [file tail $file]\]\]" \n
set thisline {}
break
}
}
return $buffer
}
set fin [open $pkgidxfile r]
set dat [read $fin]
close $fin
set thisline {}
foreach line [split $dat \n] {
append thisline $line \n
if {![info complete $thisline]} continue
set line [string trim $line]
if {[string length $line]==0} {
set thisline {} ; continue
}
if {[string index $line 0] eq "#"} {
set thisline {} ; continue
}
try {
# Ignore contditionals
if {[regexp "if.*catch.*package.*Tcl.*return" $thisline]} continue
if {[regexp "if.*package.*vsatisfies.*package.*provide.*return" $thisline]} continue
if {![regexp "package.*ifneeded" $thisline]} {
# This package index contains arbitrary code
# source instead of trying to add it to the master
# package index
return {source [file join $dir pkgIndex.tcl]}
}
append buffer $thisline \n
} on error {err opts} {
puts ***
puts "GOOF: $pkgidxfile"
puts $line
puts $err
puts [dict get $opts -errorinfo]
puts ***
} finally {
set thisline {}
}
}
return $buffer
}
proc ::practcl::pkgindex_path {base} {
set stack {}
set buffer {
lappend ::PATHSTACK $dir
}
set base [file normalize $base]
set i [string length $base]
# Build a list of all of the paths
set paths [fileutil::find $base ::practcl::_isdirectory]
foreach path $paths {
if {$path eq $base} continue
set path_indexed($path) 0
}
set path_index([file join $base boot tcl]) 1
set path_index([file join $base boot tk]) 1
foreach path $paths {
set thisdir [::fileutil::relative $base $path]
set idxbuf [::practcl::_pkgindex_directory $path]
if {[string length $idxbuf]} {
incr path_indexed($path)
append buffer "set dir \[file join \[lindex \$::PATHSTACK end\] $thisdir\]" \n
append buffer [string trimright $idxbuf] \n
}
}
append buffer {
set dir [lindex $::PATHSTACK end]
set ::PATHSTACK [lrange $::PATHSTACK 0 end-1]
}
return $buffer
}
proc read_Config.sh {filename} {
set fin [open $filename r]
set result {}
while {[gets $fin line] >= 0} {
set line [string trim $line]
if {[string index $line 0] eq "#"} continue
if {$line eq {}} continue
|
| ︙ | ︙ | |||
217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 |
lappend cmd -c [fileutil::relative $::PWD $cfile] -o $objfile
puts [list [file tail $cfile] -> [file tail $objfile]]
puts $cmd
exec {*}$cmd >&@ stdout
}
proc ::copyDir {d1 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]
}
}
}
source [file join $::HERE odieConfig.tcl]
if { $::odie(platform) eq "windows" } {
set ::KIT(EXEEXT) .exe
} else {
set ::KIT(EXEEXT) {}
}
| > > > > > > > > > | < < < | > | | | | < | < | | < < < < | < < < < < < < | < < | > | | | | | | | | | | | | | | | | | | | | | < < < | 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 |
lappend cmd -c [fileutil::relative $::PWD $cfile] -o $objfile
puts [list [file tail $cfile] -> [file tail $objfile]]
puts $cmd
exec {*}$cmd >&@ stdout
}
proc ::copyDir {d1 d2} {
#puts [list $d1 -> $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]
}
}
}
#########################################
#
# BEGIN THE KITBUILDING PROCESS HERE
#
#########################################
source [file join $::HERE odieConfig.tcl]
if { $::odie(platform) eq "windows" } {
set ::KIT(EXEEXT) .exe
} else {
set ::KIT(EXEEXT) {}
}
set PKGPREFIX /tcl
foreach dpath {
{$PWD}
{$PWD ..}
{$::odie(sandbox)}
} {
set path [file normalize [file join {*}[subst $dpath]]]
set TCLSRCDIR [file join $path toadkit$::odie_tcl(version)$::odie_tcl(patch_level) tcl]
set TKSRCDIR [file join $path toadkit$::odie_tcl(version)$::odie_tcl(patch_level) tk]
set PKGROOT [file join $path toadkit$::odie_tcl(version)$::odie_tcl(patch_level) pkg]
set BASEKITVFS [file join $path toadkit$::odie_tcl(version)$::odie_tcl(patch_level) vfs]
if {[file exists $TCLSRCDIR]} {
break
}
}
set _TclSrcDir [file join $TCLSRCDIR $::odie(tcl_src_dir)]
set _TkSrcDir [file join $TKSRCDIR $::odie(tcl_src_dir)]
puts "BUILDING ZipVFS KITS"
if {"toadkit" in $argv || ![file exists tclkit_bare$::KIT(EXEEXT)]} {
file mkdir build
file mkdir [file join $BASEKITVFS boot]
###
# Build a starter VFS for both Tcl and wish
###
set USEMSVC [info exists env(VisualStudioVersion)]
if {![file exists $TCLSRCDIR]} {
copyDir $::odie_tcl(src_dir) $TCLSRCDIR
cd $_TclSrcDir
catch {domake distclean}
}
set tclConfig.sh [file join $_TclSrcDir tclConfig.sh]
if {$USEMSVC} {
cd $_TclSrcDir
doexec nmake -f makefile.vc INSTALLDIR=$PKGROOT release
doexec nmake -f makefile.vc INSTALLDIR=$PKGROOT install
cd $PWD
} else {
if {![file exists ${tclConfig.sh}]} {
cd $_TclSrcDir
set opts {}
if {$::odie(host) != $::odie(target)} {
lappend opts --host=$::odie(target)
}
lappend opts {*}$::odie(tcl_config_flags) --prefix=$PKGPREFIX --exec_prefix=$PKGPREFIX --with-tzdata --enable-shared=no
doexec sh configure {*}$opts
domake binaries
domake packages
cd $PWD
}
}
if {![file exists $TKSRCDIR]} {
copyDir $::odie_tk(src_dir) $TKSRCDIR
cd [file join $_TkSrcDir]
catch {domake distclean}
}
set tkConfig.sh [file join $_TkSrcDir tkConfig.sh]
if {$USEMSVC} {
cd $_TkSrcDir
puts "BUILD TK"
doexec nmake -f makefile.vc TCLDIR=[file nativename $TCLSRCDIR] INSTALLDIR=$PKGROOT release
doexec nmake -f makefile.vc TCLDIR=[file nativename $TCLSRCDIR] INSTALLDIR=$PKGROOT install
cd $PWD
} else {
if {![file exists ${tkConfig.sh}]} {
set opts {}
cd $_TkSrcDir
if {$::odie(host) != $::odie(target)} {
lappend opts --host=$::odie(target)
}
lappend opts {*}$::odie(tk_config_flags) --with-tcl=$_TclSrcDir --enable-shared=yes
doexec sh configure {*}$opts
domake binaries
cd $PWD
}
}
set ::KIT(OBJS) {}
set ::KIT(INCLUDES) {}
###
|
| ︙ | ︙ | |||
361 362 363 364 365 366 367 |
}
}
}
###
# Add/synthesize bits
###
| | | | | | | | | | < | < < < > > | | | | < < | | | 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 |
}
}
}
###
# Add/synthesize bits
###
lappend ::KIT(INCLUDES) [file join $TKSRCDIR generic]
lappend ::KIT(INCLUDES) [file join $TKSRCDIR $::odie(tcl_src_dir)]
lappend ::KIT(INCLUDES) [file join $TKSRCDIR bitmaps]
lappend ::KIT(INCLUDES) [file join $TKSRCDIR xlib]
lappend ::KIT(INCLUDES) [file join $TCLSRCDIR generic]
lappend ::KIT(INCLUDES) [file join $TCLSRCDIR $::odie(tcl_src_dir)]
#lappend ::KIT(INCLUDES) [file join $$TCLSRCDIR compat]
lappend ::KIT(INCLUDES) [file join $TCLSRCDIR compat zlib]
lappend ::KIT(INCLUDES) [file join $::HERE generic]
lappend ::KIT(INCLUDES) [file join $::HERE $::odie(tcl_src_dir)]
if { $::odie(platform) eq "windows" } {
set ::KIT(EXEEXT) .exe
set ::KIT(LDFLAGS_CONSOLE) {-mconsole -pipe -static-libgcc}
set ::KIT(LDFLAGS_WINDOW) {-mwindows -pipe -static-libgcc}
set ::KIT(EXTRA_CFLAGS) {-DTCL_TOMMATH -DMP_PREC=4 -DUNICODE -D_UNICODE -DBUILD_tcl -DBUILD_tk -DBUILD_ttk -DSTATIC_BUILD}
if {[file exists [file join $PWD tclkit.rc]]} {
set RCSRC [file join $PWD tclkit.rc]
} else {
set RCSRC [file join $_TkSrcDir rc wish.rc]
}
doexec windres -o [file join $PWD tclkit.res.o] -DSTATIC_BUILD \
--include [file join $TCLSRCDIR generic] --include [file join $TKSRCDIR generic] \
--include $_TkSrcDir \
--include [file join $_TkSrcDir rc] $RCSRC
lappend ::KIT(TCLSHELL_OBJS) [file join $PWD tclkit.res.o]
lappend ::KIT(WISHSHELL_OBJS) [file join $PWD tclkit.res.o]
lappend ::KIT(INCLUDES) [file join $_TkSrcDir rc]
} else {
set ::KIT(EXEEXT) {}
set ::KIT(LDFLAGS_CONSOLE) {}
set ::KIT(LDFLAGS_WINDOW) {}
set ::KIT(EXTRA_CFLAGS) {-DTCL_TOMMATH -DMP_PREC=4 -DBUILD_tk -DBUILD_ttk}
}
|
| ︙ | ︙ | |||
433 434 435 436 437 438 439 | ### ### # Rig ourselves to statically build the bits of # zlib we need ### | | | 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 |
###
###
# Rig ourselves to statically build the bits of
# zlib we need
###
set cdir [file join $TCLSRCDIR compat zlib]
foreach file {
adler32.c compress.c crc32.c
deflate.c infback.c inffast.c
inflate.c inftrees.c trees.c
uncompr.c zutil.c
} {
COMPILE LIBTOADKIT [file join $cdir $file]
|
| ︙ | ︙ | |||
458 459 460 461 462 463 464 |
if { $::odie(platform) eq "windows" } {
# tkwinico.c tlink32.c
foreach file {
tclsh_packages.c
} {
COMPILE LIBTOADKIT [file join $cdir $file]
}
| | | | | | < | < < | | | | | < | | > > > | < < < < | < | | | | | | > > > > > | | > | < < | > > | | | | < < < < < < < < < < < < < | > > > | < < | | | > > | 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 |
if { $::odie(platform) eq "windows" } {
# tkwinico.c tlink32.c
foreach file {
tclsh_packages.c
} {
COMPILE LIBTOADKIT [file join $cdir $file]
}
COMPILE TCLSHELL [file join $_TclSrcDir tclAppInit.c] [list -DTCL_LOCAL_MAIN_HOOK=Toadkit_MainHook -DTCL_LOCAL_APPINIT=Toadkit_AppInit]
COMPILE WISHSHELL [file join $_TkSrcDir winMain.c] [list -DTK_LOCAL_MAIN_HOOK=Toadkit_MainHook -DTK_LOCAL_APPINIT=Toadkit_AppInit]
} else {
foreach file {
tclsh_packages.c
} {
COMPILE LIBTOADKIT [file join $cdir $file]
}
COMPILE TCLSHELL [file join $$_TclSrcDir tclAppInit.c] [list -DTCL_LOCAL_MAIN_HOOK=Toadkit_MainHook -DTCL_LOCAL_APPINIT=Toadkit_AppInit]
COMPILE WISHSHELL [file join $_TkSrcDir tclAppInit.c] [list -DTK_LOCAL_MAIN_HOOK=Toadkit_MainHook -DTK_LOCAL_APPINIT=Toadkit_AppInit]
}
###
# Link together our executable
###
doexec ar cr libtoadkit.a {*}$::KIT(LIBTOADKIT_OBJS) [file join $_TclSrcDir libtclstub86.a]
doexec ranlib libtoadkit.a
# Build a Tcl-only shell
set cmd [list $::KIT(cc) {*}$::KIT(cflags_optimize) {*}$::KIT(shlib_cflags)]
lappend cmd {*}$::KIT(TCLSHELL_OBJS)
foreach item [glob ${_TclSrcDir}/*.a] {
lappend cmd $item
}
lappend cmd libtoadkit.a {*}$::TCL(libs)
lappend cmd -o tclkit_bare$::KIT(EXEEXT) {*}$::KIT(LDFLAGS_CONSOLE)
doexec {*}$cmd
set pkg_paths [glob [file join $TCLSRCDIR pkgs *]]
foreach pkgpath $pkg_paths {
if {[string range [file tail $pkgpath] 0 3] eq "itcl"} continue
if {![file isdirectory $pkgpath]} continue
cd $pkgpath
if {![file exists [file join $pkgpath Makefile]]} {
if {[file exists [file join $pkgpath Makefile.in]]} {
doexec sh configure --with-tcl=$_TclSrcDir --with-tclinclude=[file join $TCLSRCDIR generic] --with-tzdata --enable-shared --enable-threads
} else {
continue
}
}
puts "INSTALLING to VFS [file tail $pkgpath]"
domake install DESTDIR=$PKGROOT
}
cd $PWD
if {[file exists $BASEKITVFS]} {
file delete -force $BASEKITVFS
}
puts "***
*** BASE KIT VFS PACKAGES
***"
puts [list COPY [file join $PKGROOT [string trimleft $PKGPREFIX /] lib]]
copyDir [file join $PKGROOT [string trimleft $PKGPREFIX /] lib] [file join $BASEKITVFS pkgs]
copyDir [file join $TCLSRCDIR library] [file join $BASEKITVFS boot tcl]
if { $::odie(platform) eq "windows" } {
set ddedll [glob -nocomplain [file join $_TclSrcDir tcldde*.dll]]
if {$ddedll != {}} {
file copy $ddedll [file join $BASEKITVFS boot tcl dde]
}
set regdll [glob -nocomplain [file join $_TclSrcDir tclreg*.dll]]
if {$regdll != {}} {
file copy $regdll [file join $BASEKITVFS boot tcl reg]
}
} else {
file delete -force [file join $BASEKITVFS boot tcl dde]
file delete -force [file join $BASEKITVFS boot tcl reg]
}
copyDir [file join $TKSRCDIR library] $BASEKITVFS/boot/tk
set dllsrc [file join $_TkSrcDir [string trim $::TK(dll_file) \"]]
file copy -force $dllsrc [file join $BASEKITVFS boot tk]
# For the following packages, cat their pkgIndex files to tclIndex
if {$::tcl_platform(platform) eq {unix}} {
file attributes [file join $BASEKITVFS boot tcl tclIndex] -permissions 0744
} else {
file attributes [file join $BASEKITVFS boot tcl tclIndex] -readonly 0
}
set fout [open [file join $BASEKITVFS boot tcl tclIndex] a]
puts $fout {#
# MANIFEST OF INCLUDED PACKAGES
#
}
puts $fout [string map [list @TKVERSION@ $::TK(version)$::TK(patch_level) @TKDLL@ [string trim $::TK(dll_file) \"]] {
package ifneeded Tk @TKVERSION@ [list load $::tk_library/@TKDLL@ Tk]
}]
puts $fout {
if {[file exists /zvfs/pkgIndex.tcl]} {
set dir /zvfs
source /zvfs/pkgIndex.tcl
}
}
#close $fout
close $fout
}
cd $PWD
if {[lindex $argv 0] eq "toadkit"} {
package ifneeded zipfile::mkzip 1.2 [list source [file join $::HERE scripts mkzip.tcl]]
package require zipfile::mkzip
set fout [open [file join $BASEKITVFS pkgIndex.tcl] w]
set buffer [::practcl::pkgindex_path $BASEKITVFS]
puts $fout $buffer
close $fout
::zipfile::mkzip::mkzip toadkit$::KIT(EXEEXT) -runtime tclkit_bare$::KIT(EXEEXT) -directory $BASEKITVFS
}
cd $PWD
if {[lindex $argv 0] eq "wrap"} {
set name [lindex $argv 1]
set vfspath [lindex $argv 2]
package ifneeded zipfile::mkzip 1.2 [list source [file join $::HERE scripts mkzip.tcl]]
package require zipfile::mkzip
copyDir $BASEKITVFS $vfspath
set fout [open [file join $vfspath pkgIndex.tcl] w]
set buffer [::practcl::pkgindex_path $vfspath]
puts $fout $buffer
close $fout
::zipfile::mkzip::mkzip ${name}$::KIT(EXEEXT) -runtime tclkit_bare$::KIT(EXEEXT) -directory $vfspath
}
|