Created
December 22, 2022 00:01
-
-
Save matu3ba/b3443a0a88b093e77d8eb9b78d0fc84e to your computer and use it in GitHub Desktop.
Build Zig with previous Zig version by parsing devkit.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# powershell script to parse devkit version and install Zig | |
# assume: 1. devkit in dir devkit, zig in dir zig in same dir | |
# 2. powershell scripts executable (execution in shell): | |
# Get-Content bZig.ps1 | PowerShell.exe -noprofile - | |
# parse pip install | |
$draftpathninja = pip show ninja | |
$pathninja = $draftpathninja[7].Split(" ")[1] | |
$joinpath = -join($pathninja, "\ninja\data\bin") | |
$env:Path += $joinpath | |
$joinpath | |
$env:Path | |
function CheckLastExitCode { | |
if (!$?) { | |
exit 1 | |
} | |
return 0 | |
} | |
# replace with other dir, if needed | |
$COMMON_DIR = -join('C:\Users\', $env:UserName, '\Desktop') | |
Set-Location -Path $COMMON_DIR | |
$line = Get-ChildItem -Path .\zig\ci\x86_64-windows.ps1 -Recurse | Select-String -Pattern 'ZIG_LLVM_CLANG_LLD_NAME =' | |
$splitted = $line -split "-" | |
$version_raw = -join($splitted[3], "-", $splitted[4]) | |
$VERSION = $version_raw.Substring(0,$version_raw.Length-1) | |
$TARGET = "x86_64-windows-gnu" | |
$ZIG_LLVM_CLANG_LLD_NAME = "zig+llvm+lld+clang-$TARGET-$VERSION" | |
$MCPU = "baseline" | |
$DEVKIT = "$(Get-Location)\devkit\$ZIG_LLVM_CLANG_LLD_NAME" | |
$ZIG = "$PREFIX_PATH\bin\zig.exe" | |
$ZIG_LIB_DIR = "$(Get-Location)\zig\lib" | |
Set-Location -Path 'zig' | |
& $DEVKIT\bin\zig.exe build -p stage3 --search-prefix $DEVKIT --zig-lib-dir lib -Dstatic-llvm -Duse-zig-libcxx -Dtarget=x86_64-windows-gnu | |
CheckLastExitCode |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
TODO: fixup overly long default zig paths for devkit to prevent too long lines.
Could be thats the reason why compilation doesnt work.