diff --git a/bin/fetchruntime.cmd b/bin/fetchruntime.cmd index 97f60f04..7f5266db 100644 --- a/bin/fetchruntime.cmd +++ b/bin/fetchruntime.cmd @@ -25,7 +25,7 @@ set -- "$@" "a=[Hide <#;Hide set;S 1 list]"; set -- : "$@";$1 = @' @REM in batch scripts - array syntax with square brackets is a simulation of arrays or associative arrays. @REM note that many shells linked as sh do not support substition syntax and may fail - e.g dash etc - generally bash should be used in this context @SETLOCAL EnableExtensions EnableDelayedExpansion -@SET "validshelltypes= powershell______ sh______________ wslbash_________ bash____________ tcl_____________ perl____________ none____________" +@SET "validshelltypes= pwsh____________ powershell______ sh______________ wslbash_________ bash____________ tcl_____________ perl____________ none____________" @REM for batch - only win32 is relevant - but other scripts on other platforms also parse the nextshell block to determine next shell to launch @REM nextshellpath and nextshelltype indices (underscore-padded to 16wide) are "other" plus those returned by Tcl platform pkg e.g win32,linux,freebsd,macosx @REM The horrible underscore-padded fixed-widths are to keep the batch labels aligned whilst allowing values to be set @@ -176,12 +176,12 @@ set -- "$@" "a=[Hide <#;Hide set;S 1 list]"; set -- : "$@";$1 = @' ) @REM avoid using CALL to launch pwsh,tclsh etc - it will intercept some args such as /? @IF "!selected_shelltype_trimmed!"=="none" ( - SET selected_shelltype_trimmed=powershell + SET selected_shelltype_trimmed=pwsh ) -@IF "!selected_shelltype_trimmed!"=="powershell" ( +@IF "!selected_shelltype_trimmed!"=="pwsh" ( REM pwsh vs powershell hasn't been tested because we didn't need to copy cmd to ps1 this time REM test availability of preferred option of powershell7+ pwsh - pwsh -nop -nol -c set-executionpolicy -Scope Process Unrestricted; write-host "statusmessage: pwsh-found" >NUL + pwsh -nop -nol -c set-executionpolicy -Scope Process Unrestricted 2>NUL; write-host "statusmessage: pwsh-found" >NUL SET pwshtest_exitcode=!errorlevel! REM ECHO pwshtest_exitcode !pwshtest_exitcode! REM fallback to powershell if pwsh failed @@ -189,33 +189,35 @@ set -- "$@" "a=[Hide <#;Hide set;S 1 list]"; set -- : "$@";$1 = @' pwsh -nop -nol -c set-executionpolicy -Scope Process Unrestricted; "%~dp0%~n0.ps1" %arglist% SET task_exitcode=!errorlevel! ) ELSE ( - REM CALL powershell -nop -nol -c write-host powershell-found - REM powershell -nop -nol -file "%~dp0%~n0.ps1" %* - powershell -nop -nol -c set-executionpolicy -Scope Process Unrestricted; %~dp0%~n0.ps1" %arglist% + REM TODO prompt user with option to call script to install pwsh using winget + REM powershell -nop -nol -c set-executionpolicy -Scope Process Unrestricted; "%~dp0%~n0.ps1" %arglist% + powershell -nop -nol -ExecutionPolicy Bypass -c "%~dp0%~n0.ps1" %arglist% SET task_exitcode=!errorlevel! ) ) ELSE ( - IF "!selected_shelltype_trimmed!"=="wslbash" ( - CALL :getWslPath %winpath% wslpath - REM ECHO wslfullpath "!wslpath!%fname%" - %selected_shellpath_trimmed% "!wslpath!%fname%" %arglist% + IF "!selected_shelltype_trimmed!"=="powershell" ( + powershell -nop -nol -ExecutionPolicy Bypass -c "%~dp0%~n0.ps1" %arglist% SET task_exitcode=!errorlevel! ) ELSE ( - REM perl or tcl or sh or bash - IF NOT "x%keyRemoved%"=="x%validshelltypes%" ( - REM sh on windows uses /c/ instead of /mnt/c - at least if using msys. Todo, review what is the norm on windows with and without msys2,cygwin,wsl - REM and what logic if any may be needed. For now sh with /c/xxx seems to work the same as sh with c:/xxx - REM The compound statement with trailing call is required to stop batch termination confirmation, whilst still capturing exitcode - @ECHO HERE "!selected_shelltype_trimmed!" "!selected_shellpath_trimmed!" - %selected_shellpath_trimmed% "%~dp0%fname%" %arglist% & SET task_exitcode=!errorlevel! & Call; + IF "!selected_shelltype_trimmed!"=="wslbash" ( + CALL :getWslPath %winpath% wslpath + REM ECHO wslfullpath "!wslpath!%fname%" + %selected_shellpath_trimmed% "!wslpath!%fname%" %arglist% + SET task_exitcode=!errorlevel! ) ELSE ( - ECHO %fname% has invalid nextshelltype value %selected_shelltype% valid options are %validshelltypes% - SET task_exitcode=66 - @REM boundary padding - @REM boundary padding - @REM boundary padding - @REM boundary padding - GOTO :exit_multishell + REM perl or tcl or sh or bash + IF NOT "x%keyRemoved%"=="x%validshelltypes%" ( + REM sh on windows uses /c/ instead of /mnt/c - at least if using msys. Todo, review what is the norm on windows with and without msys2,cygwin,wsl + REM and what logic if any may be needed. For now sh with /c/xxx seems to work the same as sh with c:/xxx + REM The compound statement with trailing call is required to stop batch termination confirmation, whilst still capturing exitcode + @ECHO HERE "!selected_shelltype_trimmed!" "!selected_shellpath_trimmed!" + %selected_shellpath_trimmed% "%~dp0%fname%" %arglist% & SET task_exitcode=!errorlevel! & Call; + ) ELSE ( + ECHO %fname% has invalid nextshelltype value %selected_shelltype% valid options are %validshelltypes% + SET task_exitcode=66 + @REM boundary padding + GOTO :exit_multishell + ) ) ) ) @@ -479,6 +481,9 @@ namespace eval ::punk::multishell { # -- --- --- --- --- --- --- --- --- --- --- --- # + +set url_kitbase "https://www.gitea1.intx.com.au/jn/punkbin/raw/branch/master" + package require http package require tls http::register https 443 [list ::tls::socket -autoservername true] @@ -489,15 +494,32 @@ set runtime_available 0 set scriptdir [file dirname [info script]] switch -- $os { "win32" { - set url "https://www.gitea1.intx.com.au/jn/punkbin/raw/branch/master/win64/tclsh901t.exe" - set output [file join $scriptdir "../src/runtime/tclsh901t.exe"] + set url "$url_kitbase/win32-x86_64/tclsh902z.exe" + set output [file join $scriptdir "../src/runtime/tclsh902z.exe"] set runtime_available 1 } "linux" { - puts stderr "No runtime currently available for linux" + switch -glob -- $plat { + *x86_64 { + set url "$url_kitbase/linux-x86_64/tclkit-902-Linux64-intel-dyn" + set output [file join $scriptdir "../src/runtime/tclkit-902-Linux64-intel-dyn"] + set runtime_available 1 + } + *arm { + set url "$url_kitbase/linux-x86_64/tclkit-902-Linux64-arm-dyn" + set output [file join $scriptdir "../src/runtime/tclkit-902-Linux64-arm-dyn"] + set runtime_available 1 + } + default { + # + puts stderr "No runtime currently available for linux $::tcl_platform(machine)" + } + } } "macosx" { - puts stderr "No runtime currently available for linux" + set url "$url_kitbase/macosx/tclkit-902-Darwin64-dyn" + set output [file join $scriptdir "../src/runtime/tclkit-902-Darwin64-dyn"] + set runtime_available 1 } "freebsd" { puts stderr "No runtime currently available for freebsd" @@ -652,11 +674,30 @@ fi # -runtime_available = 0 +$url_kitbase="https://www.gitea1.intx.com.au/jn/punkbin/raw/branch/master" +runtime_available=0 if [[ "$OSTYPE" == "linux"* ]]; then + arch=$(uname -i) + if [[ "$arch" == "x86_64"* ]]; then + url="${url_kitbase}/linux-x86_64/tclkit-902-Linux64-intel-dyn" + output="../src/runtime/tclkit-902-Linux64-intel-dyn" + $runtime_available=1 + elif [[ "$arch" == "arm"* ]]; then + url="${url_kitbase}/linux-x86_64/tclkit-902-Linux64-arm-dyn" + output="../src/runtime/tclkit-902-Linux64-arm-dyn" + $runtime_available=1 + fi + if [[ "$runtime_available" -eq 1 ]]; then + echo "Please ensure libxFt.so.2 is available" + echo "e.g on Ubuntu: sudo apt-get install libxft2" + fi os="linux" elif [[ "$OSTYPE" == "darwin"* ]]; then os="macosx" + #assumed to be Mach-O 'universal binaries' for both x86-64 and arm? - REVIEW + url="${url_kitbase}/macosx/tclkit-902-Darwin64-dyn" + output="../src/runtime/tclkit-902-Darwin64-dyn" + $runtime_available=1 elif [[ "$OSTYPE" == "freebsd"* ]]; then os="freebsd" elif [[ "$OSTYPE" == "dragonflybsd"* ]]; then @@ -665,14 +706,13 @@ elif [[ "$OSTYPE" == "netbsd"* ]]; then os="netbsd" elif [[ "$OSTYPE" == "win32" ]]; then os="win32" - runtime_available = 1 - url="https://www.gitea1.intx.com.au/jn/punkbin/raw/branch/master/win64/tclsh901t.exe" + url="${url_kitbase}/win32-x86_64/tclsh902z.exe" + runtime_available=1 #scriptdir? - output="../src/runtime/tclsh901t.exe" + output="../src/runtime/tclsh902z.exe" elif [[ "$OSTYPE" == "msys" ]]; then echo MSYS os="win32" - runtime_available = 1 #use 'command -v' (shell builtin preferred over external which) interp = `ps -p $$ | awk '$1 != "PID" {print $(NF)}' | tr -d '()' | sed -E 's/^.*\/|^-//'` shellpath=`command -v $interp` @@ -680,9 +720,10 @@ elif [[ "$OSTYPE" == "msys" ]]; then #"c:/windows/system32/" is quite likely in the path ahead of msys,git etc. #This breaks calls to various unix utils such as sed etc (wsl related?) export PATH="$shellfolder${PATH:+:${PATH}}" - url="https://www.gitea1.intx.com.au/jn/punkbin/raw/branch/master/win64/tclsh901t.exe" + url="${url_kitbase}/win32-x86_64/tclsh902z.exe" #scriptdir? - output="../src/runtime/tclsh901t.exe" + output="../src/runtime/tclsh902z.exe" + runtime_available=1 else #os="$OSTYPE" os="other" @@ -908,8 +949,8 @@ if ($matches.count) { # -$url = "https://www.gitea1.intx.com.au/jn/punkbin/raw/branch/master/win64/tclsh901t.exe" -$output = "$(join-path $PSScriptRoot "..\src\runtime\tclsh901t.exe")" +$url = "https://www.gitea1.intx.com.au/jn/punkbin/raw/branch/master/win32-x86_64/tclsh902z.exe" +$output = "$(join-path $PSScriptRoot "..\src\runtime\tclsh902z.exe")" if (-not(Test-Path -Path $output -PathType Leaf)) { Write-Host "Downloading from $url ..." diff --git a/bin/getzig.cmd b/bin/getzig.cmd index 0968b4ec..74d36ed1 100644 --- a/bin/getzig.cmd +++ b/bin/getzig.cmd @@ -923,8 +923,8 @@ $zigpubkey = "RWSGOq2NVecA2UPNdBUZykf1CCb147pkmdtYxgb3Ti+JO/wCYvhbAb/U" $mirrors_url = "https://ziglang.org/download/community-mirrors.txt" $mirrors_response = $(Invoke-WebRequest -Uri $mirrors_url) if ($mirrors_response.StatusCode -eq 200) { - #https://www.gitea1.intx.com.au/jn/punkbin/raw/branch/master/win64/tools/zig-x86_64-windows-0.15.1.zip - $mirror_array = @("https://gitea1.intx.com.au/jn/punkbin/raw/branch/master/win64/tools") + #https://www.gitea1.intx.com.au/jn/punkbin/raw/branch/master/win32-x86_64/tools/zig-x86_64-windows-0.15.1.zip + $mirror_array = @("https://gitea1.intx.com.au/jn/punkbin/raw/branch/master/win32-x86_64/tools") $mirror_array += $mirrors_response.Content.TrimEnd("`r`n") -split "`r`n|`n" #$mirror_array += "https://bogusxxx.org" #test behaviour of a bogus/down entry $mirror_array += "https://ziglang.org" #main site @@ -951,7 +951,7 @@ if ($mirrors_response.StatusCode -eq 200) { $Global:ProgressPreference = 'SilentlyContinue' #temporary dev download source $ihost = "10.30.30.107" - $imirror = "http://10.30.30.107/jn/punkbin/raw/branch/master/win64/tools" + $imirror = "http://10.30.30.107/jn/punkbin/raw/branch/master/win32-x86_64/tools" $itrace = test-netconnection $ihost -Hops 6 -TraceRoute -ErrorAction Ignore if ((${itrace}.PingSucceeded) -and (${itrace}.TraceRoute.Count -lt 5)) { $host_list += $ihost diff --git a/src/scriptapps/fetchruntime.bash b/src/scriptapps/fetchruntime.bash index 198e88f4..774e7f67 100644 --- a/src/scriptapps/fetchruntime.bash +++ b/src/scriptapps/fetchruntime.bash @@ -1,9 +1,28 @@ +$url_kitbase="https://www.gitea1.intx.com.au/jn/punkbin/raw/branch/master" runtime_available=0 if [[ "$OSTYPE" == "linux"* ]]; then + arch=$(uname -i) + if [[ "$arch" == "x86_64"* ]]; then + url="${url_kitbase}/linux-x86_64/tclkit-902-Linux64-intel-dyn" + output="../src/runtime/tclkit-902-Linux64-intel-dyn" + $runtime_available=1 + elif [[ "$arch" == "arm"* ]]; then + url="${url_kitbase}/linux-x86_64/tclkit-902-Linux64-arm-dyn" + output="../src/runtime/tclkit-902-Linux64-arm-dyn" + $runtime_available=1 + fi + if [[ "$runtime_available" -eq 1 ]]; then + echo "Please ensure libxFt.so.2 is available" + echo "e.g on Ubuntu: sudo apt-get install libxft2" + fi os="linux" elif [[ "$OSTYPE" == "darwin"* ]]; then os="macosx" + #assumed to be Mach-O 'universal binaries' for both x86-64 and arm? - REVIEW + url="${url_kitbase}/macosx/tclkit-902-Darwin64-dyn" + output="../src/runtime/tclkit-902-Darwin64-dyn" + $runtime_available=1 elif [[ "$OSTYPE" == "freebsd"* ]]; then os="freebsd" elif [[ "$OSTYPE" == "dragonflybsd"* ]]; then @@ -12,14 +31,13 @@ elif [[ "$OSTYPE" == "netbsd"* ]]; then os="netbsd" elif [[ "$OSTYPE" == "win32" ]]; then os="win32" + url="${url_kitbase}/win32-x86_64/tclsh902z.exe" runtime_available=1 - url="https://www.gitea1.intx.com.au/jn/punkbin/raw/branch/master/win64/tclsh902z.exe" #scriptdir? - output="../src/runtime/tclsh901t.exe" + output="../src/runtime/tclsh902z.exe" elif [[ "$OSTYPE" == "msys" ]]; then echo MSYS os="win32" - runtime_available=1 #use 'command -v' (shell builtin preferred over external which) interp = `ps -p $$ | awk '$1 != "PID" {print $(NF)}' | tr -d '()' | sed -E 's/^.*\/|^-//'` shellpath=`command -v $interp` @@ -27,9 +45,10 @@ elif [[ "$OSTYPE" == "msys" ]]; then #"c:/windows/system32/" is quite likely in the path ahead of msys,git etc. #This breaks calls to various unix utils such as sed etc (wsl related?) export PATH="$shellfolder${PATH:+:${PATH}}" - url="https://www.gitea1.intx.com.au/jn/punkbin/raw/branch/master/win64/tclsh902z.exe" + url="${url_kitbase}/win32-x86_64/tclsh902z.exe" #scriptdir? - output="../src/runtime/tclsh901t.exe" + output="../src/runtime/tclsh902z.exe" + runtime_available=1 else #os="$OSTYPE" os="other" diff --git a/src/scriptapps/fetchruntime.ps1 b/src/scriptapps/fetchruntime.ps1 index 1e421833..adbfbdf3 100644 --- a/src/scriptapps/fetchruntime.ps1 +++ b/src/scriptapps/fetchruntime.ps1 @@ -1,5 +1,5 @@ -$url = "https://www.gitea1.intx.com.au/jn/punkbin/raw/branch/master/win64/tclsh902z.exe" +$url = "https://www.gitea1.intx.com.au/jn/punkbin/raw/branch/master/win32-x86_64/tclsh902z.exe" $output = "$(join-path $PSScriptRoot "..\src\runtime\tclsh902z.exe")" if (-not(Test-Path -Path $output -PathType Leaf)) { diff --git a/src/scriptapps/fetchruntime.tcl b/src/scriptapps/fetchruntime.tcl index 2a00bc12..c22e1cac 100644 --- a/src/scriptapps/fetchruntime.tcl +++ b/src/scriptapps/fetchruntime.tcl @@ -1,3 +1,6 @@ + +set url_kitbase "https://www.gitea1.intx.com.au/jn/punkbin/raw/branch/master" + package require http package require tls http::register https 443 [list ::tls::socket -autoservername true] @@ -8,15 +11,32 @@ set runtime_available 0 set scriptdir [file dirname [info script]] switch -- $os { "win32" { - set url "https://www.gitea1.intx.com.au/jn/punkbin/raw/branch/master/win64/tclsh901t.exe" - set output [file join $scriptdir "../src/runtime/tclsh901t.exe"] + set url "$url_kitbase/win32-x86_64/tclsh902z.exe" + set output [file join $scriptdir "../src/runtime/tclsh902z.exe"] set runtime_available 1 } "linux" { - puts stderr "No runtime currently available for linux" + switch -glob -- $plat { + *x86_64 { + set url "$url_kitbase/linux-x86_64/tclkit-902-Linux64-intel-dyn" + set output [file join $scriptdir "../src/runtime/tclkit-902-Linux64-intel-dyn"] + set runtime_available 1 + } + *arm { + set url "$url_kitbase/linux-x86_64/tclkit-902-Linux64-arm-dyn" + set output [file join $scriptdir "../src/runtime/tclkit-902-Linux64-arm-dyn"] + set runtime_available 1 + } + default { + # + puts stderr "No runtime currently available for linux $::tcl_platform(machine)" + } + } } "macosx" { - puts stderr "No runtime currently available for linux" + set url "$url_kitbase/macosx/tclkit-902-Darwin64-dyn" + set output [file join $scriptdir "../src/runtime/tclkit-902-Darwin64-dyn"] + set runtime_available 1 } "freebsd" { puts stderr "No runtime currently available for freebsd" diff --git a/src/scriptapps/fetchruntime_bits.ps1 b/src/scriptapps/fetchruntime_bits.ps1 index 5f827e00..2a0a390c 100644 --- a/src/scriptapps/fetchruntime_bits.ps1 +++ b/src/scriptapps/fetchruntime_bits.ps1 @@ -1,4 +1,4 @@ -$url = "https://www.gitea1.intx.com.au/jn/punkbin/raw/branch/master/win64/tclsh901t.exe" +$url = "https://www.gitea1.intx.com.au/jn/punkbin/raw/branch/master/win32-x86_64/tclsh901t.exe" $output = "$(join-path $PSScriptRoot "..\src\runtime\tclsh901t.exe")" if (-not(Test-Path -Path $output -PathType Leaf)) { diff --git a/src/scriptapps/getzig.ps1 b/src/scriptapps/getzig.ps1 index 5d28029f..411162b6 100644 --- a/src/scriptapps/getzig.ps1 +++ b/src/scriptapps/getzig.ps1 @@ -89,8 +89,8 @@ $zigpubkey = "RWSGOq2NVecA2UPNdBUZykf1CCb147pkmdtYxgb3Ti+JO/wCYvhbAb/U" $mirrors_url = "https://ziglang.org/download/community-mirrors.txt" $mirrors_response = $(Invoke-WebRequest -Uri $mirrors_url) if ($mirrors_response.StatusCode -eq 200) { - #https://www.gitea1.intx.com.au/jn/punkbin/raw/branch/master/win64/tools/zig-x86_64-windows-0.15.1.zip - $mirror_array = @("https://gitea1.intx.com.au/jn/punkbin/raw/branch/master/win64/tools") + #https://www.gitea1.intx.com.au/jn/punkbin/raw/branch/master/win32-x86_64/tools/zig-x86_64-windows-0.15.1.zip + $mirror_array = @("https://gitea1.intx.com.au/jn/punkbin/raw/branch/master/win32-x86_64/tools") $mirror_array += $mirrors_response.Content.TrimEnd("`r`n") -split "`r`n|`n" #$mirror_array += "https://bogusxxx.org" #test behaviour of a bogus/down entry $mirror_array += "https://ziglang.org" #main site @@ -117,7 +117,7 @@ if ($mirrors_response.StatusCode -eq 200) { $Global:ProgressPreference = 'SilentlyContinue' #temporary dev download source $ihost = "10.30.30.107" - $imirror = "http://10.30.30.107/jn/punkbin/raw/branch/master/win64/tools" + $imirror = "http://10.30.30.107/jn/punkbin/raw/branch/master/win32-x86_64/tools" $itrace = test-netconnection $ihost -Hops 6 -TraceRoute -ErrorAction Ignore if ((${itrace}.PingSucceeded) -and (${itrace}.TraceRoute.Count -lt 5)) { $host_list += $ihost