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

Add build support for rav1e and ARM (aarch64) #360

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
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
6 changes: 5 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -112,12 +112,16 @@ ENV \
# install rust
RUN \
ARCH=`uname -m` && \
RUST_VERSION=1.64.0 && \
RUST_VERSION=1.73.0 && \
curl -sSf --output /tmp/rustup-init https://static.rust-lang.org/rustup/archive/1.25.0/${ARCH}-unknown-linux-gnu/rustup-init && \
chmod +x /tmp/rustup-init && \
/tmp/rustup-init -y --no-modify-path --default-toolchain ${RUST_VERSION} && \
rm -vf /tmp/rustup-init

# install cross-compile target (aarch64) for rust-based library
RUN \
/usr/local/cargo/bin/rustup target add aarch64-unknown-linux-gnu

# install node 18.x
RUN \
NODE_VERSION=18.6.0 && \
Expand Down
17 changes: 16 additions & 1 deletion build_codec.sh
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,22 @@ case "${CODEC}" in

rav1e)
cd ${CODECS_SRC_DIR}/rav1e
cargo build --release ${BUILD_OPTIONS}
if [[ "${ARCH}" == "aarch64" ]]; then
ARCH_OPTIONS="--target aarch64-unknown-linux-gnu"
# Rust need aarch64 as environment variable or as a config inside cargo
# folder. So we chose latter for maintainability.
mkdir -p .cargo
echo -e "[target.aarch64-unknown-linux-gnu]\nlinker = \"aarch64-linux-gnu-gcc\"\nar = \"aarch64-linux-gnu-gcc\"" > .cargo/config
mkdir -p target/release
else
ARCH_OPTIONS=""
fi
cargo build --release ${ARCH_OPTIONS} ${BUILD_OPTIONS}
# Rust tries to create a target arch folder, it messes up lot more things,
# so easy is faking the path
if [[ "${ARCH}" == "aarch64" ]]; then
cp target/aarch64-unknown-linux-gnu/release/rav1e target/release/rav1e
fi
;;

svt-av1*)
Expand Down