From 3b4145930670639cf46fcd8b88e07d96effb9750 Mon Sep 17 00:00:00 2001 From: Julian Noble Date: Thu, 28 Aug 2025 22:05:38 +1000 Subject: [PATCH] update src/make.tcl to new bin/runtime/ locations --- src/make.tcl | 63 ++++++++++++++++++++++++++++++++-------------------- 1 file changed, 39 insertions(+), 24 deletions(-) diff --git a/src/make.tcl b/src/make.tcl index 06c5369f..1900e0ec 100644 --- a/src/make.tcl +++ b/src/make.tcl @@ -195,8 +195,8 @@ namespace eval ::punkboot::lib { } x86_64 { if {$tcl_platform(wordSize) == 4} { - # See Example <1> at the top of this file. - set cpu ix86 + # See Example <1> at the top of this file. + set cpu ix86 } } ppc - @@ -216,26 +216,26 @@ namespace eval ::punkboot::lib { switch -glob -- $plat { windows { if {$tcl_platform(platform) == "unix"} { - set plat cygwin + set plat cygwin } else { - set plat win32 + set plat win32 } if {$cpu eq "amd64"} { - # Do not check wordSize, win32-x64 is an IL32P64 platform. - set cpu x86_64 + # Do not check wordSize, win32-x64 is an IL32P64 platform. + set cpu x86_64 } } sunos { set plat solaris if {[string match "ix86" $cpu]} { - if {$tcl_platform(wordSize) == 8} { - set cpu x86_64 - } + if {$tcl_platform(wordSize) == 8} { + set cpu x86_64 + } } elseif {![string match "ia64*" $cpu]} { - # sparc - if {$tcl_platform(wordSize) == 8} { - append cpu 64 - } + # sparc + if {$tcl_platform(wordSize) == 8} { + append cpu 64 + } } } darwin { @@ -243,24 +243,24 @@ namespace eval ::punkboot::lib { # Correctly identify the cpu when running as a 64bit # process on a machine with a 32bit kernel if {$cpu eq "ix86"} { - if {$tcl_platform(wordSize) == 8} { - set cpu x86_64 - } + if {$tcl_platform(wordSize) == 8} { + set cpu x86_64 + } } } aix { set cpu powerpc if {$tcl_platform(wordSize) == 8} { - append cpu 64 + append cpu 64 } } hp-ux { set plat hpux if {![string match "ia64*" $cpu]} { - set cpu parisc - if {$tcl_platform(wordSize) == 8} { - append cpu 64 - } + set cpu parisc + if {$tcl_platform(wordSize) == 8} { + append cpu 64 + } } } osf1 { @@ -2296,8 +2296,23 @@ if {$::punkboot::command eq "bin"} { } #find runtimes -set rtfolder $sourcefolder/runtime +#set rtfolder $sourcefolder/runtime +#AAA + +switch -glob -- $this_platform_generic { + macosx-* { + #assuming universal binaries x86_64 and arm + set rt_os_arch macosx + } + default { + set rt_os_arch $this_platform_generic + } +} +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 + + 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 @@ -2311,7 +2326,7 @@ foreach f $rtfolder_files { } if {![llength $runtimes]} { puts stderr "No executable runtimes found in $rtfolder - unable to build any .vfs folders into executables." - puts stderr "Add runtimes to $sourcefolder/runtime if required" + puts stderr "Add runtimes to $rtfolder if required" #todo - don't exit - it is valid to use runtime of - to just build a .kit/.zipkit ? exit 0 } @@ -2350,7 +2365,7 @@ if {$sdxpath eq ""} { #build a dict keyed on runtime executable name. #If no mapfile (or no mapfile entry for that runtime) - the runtime will be paired with a matching .vfs folder in src folder. e.g punk.exe to src/punk.vfs #If vfs folders or runtime executables which are explicitly listed in the mapfile don't exist - warn on stderr - but continue. if such nonexistants found; prompt user for whether to continue or abort. -set mapfile $rtfolder/mapvfs.config +set mapfile $rt_sourcefolder/mapvfs.config set runtime_vfs_map [dict create] set vfs_runtime_map [dict create] if {[file exists $mapfile]} {