diff --git a/xc/raspberry-pi/Dockerfile b/xc/raspberry-pi/Dockerfile new file mode 100644 index 00000000..f23769b1 --- /dev/null +++ b/xc/raspberry-pi/Dockerfile @@ -0,0 +1,7 @@ +FROM debian:bullseye + +RUN apt update && apt install --no-install-recommends -y libssl-dev pkg-config libasound2-dev gcc-aarch64-linux-gnu curl ca-certificates libc6-dev-arm64-cross + +WORKDIR /workdir + +RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y -t 'aarch64-unknown-linux-gnu' diff --git a/xc/raspberry-pi/build_container.sh b/xc/raspberry-pi/build_container.sh new file mode 100755 index 00000000..0fab927c --- /dev/null +++ b/xc/raspberry-pi/build_container.sh @@ -0,0 +1 @@ +docker build -t "rpi-xc-bullseye-aarch64" . diff --git a/xc/raspberry-pi/do_xc_build.sh b/xc/raspberry-pi/do_xc_build.sh new file mode 100755 index 00000000..f52c3f6f --- /dev/null +++ b/xc/raspberry-pi/do_xc_build.sh @@ -0,0 +1,22 @@ +set -x + +TARGET_TRIPLE="aarch64-unknown-linux-gnu" +IMAGE_NAME="rpi-xc-bullseye-aarch64" + +CARGO_ARGS="build --bin refbox --target $TARGET_TRIPLE --release" +CONTAINER_WORKDIR="/workdir/uwh-refbox-rs" + +CONTAINER_NAME="$(docker create -t -w "$CONTAINER_WORKDIR/" $IMAGE_NAME /root/.cargo/bin/cargo $CARGO_ARGS)" + +BASE_DIR="$(dirname "$0")/../.." + +for file in $(ls "$BASE_DIR" | grep -v target | grep -v xc); do + docker cp "$BASE_DIR/$file" "$CONTAINER_NAME:$CONTAINER_WORKDIR/" +done + +docker start -a "$CONTAINER_NAME" + +docker cp "$CONTAINER_NAME:$CONTAINER_WORKDIR/target/release/refbox" "$(dirname "$0")/output/$TARGET_TRIPLE/" +docker cp "$CONTAINER_NAME:$CONTAINER_WORKDIR/target/$TARGET_TRIPLE/release/refbox" "$(dirname "$0")/output/" + +docker rm "$CONTAINER_NAME"