diff --git a/.github/workflows/cross.yml b/.github/workflows/cross.yml index df98247687c..bd5cca40e32 100644 --- a/.github/workflows/cross.yml +++ b/.github/workflows/cross.yml @@ -269,3 +269,20 @@ jobs: . "$HOME/.cargo/env" cargo test -p aws-lc-rs cargo test -p aws-lc-rs --no-default-features --features=fips + cross-x86_64-pc-windows-gnu: + if: github.repository_owner == 'aws' + name: cross (prebuilt nasm) - x86_64-pc-windows-gnu + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + submodules: 'recursive' + - uses: dtolnay/rust-toolchain@stable + id: toolchain + with: + toolchain: 'stable' + target: x86_64-pc-windows-gnu + - name: Install mingw + run: sudo apt-get update && sudo apt-get install --assume-yes mingw-w64 + - name: Run cargo test + run: cargo build -p aws-lc-rs --features prebuilt-nasm --target x86_64-pc-windows-gnu diff --git a/aws-lc-sys/builder/cmake_builder.rs b/aws-lc-sys/builder/cmake_builder.rs index 351afd9c883..a0da5df771c 100644 --- a/aws-lc-sys/builder/cmake_builder.rs +++ b/aws-lc-sys/builder/cmake_builder.rs @@ -256,10 +256,16 @@ impl CmakeBuilder { emit_warning("!!! Using pre-built NASM binaries !!!"); emit_warning("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"); + let script_name = if cfg!(target_os = "windows") { + "prebuilt-nasm.bat" + } else { + "prebuilt-nasm.sh" + }; + let script_path = self .manifest_dir .join("builder") - .join("prebuilt-nasm.bat") + .join(script_name) .display() .to_string(); let script_path = script_path.replace('\\', "/"); diff --git a/aws-lc-sys/builder/prebuilt-nasm.sh b/aws-lc-sys/builder/prebuilt-nasm.sh new file mode 100755 index 00000000000..541f70c338e --- /dev/null +++ b/aws-lc-sys/builder/prebuilt-nasm.sh @@ -0,0 +1,27 @@ +#!/usr/bin/env bash +# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +# SPDX-License-Identifier: Apache-2.0 OR ISC + +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" + +while [[ $# -gt 0 ]]; do + case "$1" in + -o) + shift + path="$1" + filename="$(basename "$path")" + filename="$(echo "$filename" | cut -f 1 -d '.')" + cp "$SCRIPT_DIR/prebuilt-nasm/${filename}".obj "$path" + exit 0 + ;; + *) + shift + ;; + esac +done + +# If we reach here, it means we didn't find the -o option +echo "PATH: $path" >&2 +echo "FILENAME: $filename" >&2 +echo "SCRIPT_DIR: $SCRIPT_DIR" >&2 +exit 1