Index: Makefile ================================================================== --- Makefile +++ Makefile @@ -14,30 +14,30 @@ install: sherpa $(SHELL) scripts/make_skel.sh $(SHELL) scripts/make_tcl.sh ODIE_BUILD_TCLSH=`autosetup/find-tclsh` - $(ODIE_BUILD_TCLSH) scripts/make_sherpa.tcl + $(ODIE_BUILD_TCLSH) scripts/make_gort.tcl $(SHERPA) upgrade sqlite odielib tcllib ${ODIE_BUILD_TCLSH} build.tcl toadkit packages: sherpa - $(SHERPA) install sqlite odielib tcllib + $(SHERPA) install odielib tcllib upgrade: $(FOSSIL) update ${ODIE_BUILD_TCLSH} scripts/upgrade.tcl - $(ODIE_BUILD_TCLSH) scripts/make_sherpa.tcl + $(ODIE_BUILD_TCLSH) scripts/make_gort.tcl $(SHERPA) upgrade sqlite odielib tcllib ${ODIE_BUILD_TCLSH} build.tcl toadkit upgrade-tcl: $(FOSSIL) update $(SHELL) scripts/make_tcl.sh ODIE_BUILD_TCLSH=`autosetup/find-tclsh` ${ODIE_BUILD_TCLSH} scripts/upgrade.tcl - $(ODIE_BUILD_TCLSH) scripts/make_sherpa.tcl + $(ODIE_BUILD_TCLSH) scripts/make_gort.tcl $(SHERPA) upgrade sqlite odielib tcllib ${ODIE_BUILD_TCLSH} build.tcl clean rm -rf tcl tk ${ODIE_BUILD_TCLSH} build.tcl toadkit @@ -46,24 +46,29 @@ rebuild: $(SHELL) scripts/make_distclean.sh $(FOSSIL) update $(SHELL) scripts/make_tcl.sh - $(ODIE_BUILD_TCLSH) scripts/make_sherpa.tcl + $(ODIE_BUILD_TCLSH) scripts/make_gort.tcl $(SHERPA) upgrade sqlite odielib tcllib ${ODIE_BUILD_TCLSH} build.tcl toadkit distclean: $(SHELL) scripts/make_distclean.sh basekit: ${ODIE_BUILD_TCLSH} build.tcl toadkit -sherpa: $ODIE_DOWNLOAD/sherpa/sherpa.tcl +sherpa: $ODIE_SANDBOX/sherpa/sherpa.tcl + +gort: $ODIE_SANDBOX/gort/gort.tcl + +$ODIE_SANDBOX/sherpa/sherpa.tcl: + $(ODIE_BUILD_TCLSH) scripts/make_gort.tcl -$ODIE_DOWNLOAD/sherpa/sherpa.tcl: - $(ODIE_BUILD_TCLSH) scripts/make_sherpa.tcl +$ODIE_SANDBOX/gort/gort.tcl: + $(ODIE_BUILD_TCLSH) scripts/make_gort.tcl $(ODIE_MKHDR): $(CC) -o mkhdr.o scripts/mkhdr.c $(CC) mkhdr.o -o mkhdr${EXE_SUFFIX} cp -f mkhdr@EXE@ $(ODIE_MKHDR) Index: auto.def ================================================================== --- auto.def +++ auto.def @@ -88,11 +88,11 @@ unzip 1 0 tar 1 0 git 0 1 strip 0 0 mkhdr 0 1 - sherpa 0 1 + gort 0 1 } { if {$required} { set exename [lindex [find-an-executable -required $program] 0] } else { set exename [lindex [find-an-executable $program] 0] Index: autosetup/lib/odie.tcl ================================================================== --- autosetup/lib/odie.tcl +++ autosetup/lib/odie.tcl @@ -1,9 +1,9 @@ # @synopsis: # # ODIE modules adds teacup platform data and integration with -# sherpa +# gort # use system codebale # Build procs for this modules options { @@ -250,19 +250,19 @@ array set odie_tcl { config_flags {} version 8.6 major_version 8 minor_version 6 - patch_level .4 + patch_level .5 fossil_branch release } array set odie_tk { config_flags {} version 8.6 major_version 8 minor_version 6 - patch_level .4 + patch_level .5 fossil_branch release } array set odie { exe_suffix {} platform unix @@ -315,11 +315,11 @@ *win32* - *WIN32* { ### # With visual studio, 64 bit should be assumed # but is otherwise to taste ### - set odie(windows) 1 + set ::odie(windows) 1 set ::odie(os) windows } } @@ -553,11 +553,11 @@ # Under MSYS/Cygwin transform the Cygwinized paths # pack into proper names for Windows ### foreach path { sandbox download src_dir tcl_shell wish_shell build_tclsh - fossil git zip unzip sherpa lib local_repo + fossil git zip unzip lib local_repo } { if {[info exists ::odie($path)]} { set ::odie_build($path) [::realpath $::odie($path)] } } Index: build.tcl ================================================================== --- build.tcl +++ build.tcl @@ -1,47 +1,180 @@ ### # script to build a tclkit ### -set HERE [file dirname [file normalize [info script]]] -set PWD [pwd] - -package ifneeded zipfile::mkzip 1.2 [list source [file join $HERE scripts mkzip.tcl]] - -if {[lindex $argv 0] eq "clean"} { - file delete -force build - file delete -force tcl - file delete -force tk - foreach file [glob -nocomplain *.a] { - file delete $file - } - exit -} - -package require fileutil - + +##### +# Define procedures +##### + +namespace eval ::practcl {} proc ::cat fname { set fname [open $fname r] set data [read $fname] close $fname return $data } -### -# topic: 15c41a8a701fb2afdfbd8d479d464bda -### -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 \${VFSROOT}[string range $d1 $idx end]" - puts $fout [cat $f] - } - } +proc ::practcl::localtools {} { + +} + +proc ::practcl::_isdirectory name { + return [file isdirectory $name] +} +### +# topic: ebd68484cb7f18cad38beaab3cf574e2de5702ea +### +proc ::practcl::_istcl name { + return [string match *.tcl $name] +} + +### +# 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] { + 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]] + # 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] + if {[string index $package 0] in "\$ \["} continue + if {[string index $version 0] in "\$ \["} continue + append buffer "package ifneeded $package $version \[list source \[file join \$dir [file tail $file]\]\]" \n + 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 +} + +### +# Index all paths given as though they will end up in the same +# virtual file system +### +proc ::practcl::pkgindex_path args { + set stack {} + set buffer { +lappend ::PATHSTACK $dir + } + foreach base $args { + 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 {} @@ -76,26 +209,27 @@ puts [list make {*}$args] exec make {*}$args >&@ stdout } proc ::COMPILE {which cfile {extras {}}} { - set objfile [file normalize build/[file tail [file dirname $cfile]]_[file rootname [file tail $cfile]].o] + set objfile [file normalize [file join $::PWD build [file tail [file dirname $cfile]]_[file rootname [file tail $cfile]].o]] lappend ::KIT(${which}_OBJS) $objfile if {[file exists $objfile] && [file mtime $objfile] > [file mtime $cfile]} return lappend cmd $::KIT(cc) {*}$::KIT(cflags_optimize) {*}$::KIT(shlib_cflags) {*}$::KIT(cflags_warning) {*}$::KIT(extra_cflags) {*}$::KIT(defs) {*}$extras foreach path $::KIT(INCLUDES) { - lappend cmd -I./[fileutil::relative $::PWD $HERE] + lappend cmd -I./[fileutil::relative $::PWD $path] } lappend cmd {*}$::KIT(EXTRA_CFLAGS) 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 + #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]} { @@ -104,101 +238,286 @@ file copy -force $f [file join $d2 $ftail] } } } -source [file join $HERE odieConfig.tcl] -if { $::odie(platform) eq "windows" } { +proc ::practcl::wrap {PWD name vfspath args} { + cd $PWD + if {![file exists $vfspath]} { + file mkdir $vfspath + } + package ifneeded zipfile::mkzip 1.2 [list source [file join $::HERE scripts mkzip.tcl]] + package require zipfile::mkzip + set fout [open [file join $vfspath packages.tcl] w] + set buffer [::practcl::pkgindex_path $::KIT(BASEVFS) $vfspath] + puts $fout $buffer + close $fout + copyDir $::KIT(BASEVFS) $vfspath + foreach arg $args { + copyDir $arg $vfspath + } + ::zipfile::mkzip::mkzip ${name}$::KIT(EXEEXT) -runtime $::TARGET(tclkit_bare) -directory $vfspath + file attributes ${name}$::KIT(EXEEXT) -permissions a+x +} + +######################################### +# +# BUILD THE INTERPRETER ENVIRONMENT +# +######################################### + +set HERE [file dirname [file normalize [info script]]] +set PWD [pwd] + +lappend auto_path [file normalize [file join $HERE .. tcllib modules]] +lappend auto_path [file normalize [file join $HERE .. odielib modules]] +#package ifneeded zipfile::mkzip 1.2 [list source [file join $::HERE scripts mkzip.tcl]] + +package require fileutil + +######################################### +# +# BEGIN THE KITBUILDING PROCESS HERE +# +######################################### +set _search_paths {{$PWD} {$PWD ..}} +if {![file exists [file join $::HERE odieConfig.tcl]]} { + # Build the local toolset + cd $HERE + exec [info nameofexecutable] [file join $HERE autosetup autosetup] + cd $PWD +} +puts "AUTOPATH (276): $::auto_path" +source [file join $::HERE odieConfig.tcl] +set ::KIT(platform) ::odie(platform) +set ::KIT(ORIG_TCL_SRC_DIR) $::odie_tcl(src_dir) +set ::KIT(ORIG_TK_SRC_DIR) $::odie_tk(src_dir) +set ::KIT(TCL_BUILD_OPTS) $::odie_tcl(config_flags) +set ::KIT(TK_BUILD_OPTS) $::odie_tk(config_flags) +set ::KIT(HOST) $::odie(host) +set ::KIT(TARGET) $::odie(target) +set ::KIT(TCL_VERSION) $::odie_tcl(version) +set ::KIT(TK_VERSION) $::odie_tk(version) +set ::KIT(TCL_PATCH_LEVEL) $::odie_tcl(patch_level) +set ::KIT(TK_PATCH_LEVEL) $::odie_tk(patch_level) + +if {[file exists [file join $PWD project.rc]]} { + source [file join $PWD project.rc] + set ::KIT(platform) $::project(TEA_PLATFORM) + set ::KIT(ORIG_TCL_SRC_DIR) $::project(TCL_SRC_DIR) + set ::KIT(ORIG_TK_SRC_DIR) $::project(TK_SRC_DIR) + set ::KIT(TARGET) $::project(TEA_PLATFORM) + set ::KIT(TCL_VERSION) $::project(TCL_VERSION) + set ::KIT(TK_VERSION) $::project(TK_VERSION) + set ::KIT(TCL_PATCH_LEVEL) $::project(TCL_PATCH_LEVEL) + set ::KIT(TK_PATCH_LEVEL) $::project(TCL_PATCH_LEVEL) + lappend _search_paths {[file dirname $::project(srcdir)]} +} +lappend _search_paths $::odie(sandbox) + + +array set build { + tcl 0 + tk 0 + packages 0 + basekitvfs 0 + toadkit.rc 0 + toadkit 0 + tclkit_bare 0 + libtoadkit.a 0 +} + +### +# Begin processing our arguments +### +set COMMAND [lindex $argv 0] +switch $COMMAND { + localtcl { + + } + toadkit { + set build(toadkit) 1 + } + basekit { + set build(toadkit) 1 + } + wrap { + + } + clean { + } + default { + error "Unknown command $COMMAND. Valid: clean tcl toadkit wrap" + } +} + +if { $::KIT(platform) eq "windows" } { set ::KIT(EXEEXT) .exe + set ::KIT(platform_src_dir) win + set USEMSVC [info exists env(VisualStudioVersion)] } else { set ::KIT(EXEEXT) {} -} - -set fout [open [file join $PWD wrap.tcl] w] -puts $::fout [list set ::KIT(EXEEXT) $::KIT(EXEEXT)] -puts $::fout [list package ifneeded zipfile::mkzip 1.2 [list source [file join $HERE scripts mkzip.tcl]]] -puts $::fout "if {!\[file exists tclkit_bare\$::KIT(EXEEXT)\]} \{[list exec \[info nameofexecutable\] [info script] >&@ stdout]}" -puts $fout { -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] - } - } -} - -set name [lindex $argv 0] -set path [lindex $argv 1] -file copy -force tclkit_bare$::KIT(EXEEXT) toadkit$::KIT(EXEEXT) -package require zipfile::mkzip -copyDir tclkit.vfs/boot $HERE/boot -copyDir tclkit.vfs/lib $HERE/lib - -::zipfile::mkzip::mkzip ${name}$::KIT(EXEEXT) -runtime tclkit_bare$::KIT(EXEEXT) -directory $HERE -} -close $fout - - -puts "BUILDING ZipVFS KITS" -if {![file exists tclkit_bare$::KIT(EXEEXT)]} { - file mkdir build - file mkdir tclkit.vfs/boot - if {![file exists [file join $PWD tcl]]} { - copyDir $::odie_tcl(src_dir) [file join $PWD tcl] - cd [file join $PWD tcl $::odie(tcl_src_dir)] - catch {domake distclean} - } - set tclConfig.sh [file join $PWD tcl $::odie(tcl_src_dir) tclConfig.sh] - if {![file exists ${tclConfig.sh}]} { - cd [file join $PWD tcl $::odie(tcl_src_dir)] - set opts {} - if {$::odie(host) != $::odie(target)} { - lappend opts --host=$::odie(target) - } - lappend opts {*}$::odie(tcl_config_flags) --with-tzdata --enable-shared=no - doexec sh configure {*}$opts - domake binaries - domake packages - cd $PWD - } - - if {![file exists [file join $PWD tk]]} { - copyDir $::odie_tk(src_dir) [file join $PWD tk] - cd [file join $PWD tk $::odie(tcl_src_dir)] - catch {domake distclean} - } - - set tkConfig.sh [file join $PWD tk $::odie(tcl_src_dir) tkConfig.sh] - if {![file exists ${tkConfig.sh}]} { - set opts {} - cd [file join $PWD tk $::odie(tcl_src_dir)] - if {$::odie(host) != $::odie(target)} { - lappend opts --host=$::odie(target) - } - lappend opts {*}$::odie(tk_config_flags) --with-tcl=[file join $PWD tcl $::odie(tcl_src_dir)] --enable-shared=yes - doexec sh configure {*}$opts - domake binaries - if { $::odie(platform) eq "windows" } { - domake tk.res.o - domake wish.res.o - } - cd $PWD - } - - set ::KIT(OBJS) {} - set ::KIT(INCLUDES) {} - + set ::KIT(platform_src_dir) unix + set USEMSVC 0 +} +set ::KIT(PKGPREFIX) /zvfs + +foreach dpath $_search_paths { + set path [file normalize [file join {*}[subst $dpath] toadkit$::KIT(TCL_VERSION)$::KIT(TCL_PATCH_LEVEL)]] + set ::KIT(TCLSRCDIR) [file join $path tcl] + set ::KIT(TKSRCDIR) [file join $path tk] + set ::KIT(PKGROOT) [file join $path pkg] + set ::KIT(BASEVFS) [file join $path vfs] + if {[file exists $::KIT(TCLSRCDIR)]} { + break + } +} + + +### +# Sort out our various build products +### +set _TclSrcDir [file join $::KIT(TCLSRCDIR) $::KIT(platform_src_dir)] +set _TkSrcDir [file join $::KIT(TKSRCDIR) $::KIT(platform_src_dir)] + +set ::TARGET(tclConfig.sh) [file join $_TclSrcDir tclConfig.sh] +set ::TARGET(tkConfig.sh) [file join $_TkSrcDir tkConfig.sh] +set ::TARGET(libtoadkit.a) [file join $PWD libtoadkit.a] +set ::TARGET(tclkit_bare) [file join $PWD tclkit_bare$::KIT(EXEEXT)] +set ::TARGET(toadkit.rc) [file join $PWD toadkit.rc] + + +if {![file exists $::TARGET(tclkit_bare)]} { + set build(tclkit_bare) 1 +} +if {![file exists $::TARGET(tclConfig.sh)]} { + set build(tcl) 1 + set build(tk) 1 +} +if {![file exists $::TARGET(tkConfig.sh)]} { + set build(tk) 1 +} +if {![file exists $::TARGET(libtoadkit.a)]} { + set build(libtoadkit.a) 1 +} +if {![file exists $::KIT(PKGROOT)]} { + set build(packages) 1 +} +if {![file exists $::KIT(BASEVFS)]} { + set build(basekitvfs) 1 +} +if {$build(tcl) || $build(tk) || $build(toadkit)} { + set build(packages) 1 + set build(basekitvfs) 1 + set build(toadkit.rc) 1 + set build(tclkit_bare) 1 + set build(libtoadkit.a) 1 +} +if {$build(libtoadkit.a)} { + set build(tclkit_bare) 1 +} +if {$build(packages)} { + set build(basekitvfs) 1 +} +if {![file exists $::TARGET(toadkit.rc)]} { + set build(toadkit.rc) 1 +} +file mkdir build + + +puts "*** +::KIT(TCLSRCDIR): [file exists $::KIT(TCLSRCDIR)] $::KIT(TCLSRCDIR) +::KIT(TKSRCDIR): [file exists $::KIT(TKSRCDIR)] $::KIT(TKSRCDIR) +::KIT(PKGROOT): [file exists $::KIT(PKGROOT)] $::KIT(PKGROOT) +::KIT(BASEVFS): [file exists $::KIT(BASEVFS)] $::KIT(BASEVFS) +toadkit.rc: [file exists $::TARGET(toadkit.rc)] $::TARGET(toadkit.rc) +***" +parray build + +if {$COMMAND eq "clean"} { + file delete -force $path + file delete -force build/ + foreach file [glob -nocomplain *.a] { + file delete $file + } + exit +} + +if {$build(tcl)} { + file mkdir build + file mkdir [file join $::KIT(BASEVFS) boot] + ### + # Build a starter VFS for both Tcl and wish + ### + if {![file exists $::KIT(TCLSRCDIR)]} { + copyDir $::KIT(ORIG_TCL_SRC_DIR) $::KIT(TCLSRCDIR) + cd $_TclSrcDir + catch {domake distclean} + } + if {$USEMSVC} { + puts "BUILDING Static Tcl" + cd $_TclSrcDir + doexec nmake -f makefile.vc INSTALLDIR=$::KIT(PKGROOT) release + doexec nmake -f makefile.vc INSTALLDIR=$::KIT(PKGROOT) install + cd $PWD + } else { + if {![file exists $::TARGET(tclConfig.sh)]} { + puts "BUILDING Static Tcl" + cd $_TclSrcDir + set opts {} + if {$::KIT(HOST) != $::KIT(TARGET)} { + lappend opts --host=$::KIT(TARGET) + } + lappend opts {*}$::KIT(TCL_BUILD_OPTS) --prefix=$::KIT(PKGPREFIX) --exec_prefix=$::KIT(PKGPREFIX) --with-tzdata --enable-shared=no + puts *** + puts "CONFIGURE {*}opts" + puts *** + doexec sh configure {*}$opts + domake binaries + domake packages + cd $PWD + } + } +} +if {$build(tk)} { + if {![file exists $::KIT(TKSRCDIR)]} { + copyDir $::KIT(ORIG_TK_SRC_DIR) $::KIT(TKSRCDIR) + cd [file join $_TkSrcDir] + catch {domake distclean} + } + if {$USEMSVC} { + cd $_TkSrcDir + puts "BUILD TK" + doexec nmake -f makefile.vc TCLDIR=[file nativename $::KIT(TCLSRCDIR)] INSTALLDIR=$::KIT(PKGROOT) release + doexec nmake -f makefile.vc TCLDIR=[file nativename $::KIT(TCLSRCDIR)] INSTALLDIR=$::KIT(PKGROOT) install + cd $PWD + } else { + if {![file exists $::TARGET(tkConfig.sh)]} { + puts "BUILD TK" + set opts {} + cd $_TkSrcDir + if {$::KIT(HOST) != $::KIT(TARGET)} { + lappend opts --host=$::KIT(TARGET) + } + lappend opts {*}$::KIT(TK_BUILD_OPTS) --with-tcl=$_TclSrcDir --enable-shared=yes + puts *** + puts "CONFIGURE {*}opts" + puts *** + doexec sh configure {*}$opts + domake binaries + cd $PWD + } + } +} + +if {$build(toadkit.rc)} { + set ::KIT(OBJS) {} + set ::KIT(INCLUDES) {} ### # Read tclConfig.sh and tkConfig.sh ### - foreach {array pre file} [list ::TCL tcl ${tclConfig.sh} ::TK tk ${tkConfig.sh}] { + foreach {array pre file} [list ::TCL tcl $::TARGET(tclConfig.sh) ::TK tk $::TARGET(tkConfig.sh)] { set l [expr {[string length $pre]+1}] foreach {field dat} [read_Config.sh $file] { set field [string tolower $field] if {[string match ${pre}_* $field]} { set field [string range $field $l end] @@ -215,217 +534,218 @@ } ### # Add/synthesize bits ### - lappend ::KIT(INCLUDES) [file join $PWD tk generic] - lappend ::KIT(INCLUDES) [file join $PWD tk $::odie(tcl_src_dir)] - lappend ::KIT(INCLUDES) [file join $PWD tk bitmaps] - lappend ::KIT(INCLUDES) [file join $PWD tk xlib] - - lappend ::KIT(INCLUDES) [file join $PWD tcl generic] - lappend ::KIT(INCLUDES) [file join $PWD tcl $::odie(tcl_src_dir)] - #lappend ::KIT(INCLUDES) [file join $PWD tcl compat] - lappend ::KIT(INCLUDES) [file join $PWD tcl compat zlib] - - lappend ::KIT(INCLUDES) [file join $HERE generic] - lappend ::KIT(INCLUDES) [file join $HERE $::odie(tcl_src_dir)] - - if { $::odie(platform) eq "windows" } { + lappend ::KIT(INCLUDES) [file join $::KIT(TKSRCDIR) generic] + lappend ::KIT(INCLUDES) [file join $::KIT(TKSRCDIR) $::KIT(platform_src_dir)] + lappend ::KIT(INCLUDES) [file join $::KIT(TKSRCDIR) bitmaps] + lappend ::KIT(INCLUDES) [file join $::KIT(TKSRCDIR) xlib] + + lappend ::KIT(INCLUDES) [file join $::KIT(TCLSRCDIR) generic] + lappend ::KIT(INCLUDES) [file join $::KIT(TCLSRCDIR) $::KIT(platform_src_dir)] + #lappend ::KIT(INCLUDES) [file join $$::KIT(TCLSRCDIR) compat] + lappend ::KIT(INCLUDES) [file join $::KIT(TCLSRCDIR) compat zlib] + + lappend ::KIT(INCLUDES) [file join $::HERE generic] + lappend ::KIT(INCLUDES) [file join $::HERE $::KIT(platform_src_dir)] + + if { $::KIT(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} - lappend ::KIT(OBJS) [file join $PWD tk $::odie(tcl_src_dir) tk.res.o] [file join $PWD tk $::odie(tcl_src_dir) wish.res.o] - lappend ::KIT(INCLUDES) [file join $PWD tk $::odie(tcl_src_dir) rc] + 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 $::KIT(TCLSRCDIR) generic] --include [file join $::KIT(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} } set ::KIT(LIBS) {} - #lappend ::KIT(LIBS) {*}$::TCL(build_lib_spec) {*}$::TCL(build_stub_lib_spec) {*}$::TCL(libs) - #{*}$::TK(build_lib_spec) {*}$::TCL(build_stub_lib_spec) - #{*}$::TCL(build_stub_lib_spec) {*}$::TK(build_stub_lib_spec) set ::KIT(defs) $::TK(defs) - set fout [open toadkit.rc w] + set fout [open $::TARGET(toadkit.rc) w] puts $fout "array set ::TCL \{" foreach {field value} [lsort -stride 2 [array get ::TCL]] { puts $fout " [list $field $value]" } puts $fout "\}" puts $fout "array set ::TK \{" foreach {field value} [lsort -stride 2 [array get ::TK]] { puts $fout " [list $field $value]" } + puts $fout "\}" + puts $fout "array set ::TARGET \{" + foreach {field value} [lsort -stride 2 [array get ::TARGET]] { + puts $fout " [list $field $value]" + } puts $fout "\}" puts $fout "array set ::KIT \{" foreach {field value} [lsort -stride 2 [array get ::KIT]] { puts $fout " [list $field $value]" } puts $fout "\}" - + close $fout +} else { + source $::TARGET(toadkit.rc) +} + + +if {$build(libtoadkit.a)} { ### - # Compile our C bits + # Compile our resident static C library ### - - + cd $PWD + if {[file exists $::TARGET(libtoadkit.a)]} { + file delete $::TARGET(libtoadkit.a) + } ### # Rig ourselves to statically build the bits of # zlib we need ### - set cdir [file join $PWD tcl compat zlib] + set cdir [file join $::KIT(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] } - set cdir [file join $HERE generic] + set cdir [file join $::HERE generic] foreach file { password.c rc4.c tclkit_init.c zvfs.c zvfsboot.c } { COMPILE LIBTOADKIT [file join $cdir $file] } - set cdir [file join $HERE $::odie(tcl_src_dir)] - if { $::odie(platform) eq "windows" } { + set cdir [file join $::HERE $::KIT(platform_src_dir)] + if { $::KIT(platform) eq "windows" } { # tkwinico.c tlink32.c foreach file { tclsh_packages.c } { COMPILE LIBTOADKIT [file join $cdir $file] } - #COMPILE LIBTOADKIT [file join $PWD tcl win tclWinReg.c] [list -DSTATIC_BUILD] - #COMPILE LIBTOADKIT [file join $PWD tcl win tclWinDde.c] [list -DSTATIC_BUILD] - - COMPILE TCLSHELL [file join $PWD tcl win tclAppInit.c] [list -DTCL_LOCAL_MAIN_HOOK=Toadkit_MainHook -DTCL_LOCAL_APPINIT=Toadkit_AppInit] - COMPILE WISHSHELL [file join $PWD tk win winMain.c] [list -DTK_LOCAL_MAIN_HOOK=Toadkit_MainHook -DTK_LOCAL_APPINIT=Toadkit_AppInit] + 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] + lappend ::KIT(LIBTOADKIT_OBJS) [file join $_TclSrcDir libtclstub86.a] } else { foreach file { tclsh_packages.c } { COMPILE LIBTOADKIT [file join $cdir $file] } - COMPILE TCLSHELL [file join $PWD tcl unix tclAppInit.c] [list -DTCL_LOCAL_MAIN_HOOK=Toadkit_MainHook -DTCL_LOCAL_APPINIT=Toadkit_AppInit] - COMPILE WISHSHELL [file join $PWD tk unix tclAppInit.c] [list -DTK_LOCAL_MAIN_HOOK=Toadkit_MainHook -DTK_LOCAL_APPINIT=Toadkit_AppInit] + COMPILE TCLSHELL [file join $_TclSrcDir tclAppInit.c] [list -DTCL_LOCAL_MAIN_HOOK=Toadkit_MainHook -DTCL_LOCAL_APPINIT=Toadkit_AppInit] + COMPILE WISHSHELL [file join $_TkSrcDir tkAppInit.c] [list -DTK_LOCAL_MAIN_HOOK=Toadkit_MainHook -DTK_LOCAL_APPINIT=Toadkit_AppInit] + lappend ::KIT(LIBTOADKIT_OBJS) [file join $_TclSrcDir libtclstub8.6.a] } - - ### # Link together our executable ### - doexec ar cr libtoadkit.a {*}$::KIT(LIBTOADKIT_OBJS) [file join tcl $::odie(tcl_src_dir) 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) - set _TclSrcDir [file join tcl $::odie(tcl_src_dir)] - 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 - - ### - # Build a starter VFS for both Tcl and wish - ### - set VFSROOT [file join $PWD tclkit.vfs] - set PKGROOT [file join $PWD tclkit.pkg] - - foreach path [glob [file join $PWD tcl pkgs *]] { - if {[string range [file tail $HERE] 0 3] eq "itcl"} continue - if {![file isdirectory $HERE]} continue - cd $HERE - puts "$HERE" - if {![file exists $HERE/Makefile]} { - if {[file exists $HERE/Makefile.in]} { - doexec sh configure --with-tcl=$PWD/tcl/$::odie(tcl_src_dir) --with-tclinclude=$PWD/tcl/generic --with-tzdata --enable-shared --enable-threads + doexec ar cr $::TARGET(libtoadkit.a) {*}$::KIT(LIBTOADKIT_OBJS) + doexec ranlib $::TARGET(libtoadkit.a) +} + +if {$build(packages)} { + cd $PWD + if {[file exists $::KIT(PKGROOT)]} { + file delete -force $::KIT(PKGROOT) + } + set pkg_paths [glob [file join $::KIT(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 $::KIT(TCLSRCDIR) generic] --with-tzdata --enable-shared --enable-threads } else { continue } } - puts "INSTALLING to VFS [file tail $HERE]" - domake install DESTDIR=$PKGROOT - } - cd $PWD - - if {[file exists $VFSROOT]} { - file delete -force $VFSROOT - } - copyDir $PKGROOT/usr/local/lib $VFSROOT/pkgs - - - copyDir tcl/library $VFSROOT/boot/tcl - if { $::odie(platform) eq "windows" } { - set ddedll [glob -nocomplain tcl/win/tcldde*.dll] - if {$ddedll != {}} { - file copy $ddedll $VFSROOT/boot/tcl/dde - } - set regdll [glob -nocomplain tcl/win/tclreg*.dll] - if {$regdll != {}} { - file copy $regdll $VFSROOT/boot/tcl/reg - } - } else { - file delete -force $VFSROOT/boot/tcl/dde - file delete -force $VFSROOT/boot/tcl/reg - } - - # For the following packages, cat their pkgIndex files to tclIndex - if {$::tcl_platform(platform) eq {unix}} { - file attributes [file join $VFSROOT boot tcl tclIndex] -permissions 0744 - } else { - file attributes [file join $VFSROOT boot tcl tclIndex] -readonly 0 - } - - set fout [open [file join $VFSROOT boot tcl tclIndex] a] - puts $fout {# -# MANIFEST OF INCLUDED PACKAGES -# -set VFSROOT $dir -} - pkgIndexDir tcl/library $fout [file join $VFSROOT boot tcl] - close $fout - - copyDir tk/library $VFSROOT/boot/tk - if { $::odie(platform) eq "windows" } { - set dllsrc tk/win/[string trim $::TK(dll_file) \"] - } else { - set dllsrc tk/unix/[string trim $::TK(dll_file) \"] - } - file copy -force $dllsrc [file join $VFSROOT BOOT tk] - set fout [open [file join $VFSROOT BOOT tcl tclIndex] a] - puts $fout [string map [list @TKVERSION@ $::TK(version)$::TK(patch_level) @TKDLL@ [string trim $::TK(dll_file) \"]] { + puts "INSTALLING to VFS [file tail $pkgpath]" + domake install DESTDIR=$::KIT(PKGROOT) + } +} + +if {$build(tclkit_bare)} { + cd $PWD + # 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 $::TARGET(libtoadkit.a) {*}$::TCL(libs) + lappend cmd -o $::TARGET(tclkit_bare) {*}$::KIT(LDFLAGS_CONSOLE) + doexec {*}$cmd +} +if {$build(basekitvfs)} { + cd $PWD + if {[file exists $::KIT(BASEVFS)]} { + file delete -force $::KIT(BASEVFS) + } + puts "*** +*** BASE KIT VFS PACKAGES +***" + puts [list COPY [file join $::KIT(PKGROOT) [string trimleft $::KIT(PKGPREFIX) /] lib]] + copyDir [file join $::KIT(PKGROOT) [string trimleft $::KIT(PKGPREFIX) /] lib] [file join $::KIT(BASEVFS) pkgs] + + copyDir [file join $::KIT(TCLSRCDIR) library] [file join $::KIT(BASEVFS) boot tcl] + if { $::KIT(platform) eq "windows" } { + set ddedll [glob -nocomplain [file join $_TclSrcDir tcldde*.dll]] + if {$ddedll != {}} { + file copy $ddedll [file join $::KIT(BASEVFS) boot tcl dde] + } + set regdll [glob -nocomplain [file join $_TclSrcDir tclreg*.dll]] + if {$regdll != {}} { + file copy $regdll [file join $::KIT(BASEVFS) boot tcl reg] + } + } else { + file delete -force [file join $::KIT(BASEVFS) boot tcl dde] + file delete -force [file join $::KIT(BASEVFS) boot tcl reg] + } + + copyDir [file join $::KIT(TKSRCDIR) library] $::KIT(BASEVFS)/boot/tk + if { $::KIT(platform) eq "windows" } { + set dllsrc [file join $_TkSrcDir [string trim $::TK(dll_file) \"]] + } else { + set dllsrc [file join $_TkSrcDir [string trim $::TK(lib_file) \"]] + } + file copy -force $dllsrc [file join $::KIT(BASEVFS) boot tk] + set fout [open [file join $::KIT(BASEVFS) boot tk pkgIndex.tcl] w] + set map [list @TKVERSION@ $::TK(version)$::TK(patch_level)] + if { $::KIT(platform) eq "windows" } { + lappend map @TKDLL@ [string trim $::TK(dll_file) \"] + } else { + lappend map @TKDLL@ [string trim $::TK(lib_file) \"] + } + puts $fout [string map $map { package ifneeded Tk @TKVERSION@ [list load $::tk_library/@TKDLL@ Tk] }] close $fout } -cd $PWD - -if {[lindex $argv 0] eq "toadkit"} { - file copy -force tclkit_bare$::KIT(EXEEXT) toadkit$::KIT(EXEEXT) - puts [list AUTOPATH $::auto_path] - package ifneeded zipfile::mkzip 1.2 [list source [file join $HERE mkzip.tcl]] - package require zipfile::mkzip - #file copy -force [file join $HERE default_tclsh.tcl] tclkit.vfs/main.tcl - ::zipfile::mkzip::mkzip toadkit$::KIT(EXEEXT) -runtime tclkit_bare$::KIT(EXEEXT) -directory tclkit.vfs -} - -if {[lindex $argv 0] eq "wrap"} { - set name [lindex $argv 1] - set path [lindex $argv 2] - file copy -force tclkit_bare$::KIT(EXEEXT) toadkit$::KIT(EXEEXT) - puts [list AUTOPATH $::auto_path] - package ifneeded zipfile::mkzip 1.2 [list source [file join $HERE mkzip.tcl]] - package require zipfile::mkzip - copyDir tclkit.vfs/boot $HERE/boot - copyDir tclkit.vfs/lib $HERE/lib - ::zipfile::mkzip::mkzip ${name}$::KIT(EXEEXT) -runtime tclkit_bare$::KIT(EXEEXT) -directory $HERE +if {$COMMAND eq "toadkit"} { + ::practcl::wrap $::PWD toadkit toadkit-vfs +} + +if {$COMMAND eq "wrap"} { + puts "WRAP {*}[lrange $argv 1 end]" + ::practcl::wrap $::PWD {*}[lrange $argv 1 end] } Index: generic/rc4.c ================================================================== --- generic/rc4.c +++ generic/rc4.c @@ -102,11 +102,13 @@ /* ** Destructor for codec. */ static void CodecDestructor(void *pCodec){ - Tcl_Free(pCodec); + printf("CODE DESTRUCTOR (shell)\n"); + Tcl_Free((char *)pCodec); + printf("/CODE DESTRUCTOR (shell)\n"); } /* ** Usage: rc4 NAME PASSWORD ** @@ -484,10 +486,15 @@ /* ** Initialize the rc4 codec subsystem. */ DLLEXPORT int Rc4_Init(Tcl_Interp *interp){ + #ifdef USE_TCL_STUBS + if (Tcl_InitStubs(interp, "8.5", 0)==NULL) { + return TCL_ERROR; + } + #endif Tcl_CreateObjCommand(interp, "rc4", Rc4ObjCmd, 0, 0); Tcl_CreateObjCommand(interp, "rc4seed", Rc4SeedObjCmd, 0, 0); Tcl_CreateObjCommand(interp, "rc4encrypt", Rc4EncryptObjCmd, 0, 0); Tcl_CreateObjCommand(interp, "rc4decrypt", Rc4DecryptObjCmd, 0, 0); Tcl_CreateObjCommand(interp, "source_encrypt", Rc4EncryptSourceObjCmd, 0, 0); Index: generic/zvfsboot.c ================================================================== --- generic/zvfsboot.c +++ generic/zvfsboot.c @@ -63,16 +63,22 @@ Tcl_DStringAppendElement(&preinit,vfsmountpoint); if(Tcl_FSAccess(vfstcllib,F_OK)==0) { Tcl_DStringAppend(&preinit,"\nset tcl_library ",-1); Tcl_DStringAppendElement(&preinit,Tcl_GetString(vfstcllib)); + Tcl_DStringAppend(&preinit,"\nset auto_path {}",-1); } if(Tcl_FSAccess(vfstklib,F_OK)==0) { Tcl_DStringAppend(&preinit,"\nset tk_library ",-1); Tcl_DStringAppendElement(&preinit,Tcl_GetString(vfstklib)); } - Tcl_DStringAppend(&preinit,"\nlappend ::auto_path [file join $::SRCDIR pkgs]",-1); + Tcl_DStringAppend(&preinit,"\nif {[file exists [file join $::SRCDIR packages.tcl]]} \{",-1); + Tcl_DStringAppend(&preinit,"\n #In a wrapped exe, we don't go out to the environment",-1); + Tcl_DStringAppend(&preinit,"\n set auto_path {}",-1); + Tcl_DStringAppend(&preinit,"\n set dir $::SRCDIR",-1); + Tcl_DStringAppend(&preinit,"\n source [file join $::SRCDIR packages.tcl]",-1); + Tcl_DStringAppend(&preinit,"\n\}",-1); vfspreinit=Tcl_NewStringObj(Tcl_DStringValue(&preinit),-1); /* NOTE: We never decr this refcount, lest the contents of the script be deallocated */ Tcl_IncrRefCount(vfspreinit); TclSetPreInitScript(Tcl_GetString(vfspreinit)); Index: odieConfig.sh.in ================================================================== --- odieConfig.sh.in +++ odieConfig.sh.in @@ -76,11 +76,13 @@ UNZIP=@UNZIP_PROG@ ODIE_RM=${ODIE_BUILD_TCLSH} ODIE_RM+=${ODIE_SRC_DIR}/scripts/rmdir.tcl SHERPA=${ODIE_BUILD_TCLSH} -SHERPA+=@ODIE_SANDBOX_PATH@/sherpa/sherpa.tcl +SHERPA+=@ODIE_SANDBOX_PATH@/gort/gort.tcl +GORT=${ODIE_BUILD_TCLSH} +GORT+=@ODIE_SANDBOX_PATH@/gort/gort.tcl KETTLE=${ODIE_BUILD_TCLSH} KETTLE+=${exec_prefix}/bin/kettle ### # Bits generated by autosetup Index: odieConfig.tcl.in ================================================================== --- odieConfig.tcl.in +++ odieConfig.tcl.in @@ -67,11 +67,12 @@ wish_shell "@WISH_PROG@" zzetup "${exec_prefix}/bin/zzipsetupstub@EXEEXT@" wish_kit "@TKKIT_PROG@" tcl_kit "@TCLKIT_PROG@" toad_kit "@TOADKIT_PROG@" - sherpa "@ODIE_BUILD_TCLSH@ @ODIE_SANDBOX_PATH@/sherpa/sherpa.tcl" + gort "@ODIE_BUILD_TCLSH@ @ODIE_SANDBOX_PATH@/gort/gort.tcl" + sherpa "@ODIE_BUILD_TCLSH@ @ODIE_SANDBOX_PATH@/gort/gort.tcl" kettle "${exec_prefix}/bin/kettle" zip_kit "${exec_prefix}/bin/zipkit.zip" lib "$prefix/lib" rc "@RC@" res "@RES@" Index: scripts/common.tcl ================================================================== --- scripts/common.tcl +++ scripts/common.tcl @@ -29,13 +29,13 @@ source [file join $::autosetup(libdir) $file] } proc ::noop args {} -namespace eval ::sherpa_bootstrap {} +namespace eval ::gort_bootstrap {} -proc ::sherpa_bootstrap::download_fossil {pkg} { +proc ::gort_bootstrap::download_fossil {pkg} { variable distribution set PKG_SRCPATH [sandbox_path $pkg] set fosdb [fossil_db $pkg] if {![file exists $fosdb]} { puts "Fossil clone $pkg" @@ -62,23 +62,23 @@ doexec $::odie(fossil) update } return ${PKG_SRCPATH} } -proc ::sherpa_bootstrap::fossil_db pkg { +proc ::gort_bootstrap::fossil_db pkg { if {[file exists [file join $::odie(download) $pkg.fossil]]} { return [file join $::odie(download) $pkg.fossil] } return [file join $::odie(download) $pkg.fos] } -proc ::sherpa_bootstrap::sandbox_path pkg { +proc ::gort_bootstrap::sandbox_path pkg { return [file join $::odie(sandbox) $pkg] } -proc ::sherpa_bootstrap::build_gnumake {pkg action} { +proc ::gort_bootstrap::build_gnumake {pkg action} { puts "BUILD GNUMAKE $pkg $action" if {$action eq "install"} { set PKG_SRCPATH [sandbox_path $pkg] cd ${PKG_SRCPATH} doexec $::odie(fossil) update @@ -108,30 +108,30 @@ exit 1 } } } -proc ::sherpa_bootstrap::build_sak {pkg action} { +proc ::gort_bootstrap::build_sak {pkg action} { if {$action eq "install"} { set PKG_SRCPATH [sandbox_path $pkg] doexec $::odie(build_tclsh) [file join $PKG_SRCPATH installer.tcl] \ -app-path $::odie(prefix)/bin -pkg-path $::odie(prefix)/lib/$pkg \ -no-examples -no-nroff -no-html \ -no-wait -no-gui } } -proc ::sherpa_bootstrap::build_kettle {pkg action} { +proc ::gort_bootstrap::build_kettle {pkg action} { set PKG_SRCPATH [sandbox_path $pkg] if {$pkg eq "kettle"} { doexec $::odie(build_tclsh) [file join $PKG_SRCPATH kettle] -f [file join $PKG_SRCPATH build.tcl] $action } else { doexec $::odie(build_tclsh) $::odie(kettle) -f [file join $PKG_SRCPATH build.tcl] $action } } -proc ::sherpa_bootstrap::build_sqlite {pkg action} { +proc ::gort_bootstrap::build_sqlite {pkg action} { ### # Sqlite ### puts "INSTALLING SQLITE" set SQLITE_VERSION 3.8.7.2 @@ -156,21 +156,21 @@ doexec sh ./configure --prefix=[::cygpath $::odie(local_repo)] --libdir=[::cygpath $::odie(local_repo)/lib] --host=$::odie(host) } doexec make install } -proc ::sherpa_bootstrap::install_package package { +proc ::gort_bootstrap::install_package package { variable distribution set pkginfo [dict get $distribution $package] puts [list $package $pkginfo] set download [dict get $pkginfo get_proc] $download $package set build [dict get $pkginfo build_proc] $build $package install } -proc ::sherpa_bootstrap::distribution {name properties} { +proc ::gort_bootstrap::distribution {name properties} { variable distribution foreach {field value} $properties { dict set distribution $name $field $value } @@ -180,58 +180,58 @@ if {![dict exists $distribution $name build_proc]} { dict set distribution $name build_proc ::noop } } -::sherpa_bootstrap::distribution sqlite { +::gort_bootstrap::distribution sqlite { get_proc ::noop build_proc build_sqlite #build_proc ::noop } if {!$::odie(windows)} { - ::sherpa_bootstrap::distribution tclx { + ::gort_bootstrap::distribution tclx { get_proc download_fossil build_proc build_gnumake } if 0 { - ::sherpa_bootstrap::distribution kettle { + ::gort_bootstrap::distribution kettle { get_proc download_fossil requires {tclx tcllib tklib} build_proc build_kettle } } } -::sherpa_bootstrap::distribution tclvfs { +::gort_bootstrap::distribution tclvfs { get_proc download_fossil requires tcllib build_proc build_gnumake } -::sherpa_bootstrap::distribution taolib { +::gort_bootstrap::distribution taolib { get_proc download_fossil requires {sqlite tcllib tklib} build_proc build_sak } -::sherpa_bootstrap::distribution tcllib { +::gort_bootstrap::distribution tcllib { get_proc download_fossil fossil_branch odie build_proc build_sak } -::sherpa_bootstrap::distribution tklib { +::gort_bootstrap::distribution tklib { get_proc download_fossil requires tcllib build_proc build_sak } -::sherpa_bootstrap::distribution odielib { +::gort_bootstrap::distribution odielib { get_proc download_fossil fossil_branch autosetup requires {tcllib sqlite} build_proc build_gnumake } -::sherpa_bootstrap::distribution sherpa { +::gort_bootstrap::distribution gort { get_proc download_fossil fossil_branch trunk requires {tcllib odielib taolib sqlite} build_proc build_gnumake } @@ -242,19 +242,19 @@ ### # Make sure the odielib toolkit is downloaded ### if {![file exists [file join $::odie(sandbox) odielib modules odie index.tcl]]} { - ::sherpa_bootstrap::download_fossil odielib + ::gort_bootstrap::download_fossil odielib } source [file join $path .. odielib modules odie index.tcl] source [file join $path .. odielib modules cmdline cmdline.tcl] source [file join $path .. odielib modules fileutil index.tcl] source [file join $path .. odielib modules codebale index.tcl] -#::sherpa_bootstrap::distribution sherpa { +#::gort_bootstrap::distribution gort { # get_proc download_fossil # requires {taolib tcllib odielib kettle} # build_proc build_kettle #} ADDED scripts/gort.tcl Index: scripts/gort.tcl ================================================================== --- /dev/null +++ scripts/gort.tcl @@ -0,0 +1,81 @@ +#!/bin/sh +# Copyright (c) 2006-2011 WorkWare Systems http://www.workware.net.au/ +# All rights reserved +# vim:se syntax=tcl: +# \ +dir=`dirname "$0"`; exec "`$dir/../autosetup/find-tclsh`" "$0" "$@" + +### +# Micronized version of gort for bootstrapping Odie +### + +set path [file normalize [file join [file dirname [file normalize [info script]]] ..]] +source [file join $path scripts common.tcl] + +namespace eval ::command {} + +proc ::command::help {} { + foreach command [lsort -dictionary [info command ::command::*]] { + puts " * [namespace tail $command]" + } +} + +proc ::command::package-list {} { + foreach distro [lsort -dictionary [dict keys $::gort_bootstrap::distribution]] { + puts " * $distro" + } +} + +proc ::command::install {package} { + if {$package eq "all"} { + install-all + return + } + ::gort_bootstrap::install_package $package +} + +proc ::command::install-all {} { + set info $::gort_bootstrap::distribution + set allpkgs [lsort -dictionary [dict keys $info]] + set installed {} + foreach item $allpkgs { + if {[dict exists $info $item requires]} { + set requires($item) [dict get $info $item requires] + } else { + set requires($item) {} + } + } + + for {set i 0} {$i < [llength $allpkgs]} {incr i} { + foreach item $allpkgs { + if { $item in $installed } continue + set needs {} + foreach req $requires($item) { + if { $req ni $installed } { + lappend needs $req + } + } + if {[llength $needs]} { + puts [list $item needs $needs] + continue + } + lappend installed $item + } + } + foreach item $installed { + puts "INSTALLING $item" + } + foreach item $installed { + ::gort_bootstrap::install_package $item + } +} + +set method [lindex $argv 0] +if { [info command ::command::$method] eq {} } { + puts stderr "Invalid command: $method." + ::command::help + exit 1 +} +::command::$method {*}[lrange $argv 1 end] +update +exit 0 Index: scripts/make_distclean.sh ================================================================== --- scripts/make_distclean.sh +++ scripts/make_distclean.sh @@ -12,14 +12,11 @@ cd ${ODIE_SANDBOX_PATH}/tcl-static/${ODIE_TCL_PLATFORM_DIR} ; make distclean cd ${ODIE_SANDBOX_PATH}/tk-static/${ODIE_TCL_PLATFORM_DIR} ; make distclean cd ${ODIE_SANDBOX_PATH}/sqlite/tea ; make distclean cd ${ODIE_SANDBOX_PATH}/tclvfs ; make distclean cd ${ODIE_SANDBOX_PATH}/tcllib ; make distclean -cd ${ODIE_SRC_DIR}/apps/sherpa ; make clean -cd ${ODIE_SRC_DIR}/src/toadkit ; make clean -cd ${ODIE_SRC_DIR}/src/odielib ; make clean -cd ${ODIE_SRC_DIR}/src/odielib ; make distclean +cd ${ODIE_SRC_DIR} ; ${ODIE_BUILD_TCLSH} build.tcl clean find ${ODIE_SRC_DIR} -type d -iname "*.vfs" -exec rm {} \; if [ ! -f "odieConfig.sh" ]; then rm odieConfig.sh ADDED scripts/make_gort.tcl Index: scripts/make_gort.tcl ================================================================== --- /dev/null +++ scripts/make_gort.tcl @@ -0,0 +1,56 @@ +#!/bin/sh +# Copyright (c) 2006-2011 WorkWare Systems http://www.workware.net.au/ +# All rights reserved +# vim:se syntax=tcl: +# \ +dir=`dirname "$0"`; exec "`$dir/../autosetup/find-tclsh`" "$0" "$@" + +set path [file dirname [file normalize [info script]]] +proc ::doexec args { + exec {*}$args >&@ stdout +} + +source $path/../odieConfig.tcl + +proc get_distro {pkg {tag trunk} {local_path {}}} { + if {$local_path eq {}} { + set local_path $pkg + } + set PKG_SRCPATH $::odie(sandbox)/$local_path + if {![file exists $::odie(download)/$pkg.fos]} { + puts "Fossil clone $pkg" + doexec $::odie(fossil) clone $::odie(mirror_url)/$pkg $::odie(download)/$pkg.fos + } + + if {![file exists ${PKG_SRCPATH}/$::odie(fossil_checkout)]} { + puts "Fossil open $local_path" + file mkdir ${PKG_SRCPATH} + cd ${PKG_SRCPATH} + doexec $::odie(fossil) open $::odie(download)/$pkg.fos + } + cd ${PKG_SRCPATH} + doexec $::odie(fossil) update $tag + return ${PKG_SRCPATH} +} + +get_distro tcllib odie +get_distro gort trunk +get_distro gort sherpa sherpa + +### +# Build supporting libraries needed by Gort +## +file mkdir $::odie(prefix)/bin +# Rebuild gort +set GORT_SRCPATH $::odie(src_dir)/../gort +set SHERPA_SRCPATH $::odie(src_dir)/../sherpa + +if {$::tcl_platform(platform) eq "windows"} { + file copy -force ${GORT_SRCPATH}/gort.tcl $::odie(prefix)/bin/gort.tcl + file copy -force ${SHERPA_SRCPATH}/sherpa.tcl $::odie(prefix)/bin/sherpa.tcl +} else { + file delete $::odie(prefix)/bin/gort + file link -symbolic $::odie(prefix)/bin/gort ${GORT_SRCPATH}/gort.tcl + file delete $::odie(prefix)/bin/sherpa + file link -symbolic $::odie(prefix)/bin/sherpa ${SHERPA_SRCPATH}/sherpa.tcl +} DELETED scripts/make_sherpa.tcl Index: scripts/make_sherpa.tcl ================================================================== --- scripts/make_sherpa.tcl +++ /dev/null @@ -1,49 +0,0 @@ -#!/bin/sh -# Copyright (c) 2006-2011 WorkWare Systems http://www.workware.net.au/ -# All rights reserved -# vim:se syntax=tcl: -# \ -dir=`dirname "$0"`; exec "`$dir/../autosetup/find-tclsh`" "$0" "$@" - -set path [file dirname [file normalize [info script]]] -proc ::doexec args { - exec {*}$args >&@ stdout -} - -source $path/../odieConfig.tcl - -proc get_distro {pkg {tag trunk}} { - set PKG_SRCPATH $::odie(sandbox)/$pkg - if {![file exists $::odie(download)/$pkg.fos]} { - puts "Fossil clone $pkg" - doexec $::odie(fossil) clone $::odie(mirror_url)/$pkg $::odie(download)/$pkg.fos - } - - if {![file exists ${PKG_SRCPATH}/$::odie(fossil_checkout)]} { - puts "Fossil open $pkg" - file mkdir ${PKG_SRCPATH} - cd ${PKG_SRCPATH} - doexec $::odie(fossil) open $::odie(download)/$pkg.fos - } - cd ${PKG_SRCPATH} - doexec $::odie(fossil) update $tag - return ${PKG_SRCPATH} -} - -get_distro tcllib odie -get_distro sherpa sherpa - -### -# Build supporting libraries needed by Sherpa -## -file mkdir $::odie(prefix)/bin -# Rebuild sherpa -set SHERPA_SRCPATH $::odie(src_dir)/../sherpa -if {$::tcl_platform(platform) eq "windows"} { - file copy -force ${SHERPA_SRCPATH}/sherpa.cmd $::odie(prefix)/bin/sherpa.cmd - file copy -force ${SHERPA_SRCPATH}/sherpa.tcl $::odie(prefix)/bin/sherpa.tcl - file copy -force ${SHERPA_SRCPATH}/sherpa.tcl $::odie(prefix)/bin/sherpa -} else { - file delete $::odie(prefix)/bin/sherpa - file link -symbolic $::odie(prefix)/bin/sherpa ${SHERPA_SRCPATH}/sherpa.tcl -} Index: scripts/make_tcl.sh ================================================================== --- scripts/make_tcl.sh +++ scripts/make_tcl.sh @@ -35,24 +35,23 @@ #cd ${SANDBOX}/tcl #${FOSSIL} update ${TCL_FOSSIL_BRANCH} cd ${TCL_SRCPATH} # Build Tcl twice. Once statically, once dynamically -echo Build Static Tcl -if [ "${ODIE_HOST}" != "${ODIE_TARGET}" ] ; then - sh ./configure --enable-shared=no --with-tzdata --host=${ODIE_TARGET} ${TCL_CONFIG_FLAGS} -else - sh ./configure --enable-shared=no --with-tzdata ${TCL_CONFIG_FLAGS} -fi -make clean -make binaries -echo "COPYING STATIC LIBRARY" -source tclConfig.sh -cp -f $TCL_LIB_FILE ${ODIE_STATIC_TCLLIB} -cp -f tclConfig.sh ${exec_prefix}/lib/tclkitConfig.sh - -cd ${TCL_SRCPATH} +#echo Build Static Tcl +#if [ "${ODIE_HOST}" != "${ODIE_TARGET}" ] ; then +# sh ./configure --enable-shared=no --with-tzdata --host=${ODIE_TARGET} ${TCL_CONFIG_FLAGS} +#else +# sh ./configure --enable-shared=no --with-tzdata ${TCL_CONFIG_FLAGS} +#fi +#make clean +#make binaries +#echo "COPYING STATIC LIBRARY" +#source tclConfig.sh +#cp -f $TCL_LIB_FILE ${ODIE_STATIC_TCLLIB} +#cp -f tclConfig.sh ${exec_prefix}/lib/tclkitConfig.sh +#cd ${TCL_SRCPATH} echo Build Dynamic Tcl if [ "${ODIE_HOST}" != "${ODIE_TARGET}" ] ; then sh ./configure --prefix=${LOCAL_REPO} --libdir=${LOCAL_REPO}/lib --with-tzdata --host=${ODIE_TARGET} ${TCL_CONFIG_FLAGS} else sh ./configure --prefix=${LOCAL_REPO} --libdir=${LOCAL_REPO}/lib --with-tzdata ${TCL_CONFIG_FLAGS} Index: scripts/mkdoc.tcl ================================================================== --- scripts/mkdoc.tcl +++ scripts/mkdoc.tcl @@ -1,10 +1,5 @@ -namespace eval sherpa {} - -### -# Begin -### source [file join [file dirname [file normalize [info script]]] common.tcl] package require codebale ::codebale::mkdoc_embedded_html $::odielib(srcroot) $::odielib(modules) [file join $::odielib(srcroot) autodoc] \ DELETED scripts/sherpa.tcl Index: scripts/sherpa.tcl ================================================================== --- scripts/sherpa.tcl +++ /dev/null @@ -1,81 +0,0 @@ -#!/bin/sh -# Copyright (c) 2006-2011 WorkWare Systems http://www.workware.net.au/ -# All rights reserved -# vim:se syntax=tcl: -# \ -dir=`dirname "$0"`; exec "`$dir/../autosetup/find-tclsh`" "$0" "$@" - -### -# Micronized version of sherpa for bootstrapping Odie -### - -set path [file normalize [file join [file dirname [file normalize [info script]]] ..]] -source [file join $path scripts common.tcl] - -namespace eval ::command {} - -proc ::command::help {} { - foreach command [lsort -dictionary [info command ::command::*]] { - puts " * [namespace tail $command]" - } -} - -proc ::command::package-list {} { - foreach distro [lsort -dictionary [dict keys $::sherpa_bootstrap::distribution]] { - puts " * $distro" - } -} - -proc ::command::install {package} { - if {$package eq "all"} { - install-all - return - } - ::sherpa_bootstrap::install_package $package -} - -proc ::command::install-all {} { - set info $::sherpa_bootstrap::distribution - set allpkgs [lsort -dictionary [dict keys $info]] - set installed {} - foreach item $allpkgs { - if {[dict exists $info $item requires]} { - set requires($item) [dict get $info $item requires] - } else { - set requires($item) {} - } - } - - for {set i 0} {$i < [llength $allpkgs]} {incr i} { - foreach item $allpkgs { - if { $item in $installed } continue - set needs {} - foreach req $requires($item) { - if { $req ni $installed } { - lappend needs $req - } - } - if {[llength $needs]} { - puts [list $item needs $needs] - continue - } - lappend installed $item - } - } - foreach item $installed { - puts "INSTALLING $item" - } - foreach item $installed { - ::sherpa_bootstrap::install_package $item - } -} - -set method [lindex $argv 0] -if { [info command ::command::$method] eq {} } { - puts stderr "Invalid command: $method." - ::command::help - exit 1 -} -::command::$method {*}[lrange $argv 1 end] -update -exit 0 Index: scripts/upload.tcl ================================================================== --- scripts/upload.tcl +++ scripts/upload.tcl @@ -60,11 +60,11 @@ if {[file exists $::odie(wish_kit)]} { upload $fout $::odie(wish_kit) ${server} $path "Base kit with tk" } upload $fout $::odie(tcl_kit) ${server} $path "Base kit with no tk" upload $fout $::odie(zip_kit) ${server} $path "Sourceable Zipfile" -upload $fout $::odie(sherpa) ${server} $path "The Sherpa package manager" +upload $fout $::odie(gort) ${server} $path "The Gort package manager" puts $fout "Config Files" upload $fout $here/../odieConfig.sh ${server} $path "Odie Configuration Paramters (sh readable)" upload $fout $here/../odieConfig.tcl ${server} $path "Odie Configuration Paramters (tcl readable)" upload $fout ${exec_prefix}/lib/tclConfig.sh ${server} $path "Tcl Configuration Paramters (sh readable)" upload $fout ${exec_prefix}/lib/tkConfig.sh ${server} $path "Tk Configuration Paramters (sh readable)"