| ... | @@ -1,20 +1,17 @@ | ... | @@ -1,20 +1,17 @@ |
| 1 | $TARGET = "$($Env:ARCH)-windows-gnu" | 1 | $TARGET = "$($Env:ARCH)-windows-gnu" |
| 2 | $ZIG_LLVM_CLANG_LLD_NAME = "zig+llvm+lld+clang-$TARGET-0.11.0-dev.448+e6e459e9e" | 2 | $ZIG_LLVM_CLANG_LLD_NAME = "zig+llvm+lld+clang-$TARGET-0.11.0-dev.448+e6e459e9e" |
| | 3 | $MCPU = "baseline" |
| 3 | $ZIG_LLVM_CLANG_LLD_URL = "https://ziglang.org/deps/$ZIG_LLVM_CLANG_LLD_NAME.zip" | 4 | $ZIG_LLVM_CLANG_LLD_URL = "https://ziglang.org/deps/$ZIG_LLVM_CLANG_LLD_NAME.zip" |
| | 5 | $PREFIX_PATH = "$(Get-Location)\$ZIG_LLVM_CLANG_LLD_NAME" |
| | 6 | $ZIG = "$PREFIX_PATH\bin\zig.exe" |
| 4 | | 7 | |
| 5 | Write-Output "Downloading $ZIG_LLVM_CLANG_LLD_URL" | 8 | Write-Output "Downloading $ZIG_LLVM_CLANG_LLD_URL" |
| 6 | | | |
| 7 | Invoke-WebRequest -Uri "$ZIG_LLVM_CLANG_LLD_URL" -OutFile "$ZIG_LLVM_CLANG_LLD_NAME.zip" | 9 | Invoke-WebRequest -Uri "$ZIG_LLVM_CLANG_LLD_URL" -OutFile "$ZIG_LLVM_CLANG_LLD_NAME.zip" |
| 8 | | 10 | |
| 9 | Write-Output "Extracting..." | 11 | Write-Output "Extracting..." |
| 10 | | 12 | Add-Type -AssemblyName System.IO.Compression.FileSystem ; |
| 11 | Add-Type -AssemblyName System.IO.Compression.FileSystem ; | | |
| 12 | [System.IO.Compression.ZipFile]::ExtractToDirectory("$PWD/$ZIG_LLVM_CLANG_LLD_NAME.zip", "$PWD") | 13 | [System.IO.Compression.ZipFile]::ExtractToDirectory("$PWD/$ZIG_LLVM_CLANG_LLD_NAME.zip", "$PWD") |
| 13 | | 14 | |
| 14 | Set-Variable -Name ZIGLIBDIR -Value "$(Get-Location)\lib" | | |
| 15 | Set-Variable -Name ZIGINSTALLDIR -Value "$(Get-Location)\stage3-release" | | |
| 16 | Set-Variable -Name ZIGPREFIXPATH -Value "$(Get-Location)\$ZIG_LLVM_CLANG_LLD_NAME" | | |
| 17 | | | |
| 18 | function CheckLastExitCode { | 15 | function CheckLastExitCode { |
| 19 | if (!$?) { | 16 | if (!$?) { |
| 20 | exit 1 | 17 | exit 1 |
| ... | @@ -31,33 +28,41 @@ if ((git rev-parse --is-shallow-repository) -eq "true") { | ... | @@ -31,33 +28,41 @@ if ((git rev-parse --is-shallow-repository) -eq "true") { |
| 31 | git fetch --unshallow # `git describe` won't work on a shallow repo | 28 | git fetch --unshallow # `git describe` won't work on a shallow repo |
| 32 | } | 29 | } |
| 33 | | 30 | |
| 34 | Write-Output "Building Zig..." | 31 | Write-Output "Building from source..." |
| 35 | | 32 | Remove-Item -Path 'build-release' -Recurse -Force -ErrorAction Ignore |
| 36 | & "$ZIGPREFIXPATH\bin\zig.exe" build ` | 33 | New-Item -Path 'build-release' -ItemType Directory |
| 37 | --prefix "$ZIGINSTALLDIR" ` | 34 | Set-Location -Path 'build-release' |
| 38 | --search-prefix "$ZIGPREFIXPATH" ` | | |
| 39 | --zig-lib-dir "$ZIGLIBDIR" ` | | |
| 40 | -Denable-stage1 ` | | |
| 41 | -Dstatic-llvm ` | | |
| 42 | -Drelease ` | | |
| 43 | -Duse-zig-libcxx ` | | |
| 44 | -Dtarget="$TARGET" | | |
| 45 | CheckLastExitCode | | |
| 46 | | 35 | |
| 47 | Write-Output " zig build test docs..." | 36 | # CMake gives a syntax error when file paths with backward slashes are used. |
| | 37 | # Here, we use forward slashes only to work around this. |
| | 38 | & cmake .. ` |
| | 39 | -GNinja ` |
| | 40 | -DCMAKE_INSTALL_PREFIX="stage3-release" ` |
| | 41 | -DCMAKE_PREFIX_PATH="$($PREFIX_PATH -Replace "\\", "/")" ` |
| | 42 | -DCMAKE_BUILD_TYPE=Release ` |
| | 43 | -DCMAKE_C_COMPILER="$($ZIG -Replace "\\", "/");cc;-target;$TARGET;-mcpu=$MCPU" ` |
| | 44 | -DCMAKE_CXX_COMPILER="$($ZIG -Replace "\\", "/");c++;-target;$TARGET;-mcpu=$MCPU" ` |
| | 45 | -DZIG_TARGET_TRIPLE="$TARGET" ` |
| | 46 | -DZIG_TARGET_MCPU="$MCPU" ` |
| | 47 | -DZIG_STATIC=ON |
| | 48 | CheckLastExitCode |
| 48 | | 49 | |
| 49 | & "$ZIGINSTALLDIR\bin\zig.exe" build test docs ` | 50 | ninja install |
| 50 | --search-prefix "$ZIGPREFIXPATH" ` | | |
| 51 | -Dstatic-llvm ` | | |
| 52 | -Dskip-non-native ` | | |
| 53 | -Denable-symlinks-windows | | |
| 54 | CheckLastExitCode | 51 | CheckLastExitCode |
| 55 | | 52 | |
| 56 | # Produce the experimental std lib documentation. | 53 | Write-Output "Main test suite..." |
| 57 | Write-Output "zig test std/std.zig..." | 54 | & "stage3-release\bin\zig.exe" build test docs ` |
| | 55 | --zig-lib-dir "..\lib" ` |
| | 56 | --search-prefix "../$ZIG_LLVM_CLANG_LLD_NAME" ` |
| | 57 | -Dstatic-llvm ` |
| | 58 | -Dskip-non-native ` |
| | 59 | -Denable-symlinks-windows |
| | 60 | CheckLastExitCode |
| 58 | | 61 | |
| 59 | & "$ZIGINSTALLDIR\bin\zig.exe" test "$ZIGLIBDIR\std\std.zig" ` | 62 | Write-Output "Testing Autodocs..." |
| 60 | --zig-lib-dir "$ZIGLIBDIR" ` | 63 | & "stage3-release\bin\zig.exe" test "..\lib\std\std.zig" ` |
| | 64 | --zig-lib-dir "..\lib" ` |
| 61 | -femit-docs ` | 65 | -femit-docs ` |
| 62 | -fno-emit-bin | 66 | -fno-emit-bin |
| 63 | CheckLastExitCode | 67 | CheckLastExitCode |
| | 68 | |