Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support cross compiling with prebuilt NASM #528

Merged
merged 3 commits into from
Sep 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions .github/workflows/cross.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
8 changes: 7 additions & 1 deletion aws-lc-sys/builder/cmake_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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('\\', "/");
Expand Down
27 changes: 27 additions & 0 deletions aws-lc-sys/builder/prebuilt-nasm.sh
Original file line number Diff line number Diff line change
@@ -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
Loading