|
|
|
|
@ -2446,28 +2446,46 @@ set rtfolder $binfolder/runtime/$rt_os_arch
|
|
|
|
|
set rt_sourcefolder $sourcefolder/runtime ;#where our config lives |
|
|
|
|
#review - when building kits for other platforms - it's unlikely runtime will be marked as executable - we should probably process all files in runtime folder except those with certain extensions |
|
|
|
|
|
|
|
|
|
proc ::punkboot::lib::runtime_buildcopyname {runtime} { |
|
|
|
|
if {$::tcl_platform(platform) eq "windows"} { |
|
|
|
|
set rtname [file rootname [file tail $runtime]] |
|
|
|
|
set bcname ${rtname}_BUILDCOPY.exe |
|
|
|
|
} else { |
|
|
|
|
set rtname [file tail $runtime] |
|
|
|
|
set bcname ${rtname}_BUILDCOPY |
|
|
|
|
} |
|
|
|
|
return $bcname |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
set runtimes [list] |
|
|
|
|
if {[file dirname [info nameofexecutable]] eq $rtfolder} { |
|
|
|
|
#fix so that we can find and use a runtime tclkit that is currently in use as the runtime that is running this script. |
|
|
|
|
# - when the current runtime is using a runtime in the rtfolder that is a tclkit, it is mounted at the same path as the physical file and so appears to Tcl as if it's a directory. |
|
|
|
|
# - use external filesystem tools to make a copy of the file |
|
|
|
|
if {$::tcl_platform(platform) eq "windows"} { |
|
|
|
|
exec cmd /c copy [info nameofexecutable] $rtfolder/[file rootname [file tail [info nameofexecutable]]]_BUILDCOPY.exe |
|
|
|
|
#exec cmd /c copy [info nameofexecutable] $rtfolder/[file rootname [file tail [info nameofexecutable]]]_BUILDCOPY.exe |
|
|
|
|
exec cmd /c copy [info nameofexecutable] $rtfolder/[punkboot::lib::runtime_buildcopyname [info nameofexecutable]] |
|
|
|
|
} else { |
|
|
|
|
exec cp [info nameofexecutable] $rtfolder/[file tail [info nameofexecutable]]_BUILDCOPY |
|
|
|
|
#exec cp [info nameofexecutable] $rtfolder/[file tail [info nameofexecutable]]_BUILDCOPY |
|
|
|
|
exec cp [info nameofexecutable] $rtfolder/[punkboot::lib::runtime_buildcopyname [info nameofexecutable]] |
|
|
|
|
} |
|
|
|
|
lappend runtimes [file tail [info nameofexecutable]] |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
set rtfolder_files [glob -nocomplain -dir $rtfolder -types {f} -tail *] |
|
|
|
|
set exclusions {.config .md .ico .txt .doc .pdf .htm .html} ;#we don't encourage other files in runtime folder aside from mapvfs.config - but lets ignore some common possibilities |
|
|
|
|
lappend exclusions .zip .7z .pea .bz2 .tar .gz .tgz .z .xz ;#don't allow archives to directly be treated as runtimes - tolerate presence but require user to unpack or rename if they're to be used as runtimes |
|
|
|
|
lappend exclusions .tail ;#result of running sdx mksplit on a kit - in theory the .head could be used - review/test |
|
|
|
|
set runtimes [list] |
|
|
|
|
foreach f $rtfolder_files { |
|
|
|
|
if {[string match "*_BUILDCOPY*" $f]} { |
|
|
|
|
continue |
|
|
|
|
} |
|
|
|
|
if {[string tolower [file extension $f]] in $exclusions} { |
|
|
|
|
continue |
|
|
|
|
} |
|
|
|
|
lappend runtimes $f |
|
|
|
|
if {$f ni $runtimes} { |
|
|
|
|
lappend runtimes $f |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
if {![llength $runtimes]} { |
|
|
|
|
puts stderr "No executable runtimes found in $rtfolder - unable to build any .vfs folders into executables." |
|
|
|
|
@ -2476,35 +2494,7 @@ if {![llength $runtimes]} {
|
|
|
|
|
exit 0 |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
set have_sdx 1 |
|
|
|
|
set sdxpath [auto_execok $binfolder/sdx] |
|
|
|
|
if {$sdxpath eq ""} { |
|
|
|
|
set sdxpath [auto_execok [file dirname [info nameofexecutable]]/sdx] |
|
|
|
|
if {$sdxpath eq ""} { |
|
|
|
|
#last resort - look on path |
|
|
|
|
set sdxpath [auto_execok sdx] |
|
|
|
|
} |
|
|
|
|
if {$sdxpath eq ""} { |
|
|
|
|
#last resort - a tclkit and sdx.kit fine |
|
|
|
|
if {[file exists $binfolder/sdx.kit]} { |
|
|
|
|
set tclkitpath [auto_execok $binfolder/tclkit] |
|
|
|
|
if {$tclkitpath eq ""} { |
|
|
|
|
set tclkitpath [auto_execok tclkit] |
|
|
|
|
} |
|
|
|
|
set sdxpath [list {*}$tclkitpath $binfolder/sdx.kit] |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if {$sdxpath eq "" || [catch {exec {*}$sdxpath help} errM]} { |
|
|
|
|
puts stderr "FAILED to find usable sdx command or tclkit executable with sdx.bat" |
|
|
|
|
puts stderr "If tclkit-based runtimes are required - check that sdx executable is in bin folder of project or in same folder as tcl/punk executable or on path" |
|
|
|
|
puts stderr "This is not a problem if tcl8.7/tcl9+ kits using the preferred method 'zipfs' are to be used, or if cookfs based kits are to be used." |
|
|
|
|
puts stderr "err: $errM" |
|
|
|
|
#exit 1 |
|
|
|
|
set have_sdx 0 |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
#previous have_sdx test location |
|
|
|
|
# -- --- --- --- --- --- --- --- --- --- |
|
|
|
|
#load mapvfs.config file (if any) in runtime folder to map runtimes to vfs folders. |
|
|
|
|
#build a dict keyed on runtime executable name. |
|
|
|
|
@ -2631,7 +2621,7 @@ foreach runtime [dict keys $runtime_vfs_map] {
|
|
|
|
|
#temp |
|
|
|
|
#build for current platform only for now |
|
|
|
|
if {![file exists $rtfolder/$runtime]} { |
|
|
|
|
dict set runtime_caps $runtime exitcode -1 error "find-fail" |
|
|
|
|
dict set runtime_caps $runtime exitcode -1 error "find-fail $rtfolder/$runtime" |
|
|
|
|
continue |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ -2749,6 +2739,58 @@ foreach runtimefile $runtimes {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
# -- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- |
|
|
|
|
set have_sdx 1 |
|
|
|
|
set sdxpath [auto_execok $binfolder/sdx] |
|
|
|
|
if {$sdxpath eq ""} { |
|
|
|
|
set sdxpath [auto_execok [file dirname [info nameofexecutable]]/sdx] |
|
|
|
|
if {$sdxpath eq ""} { |
|
|
|
|
#last resort - look on path |
|
|
|
|
set sdxpath [auto_execok sdx] |
|
|
|
|
} |
|
|
|
|
if {$sdxpath eq ""} { |
|
|
|
|
#last resorts - a tclkit and sdx.kit file |
|
|
|
|
if {[file exists $binfolder/sdx.kit]} { |
|
|
|
|
set tclkitpath [auto_execok $binfolder/tclkit] |
|
|
|
|
if {$tclkitpath eq ""} { |
|
|
|
|
set tclkitpath [auto_execok tclkit] |
|
|
|
|
} |
|
|
|
|
if {$tclkitpath ne ""} { |
|
|
|
|
set sdxpath [list {*}$tclkitpath $binfolder/sdx.kit] |
|
|
|
|
} else { |
|
|
|
|
#see if the runtime (or any runtime *for current platform*) has tclkit in the name or has_starkit(?) and use that |
|
|
|
|
#todo - review |
|
|
|
|
#picking first found for now - fix |
|
|
|
|
dict for {rtname rtprops} $runtime_caps { |
|
|
|
|
if {[dict exists $rtprops has_starkit] && [dict get $rtprops has_starkit]} { |
|
|
|
|
set testpath $rtfolder/$rtname |
|
|
|
|
if {[file exists $testpath]} { |
|
|
|
|
if {[file type $testpath] eq "directory"} { |
|
|
|
|
set alt_tclkitpath $rtfolder/[punkboot::lib::runtime_buildcopyname $testpath] |
|
|
|
|
} else { |
|
|
|
|
set alt_tclkitpath $testpath |
|
|
|
|
} |
|
|
|
|
if {[file exists $alt_tclkitpath]} { |
|
|
|
|
set sdxpath [list {*}$alt_tclkitpath $binfolder/sdx.kit] |
|
|
|
|
break |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if {$sdxpath eq "" || [catch {exec {*}$sdxpath help} errM]} { |
|
|
|
|
puts stderr "FAILED to find usable sdx command or tclkit executable with sdx.bat" |
|
|
|
|
puts stderr "If tclkit-based runtimes are required - check that sdx executable is in bin folder of project or in same folder as tcl/punk executable or on path" |
|
|
|
|
puts stderr "This is not a problem if tcl8.7/tcl9+ kits using the preferred method 'zipfs' are to be used, or if cookfs based kits are to be used." |
|
|
|
|
puts stderr "err: $errM" |
|
|
|
|
#exit 1 |
|
|
|
|
set have_sdx 0 |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
# -- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- |
|
|
|
|
|
|
|
|
|
set failed_kits [list] |
|
|
|
|
set installed_kits [list] |
|
|
|
|
set skipped_kits [list] |
|
|
|
|
|