From cb650487eca265a1be6a9d53bd8504c0427e4505 Mon Sep 17 00:00:00 2001 From: Julian Noble Date: Wed, 22 Jul 2026 14:51:43 +1000 Subject: [PATCH] layouts make.tcl: platform_punk boot helper - canonical platform-dir names Add punkboot::lib::platform_punk to the three layout make.tcl copies (basic, project-0.1, and the modpod-template mirror): an inline copy of punk::platform::normalize (the boot stage cannot package require) that folds platform_generic's version-dependent cpu/os aliases (amd64->x86_64, aarch64->arm64, macos->macosx, macosx arm->arm64) into the canonical punkshell platform-dir names. The bootsupport/library path wiring now uses it, so platform-suffixed dirs match the punkbin / punk::platform canon documented in 'help platforms'. Assisted-by: harness=claude; primary-model=claude-fable-5; api-location=anthropic.com --- .../vendor/punk/project-0.1/src/make.tcl | 19 ++++++++++++++++++- .../vendor/punk/basic/src/make.tcl | 19 ++++++++++++++++++- .../vendor/punk/project-0.1/src/make.tcl | 19 ++++++++++++++++++- 3 files changed, 54 insertions(+), 3 deletions(-) diff --git a/src/modules/punk/mix/#modpod-templates-999999.0a1.0/templates/project_layouts/vendor/punk/project-0.1/src/make.tcl b/src/modules/punk/mix/#modpod-templates-999999.0a1.0/templates/project_layouts/vendor/punk/project-0.1/src/make.tcl index fd4bf051..36c83222 100644 --- a/src/modules/punk/mix/#modpod-templates-999999.0a1.0/templates/project_layouts/vendor/punk/project-0.1/src/make.tcl +++ b/src/modules/punk/mix/#modpod-templates-999999.0a1.0/templates/project_layouts/vendor/punk/project-0.1/src/make.tcl @@ -278,6 +278,23 @@ namespace eval ::punkboot::lib { return "${plat}-${cpu}" } + proc platform_punk {} { + #canonical punkshell platform-dir name: platform_generic normalized. + #INLINE COPY of punk::platform::normalize (src/modules/punk/platform-*.tm; + #'help platforms' documents the canon) - the boot stage cannot package + #require, so keep this mapping in sync with that module: + #amd64->x86_64, aarch64->arm64, macos->macosx, macosx arm->arm64. + set parts [split [platform_generic] -] + set cpu [lindex $parts end] + set os [join [lrange $parts 0 end-1] -] + if {$os eq "macos"} {set os macosx} + switch -- $cpu { + amd64 {set cpu x86_64} + aarch64 {set cpu arm64} + arm {if {$os eq "macosx"} {set cpu arm64}} + } + return "${os}-${cpu}" + } } @@ -370,7 +387,7 @@ set startdir [pwd] # ------------------------------------------------------------------------------------- set bootsupport_module_paths [list] set bootsupport_library_paths [list] -set this_platform_generic [punkboot::lib::platform_generic] +set this_platform_generic [punkboot::lib::platform_punk] ;#normalized punkshell platform-dir name (punk::platform canon) #we always create these lists in order of desired precedence. # - this is the same order when adding to auto_path - but will need to be reversed when using tcl:tm::add if {[file exists [file join $::punkboot::scriptfolder bootsupport]]} { diff --git a/src/project_layouts/vendor/punk/basic/src/make.tcl b/src/project_layouts/vendor/punk/basic/src/make.tcl index fd4bf051..36c83222 100644 --- a/src/project_layouts/vendor/punk/basic/src/make.tcl +++ b/src/project_layouts/vendor/punk/basic/src/make.tcl @@ -278,6 +278,23 @@ namespace eval ::punkboot::lib { return "${plat}-${cpu}" } + proc platform_punk {} { + #canonical punkshell platform-dir name: platform_generic normalized. + #INLINE COPY of punk::platform::normalize (src/modules/punk/platform-*.tm; + #'help platforms' documents the canon) - the boot stage cannot package + #require, so keep this mapping in sync with that module: + #amd64->x86_64, aarch64->arm64, macos->macosx, macosx arm->arm64. + set parts [split [platform_generic] -] + set cpu [lindex $parts end] + set os [join [lrange $parts 0 end-1] -] + if {$os eq "macos"} {set os macosx} + switch -- $cpu { + amd64 {set cpu x86_64} + aarch64 {set cpu arm64} + arm {if {$os eq "macosx"} {set cpu arm64}} + } + return "${os}-${cpu}" + } } @@ -370,7 +387,7 @@ set startdir [pwd] # ------------------------------------------------------------------------------------- set bootsupport_module_paths [list] set bootsupport_library_paths [list] -set this_platform_generic [punkboot::lib::platform_generic] +set this_platform_generic [punkboot::lib::platform_punk] ;#normalized punkshell platform-dir name (punk::platform canon) #we always create these lists in order of desired precedence. # - this is the same order when adding to auto_path - but will need to be reversed when using tcl:tm::add if {[file exists [file join $::punkboot::scriptfolder bootsupport]]} { diff --git a/src/project_layouts/vendor/punk/project-0.1/src/make.tcl b/src/project_layouts/vendor/punk/project-0.1/src/make.tcl index fd4bf051..36c83222 100644 --- a/src/project_layouts/vendor/punk/project-0.1/src/make.tcl +++ b/src/project_layouts/vendor/punk/project-0.1/src/make.tcl @@ -278,6 +278,23 @@ namespace eval ::punkboot::lib { return "${plat}-${cpu}" } + proc platform_punk {} { + #canonical punkshell platform-dir name: platform_generic normalized. + #INLINE COPY of punk::platform::normalize (src/modules/punk/platform-*.tm; + #'help platforms' documents the canon) - the boot stage cannot package + #require, so keep this mapping in sync with that module: + #amd64->x86_64, aarch64->arm64, macos->macosx, macosx arm->arm64. + set parts [split [platform_generic] -] + set cpu [lindex $parts end] + set os [join [lrange $parts 0 end-1] -] + if {$os eq "macos"} {set os macosx} + switch -- $cpu { + amd64 {set cpu x86_64} + aarch64 {set cpu arm64} + arm {if {$os eq "macosx"} {set cpu arm64}} + } + return "${os}-${cpu}" + } } @@ -370,7 +387,7 @@ set startdir [pwd] # ------------------------------------------------------------------------------------- set bootsupport_module_paths [list] set bootsupport_library_paths [list] -set this_platform_generic [punkboot::lib::platform_generic] +set this_platform_generic [punkboot::lib::platform_punk] ;#normalized punkshell platform-dir name (punk::platform canon) #we always create these lists in order of desired precedence. # - this is the same order when adding to auto_path - but will need to be reversed when using tcl:tm::add if {[file exists [file join $::punkboot::scriptfolder bootsupport]]} {