@@ -98,3 +98,45 @@ RUN powershell -Command \
9898 Add-Type -AssemblyName System.IO.Compression.FileSystem ; \
9999 [System.IO.Compression.ZipFile]::ExtractToDirectory(' actions-runner-win.zip', $PWD) ;\
100100 rm actions-runner-win.zip
101+
102+ # Set the LLVM_VERSION environment variable
103+ ENV LLVM_VERSION=21.1.2
104+
105+ # Download and extract Clang compiler.
106+ # Create directories, download, extract, and clean up all in one layer
107+ RUN powershell -Command \
108+ # --- Setup directories --- \
109+ Write-Host "Creating directories..."; \
110+ New-Item -Path "C:\t emp-download" -ItemType "Directory" -Force ; \
111+ New-Item -Path "C:\x z-utils" -ItemType "Directory" -Force ; \
112+ New-Item -Path "C:\c lang" -ItemType "Directory" -Force ; \
113+ # --- 1. Download and extract xz --- \
114+ Set-Location C:\t emp-download ; \
115+ Invoke-WebRequest -Uri "http://github.com/tukaani-project/xz/releases/download/v5.8.1/xz-5.8.1-windows.zip" -OutFile "xz.zip"; \
116+ (Get-FileHash -Path "C:\t emp-download\x z.zip" -Algorithm MD5).Hash -eq ' c3c69fdce3e825cc0b76123b36b0bcc2' ; \
117+ Add-Type -AssemblyName "System.IO.Compression.FileSystem"; \
118+ [System.IO.Compression.ZipFile]::ExtractToDirectory(' C:\t emp-download\x z.zip', ' C:\x z-utils'); \
119+ # --- 2. Download and decompress Clang --- \
120+ Invoke-WebRequest -Uri "http://github.com/llvm/llvm-project/releases/download/llvmorg-21.1.2/clang+llvm-21.1.2-x86_64-pc-windows-msvc.tar.xz" -OutFile "clang+llvm-21.1.2-x86_64-pc-windows-msvc.tar.xz" ; \
121+ (Get-FileHash -Path "C:\t emp-download\c lang+llvm-21.1.2-x86_64-pc-windows-msvc.tar.xz" -Algorithm MD5).Hash -eq ' 0ae1d3effd9ab9d323f7fa595777f0a2' ; \
122+ C:\x z-utils\b in_x86-64\x z.exe -d -qq clang+llvm-21.1.2-x86_64-pc-windows-msvc.tar.xz ; \
123+ # --- 3. Extract clang --- \
124+ C:\W indows\S ystem32\t ar.exe -xf clang+llvm-21.1.2-x86_64-pc-windows-msvc.tar -C C:\c lang ; \
125+ # --- 4. Clean up --- \
126+ Set-Location C:\ ; \
127+ Remove-Item C:\t emp-download -Recurse -Force; \
128+ Remove-Item C:\x z-utils -Recurse -Force; \
129+ # -- 5. Shorten path to clang files & remove unnecessary files -- \
130+ Set-Location C:\c lang ; \
131+ Rename-Item -Path "C:\c lang\c lang+llvm-21.1.2-x86_64-pc-windows-msvc" -NewName "C:\c lang\c lang-msvc" ; \
132+ Set-Location C:\c lang\c lang-msvc ; \
133+ Remove-Item -Path C:\c lang\c lang-msvc\l ibexec -Recurse -Force ; \
134+ Remove-Item -Path C:\c lang\c lang-msvc\s hare -Recurse -Force ; \
135+ Rename-Item -Path "C:\c lang\c lang-msvc\b in" -NewName "C:\c lang\c lang-msvc\b in-full" ; \
136+ New-Item -Path "C:\c lang\c lang-msvc\b in" -ItemType Directory -Force ; \
137+ Set-Location C:\c lang\c lang-msvc\b in ; \
138+ Copy-Item -Path C:\c lang\c lang-msvc\b in-full\* .dll -Destination C:\c lang\c lang-msvc\b in\. ; \
139+ Copy-Item -Path C:\c lang\c lang-msvc\b in-full\c lang-cl.exe -Destination C:\c lang\c lang-msvc\b in\. ; \
140+ Copy-Item -Path C:\c lang\c lang-msvc\b in-full\l ld-link.exe -Destination C:\c lang\c lang-msvc\b in\. ; \
141+ Set-Location C:\c lang\c lang-msvc ; \
142+ Remove-Item -Path C:\c lang\c lang-msvc\b in-full -Recurse -Force ;
0 commit comments