@@ -222,6 +222,73 @@ jobs:
222222 cargo test -p aws-lc-sys --target x86_64-pc-windows-msvc
223223 cargo test -p aws-lc-rs --target x86_64-pc-windows-msvc
224224
225+ # Cross-compile to Windows from Linux using cargo-xwin (clang-cl + lld-link)
226+ aws-lc-rs-windows-cross :
227+ if : github.repository_owner == 'aws'
228+ runs-on : ubuntu-24.04
229+ name : aws-lc-rs-windows-cross (${{ matrix.name }})
230+ strategy :
231+ fail-fast : false
232+ matrix :
233+ include :
234+ - name : x86_64
235+ target : x86_64-pc-windows-msvc
236+ - name : x86_64-fips
237+ target : x86_64-pc-windows-msvc
238+ fips : true
239+ steps :
240+ - uses : actions/checkout@v4
241+ with :
242+ repository : aws/aws-lc-rs
243+ path : ./aws-lc-rs
244+ submodules : ' recursive'
245+ - name : Remove aws-lc submodule from crate directories
246+ shell : bash
247+ run : |
248+ rm -rf ./aws-lc-rs/aws-lc-sys/aws-lc
249+ rm -rf ./aws-lc-rs/aws-lc-fips-sys/aws-lc
250+ - uses : actions/checkout@v4
251+ with :
252+ path : ./aws-lc-rs/aws-lc-sys/aws-lc
253+ - uses : actions/checkout@v4
254+ with :
255+ path : ./aws-lc-rs/aws-lc-fips-sys/aws-lc
256+ - uses : dtolnay/rust-toolchain@stable
257+ with :
258+ targets : ${{ matrix.target }}
259+ - uses : actions/setup-go@v4
260+ with :
261+ go-version : ' >=1.20'
262+ - name : Install dependencies
263+ run : |
264+ set -ex
265+ sudo apt-get update -o Acquire::Languages=none -o Acquire::Translation=none
266+ sudo apt-get install --assume-yes --no-install-recommends \
267+ cmake ninja-build nasm \
268+ wget lsb-release software-properties-common gnupg
269+ # Install Clang 19 from LLVM apt repository
270+ # (xwin's MSVC STL headers require Clang 19+; Ubuntu 24.04 ships Clang 18)
271+ wget -qO- https://apt.llvm.org/llvm.sh | sudo bash -s -- 19
272+ sudo ln -sf /usr/bin/clang-19 /usr/local/bin/clang-cl
273+ sudo ln -sf /usr/bin/lld-19 /usr/local/bin/lld-link
274+ sudo ln -sf /usr/bin/llvm-ar-19 /usr/local/bin/llvm-lib
275+ cargo install cargo-xwin --locked
276+ - name : Setup Wine binfmt
277+ if : matrix.fips
278+ env :
279+ WINEDEBUG : " -all"
280+ DISPLAY : " "
281+ run : |
282+ # Wine binfmt allows the kernel to transparently run .exe files through
283+ # Wine. This is needed for the FIPS build, which runs fips_empty_main.exe
284+ # at build time to capture the integrity hash.
285+ sudo apt-get install --assume-yes --no-install-recommends wine64 binfmt-support wine-binfmt
286+ sudo update-binfmts --enable wine
287+ wineboot --init
288+ - name : Build
289+ working-directory : ./aws-lc-rs
290+ run : cargo xwin build -p aws-lc-rs --target ${{ matrix.target }} ${{ matrix.fips && '--features fips' || '' }}
291+
225292 # CMake Rust bindings generation tests
226293 cmake-rust-bindings :
227294 if : github.repository_owner == 'aws'
0 commit comments