Skip to content
Closed
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
25 changes: 25 additions & 0 deletions .github/workflows/rva23.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Cross-compile to RVA23

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

env:
CARGO_TERM_COLOR: always

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build image
run: podman build -t odorobo-builder:rva23 .
- name: Build binaries
run: podman run --rm -v ${{ github.workspace }}:/code -w /code odorobo-builder:rva23 cargo build --release
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: odorobo
path: target/riscv64a23-unknown-linux-gnu/release/odorobo
17 changes: 17 additions & 0 deletions Containerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
FROM alpine:3.23.3
RUN <<EOF
apk add \
bash \
gcc \
musl-dev \
rustup \
zig
rustup-init \
--profile minimal \
--target riscv64a23-unknown-linux-gnu \
-y
EOF
ENV CARGO_BUILD_TARGET="riscv64a23-unknown-linux-gnu"
ENV PATH="/root/.cargo/bin:$PATH"
ENV CC_riscv64a23_unknown_linux_gnu="/code/scripts/zig-cc-rva23.sh"
ENV CARGO_TARGET_RISCV64A23_UNKNOWN_LINUX_GNU_RUSTFLAGS="-C linker=scripts/zig-cc-rva23.sh"
17 changes: 17 additions & 0 deletions scripts/zig-cc-rva23.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/usr/bin/env bash
set -euo pipefail

# A script for cargo to use as the C compiler and linker when building RVA23
# binaries. This links them using zig cc.

args=()
for arg in "$@"; do
case "$arg" in
--target=riscv64-unknown-linux-gnu)
;;
*)
args+=("$arg")
;;
esac
done
exec zig cc -target riscv64-linux-gnu "${args[@]}"
Loading